:root {
  color-scheme: light;
  --ink: #21312a;
  --ink-soft: #5f6d65;
  --ink-faint: #879189;
  --cream: #f7f5ef;
  --surface: #fffefa;
  --surface-alt: #f1f2eb;
  --line: #dce1d8;
  --line-strong: #cbd3c8;
  --green: #246e4f;
  --green-dark: #164e38;
  --green-soft: #dcefe5;
  --mint: #ebf6ef;
  --amber: #9a681e;
  --amber-soft: #fff2d8;
  --red: #ab4a41;
  --red-soft: #fee9e6;
  --blue: #356f8a;
  --shadow: 0 22px 70px rgba(37, 66, 49, 0.10), 0 2px 7px rgba(37, 66, 49, 0.04);
  --radius: 17px;
  --radius-sm: 11px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--cream); }
body { margin: 0; min-width: 320px; color: var(--ink); background: radial-gradient(circle at 74% -7%, #fffdf6 0, var(--cream) 33rem), var(--cream); font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, dialog:focus-visible { outline: 3px solid rgba(36,110,79,.25); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 228px; flex: 0 0 228px; padding: 25px 17px 20px; background: #eeefe7; color: var(--ink); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 11px 28px; }
.brand-mark { width: 33px; height: 33px; border-radius: 11px; display: grid; place-items: center; background: var(--green-dark); color: #fff; font: 800 18px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.brand-name { margin: 0; font: 800 17px/1.1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: -.025em; }
.brand-subtitle { margin-top: 4px; color: #899589; font-size: 11px; }
.nav-heading { padding: 0 12px 9px; color: #899589; text-transform: uppercase; letter-spacing: .1em; font-size: 10px; font-weight: 700; }
.nav-list { display: grid; gap: 5px; }
.nav-item { border: 0; color: #657264; background: transparent; padding: 10px 12px; border-radius: 10px; display: flex; align-items: center; gap: 11px; text-align: left; font-weight: 600; }
.nav-item:hover, .nav-item.active { background: #dbe5d8; color: var(--green-dark); }
.nav-icon { width: 17px; color: #778c76; font-size: 16px; text-align: center; }
.sidebar-spacer { flex: 1; }
.sidebar-note { margin: 12px 8px 0; padding: 13px; border: 1px solid #d5decf; border-radius: 13px; color: #7f8a79; font-size: 11px; }
.sidebar-note strong { display: block; color: var(--green-dark); font-size: 12px; margin-bottom: 3px; }

.main { width: 100%; min-width: 0; max-width: 1590px; margin: 0 auto; padding: 32px 32px 60px; }
.topbar { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; justify-content: space-between; margin-bottom: 31px; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
h1, h2, h3, p { margin: 0; }
h1 { margin-top: 7px; font: 800 clamp(25px, 3vw, 37px)/1.08 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: -.045em; }
.subtitle { margin-top: 10px; color: var(--ink-soft); max-width: 680px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.connection-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 9px 12px; border-radius: 999px; background: rgba(255,254,250,.82); color: var(--ink-soft); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); box-shadow: 0 0 0 3px rgba(135,145,137,.14); }
.status-connected { background: #329b65; box-shadow: 0 0 0 3px rgba(50,155,101,.16); }
.status-connecting { background: #c4933e; box-shadow: 0 0 0 3px rgba(196,147,62,.17); }
.status-disconnected { background: #b75a50; box-shadow: 0 0 0 3px rgba(183,90,80,.16); }

.connection-card { margin-bottom: 25px; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,254,250,.82); box-shadow: 0 2px 4px rgba(37,66,49,.025); }
.connection-copy strong { display: block; font: 700 15px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.connection-copy span { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 12px; }
.connection-actions { display: flex; gap: 9px; align-items: center; }

.section { margin-top: 24px; scroll-margin-top: 18px; }
.section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-title { font: 800 19px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: -.025em; }
.section-description { color: var(--ink-soft); font-size: 12px; margin-top: 3px; }

.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.summary-card { min-height: 132px; padding: 17px 18px; border: 1px solid var(--line); background: rgba(255,254,250,.89); border-radius: var(--radius); box-shadow: 0 2px 4px rgba(37,66,49,.025); }
.summary-label { color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.summary-value { display: block; margin-top: 17px; font: 800 27px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: -.045em; }
.admission { display: flex; align-items: center; justify-content: flex-end; min-height: 20px; }

.grid-two { display: grid; grid-template-columns: 1.16fr .84fr; gap: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,254,250,.92); box-shadow: 0 2px 4px rgba(37,66,49,.025); padding: 19px; }
.card h3 { font: 700 15px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.card-caption { margin-top: 6px; color: var(--ink-soft); font-size: 12px; }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }

.button { min-height: 37px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid transparent; border-radius: 10px; color: #fff; background: var(--green); font-weight: 700; transition: background .15s, transform .15s, border-color .15s; }
.button:hover { background: var(--green-dark); }
.button:active { transform: translateY(1px); }
.button-ghost { color: var(--green-dark); border-color: var(--line-strong); background: #fffefa; }
.button-ghost:hover { color: var(--green-dark); border-color: var(--green); background: var(--mint); }
.button-light { color: var(--ink); background: var(--surface-alt); border-color: var(--line); }
.button-light:hover { color: var(--green-dark); background: var(--green-soft); }
.button-danger { color: var(--red); background: var(--red-soft); border-color: #f4cbc6; }
.button-danger:hover { background: #fbd8d3; }
.button-small { min-height: 30px; padding: 5px 9px; border-radius: 8px; font-size: 12px; }
.button-link { border: 0; color: var(--green); background: none; padding: 0; font-weight: 700; }

.form-field { display: grid; gap: 7px; margin-top: 16px; }
.form-field label { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--ink); background: #fffefa; padding: 10px 11px; }
input::placeholder, textarea::placeholder { color: #a1aaa1; }
textarea { min-height: 126px; resize: vertical; line-height: 1.48; }
select { min-height: 38px; }
.helper { margin-top: 6px; color: var(--ink-faint); font-size: 11px; }

.notice { padding: 11px 13px; border-radius: 10px; font-size: 12px; }
.notice[hidden] { display: none; }
.notice-info { color: var(--ink-soft); background: var(--surface-alt); border: 1px solid var(--line); }
.notice-success { color: #2a6e4c; background: var(--mint); border: 1px solid #cbe8d5; }
.notice-warning { color: #8b5c19; background: var(--amber-soft); border: 1px solid #f0ddb5; }
.notice-error { color: #9b443b; background: var(--red-soft); border: 1px solid #f0c4bf; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 11px; margin-bottom: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.filter-input { width: min(280px, 100%); }
.filter-select { width: auto; min-width: 130px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fffefa; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--ink-soft); background: var(--surface-alt); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcf7; }
.table-index { width: 44px; color: var(--ink-faint); font-weight: 700; }
.identity-cell { display: flex; align-items: center; gap: 10px; min-width: 175px; }
.identity-cell strong { font-size: 13px; }
.cell-note { display: block; margin-top: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.credit-stack { display: grid; gap: 3px; min-width: 166px; }
.credit-total { font: 700 14px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.credit-breakdown { display: grid; grid-template-columns: auto auto; gap: 2px 9px; color: var(--ink-faint); font-size: 10px; }
.credit-part { display: inline-flex; gap: 3px; }
.slots-cell { min-width: 90px; }
.action-cell { display: flex; gap: 5px; }
.badge { display: inline-flex; align-items: center; width: fit-content; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.badge-live { color: #247046; background: var(--green-soft); }
.badge-busy { color: #725213; background: var(--amber-soft); }
.badge-cooldown { color: #825e2a; background: #f9eedc; }
.badge-banned, .badge-error { color: #9e453c; background: var(--red-soft); }
.badge-unknown { color: var(--ink-soft); background: var(--surface-alt); }
.unknown-value { color: var(--ink-faint); }
.error-copy { display: inline-block; max-width: 160px; overflow: hidden; color: var(--red); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--ink-faint); }
.empty-state { padding: 24px; color: var(--ink-faint); text-align: center; }
.empty-state[hidden] { display: none; }

.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 9px; padding-top: 12px; }
.page-label { color: var(--ink-soft); font-size: 12px; min-width: 50px; text-align: center; }

#connectForm { display: flex; gap: 9px; align-items: center; }
#connectForm[hidden], #dashboardContent[hidden] { display: none; }
#adminKey { width: min(310px, 46vw); }

#notice { margin-bottom: 20px; }
body.is-mutating .button:not(.button-danger) { cursor: wait; }

.dialog-backdrop { border: 0; border-radius: 18px; padding: 0; width: min(580px, calc(100vw - 30px)); color: var(--ink); background: var(--surface); box-shadow: 0 30px 100px rgba(31,58,42,.28); }
.dialog-backdrop::backdrop { background: rgba(25,45,34,.34); backdrop-filter: blur(3px); }
.dialog-inner { padding: 22px; }
.dialog-title { font: 800 19px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.dialog-description { margin-top: 7px; color: var(--ink-soft); font-size: 12px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 1120px) {
  .sidebar { width: 205px; flex-basis: 205px; }
  .main { padding-left: 25px; padding-right: 25px; }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; height: auto; min-height: 0; padding: 13px 15px; position: relative; }
  .brand { padding: 0 4px 12px; }
  .nav-heading, .sidebar-note, .sidebar-spacer { display: none; }
  .nav-list { display: flex; overflow: auto; gap: 4px; }
  .nav-item { flex: 0 0 auto; padding: 8px 10px; font-size: 12px; }
  .main { padding: 24px 15px 42px; }
  .topbar { display: block; margin-bottom: 22px; }
  .top-actions { justify-content: flex-start; margin-top: 15px; }
  .connection-card { display: block; }
  .connection-actions { margin-top: 12px; }
  #connectForm { align-items: stretch; flex-direction: column; }
  #adminKey { width: 100%; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .summary-card { min-height: 92px; padding: 13px; }
  .summary-value { margin-top: 11px; font-size: 22px; }
  .section-header { align-items: flex-start; display: block; }
  .section-header .button, .section-header .filters { margin-top: 11px; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-input { grid-column: 1 / -1; width: 100%; }
  .filter-select { width: 100%; min-width: 0; }
  .card { padding: 15px; }
  .card-actions { align-items: stretch; flex-direction: column; }
  .card-actions .button { width: 100%; }
  .credit-breakdown { display: grid; gap: 2px; }
}
@media (max-width: 400px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card { min-height: 84px; }
  .summary-label { font-size: 11px; }
  .summary-value { font-size: 19px; }
  .top-actions, .connection-actions { width: 100%; }
  .top-actions > *, .connection-actions > * { flex: 1; }
}

[hidden] { display: none !important; }
.nav-count { margin-left: auto; background: rgba(38,91,58,.08); color: #6e876b; font-size: 10px; border-radius: 5px; padding: 1px 5px; }
.summary-detail { display: block; color: #94a08e; font-size: 10px; margin-top: 11px; }
.summary-card-accent { border-color: #bfd2bf; background: #e4eddf; }
.summary-card-accent .summary-label { color: #43613a; }
.summary-card-accent .summary-value { color: #214e33; }
.summary-card-accent .summary-detail { color: #69885f; }
.identity-lines { display: grid; gap: 4px; }
.identity-lines strong { max-width: 215px; overflow-wrap: anywhere; white-space: normal; }
.identity-lines .mono { color: #929b8c; max-width: 230px; overflow-wrap: anywhere; white-space: normal; font-size: 9px; }
.account-avatar { width: 30px; height: 30px; border-radius: 10px; background: #eef1e7; color: #7c9270; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 11px; }
.updated-cell { white-space: normal; min-width: 130px; font-size: 11px; }
.error-copy { white-space: normal; overflow: visible; }
.cell-note { font-size: 10px; }
.sync-separator { margin: 0 7px; color: #adb6a5; }
.range-label { margin-right: auto; color: #8b9781; font-size: 11px; }
.job-id strong { display: block; max-width: 240px; white-space: normal; overflow-wrap: anywhere; font-size: 10px; }
.job-diagnostic { max-width: 235px; min-width: 125px; white-space: normal; overflow-wrap: anywhere; font-size: 11px; }
#proxiesSection table { min-width: 535px; }
#jobsSection table { min-width: 800px; }
.proxy-label { white-space: normal; overflow-wrap: anywhere; }
.check-results { display: grid; gap: 8px; margin-top: 12px; max-height: 235px; overflow: auto; }
.check-result { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 8px; background: #f2f5ed; border-radius: 8px; font-size: 11px; overflow-wrap: anywhere; }
.check-result > span { min-width: 0; }
#jobNotice { margin-bottom: 14px; }
.dialog-inner .notice { margin-top: 13px; }
.dialog-footer .button { font-size: 12px; }
.welcome-card { position: relative; margin: 18px 0 0; padding: 55px 35px 35px; min-height: 460px; border: 1px solid #dfe6d7; border-radius: 22px; text-align: center; overflow: hidden; background: linear-gradient(165deg, #f1f4e9 0%, #fafbf5 49%, #edf1e5 100%); }
.welcome-card h2 { margin: 13px 0; font-size: 35px; font-weight: 750; letter-spacing: -.045em; line-height: 1.2; }
.welcome-card > p { max-width: 530px; margin: 0 auto; color: #819076; font-size: 13px; line-height: 1.8; }
.welcome-art { height: 110px; position: relative; display: flex; justify-content: center; align-items: center; margin: 10px 0 25px; }
.welcome-mark { display: grid; place-items: center; height: 66px; width: 66px; color: #dce8d3; background: #315c3c; font-size: 33px; font-weight: 600; border-radius: 22px; box-shadow: 0 13px 30px #2b593627; transform: rotate(-8deg); z-index: 1; }
.orbit { position: absolute; border: 1px solid #cfdcc0; border-radius: 50%; width: 200px; height: 94px; transform: rotate(-25deg); }
.orbit-two { width: 200px; height: 94px; transform: rotate(25deg); }
.orbit-dot { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: #abc19b; transform: translate(93px, -22px); box-shadow: 0 0 0 7px #b3c7a91c; }
.welcome-features { display: flex; justify-content: center; flex-wrap: wrap; gap: 26px; margin-top: 24px; color: #69825b; font-size: 11px; }
.welcome-footnote { color: #96a38a; margin-top: 43px; font-size: 10px; }
input, select, textarea { min-width: 0; }
.top-actions { max-width: 100%; }
.connection-chip { min-width: 0; overflow-wrap: anywhere; }
.connection-card { flex-wrap: wrap; }
#connectForm { flex: 1; min-width: 260px; justify-content: flex-end; }
#adminKey { min-width: 0; }
#dashboardContent .section:first-child { margin-top: 0; }
@media (min-width: 1500px) { .main { padding: 37px 45px 60px; } }
@media (max-width: 1050px) { .summary-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } .toolbar { align-items: stretch; } .filters { width: 100%; } .filter-select { max-width: 185px; } }
@media (max-width: 760px) {
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-count { display: none; }
  .brand-subtitle { font-size: 10px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .summary-card { min-height: 115px; }
  .summary-card-accent { grid-column: 1 / -1; }
  .summary-card-accent .summary-value { font-size: 30px; }
  .welcome-card { padding: 27px 15px; min-height: 430px; }
  .welcome-card h2 { font-size: 30px; }
  .welcome-card > p { font-size: 12px; }
  .welcome-features { gap: 13px; font-size: 10px; }
  .welcome-footnote { margin-top: 30px; line-height: 1.8; }
  .connection-copy span { max-width: 290px; }
  #connectForm { min-width: 0; flex-basis: 100%; }
  #retryConnection { width: 100%; }
  .filter-select { max-width: none; }
  .action-row { margin-top: 12px; }
  .section-header .action-row .button { margin-top: 0; }
  .section-header .filters .button { margin-top: 0; }
  .section-header .filters { align-items: center; }
  .dialog-footer { flex-wrap: wrap; }
  .dialog-footer .button { flex: 1; }
  .dialog-inner { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
