/* One-page dashboard */
.app-shell { min-height: 100vh; }
.topbar { display: flex; min-height: 48px; align-items: center; gap: 23px; padding: 0 clamp(15px, 2vw, 28px); border-bottom: 1px solid var(--line); background: #0c1215; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.mode-tag, .topbar-live, .readonly-badge, .pending-tag { display: inline-flex; min-height: 22px; align-items: center; gap: 6px; padding: 0 7px; border: 1px solid #35443a; border-radius: 5px; background: #171f1a; color: #c4d4b9; font-size: 8px; font-weight: 740; letter-spacing: .06em; white-space: nowrap; }
.mode-dot, .live-pulse, .live-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--green); }
.topbar-live { border-color: #2b3b35; background: #111916; color: #aebbb4; }
.login-shortcut { padding: 4px 3px; color: #91a09a; font-size: 10px; }
.login-shortcut:hover { color: var(--accent); }
.icon-button { display: inline-grid; width: 31px; height: 31px; flex: 0 0 auto; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #9ca9a1; cursor: pointer; transition: background 140ms ease, color 140ms ease; }
.icon-button:hover { border-color: var(--line); background: var(--surface-2); color: var(--text); }
.icon-button svg { width: 16px; height: 16px; }
.icon-button.is-loading svg { animation: rotate .8s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }
.workspace { width: min(100%, 1600px); margin: 0 auto; padding: 13px clamp(14px, 2vw, 28px) 12px; }
.page-heading { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 9px; }
.page-heading h1 { margin: 3px 0 0; font-size: 21px; font-weight: 650; letter-spacing: -.045em; line-height: 1.1; }
.heading-actions { display: flex; align-items: center; gap: 15px; }
.updated-label { color: #839189; font-size: 9px; white-space: nowrap; }
.updated-label strong { margin-left: 4px; color: #bbc6bf; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; font-weight: 550; }
.button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; font-size: 10px; font-weight: 680; transition: background 130ms ease, border-color 130ms ease, opacity 130ms ease; }
.button-primary { border-color: #afd96d; background: #abd96a; color: #17210f; }
.button-primary:hover { border-color: #c8ef91; background: #c1e985; }
.button-primary:disabled { cursor: wait; opacity: .62; }
.button-compact { min-height: 32px; padding: 0 10px; }
.button-wide { width: 100%; justify-content: space-between; min-height: 40px; }
.button.loading .button-label::before { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid rgb(23 33 15 / 35%); border-top-color: #17210f; border-radius: 50%; content: ""; vertical-align: -1px; animation: rotate .8s linear infinite; }

.runtime-banner { display: flex; min-height: 39px; align-items: center; gap: 9px; margin-bottom: 9px; padding: 0 11px; border: 1px solid #2f4938; border-radius: 7px; background: linear-gradient(90deg, #16251b, #121b1b); }
.runtime-banner.offline { border-color: #523939; background: #251b1d; }
.runtime-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #77847c; }
.runtime-dot.online { background: var(--green); box-shadow: 0 0 0 3px rgb(99 217 154 / 10%); }
.runtime-dot.offline { background: var(--red); }
.runtime-banner > strong { color: #e0eadf; font-size: 10px; font-weight: 680; white-space: nowrap; }
.runtime-banner > span:nth-of-type(2) { overflow: hidden; color: #9eaca2; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.runtime-state { margin-left: auto; color: #c0d1c3; font-size: 8px; font-weight: 760; letter-spacing: .06em; white-space: nowrap; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 10px; }
.metric-card { display: grid; min-width: 0; min-height: 74px; grid-template-columns: 1fr auto; align-content: center; align-items: center; gap: 1px 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(145deg, #131b1f, #10171a); }
.metric-label { color: #9ba8a0; font-size: 9px; font-weight: 560; }
.metric-value { grid-row: span 2; grid-column: 2; color: #edf3ee; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: clamp(16px, 1.55vw, 21px); font-weight: 560; letter-spacing: -.045em; text-align: right; white-space: nowrap; }
.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }
.metric-note { overflow: hidden; color: #77857d; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }

.overview-balance-panel { margin-bottom: 9px; }
.overview-balance-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.overview-range-control { display: inline-flex; align-items: center; gap: 6px; color: #849189; font-size: 8px; }
.overview-range-control select { height: 27px; min-width: 125px; padding: 0 25px 0 8px; border: 1px solid #34443c; border-radius: 6px; background: #0c1416; color: #dfe8e1; font-size: 9px; }
.overview-range-control select:focus { border-color: #a6d873; outline: 2px solid rgb(173 221 106 / 13%); }
.overview-custom-range { justify-content: flex-end; padding: 7px 11px; border-bottom: 1px solid #27343a; }
.overview-custom-range label { color: #93a097; font-size: 8px; }
.overview-custom-range input { width: 132px; min-width: 0; height: 29px; padding: 0 7px; border: 1px solid #334149; border-radius: 5px; background: #0b1215; color: #dce5de; color-scheme: dark; font-size: 9px; }
.overview-balance-summary { display: flex; min-height: 47px; align-items: center; gap: clamp(13px, 3vw, 35px); padding: 7px 12px 1px; }
.overview-balance-summary > div { display: grid; min-width: 0; gap: 3px; }
.overview-balance-summary > div > span { color: #839189; font-size: 8px; }
.overview-balance-summary strong { overflow: hidden; color: #e0e9e2; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.overview-balance-summary strong.positive { color: var(--green); }
.overview-balance-summary strong.negative { color: var(--red); }
.overview-period-label { margin-left: auto; color: #829087; font-size: 8px; white-space: nowrap; }
.overview-balance-legend { display: flex; align-items: center; gap: 16px; padding: 7px 12px 0; color: #9aa79f; font-size: 9px; }
.overview-balance-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.overview-balance-legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; }
.overview-legend-balance { border-color: #b4df7b !important; }
.overview-legend-equity { border-color: #6ec8df !important; border-top-style: dashed !important; }
.overview-balance-chart-wrap { padding: 1px 10px 7px; }
.overview-balance-chart-wrap svg { display: block; width: 100%; height: 176px; overflow: visible; }
.overview-chart-grid { fill: none; stroke: #28363a; stroke-width: 1; stroke-dasharray: 3 5; }
.overview-balance-line, .overview-equity-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.overview-balance-line { stroke: #b4df7b; }
.overview-equity-line { stroke: #6ec8df; stroke-dasharray: 7 5; }
.overview-chart-points circle { fill: #10181a; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.overview-balance-points circle { stroke: #b4df7b; }
.overview-equity-points circle { stroke: #6ec8df; }
.overview-balance-axis { display: flex; justify-content: space-between; padding: 0 4px 0 108px; color: #819087; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8px; }
.overview-balance-note { margin: 5px 4px 0 108px; color: #89968e; font-size: 8px; line-height: 1.4; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 10px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(145deg, #121a1e, #10171a); scroll-margin-top: 10px; }
.panel-heading { display: flex; min-height: 43px; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 11px; border-bottom: 1px solid #27343a; }
.panel-title-wrap { min-width: 0; }
.section-eyebrow { display: block; color: #819087; font-size: 7px; }
.panel-heading h2 { display: flex; align-items: center; gap: 7px; margin: 2px 0 0; color: #e1e9e3; font-size: 12px; font-weight: 620; letter-spacing: -.015em; line-height: 1.2; }
.count-tag { display: inline-grid; min-width: 17px; height: 17px; place-items: center; border: 1px solid #34433a; border-radius: 5px; background: #1a241d; color: #c5d6b5; font-family: ui-monospace, monospace; font-size: 8px; font-weight: 600; }
.search-field { display: flex; width: 138px; height: 27px; align-items: center; gap: 6px; padding: 0 7px; border: 1px solid #334149; border-radius: 6px; background: #0c1316; color: #819087; }
.search-field svg { width: 13px; height: 13px; flex: 0 0 auto; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font-size: 9px; }
.search-field input::placeholder { color: #718078; }
.search-field:focus-within { border-color: #8ebc5c; }
.table-wrap { overflow-x: auto; scrollbar-width: thin; scrollbar-color: #34443c transparent; }
.account-table { width: 100%; border-collapse: collapse; text-align: left; }
.account-table thead { background: #11191d; }
.account-table th { height: 28px; padding: 0 8px; border-bottom: 1px solid #27343a; color: #829088; font-size: 7px; font-weight: 760; letter-spacing: .08em; white-space: nowrap; }
.account-table th:first-child, .account-table td:first-child { padding-left: 11px; }
.account-table th:last-child, .account-table td:last-child { padding-right: 11px; }
.account-table td { height: 46px; padding: 5px 8px; border-bottom: 1px solid #222f34; color: #c0cbc4; font-size: 9px; vertical-align: middle; }
.account-table tbody tr:last-child td { border-bottom: 0; }
.account-table tbody tr:hover { background: #151f22; }
.number-cell { text-align: right; }
.account-name { display: flex; min-width: 128px; align-items: center; gap: 7px; }
.account-mark { display: grid; width: 25px; height: 25px; flex: 0 0 auto; place-items: center; border: 1px solid #34443a; border-radius: 6px; background: #19231c; color: var(--accent); }
.account-mark svg { width: 14px; height: 14px; }
.account-name-copy { display: grid; min-width: 0; gap: 1px; }
.account-name-copy strong { overflow: hidden; color: #e1e9e3; font-size: 9px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.account-name-copy span { color: #829087; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 7px; }
.login-value, .docker-id, .balance-value { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.server-value { display: inline-block; max-width: 185px; overflow: hidden; color: #d0d9d2 !important; text-overflow: ellipsis; white-space: nowrap; }
.docker-id { color: #8f9c94 !important; font-size: 8px !important; }
.balance-value { color: #e7eee8 !important; font-size: 9px !important; text-align: right; }
.status-pill { display: inline-flex; min-height: 19px; align-items: center; gap: 5px; padding: 0 6px; border: 1px solid #35423b; border-radius: 5px; background: #18201c; color: #c0c9bf; font-size: 8px; font-weight: 650; white-space: nowrap; }
.status-pill::before { width: 5px; height: 5px; border-radius: 50%; background: #9ca69e; content: ""; }
.status-pill.connected { border-color: #2e4b39; background: #15251b; color: #91e1aa; }
.status-pill.connected::before { background: var(--green); }
.status-pill.connecting, .status-pill.starting, .status-pill.preparing { border-color: #4a4230; background: #242219; color: #e5ca80; }
.status-pill.connecting::before, .status-pill.starting::before, .status-pill.preparing::before { background: var(--amber); }
.status-pill.disconnected, .status-pill.error { border-color: #533737; background: #291d1e; color: #f0a1a1; }
.status-pill.disconnected::before, .status-pill.error::before { background: var(--red); }
.empty-table-cell { height: 50px !important; color: #87948d !important; font-size: 9px !important; text-align: center; }
.account-panel-footer { display: flex; min-height: 28px; align-items: center; justify-content: space-between; padding: 0 11px; border-top: 1px solid #243137; color: #829087; font-size: 8px; }
.live-dot { display: inline-block; width: 5px; height: 5px; margin-right: 5px; vertical-align: 1px; }

.control-stack { display: grid; gap: 9px; }
.compact-panel .panel-heading { min-height: 40px; }
.readonly-badge { min-height: 19px; padding: 0 6px; border-color: #3d4438; background: #1b2019; color: #c7cbb9; font-size: 7px; }
.readonly-badge i { width: 5px; height: 5px; border-radius: 50%; background: var(--amber); }
.pending-tag { min-height: 19px; border-color: #4a4230; background: #242219; color: #e7cd8c; font-size: 7px; letter-spacing: 0; }
.panel-caption { color: #7e8d85; font-size: 8px; white-space: nowrap; }
.main-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; color: #75837b; font-size: 8px; }

/* Account form stays tucked away until requested. */
.add-account-panel { margin: 0 8px 9px; padding: 0 9px 9px; border: 1px solid #2b3b3b; border-radius: 7px; background: #0e1518; }
.add-account-heading { display: flex; min-height: 35px; align-items: center; justify-content: space-between; border-bottom: 1px solid #27343a; }
.add-account-heading h3 { margin: 2px 0 0; color: #e0e9e2; font-size: 11px; font-weight: 620; }
.close-button { display: grid; width: 26px; height: 26px; place-items: center; border: 0; border-radius: 5px; background: transparent; color: #a1ada5; cursor: pointer; font-size: 19px; }
.close-button:hover { background: #202a2d; color: var(--text); }
.connect-form { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(150px, 1.15fr) minmax(130px, 1.15fr) auto; align-items: end; gap: 8px; padding-top: 8px; }
.form-field { display: grid; min-width: 0; gap: 4px; }
.form-field label { color: #b8c5bd; font-size: 8px; font-weight: 620; }
.form-field input { width: 100%; min-width: 0; height: 31px; padding: 0 8px; border: 1px solid #334249; border-radius: 5px; background: #0a1114; color: var(--text); font-size: 10px; }
.form-field input::placeholder { color: #66746d; }
.form-field input:focus { border-color: #8eb95b; outline: none; box-shadow: 0 0 0 2px rgb(173 221 106 / 9%); }
.form-field input[aria-invalid="true"] { border-color: var(--red); }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 51px; }
.input-action { position: absolute; top: 3px; right: 3px; min-width: 43px; height: 25px; padding: 0 4px; border: 0; border-radius: 4px; background: transparent; color: #adc68f; cursor: pointer; font-size: 8px; }
.input-action:hover { background: #1d2920; }
.field-hint, .field-error { color: #819087; font-size: 7px; line-height: 1.3; }
.field-error { color: #f09696; }
.form-error { grid-column: 1 / -1; padding: 7px 9px; border: 1px solid #543839; border-radius: 5px; background: #281c1e; color: #ffc7c0; font-size: 9px; }
.connect-form > .button { min-height: 31px; white-space: nowrap; }
.toast-region { position: fixed; z-index: 100; right: 15px; bottom: 15px; display: grid; width: min(330px, calc(100vw - 26px)); gap: 7px; }
.toast { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #34523b; border-radius: 7px; background: #15231a; box-shadow: var(--shadow); color: #d7ebd7; font-size: 10px; }
.toast > span:first-child { color: var(--green); font-weight: 800; }
.toast.error { border-color: #643c3c; background: #291c1d; color: #ffd0cb; }
.toast.error > span:first-child { color: var(--red); }

@media (max-width: 1050px) {
  .account-table th, .account-table td { padding-right: 6px; padding-left: 6px; }
  .account-table th:first-child, .account-table td:first-child { padding-left: 8px; }
  .account-table th:last-child, .account-table td:last-child { padding-right: 8px; }
  .account-name { min-width: 110px; }
  .server-value { max-width: 130px; }
}

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; min-height: 45px; gap: 5px 12px; padding-top: 5px; padding-bottom: 5px; }
  .topbar-actions { margin-left: auto; }
  .workspace { padding: 11px 13px 12px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .control-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

@media (max-width: 600px) {
  body { font-size: 12px; }
  .topbar { padding-right: 10px; padding-left: 10px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-mark svg { width: 25px; height: 25px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { font-size: 7px; }
  .mode-tag { min-height: 20px; font-size: 7px; }
  .topbar-live { display: none; }
  .login-shortcut { font-size: 9px; }
  .workspace { padding: 9px 10px 12px; }
  .page-heading { min-height: 39px; gap: 8px; margin-bottom: 7px; }
  .page-heading h1 { font-size: 18px; }
  .heading-actions { gap: 8px; }
  .updated-label { display: none; }
  .button-compact { min-height: 30px; padding: 0 8px; font-size: 9px; }
  .runtime-banner { min-height: 35px; gap: 7px; padding: 0 8px; }
  .runtime-banner > strong, .runtime-banner > span:nth-of-type(2) { font-size: 8px; }
  .runtime-banner > span:nth-of-type(2) { max-width: 48vw; }
  .runtime-state { font-size: 7px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 7px; }
  .metric-card { min-height: 61px; gap: 1px 5px; padding: 6px 8px; }
  .metric-label { font-size: 8px; }
  .metric-value { font-size: 15px; }
  .metric-note { font-size: 7px; }
  .overview-balance-meta { gap: 5px; }
  .overview-range-control > span { display: none; }
  .overview-range-control select { min-width: 116px; }
  .overview-balance-summary { gap: 10px; padding-right: 8px; padding-left: 8px; }
  .overview-balance-summary strong { max-width: 32vw; font-size: 10px; }
  .overview-period-label { display: none; }
  .overview-custom-range input { width: min(128px, calc(50vw - 45px)); }
  .overview-balance-chart-wrap { padding: 1px 6px 7px; }
  .overview-balance-chart-wrap svg { height: 150px; }
  .overview-balance-legend { gap: 11px; padding-right: 8px; padding-left: 8px; font-size: 8px; }
  .overview-balance-axis { padding-left: 75px; font-size: 7px; }
  .overview-balance-note { margin-left: 75px; font-size: 7px; }
  .dashboard-grid, .control-stack { gap: 7px; }
  .control-stack { grid-template-columns: 1fr; }
  .panel-heading { min-height: 37px; padding: 6px 8px; }
  .panel-heading h2 { font-size: 11px; }
  .search-field { width: 100px; height: 25px; }
  .search-field input { font-size: 9px; }
  .account-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .account-table, .account-table tbody { display: block; width: 100%; }
  .account-table tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 9px; padding: 7px 9px; border-bottom: 1px solid #222f34; }
  .account-table td, .account-table td:first-child, .account-table td:last-child { display: block; width: auto; height: auto; min-width: 0; padding: 4px 0; border: 0; font-size: 9px; text-align: left; }
  .account-table td[data-label]::before { display: block; margin-bottom: 2px; color: #7f8d85; content: attr(data-label); font-family: Inter, "Segoe UI", sans-serif; font-size: 7px; font-weight: 700; letter-spacing: .07em; }
  .account-table td:first-child { grid-column: 1 / -1; padding-bottom: 5px; }
  .account-table td:first-child::before { display: none; }
  .account-table td.number-cell, .account-table td.balance-value { text-align: left; }
  .account-table td.empty-table-cell { grid-column: 1 / -1; text-align: center; }
  .account-name { min-width: 0; }
  .account-name-copy strong { max-width: 68vw; }
  .account-panel-footer { min-height: 25px; padding: 0 8px; font-size: 7px; }
  .main-footer { margin-top: 7px; font-size: 7px; }
  .connect-form { grid-template-columns: 1fr 1fr; gap: 7px; }
  .connect-form > .button, .form-error { grid-column: 1 / -1; }
  .form-field input { height: 34px; font-size: 14px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-main { min-height: 100dvh; justify-content: flex-start; padding: max(18px, env(safe-area-inset-top)) 14px 16px; }
  .login-mobile-brand { display: inline-flex; margin-bottom: 24px; }
  .login-card { padding: 21px 18px; }
  .login-card h2 { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


