:root {
  --ink: #152323;
  --ink-soft: #3c4c4b;
  --muted: #71807d;
  --paper: #f3f7f3;
  --surface: #ffffff;
  --line: #dce5df;
  --mint: #2aa68d;
  --mint-dark: #167866;
  --mint-soft: #ddf2eb;
  --coral: #ef785b;
  --shadow: 0 12px 34px rgba(21, 35, 35, .08);
  --radius: 6px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 76px; padding: 0 clamp(18px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #f3f7f3; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand strong { display: block; font-size: 16px; letter-spacing: .02em; }
.brand small { display: block; margin-top: 3px; color: #9bb2ab; font-family: var(--mono); font-size: 9px; letter-spacing: .16em; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 8px); gap: 3px; width: 23px; height: 23px; padding: 2px; border: 1px solid #72d2ba; border-radius: 4px; }
.brand-mark span { display: block; background: #72d2ba; border-radius: 1px; }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3) { opacity: .52; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.secure-badge { display: inline-flex; align-items: center; gap: 6px; color: #b1d9ce; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; }
.secure-badge svg, .icon-button svg, .primary-button svg, .secondary-button svg, .password-field svg, .search-field svg, .notice-icon svg, .mini-lock svg, .page-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 1px solid #415755; border-radius: 5px; color: #b1d9ce; background: transparent; transition: background .2s ease, border-color .2s ease, color .2s ease; }
.icon-button:hover { border-color: #72d2ba; color: #e9fff8; background: #203b39; }
.icon-button.light { border-color: #b8d0c8; color: var(--mint-dark); background: #f6fffb; }
.icon-button.light:hover { background: var(--mint-soft); border-color: var(--mint); }
main { flex: 1; }
.boot-view { min-height: calc(100vh - 136px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.boot-indicator { display: flex; align-items: end; gap: 4px; width: 32px; height: 24px; }
.boot-indicator span { width: 8px; height: 8px; border-radius: 2px; background: var(--mint); animation: boot-pulse .9s ease-in-out infinite; }
.boot-indicator span:nth-child(2) { animation-delay: .12s; }
.boot-indicator span:nth-child(3) { animation-delay: .24s; }
@keyframes boot-pulse { 0%, 100% { height: 8px; opacity: .45; } 50% { height: 24px; opacity: 1; } }
.login-view { min-height: calc(100vh - 136px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: clamp(34px, 8vw, 120px); align-items: center; width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 70px 0; }
.login-panel { max-width: 480px; }
.eyebrow, .panel-kicker { color: var(--mint-dark); font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.eyebrow { display: flex; align-items: center; gap: 8px; }
.pulse-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px var(--mint-soft); }
h1, h2, p { margin: 0; }
.login-panel h1 { margin-top: 19px; font-size: clamp(36px, 5vw, 64px); line-height: 1.05; letter-spacing: -.02em; font-weight: 760; }
.login-copy { margin-top: 18px; max-width: 360px; color: var(--ink-soft); font-size: 16px; line-height: 1.7; }
.login-form { margin-top: 36px; max-width: 380px; }
.login-form label { display: block; margin-bottom: 9px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.password-field, .search-field { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .2s ease, box-shadow .2s ease; }
.password-field { padding: 0 14px; height: 50px; }
.password-field:focus-within, .search-field:focus-within { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.password-field svg, .search-field svg { color: var(--muted); flex: 0 0 auto; }
.password-field input, .search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.password-field input::placeholder, .search-field input::placeholder { color: #9aa9a5; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 5px; font-size: 13px; font-weight: 750; transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.primary-button { width: 100%; height: 50px; margin-top: 12px; border: 1px solid var(--mint-dark); color: #f5fffb; background: var(--mint-dark); box-shadow: 0 7px 16px rgba(22, 120, 102, .18); }
.primary-button:hover { background: #106654; box-shadow: 0 10px 20px rgba(22, 120, 102, .24); transform: translateY(-1px); }
.primary-button:active, .secondary-button:active { transform: translateY(0); }
.form-error { min-height: 20px; margin-top: 10px; color: #b64e3b; font-size: 12px; }
.login-foot { display: flex; align-items: center; gap: 8px; margin-top: 28px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.mini-lock { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 4px; color: var(--mint-dark); background: var(--surface); }
.mini-lock svg { width: 12px; height: 12px; }
.login-aside { min-height: 300px; padding: 28px; border: 1px solid #cbded6; border-radius: 6px; background: #e2f0eb; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.signal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; opacity: .72; }
.signal-grid span { aspect-ratio: 1; border: 1px solid #98c8ba; background: #cfe7de; }
.signal-grid span:nth-child(3n) { background: #75bda9; border-color: #75bda9; }
.signal-grid span:nth-child(5n) { background: #f0a181; border-color: #f0a181; }
.aside-caption { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding-top: 20px; border-top: 1px solid #bad4ca; }
.aside-caption span { color: #4c7d70; font-family: var(--mono); font-size: 10px; letter-spacing: .15em; }
.aside-caption strong { max-width: 160px; color: #1e5e50; text-align: right; font-size: 13px; line-height: 1.35; }
.dashboard { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 70px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 28px; }
.page-heading h1 { margin-top: 12px; font-size: clamp(30px, 4vw, 46px); line-height: 1.1; letter-spacing: -.02em; }
.page-heading p { margin-top: 10px; color: var(--muted); font-size: 14px; }
.secondary-button { min-height: 40px; padding: 0 15px; border: 1px solid #b5cbc3; color: var(--mint-dark); background: var(--surface); }
.secondary-button:hover { border-color: var(--mint); background: var(--mint-soft); }
.secondary-button:disabled { cursor: wait; opacity: .55; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { min-height: 132px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 6px 18px rgba(21, 35, 35, .04); }
.stat-primary { border-color: #a6d7c7; background: #e6f5ef; }
.stat-label { display: block; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; }
.stat-card strong { display: block; margin-top: 15px; font-size: 31px; line-height: 1; letter-spacing: -.02em; }
.stat-primary strong { color: var(--mint-dark); }
.stat-meta { display: block; margin-top: 11px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice-bar { display: flex; align-items: center; gap: 10px; min-height: 42px; margin: 14px 0; padding: 0 15px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-soft); background: #eef4f0; font-size: 12px; }
.notice-bar.error { border-color: #efc5ba; color: #9f4737; background: #fff3ef; }
.notice-bar.success { border-color: #aed8c8; color: #246b5b; background: #e9f8f2; }
.notice-bar.running { border-color: #e6d3a9; color: #896629; background: #fff8e9; }
.notice-icon { display: inline-flex; color: var(--mint-dark); }
.notice-bar.error .notice-icon { color: var(--coral); }
.notice-bar.running .notice-icon { color: #c88d2e; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.pool-panel { overflow: hidden; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 22px 24px 17px; }
.panel-heading h2 { margin-top: 7px; font-size: 21px; letter-spacing: -.01em; }
.result-count { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 24px 18px; }
.search-field { flex: 1 1 330px; max-width: 430px; height: 40px; padding: 0 12px; }
.search-field input { font-size: 13px; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: #f2f6f3; }
.segment { min-height: 30px; padding: 0 11px; border: 0; border-radius: 3px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.segment:hover { color: var(--ink); }
.segment.active { color: var(--mint-dark); background: var(--surface); box-shadow: 0 2px 6px rgba(21,35,35,.08); }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 660px; }
th, td { padding: 14px 24px; border-bottom: 1px solid #edf1ee; text-align: left; }
th { color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: #fafcfa; }
td { color: var(--ink-soft); font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfefc; }
.proxy-code { color: var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 650; }
.host-cell { font-family: var(--mono); font-size: 12px; }
.port-cell { color: var(--ink); font-family: var(--mono); }
.country-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 23px; padding: 0 7px; border: 1px solid #d4ddd8; border-radius: 4px; color: var(--ink-soft); background: #f4f7f5; font-family: var(--mono); font-size: 10px; font-weight: 700; }
.protocol-pill { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border: 1px solid #bfe2d5; border-radius: 12px; color: var(--mint-dark); background: var(--mint-soft); font-family: var(--mono); font-size: 10px; font-weight: 700; }
.time-cell { color: var(--muted); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.empty-state { height: 180px; color: var(--muted); text-align: center; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 24px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 10px; }
.live-indicator { display: inline-flex; align-items: center; gap: 7px; }
.live-indicator .pulse-dot { width: 5px; height: 5px; box-shadow: none; }
.pagination { display: inline-flex; align-items: center; gap: 8px; }
.page-button { display: inline-flex; align-items: center; justify-content: center; width: 29px; height: 29px; padding: 0; border: 1px solid var(--line); border-radius: 4px; color: var(--ink-soft); background: var(--surface); }
.page-button:hover:not(:disabled) { border-color: var(--mint); color: var(--mint-dark); background: var(--mint-soft); }
.page-button:disabled { cursor: default; opacity: .4; }
.page-button svg { width: 14px; height: 14px; }
.api-panel { display: grid; grid-template-columns: 1fr auto; gap: 18px 30px; align-items: center; margin-bottom: 18px; padding: 23px 24px; border: 1px solid #2a5048; border-radius: var(--radius); color: #e7f8f2; background: var(--ink); }
.api-copy h2 { margin-top: 7px; font-size: 19px; }
.api-copy p { margin-top: 8px; color: #9bb2ab; font-size: 12px; }
.api-copy p code { color: #c5eade; font-family: var(--mono); font-size: 11px; }
.api-panel .panel-kicker { color: #78d2b9; }
.api-endpoint { display: inline-flex; align-items: center; gap: 10px; justify-self: end; }
.api-endpoint code, .api-snippet code { color: #b4e5d6; font-family: var(--mono); font-size: 12px; }
.api-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.key-button { display: inline-flex; align-items: center; gap: 9px; min-height: 38px; padding: 0 13px; border: 1px solid #5a927e; border-radius: 5px; color: #d8f7ec; background: #244c43; font-size: 12px; font-weight: 750; }
.key-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.key-button:hover { border-color: #9ce3ca; background: #2e6054; }
.key-button:disabled { cursor: wait; opacity: .55; }
.key-status { color: #a6c9bd; font-family: var(--mono); font-size: 10px; }
.current-key { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid #6a9f8d; border-radius: 4px; background: #20423b; }
.current-key > div { min-width: 0; }
.current-key span { display: block; color: #9fcbbd; font-family: var(--mono); font-size: 10px; }
.current-key code { display: block; margin-top: 6px; color: #f1fff9; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.icon-button:disabled { cursor: default; opacity: .45; }
.api-params { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); border-top: 1px solid #345b52; border-bottom: 1px solid #345b52; }
.api-param { display: grid; grid-template-columns: minmax(100px, auto) 1fr; align-items: center; gap: 14px; min-width: 0; padding: 13px 0; }
.api-param + .api-param { padding-left: 22px; border-left: 1px solid #345b52; }
.api-param-name { display: inline-flex; align-items: center; gap: 8px; }
.api-param-name code { color: #b4e5d6; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.api-param-name span { min-height: 20px; padding: 3px 6px; border: 1px solid #52766d; border-radius: 3px; color: #9fcbbd; font-family: var(--mono); font-size: 9px; }
.api-param-name .param-required { border-color: #9f644f; color: #f1a489; }
.api-param p { color: #9bb2ab; font-size: 11px; line-height: 1.55; }
.api-param p code { color: #d0eee5; font-family: var(--mono); font-size: 10px; }
.api-snippet { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: 1px solid #345b52; border-radius: 4px; background: #1b3532; }
.api-snippet span { color: #f1a489; font-family: var(--mono); font-size: 10px; font-weight: 700; }
.api-snippet code { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.api-snippet .icon-button { flex: 0 0 auto; width: 30px; height: 30px; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: min(1180px, calc(100% - 40px)); min-height: 60px; margin: 0 auto; color: #8b9b96; font-family: var(--mono); font-size: 10px; }

@media (prefers-reduced-motion: reduce) {
  .boot-indicator span { animation: none; height: 16px; opacity: .75; }
}

@media (max-width: 800px) {
  .login-view { grid-template-columns: 1fr; min-height: 0; padding: 66px 0 54px; }
  .login-aside { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard { padding-top: 38px; }
}

@media (max-width: 560px) {
  .topbar { height: 68px; padding: 0 18px; }
  .secure-badge { display: none; }
  .dashboard, .footer { width: min(100% - 28px, 1180px); }
  .login-view { width: min(100% - 36px, 480px); }
  .page-heading { align-items: start; flex-direction: column; }
  .secondary-button { width: 100%; }
  .stats-grid { gap: 8px; }
  .stat-card { min-height: 120px; padding: 15px; }
  .stat-card strong { font-size: 26px; }
  .panel-heading, .toolbar, .panel-footer { padding-left: 16px; padding-right: 16px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-field { max-width: none; }
  .segmented { align-self: flex-start; }
  th, td { padding-left: 16px; padding-right: 16px; }
  .api-panel { grid-template-columns: 1fr; padding: 20px 16px; }
  .api-endpoint { justify-self: start; }
  .api-actions { align-items: flex-start; flex-direction: column; }
  .api-params { grid-template-columns: 1fr; }
  .api-param { grid-template-columns: 1fr; gap: 7px; }
  .api-param + .api-param { padding-left: 0; border-top: 1px solid #345b52; border-left: 0; }
  .footer { min-height: 76px; align-items: start; flex-direction: column; justify-content: center; gap: 5px; }
  .panel-footer { flex-wrap: wrap; }
  .pagination { order: 3; width: 100%; justify-content: center; }
}
