:root {
    color-scheme: light;
    --canvas: #e9ebe8;
    --surface: #f4f5f2;
    --surface-soft: #eceeeb;
    --surface-hover: #e3e7e4;
    --border: #d9dedb;
    --border-strong: #c2cbc6;
    --ink: #202a31;
    --text: #37444b;
    --muted: #68757a;
    --quiet: #879296;
    --accent: #49647a;
    --accent-hover: #3b5368;
    --accent-soft: #e4ebf0;
    --blue: #426f91;
    --violet: #70678a;
    --red: #a5453c;
    --red-soft: #fbefed;
    --amber: #8b641f;
    --amber-soft: #fbf4e5;
    --radius: 12px;
    --font: 'IBM Plex Sans Arabic', 'DM Sans', sans-serif;
    --mono: 'DM Mono', Consolas, monospace;
    --shadow-sm: 0 1px 2px rgba(22, 37, 28, .04);
    --shadow-modal: 0 20px 60px rgba(25, 39, 31, .18);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--canvas); scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: var(--canvas); font-family: var(--font); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(73, 100, 122, .35); outline-offset: 2px; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.mono-text { font-family: var(--mono); direction: ltr; text-align: left; }

/* Sign in */
.login-shell { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 32px 20px 72px; background: var(--canvas); }
.login-orbit { display: none; }
.login-card { width: min(100%, 432px); position: relative; z-index: 1; padding: 32px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 12px 34px rgba(28, 43, 34, .07); }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; direction: ltr; }
.brand-image { width: 34px; height: 34px; flex: 0 0 auto; object-fit: contain; }
.login-brand .brand-image { width: 46px; height: 46px; }
.brand-text { color: var(--ink); font-family: 'DM Sans', sans-serif; font-size: 17px; font-weight: 700; letter-spacing: -.6px; }
.login-brand .brand-text { font-size: 20px; }
.login-brand { width: 100%; justify-content: center; margin-bottom: 36px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: 'DM Sans', var(--font); font-size: 11px; font-weight: 600; letter-spacing: .35px; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #3e8a63; }
.login-card h1 { margin: 16px 0 8px; color: var(--ink); font-size: 25px; font-weight: 600; letter-spacing: -.25px; }
.login-description { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.login-form label, .form-section > label, .field-label { display: block; margin-bottom: 8px; color: var(--text); font-size: 12px; font-weight: 600; }
.password-field { position: relative; }
.password-field input { width: 100%; padding-left: 44px !important; }
.lock-icon { position: absolute; top: 50%; left: 14px; color: var(--muted); transform: translateY(-50%); font-size: 18px; }
input, select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--ink); transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease; }
input::placeholder { color: #87928b; opacity: 1; }
input:hover, select:hover { border-color: #a7b2b8; }
input:focus, select:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(73, 100, 122, .13); }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease; white-space: nowrap; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-primary { border-color: var(--accent); background: var(--accent); color: #f8f9fa; box-shadow: var(--shadow-sm); }
.button-primary:hover:not(:disabled) { border-color: var(--accent-hover); background: var(--accent-hover); }
.button-secondary { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.button-secondary:hover:not(:disabled) { border-color: #abb8af; background: var(--surface-hover); }
.button-full { width: 100%; min-height: 46px; margin-top: 16px; font-size: 13px; }
.button-arrow { font-family: sans-serif; font-size: 17px; line-height: 1; }
.form-error { min-height: 19px; margin: 8px 0 0; color: var(--red); font-size: 12px; }
.login-foot { padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); text-align: center; font-size: 11px; }
.tiny-shield { margin-left: 5px; color: var(--accent); }

/* Dashboard frame and navigation */
.app-shell { min-height: 100vh; }
.sidebar { width: 248px; position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; flex-direction: column; padding: 20px 16px 14px; border-right: 1px solid var(--border); background: var(--surface); direction: rtl; }
.sidebar-top { height: 40px; display: flex; align-items: center; justify-content: space-between; padding: 0 7px; direction: ltr; }
.sidebar-close { display: none !important; }
.side-label { padding: 0 10px; color: var(--muted); font-size: 11px; font-weight: 600; text-align: right; }
.side-label-spaced { margin-top: 24px; margin-bottom: 8px; }
.side-nav { display: grid; gap: 4px; margin-top: 8px; }
.nav-link { min-height: 42px; position: relative; display: flex; align-items: center; gap: 10px; padding: 0 11px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-family: var(--font); font-size: 12px; text-align: right; cursor: pointer; direction: rtl; transition: background-color .16s ease, color .16s ease, border-color .16s ease; }
.nav-link:hover { background: var(--surface-soft); color: var(--ink); }
.nav-link:active { background: var(--surface-hover); }
.nav-link.active { border-color: #d2dde4; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-link.active .nav-icon { color: var(--accent); }
.nav-icon { width: 18px; color: #7d8981; text-align: center; font-family: 'DM Sans', sans-serif; font-size: 15px; line-height: 1; }
.nav-active-mark { width: 3px; height: 20px; position: absolute; top: 10px; right: -17px; border-radius: 3px 0 0 3px; background: var(--accent); opacity: 0; }
.nav-link.active .nav-active-mark { opacity: 1; }
.nav-count { min-width: 21px; height: 20px; display: grid; place-items: center; margin-right: auto; border-radius: 6px; background: #edf0ed; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.nav-button { width: 100%; }
.credentials-indicator { width: 7px; height: 7px; margin-right: auto; border-radius: 50%; background: #a6b0a9; }
.credentials-indicator.ready { background: #438561; }
.small-live-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #448460; }
.icon-button { display: grid; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.main-area { min-height: 100vh; margin-left: 248px; direction: rtl; }
.topbar { height: 64px; position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 36px; border-bottom: 1px solid var(--border); background: rgba(244, 245, 242, .96); }
.topbar-actions { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; }
.logout-topbar { min-height: 32px; padding: 5px 8px; color: var(--muted); }
.logout-topbar:hover { background: var(--surface-hover); color: var(--ink); }
.live-indicator { display: flex; align-items: center; gap: 8px; }
.live-indicator .status-dot { width: 7px; height: 7px; }
.topbar-divider { height: 18px; border-left: 1px solid var(--border-strong); }
.menu-toggle { display: none !important; }
.content-wrap { width: min(100%, 1320px); margin: 0 auto; padding: 32px 36px 24px; }
.view-panel { display: none; animation: appear .2s ease both; }
.view-panel.active { display: block; }
@keyframes appear { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.heading-line { width: 16px; height: 2px; display: inline-block; border-radius: 2px; background: var(--accent); }
.page-heading h1 { margin: 8px 0 4px; color: var(--ink); font-size: 25px; font-weight: 600; letter-spacing: -.3px; line-height: 1.4; }
.page-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; gap: 8px; padding-bottom: 2px; }
.account-switcher { display: flex; align-items: center; gap: 10px; margin: -10px 0 18px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.account-switcher label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.account-switcher select { width: min(100%, 340px); height: 38px; padding: 0 10px; font-size: 12px; }
.account-switcher .button { margin-right: auto; }
.refresh-icon, .plus-icon { font-family: 'DM Sans', sans-serif; font-size: 16px; line-height: .8; }
.notice-card { min-height: 64px; display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 16px; border: 1px solid #eadcb8; border-radius: 10px; background: var(--amber-soft); }
.notice-icon { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: #f4e8ca; color: var(--amber); font-weight: 700; }
.notice-card strong { color: #75541d; font-size: 12px; }
.notice-card p { margin: 3px 0 0; color: #786d56; font-size: 11px; line-height: 1.65; }
.notice-action { margin-right: auto; padding: 8px 11px; border: 1px solid #e3d3ad; border-radius: 7px; background: #fffaf0; color: #73531d; font-size: 11px; cursor: pointer; white-space: nowrap; }
.notice-action:hover { background: #fff; border-color: #cdbb91; }
.notice-action span { padding-right: 7px; font-family: sans-serif; font-size: 14px; }

/* Usage overview */
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat-card { min-height: 148px; position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.stat-card-featured { border-color: #d1dadd; background: #f0f3f3; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-family: 'DM Sans', sans-serif; font-size: 15px; }
.stat-icon-green { border-color: #d2dce2; background: #e9eff2; color: var(--accent); }
.stat-icon-blue { color: var(--blue); }
.stat-icon-violet { color: var(--violet); }
.stat-value-row { display: flex; align-items: baseline; justify-content: flex-start; gap: 8px; margin: 12px 0 8px; direction: ltr; }
.stat-value { color: var(--ink); font-family: 'DM Sans', sans-serif; font-size: 32px; font-weight: 600; letter-spacing: -1px; line-height: 1; }
.stat-unit { color: var(--muted); font-family: 'DM Sans', sans-serif; font-size: 12px; }
.stat-foot { min-height: 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.stat-trend { color: var(--accent); font-size: 11px; font-weight: 500; }
.subtle-value { color: var(--muted); font-family: var(--mono); font-size: 10px; }
.card-glow { display: none; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid #d8e7dc; border-radius: 20px; background: #f1f7f2; color: #356d4d; font-size: 10px; }
.status-pill i, .account-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.inactive, .account-status.inactive { border-color: #edd5d2; background: var(--red-soft); color: var(--red); }
.usage-card { margin-top: 16px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-kicker { color: var(--muted); font-family: 'DM Sans', var(--font); font-size: 10px; font-weight: 600; letter-spacing: .45px; text-transform: uppercase; }
.section-heading h2 { margin: 4px 0 0; color: var(--ink); font-size: 15px; font-weight: 600; }
.usage-range { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.range-dot { width: 7px; height: 7px; border-radius: 50%; background: #4e8a62; }
.range-divider { height: 14px; margin: 0 3px; border-left: 1px solid var(--border-strong); }
.usage-summary { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 20px; }
.usage-summary > div { display: flex; flex-direction: column; gap: 3px; }
.usage-summary > div:first-child { align-items: flex-start; }
.usage-summary strong { color: var(--ink); direction: ltr; font-family: 'DM Sans', sans-serif; font-size: 21px; font-weight: 600; letter-spacing: -.4px; }
.usage-summary span { color: var(--muted); font-size: 11px; }
.usage-summary .usage-total { align-items: flex-end; }
.usage-total strong { color: var(--accent); font-size: 18px; }
.meter-track { height: 9px; position: relative; overflow: hidden; margin: 16px 0 12px; border-radius: 8px; background: #e9eeea; direction: ltr; }
.meter-fill { width: 0; height: 100%; position: relative; border-radius: inherit; background: #4d8a64; transition: width .6s ease; }
.meter-marker { width: 2px; height: 13px; position: absolute; top: -2px; left: 0; border-radius: 2px; background: #315f43; transition: left .6s ease; }
.meter-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.meter-legend span { display: flex; align-items: center; gap: 7px; }
.meter-legend strong { color: var(--text); direction: ltr; font-family: var(--mono); font-size: 10px; font-weight: 400; }
.meter-legend i { width: 7px; height: 7px; border-radius: 50%; }
.legend-used { background: #4d8a64; }
.legend-remain { background: #c9d2cc; }
.bottom-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.account-card { min-height: 174px; position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.account-card { padding: 18px 20px 0; }
.bottom-grid .account-card { width: min(100%, 720px); }
.account-card-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.account-card h3 { margin: 5px 0; color: var(--ink); font-size: 14px; font-weight: 600; }
.account-status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid #d8e7dc; border-radius: 20px; background: #f1f7f2; color: #356d4d; font-size: 10px; }
.account-detail { display: flex; justify-content: space-between; gap: 10px; margin-top: 13px; color: var(--muted); font-size: 11px; }
.account-detail strong { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 11px; font-weight: 500; }
.service-mini-dot { width: 6px; height: 6px; border-radius: 50%; background: #4d8a64; }
.account-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px -20px 0; padding: 11px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.account-footer a { color: var(--accent); font-weight: 500; }
.account-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.secure-small { color: var(--muted); }

/* Proxy list */
.proxy-page-heading { margin-bottom: 24px; }
.proxy-toolbar { min-height: 64px; display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 10px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.format-control { display: flex; align-items: center; gap: 10px; }
.format-control label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.format-control select { width: auto; min-width: 200px; height: 36px; padding: 0 10px; border-radius: 7px; font-family: var(--mono); font-size: 10px; direction: ltr; }
.toolbar-divider { height: 22px; border-left: 1px solid var(--border-strong); }
.proxy-list-count { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.proxy-list-count strong { color: var(--text); font-family: var(--mono); font-weight: 500; }
.small-live-dot { width: 6px; height: 6px; }
.text-button { padding: 7px 6px; border: 0; border-radius: 6px; background: transparent; font-size: 11px; cursor: pointer; }
.text-button:hover:not(:disabled) { background: var(--surface-hover); }
.text-button:disabled { opacity: .5; cursor: not-allowed; }
.danger-text { color: var(--red); }
.danger-text:hover:not(:disabled) { background: var(--red-soft); }
.button-danger { border-color: #ecd9d6; background: var(--surface); color: var(--red); }
.button-danger:hover:not(:disabled) { border-color: #dfbfba; background: var(--red-soft); }
.button-danger:disabled { border-color: var(--border); background: var(--surface-soft); color: #8b9690; }
.proxy-table-card { overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; }
thead { background: var(--surface-soft); }
th { height: 44px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
th:first-child, td:first-child { padding-right: 18px; }
td { padding: 12px 14px; border-bottom: 1px solid #edf0ed; color: var(--text); font-size: 11px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.proxy-row { cursor: pointer; transition: background-color .14s ease; }
.proxy-row:hover { background: #eef0ed; }
.proxy-row:focus-visible { outline: 2px solid rgba(73, 100, 122, .45); outline-offset: -2px; }
.proxy-line-cell { max-width: 420px; }
.proxy-line-code { max-width: 380px; display: block; overflow: hidden; color: #45564b; font-family: var(--mono); font-size: 10px; direction: ltr; text-align: left; text-overflow: ellipsis; }
.copy-row { min-width: 52px; min-height: 30px; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 10px; cursor: pointer; }
.copy-row:hover { border-color: #9fb5a5; background: var(--surface-soft); color: var(--accent); }
.meta-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); color: var(--text); font-size: 10px; }
.meta-chip.green { border-color: #d1dde3; background: #e9eff2; color: #425f76; }
.country-chip { justify-content: center; gap: 7px; direction: ltr; font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: lowercase; }
.meta-chip.blue { border-color: #dce6ec; background: #f1f6f9; color: #426f91; }
.meta-chip .chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.empty-row td { padding: 0; }
.empty-state { min-height: 272px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; }
.empty-symbol { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 12px; border: 1px solid #dce8df; border-radius: 11px; background: #f2f7f3; color: var(--accent); font-size: 20px; }
.empty-state strong { color: var(--ink); font-size: 13px; font-weight: 600; }
.empty-state p { margin: 6px 0 16px; color: var(--muted); font-size: 11px; }
.table-footer { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.table-hint { color: var(--muted); }

/* Generator, settings, and feedback */
.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(25, 36, 30, .42); animation: fade .16s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card { width: min(100%, 560px); max-height: min(900px, 92vh); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-modal); animation: modal-up .18s ease both; }
@keyframes modal-up { from { transform: translateY(7px); opacity: .75; } to { transform: translateY(0); opacity: 1; } }
.generator-modal { width: min(100%, 560px); }
.settings-modal { width: min(100%, 560px); }
.generator-modal > form { min-height: 0; display: flex; flex: 1; flex-direction: column; overflow: hidden; }
.modal-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.modal-header h2 { margin: 4px 0 0; color: var(--ink); font-size: 17px; font-weight: 600; }
.icon-button { width: 34px; height: 34px; border-color: var(--border); background: var(--surface); color: var(--muted); font-size: 21px; line-height: 1; }
.icon-button:hover { border-color: var(--border-strong); background: var(--surface-hover); color: var(--ink); }
.modal-close { font-family: 'DM Sans', sans-serif; }
.modal-body { overflow-y: auto; padding: 20px 24px 16px; scrollbar-color: #c5cec7 transparent; scrollbar-width: thin; }
.generator-modal .modal-body { min-height: 0; flex: 1; }
.form-section { min-width: 0; margin-bottom: 16px; }
.field-label { margin-bottom: 8px; }
.required-mark { color: var(--accent); font-size: 12px; }
.optional-label { margin-right: 5px; color: var(--muted); font-size: 10px; font-weight: 400; }
.form-section input, .form-section select { height: 40px; font-size: 12px; }
.select-wrap { position: relative; }
.select-wrap select { padding-left: 34px; appearance: none; }
.select-wrap select option { background: var(--surface); color: var(--ink); }
.select-chevron { position: absolute; top: 50%; left: 12px; color: var(--muted); font-size: 15px; transform: translateY(-55%); pointer-events: none; }
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.beta-tag { margin-right: 6px; padding: 2px 5px; border: 1px solid #eadcb8; border-radius: 4px; background: var(--amber-soft); color: var(--amber); font-family: 'DM Sans', sans-serif; font-size: 9px; }
.segmented-control { min-height: 40px; display: flex; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-soft); }
.segment { min-height: 38px; flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 9px; border: 0; border-left: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; transition: background-color .14s ease, color .14s ease; }
.segment:first-child { border-left: 0; }
.segment.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.segment:hover:not(.active) { background: #e5e9e7; color: var(--ink); }
.segment span { color: inherit; font-family: 'DM Sans', sans-serif; font-size: 10px; }
.form-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-two .form-section { margin-bottom: 16px; }
.form-separator { height: 1px; margin: 4px 0 16px; background: var(--border); }
.form-separator + .form-section { margin-top: 0; }
.quantity-field { display: flex; align-items: center; gap: 10px; }
.quantity-field input { width: 112px; direction: ltr; text-align: left; font-family: var(--mono); }
.quantity-field span { color: var(--muted); font-size: 11px; }
.modal-footer { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-soft); }
.generator-modal .modal-footer { flex: 0 0 auto; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 16px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); }
.toggle-row > div { display: flex; flex-direction: column; gap: 3px; }
.toggle-row strong { color: var(--text); font-size: 11px; font-weight: 600; }
.toggle-row span:not(.switch-slider) { color: var(--muted); font-size: 10px; }
.switch { width: 38px; height: 22px; position: relative; display: inline-block; flex: 0 0 auto; }
.switch input { width: 1px; height: 1px; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.switch-slider { position: absolute; inset: 0; border: 1px solid #bac5bd; border-radius: 20px; background: #e8ece9; cursor: pointer; transition: background-color .16s ease, border-color .16s ease; }
.switch-slider::before { width: 14px; height: 14px; position: absolute; top: 3px; right: 3px; border-radius: 50%; background: #849188; content: ''; transition: transform .16s ease, background-color .16s ease; }
.switch input:checked + .switch-slider { border-color: var(--accent); background: var(--accent); }
.switch input:checked + .switch-slider::before { background: #fff; transform: translateX(-16px); }
.switch input:focus-visible + .switch-slider { outline: 3px solid rgba(73, 100, 122, .3); outline-offset: 2px; }
.settings-body { padding-top: 20px; }
.settings-body .form-section { margin-bottom: 16px; }
.settings-body .form-section input { height: 42px; }
.accounts-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.accounts-section-heading h3, .add-account-title { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.saved-accounts { display: grid; gap: 8px; }
.saved-account { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); }
.saved-account.active { border-color: #c5d2d9; background: #edf2f4; }
.saved-account-info { min-width: 0; display: grid; gap: 3px; }
.saved-account-name { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.saved-account-meta { overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 9px; direction: ltr; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.saved-account-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.account-active-tag { padding: 3px 7px; border: 1px solid #c8d6dc; border-radius: 999px; background: #f7f9fa; color: var(--accent); font-size: 9px; white-space: nowrap; }
.saved-accounts-empty { margin: 0; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--muted); font-size: 11px; text-align: center; }
.settings-body .form-separator { margin: 16px 0; }
.add-account-title { margin-bottom: 16px; }
.account-form-actions { display: flex; gap: 8px; margin-top: 12px; }
.account-form-actions .button { flex: 1; }
.connection-preview.valid { color: #356d4d; }
.connection-preview.invalid { color: var(--red); }
.settings-password input { padding-left: 44px !important; }
.api-key-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.api-key-heading .field-label { margin-bottom: 8px; }
.api-key-status { margin-bottom: 8px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 10px; }
.api-key-status.configured { border-color: #cbd9de; background: #e8eff2; color: #425f76; }
.reveal-password { position: absolute; top: 50%; left: 8px; width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; transform: translateY(-50%); }
.reveal-password:hover { background: var(--surface-hover); color: var(--accent); }
.login-reveal { display: grid; place-items: center; padding: 0; }
.login-reveal svg { width: 18px; height: 18px; }
.login-reveal .eye-closed { display: none; }
.login-reveal[aria-pressed="true"] .eye-open { display: none; }
.login-reveal[aria-pressed="true"] .eye-closed { display: block; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.toast-region { position: fixed; z-index: 100; bottom: 20px; left: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 220px; max-width: min(360px, calc(100vw - 40px)); display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid #d8e7dc; border-radius: 9px; background: var(--surface); box-shadow: 0 8px 24px rgba(25, 39, 31, .13); color: var(--text); font-size: 12px; animation: toast-in .18s ease both; }
.toast.error { border-color: #edd5d2; background: #fffafa; color: var(--red); }
.toast-icon { color: var(--accent); font-size: 14px; }
.toast.error .toast-icon { color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.sidebar-backdrop { display: none; }

@media (min-width: 1500px) {
    .content-wrap { padding-top: 40px; }
    .stat-card { min-height: 156px; padding: 22px; }
    .usage-card { padding: 22px 24px; }
}
@media (max-width: 1150px) {
    .sidebar { width: 224px; }
    .main-area { margin-left: 224px; }
    .topbar { padding: 0 26px; }
    .content-wrap { padding: 28px 26px 22px; }
    .stats-grid { gap: 12px; }
    .stat-card { padding: 16px; }
    .bottom-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .sidebar { width: 256px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 10px 0 28px rgba(25, 39, 31, .12); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: grid !important; }
    .main-area { margin-left: 0; }
    .menu-toggle { display: grid !important; width: 34px; height: 34px; position: absolute; left: 14px; top: 15px; }
    .topbar { padding: 0 56px; }
    .sidebar-backdrop.visible { position: fixed; z-index: 25; inset: 0; display: block; background: rgba(25, 36, 30, .3); }
    .content-wrap { max-width: 850px; }
}
@media (max-width: 680px) {
    .content-wrap { padding: 24px 16px 20px; }
    .topbar { height: 58px; padding: 0 16px 0 54px; }
    .topbar-actions { gap: 10px; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 20px; }
    .page-heading h1 { font-size: 22px; }
    .page-heading p { font-size: 12px; }
    .heading-actions { width: 100%; flex-wrap: wrap; }
    .heading-actions .button { flex: 1; }
    .account-switcher { flex-wrap: wrap; margin-top: -8px; }
    .account-switcher select { flex: 1; min-width: 150px; }
    .stats-grid { grid-template-columns: 1fr; gap: 8px; }
    .stat-card { min-height: 126px; padding: 15px 16px; }
    .stat-value-row { margin: 9px 0 7px; }
    .stat-value { font-size: 29px; }
    .usage-card { padding: 16px; }
    .usage-range { flex-wrap: wrap; justify-content: flex-end; font-size: 9px; }
    .bottom-grid { grid-template-columns: 1fr; gap: 12px; }
    .account-card { min-height: 160px; }
    .notice-card { align-items: flex-start; flex-wrap: wrap; }
    .notice-action { margin-right: 40px; }
    .proxy-toolbar { flex-wrap: wrap; gap: 10px; }
    .format-control { width: 100%; justify-content: space-between; }
    .format-control select { flex: 1; min-width: 0; }
    .toolbar-divider { display: none; }
    .proxy-toolbar .danger-text { margin-right: auto; }
    .table-scroll { margin-left: -1px; }
    table { min-width: 720px; }
    .table-footer { font-size: 9px; }
    .modal-backdrop { padding: 10px; }
    .modal-card { max-height: 94vh; border-radius: 12px; }
    .modal-header { min-height: 68px; padding: 12px 16px; }
    .modal-body { padding: 16px 16px 12px; }
    .modal-footer { padding: 10px 16px; }
    .modal-footer .button { flex: 1; }
    .form-grid-two { gap: 10px; }
    .login-card { padding: 28px 24px 22px; }
    .login-brand { margin-bottom: 32px; }
}
@media (max-width: 420px) {
    .form-grid-two { grid-template-columns: 1fr; gap: 0; }
    .heading-actions .button { min-width: 0; padding: 0 10px; font-size: 11px; }
    .usage-summary strong { font-size: 18px; }
    .usage-range { max-width: 48%; }
    .settings-actions { align-items: stretch; flex-direction: column; }
    .account-switcher { gap: 8px; }
    .account-switcher select { min-width: 120px; }
    .account-switcher .button { width: 100%; margin-right: 0; }
    .saved-account { align-items: flex-start; flex-direction: column; }
    .saved-account-actions { width: 100%; justify-content: flex-end; }
    .topbar-actions { gap: 6px; font-size: 10px; }
    .logout-topbar { padding: 4px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
