:root {
  color-scheme: light;
  --canvas: #f6f7f5;
  --canvas-warm: #f9f6ee;
  --surface: #ffffff;
  --surface-inset: #f0f2ef;
  --surface-hover: #edf3ef;
  --ink: #17221c;
  --ink-secondary: #46534c;
  --ink-tertiary: #68756e;
  --ink-muted: #89938d;
  --line: rgba(23, 34, 28, 0.10);
  --line-soft: rgba(23, 34, 28, 0.06);
  --accent: #1f6a4d;
  --accent-strong: #165039;
  --accent-soft: #e3f0e9;
  --success: #23704f;
  --success-soft: #e4f3eb;
  --warning: #8a5c16;
  --warning-soft: #f8edda;
  --danger: #a4413c;
  --danger-soft: #f8e7e5;
  --radius-control: 10px;
  --radius-panel: 14px;
  --radius-dialog: 18px;
  --shadow-panel: 0 0 0 1px rgba(23, 34, 28, 0.05), 0 1px 2px rgba(23, 34, 28, 0.03), 0 8px 24px rgba(23, 34, 28, 0.04);
  --shadow-dialog: 0 24px 80px rgba(16, 28, 21, 0.20);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --motion-fast: 150ms;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; max-width: 100%; overflow-x: hidden; color: var(--ink); background: var(--canvas); font-family: "Aptos", "Segoe UI Variable", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { border: 0; }
button:not(:disabled), select:not(:disabled), input[type="checkbox"] { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -.025em; }
p { text-wrap: pretty; }
code, .metric strong, .badge, .pager { font-variant-numeric: tabular-nums; }
code { font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; font-size: 12px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.muted { color: var(--ink-tertiary); }

:focus-visible { outline: 3px solid rgba(31, 106, 77, .24); outline-offset: 2px; }
::selection { color: var(--ink); background: #cfe5d8; }

.boot-view { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--ink-secondary); }
.public-view, .admin-view, .login-view { display: none; }
.public-view.visible { display: flex; }
.admin-view.visible { display: flex; }
.login-view.visible { display: grid; }

.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: #fff; background: var(--accent); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 5px 14px rgba(31,106,77,.16); font-size: 12px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark.large { width: 54px; height: 54px; border-radius: 17px; font-size: 15px; }
.eyebrow { color: var(--ink-tertiary); font-size: 10px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.primary-button, .secondary-button, .danger-button, .text-button, .icon-button, .header-link {
  min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius-control); padding: 0 14px; font-weight: 680; line-height: 1; text-decoration: none;
  transition: transform var(--motion-fast) var(--ease-out), opacity var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}
.primary-button { color: #fff; background: var(--accent); box-shadow: 0 1px 2px rgba(20,70,49,.18); }
.primary-button:hover { background: var(--accent-strong); transform: translateY(-1px); }
.secondary-button { color: var(--ink-secondary); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.secondary-button:hover { color: var(--ink); background: var(--surface-hover); }
.danger-button { color: var(--danger); background: var(--danger-soft); box-shadow: inset 0 0 0 1px rgba(164,65,60,.10); }
'.danger-button:hover { background: #f4d9d7; }
.success-button { color: var(--success); background: var(--success-soft); box-shadow: inset 0 0 0 1px rgba(35,112,79,.12); }
.success-button:hover { background: #d8eee3; }
.text-button { min-height: 40px; color: var(--ink-tertiary); background: transparent; }
.text-button:hover { color: var(--ink); background: var(--surface-inset); }
.icon-button { width: 40px; min-width: 40px; padding: 0; color: var(--ink-secondary); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 20px; }
.icon-button:hover { background: var(--surface-hover); transform: rotate(14deg); }
.compact { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 12px; }
.full { width: 100%; }
button:active, .header-link:active { transform: scale(.97); }

label { display: grid; gap: 6px; color: var(--ink-secondary); font-size: 12px; font-weight: 650; }
input, textarea, select {
  min-width: 0;
  width: 100%; min-height: 38px; border: 1px solid transparent; border-radius: var(--radius-control); padding: 8px 11px; color: var(--ink); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--line-soft); outline: none;
  transition: background-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}
textarea { min-height: 112px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
input:focus, textarea:focus, select:focus { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px rgba(31,106,77,.12); }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); box-shadow: none; }
.check-label { grid-template-columns: 18px 1fr; align-items: center; align-self: end; min-height: 38px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.field-grid .full { grid-column: 1 / -1; }
.stack-form { display: grid; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.session-actions, .result-actions { align-items: center; }
.result-actions .primary-button, .result-actions .secondary-button { min-width: 118px; }
.usage-history { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.usage-history-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.usage-history-head .eyebrow { margin: 0 0 3px; }
.usage-history-head h3 { margin: 0; font-size: 16px; line-height: 1.25; }
.usage-history-count { color: var(--ink-tertiary); font-size: 11px; white-space: nowrap; }
.usage-table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); }
.usage-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.usage-table th, .usage-table td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.usage-table th { color: var(--ink-tertiary); background: var(--surface-inset); font-size: 11px; font-weight: 600; }
.usage-table tr:last-child td { border-bottom: 0; }
.usage-table th:nth-child(1), .usage-table td:nth-child(1) { width: 30%; }
.usage-table th:nth-child(2), .usage-table td:nth-child(2) { width: 25%; }
.usage-table th:nth-child(3), .usage-table td:nth-child(3) { width: 16%; }
.usage-table th:nth-child(4), .usage-table td:nth-child(4) { width: 29%; }
.usage-run-id { display: inline-block; max-width: 100%; color: var(--ink-secondary); font-size: 11px; white-space: normal; word-break: break-all; }
.form-error { min-height: 20px; color: var(--danger); font-size: 12px; }
.field-help { margin: -8px 0 0; color: var(--ink-tertiary); font-size: 12px; line-height: 1.45; }
.inline-field-help { color: var(--ink-tertiary); font-size: 11px; font-weight: 400; line-height: 1.4; }
.danger-text { color: var(--danger); }

.panel { border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-panel); }
.notice { margin-top: 14px; padding: 12px 14px; border-radius: 12px; color: var(--ink-secondary); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--line-soft); }
.empty { min-height: 220px; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 28px; text-align: center; }
.empty span { color: var(--ink-tertiary); }
.loading-panel { min-height: 220px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink-tertiary); }

.public-view { min-height: 100dvh; flex-direction: column; background: radial-gradient(circle at 20% 0%, #edf3ec 0, transparent 38%), var(--canvas-warm); }
.public-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; width: min(1100px, calc(100% - 40px)); max-width: 100%; margin: 0 auto; }
.public-brand { min-width: 0; display: flex; align-items: center; gap: 12px; }
.public-header h1 { margin-top: 1px; font-size: 18px; font-weight: 720; }
.public-brand-subtitle { display: block; margin-top: 2px; color: var(--ink-tertiary); font-size: 11px; font-weight: 600; }
.header-link { color: var(--accent); background: rgba(255,255,255,.66); box-shadow: inset 0 0 0 1px var(--line); backdrop-filter: blur(12px); }
.public-content { width: min(1100px, calc(100% - 40px)); margin: auto; padding: 48px 0 72px; }
.public-footer { padding: 20px; color: var(--ink-tertiary); font-size: 11px; text-align: center; }
.not-found-view { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--canvas-warm); }
.not-found-card { width: min(520px, 100%); display: grid; justify-items: start; gap: 14px; margin: auto; padding: 36px; }
.not-found-card h1, .not-found-card h2 { margin: 0; font-size: 28px; text-wrap: balance; }
.not-found-card p { text-wrap: pretty; }
.exchange-layout { display: grid; grid-template-columns: minmax(0,.85fr) minmax(440px,1fr); align-items: center; gap: clamp(40px,8vw,100px); }
.exchange-layout > *, .exchange-card, .stack-form { min-width: 0; }
.exchange-intro { max-width: 460px; }
.exchange-intro h2 { margin: 10px 0 14px; font-size: clamp(32px,4vw,48px); line-height: 1.08; font-weight: 690; }
.exchange-intro > p:last-of-type { color: var(--ink-secondary); font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.trust-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.trust-list span { padding: 6px 9px; border-radius: 8px; color: var(--ink-secondary); background: rgba(255,255,255,.58); box-shadow: inset 0 0 0 1px var(--line-soft); font-size: 11px; }
.exchange-card { padding: 20px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 0 0 24px; padding: 0; color: var(--ink-muted); font-size: 11px; }
.steps li { display: flex; align-items: center; gap: 7px; }
.steps li::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps span { width: 23px; height: 23px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--surface-inset); font-weight: 750; }
.steps .active { color: var(--accent); }
.steps .active span { color: #fff; background: var(--accent); }
.result-card { max-width: 620px; margin: auto; padding: 28px; text-align: center; }
.result-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 28px auto 16px; border-radius: 18px; color: var(--success); background: var(--success-soft); font-size: 26px; font-weight: 800; }
.result-card h2 { margin: 8px 0; font-size: 26px; }
.result-card .primary-button { margin-top: 22px; }
.result-actions .primary-button { margin-top: 0; }
.maintenance { max-width: 620px; margin: auto; padding: 50px 28px; text-align: center; }
.maintenance .brand-mark { margin: 0 auto 20px; }
.maintenance h2 { margin: 8px 0; font-size: 26px; }

.admin-view { min-height: 100dvh; }
.sidebar { position: sticky; top: 0; width: 224px; height: 100dvh; flex: 0 0 224px; display: flex; flex-direction: column; gap: 22px; padding: 20px 14px 16px; border-right: 1px solid var(--line); background: var(--canvas); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 13px; }
.sidebar-brand span { margin-top: 1px; color: var(--ink-tertiary); font-size: 11px; }
#admin-nav { display: grid; gap: 3px; }
#admin-nav button { min-height: 38px; padding: 0 11px; border-radius: var(--radius-control); color: var(--ink-secondary); background: transparent; text-align: left; font-weight: 600; transition: transform var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out); }
#admin-nav button:hover { color: var(--ink); background: var(--surface-inset); transform: translateX(2px); }
#admin-nav button.active { color: var(--accent-strong); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar-bottom .text-button { width: 100%; justify-content: flex-start; }
.admin-main { min-width: 0; flex: 1; }
.admin-topbar { position: sticky; top: 0; z-index: 5; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: rgba(246,247,245,.88); backdrop-filter: blur(14px); }
.admin-topbar h1 { margin-top: 1px; font-size: 20px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.admin-content { width: min(1480px,100%); padding: 22px 24px 48px; }
.page-head { min-height: 58px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.page-head h2 { margin: 3px 0 2px; font-size: 22px; font-weight: 690; }
.page-head p:not(.eyebrow) { color: var(--ink-tertiary); font-size: 12px; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 9px; color: var(--success); background: var(--success-soft); font-size: 11px; font-weight: 700; }
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(35,112,79,.12); }
.metric-strip { display: grid; grid-template-columns: repeat(8,minmax(90px,1fr)); margin-bottom: 16px; overflow: hidden; border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-panel); }
.metric { min-height: 92px; display: grid; align-content: center; gap: 3px; padding: 14px; border-right: 1px solid var(--line-soft); }
.metric:last-child { border: 0; }
.metric span { color: var(--ink-tertiary); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.metric strong { font-size: 24px; font-weight: 660; letter-spacing: -.04em; }
.metric small { color: var(--ink-tertiary); font-size: 9px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric.featured { background: var(--accent-soft); }
.metric.success strong { color: var(--success); }
.metric.warn strong { color: var(--warning); }
.operational-note { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; }
.operational-note p { margin-top: 3px; color: var(--ink-tertiary); font-size: 12px; }

.table-shell { overflow: hidden; border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-panel); }
.table-shell > table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { color: var(--ink-tertiary); background: #fbfcfb; font-size: 10px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
td { color: var(--ink-secondary); font-size: 12px; }
td strong, td small { display: block; }
td strong { color: var(--ink); font-weight: 660; }
td small { margin-top: 2px; color: var(--ink-muted); font-size: 10px; }
tbody tr { transition: background-color var(--motion-fast) var(--ease-out); }
tbody tr:hover { background: #fafcfb; }
tbody tr:last-child td { border-bottom: 0; }
.actions-col { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; flex-wrap: nowrap; gap: 5px; white-space: nowrap; }
.row-actions button[data-action="card-copy"], .bulk-toolbar button[data-action="bulk-copy"] { min-width: 72px; }
.actions-col, td:last-child { min-width: 218px; }
.secret-code { color: var(--ink); white-space: nowrap; }
.check-col { width: 42px; text-align: center; }
.checkbox-hit { position: relative; width: 40px; height: 40px; display: grid; place-items: center; margin: -9px auto; cursor: pointer; }
.checkbox-hit input { position: absolute; width: 20px; height: 20px; margin: 0; opacity: 0; }
.checkbox-hit span { width: 18px; height: 18px; border-radius: 6px; background: var(--surface); box-shadow: inset 0 0 0 1px rgba(23,34,28,.22); transition: transform var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out); }
.checkbox-hit input:checked + span { background: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.checkbox-hit input:checked + span::after { content: ""; display: block; width: 8px; height: 4px; margin: 5px 0 0 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg); }
.checkbox-hit input:indeterminate + span { background: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.checkbox-hit input:indeterminate + span::after { content: ""; display: block; width: 8px; height: 2px; margin: 8px 0 0 5px; background: #fff; }
.checkbox-hit input:focus-visible + span { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px rgba(31,106,77,.18); }
.empty-row { padding: 32px; color: var(--ink-muted); text-align: center; }
.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 8px; border-radius: 7px; color: var(--ink-secondary); background: var(--surface-inset); font-size: 10px; font-weight: 750; }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.warn { color: var(--warning); background: var(--warning-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.pager { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 12px; border-top: 1px solid var(--line-soft); color: var(--ink-tertiary); font-size: 11px; }
.pager.single { justify-content: flex-start; }
.pager-actions { display: flex; align-items: center; gap: 7px; }
.pager-actions label { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.pager-actions select { width: 70px; min-height: 32px; padding: 4px 8px; }
.filter-bar, .bulk-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.filter-bar { color: var(--ink-tertiary); font-size: 11px; }
.filter-bar label { display: flex; align-items: center; gap: 8px; }
.filter-bar .search-field { flex: 1; min-width: 220px; display: grid; grid-template-columns: auto minmax(160px, 1fr); align-items: center; gap: 8px; }
.filter-bar .search-label { color: var(--ink-secondary); font-size: 11px; white-space: nowrap; }
.filter-bar .search-field input { width: 100%; min-height: 34px; }
.filter-bar .list-toolbar { gap: 10px; }
.filter-bar .list-toolbar .search-field { flex: 1; }
.filter-bar select { width: 138px; min-height: 34px; }
.bulk-toolbar { position: sticky; top: 80px; z-index: 4; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.bulk-toolbar strong { font-size: 12px; }
.bulk-toolbar > div { display: flex; flex-wrap: wrap; gap: 6px; }

.settings-panel { display: grid; gap: 0; max-width: 820px; padding: 6px 18px 18px; }
.switch-row { min-height: 72px; grid-template-columns: 1fr auto; align-items: center; gap: 18px; border-bottom: 1px solid var(--line-soft); }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { color: var(--ink); font-size: 13px; }
.switch-row small { margin-top: 3px; color: var(--ink-tertiary); font-weight: 400; }
.switch-row input { width: 20px; height: 20px; }
.screenshot-switch input { appearance: none; position: relative; width: 40px; height: 24px; min-height: 24px; padding: 0; border: 0; border-radius: 12px; cursor: pointer; background: var(--line); box-shadow: none; }
.screenshot-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); }
.screenshot-switch input:checked { background: var(--accent); }
.screenshot-switch input:checked::after { transform: translateX(16px); }
.screenshot-switch input:focus-visible { outline: 3px solid rgba(31, 106, 77, .24); outline-offset: 3px; }
.settings-panel > label:not(.switch-row) { margin-top: 16px; }

.modal { width: min(600px,calc(100% - 28px)); max-height: min(760px,calc(100dvh - 32px)); padding: 0; border: 0; border-radius: var(--radius-dialog); color: var(--ink); background: transparent; box-shadow: var(--shadow-dialog); overflow: hidden; }
.modal-wide { width: min(860px,calc(100% - 28px)); max-height: min(860px,calc(100dvh - 32px)); }
.modal::backdrop { background: rgba(13,24,18,.42); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in 180ms var(--ease-out); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-card { display: grid; max-height: inherit; background: var(--surface); }
.modal-card header, .modal-card footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.modal-card header { border-bottom: 1px solid var(--line-soft); }
.modal-card header h2 { margin-top: 2px; font-size: 18px; }
.modal-card footer { justify-content: flex-end; border-top: 1px solid var(--line-soft); }
.modal-body { padding: 18px; overflow: auto; }
.dialog-message { color: var(--ink-secondary); }
.dialog-tools { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.code-block { min-height: 240px; max-height: 520px; margin: 0; overflow: auto; padding: 16px; border-radius: 12px; color: var(--ink); background: var(--surface-inset); font: 13px/1.72 "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }
.log-view { min-height: 280px; }
.logs-table { min-width: 900px; }
.logs-table .actions-col, .logs-table td:last-child { min-width: 116px; text-align: right; }
.logs-task-cell code { overflow-wrap: anywhere; }
.task-log-dialog { width: min(1120px,calc(100% - 28px)); height: min(860px,calc(100dvh - 32px)); max-height: none; }
body.task-log-modal-open { overflow: hidden; }
.task-log-dialog .modal-card { height: 100%; grid-template-rows: auto minmax(0,1fr) auto; }
.task-log-dialog .modal-card header > div { min-width: 0; }
.task-log-dialog .modal-card header h2 { overflow-wrap: anywhere; }
.task-log-dialog .modal-card header > button { flex-shrink: 0; }
.task-log-dialog .modal-body { min-height: 0; min-width: 0; display: grid; grid-template-rows: auto auto minmax(0,1fr); gap: 12px; overflow: hidden; padding: 14px 16px; }
.task-log-summary { display: grid; grid-template-columns: minmax(0,1.6fr) repeat(3,minmax(0,1fr)); overflow: hidden; border-radius: 12px; background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--line-soft); }
.task-log-summary-item { min-width: 0; display: grid; align-content: center; gap: 5px; min-height: 68px; padding: 10px 12px; border-right: 1px solid var(--line-soft); }
.task-log-summary-item:last-child { border-right: 0; }
.task-log-summary-item > span { color: var(--ink-tertiary); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.task-log-summary-item > strong { min-width: 0; color: var(--ink); font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.task-log-summary-item > small { min-width: 0; color: var(--ink-tertiary); font-size: 10px; overflow-wrap: anywhere; }
.task-log-summary-item .badge { margin: 1px 3px 1px 0; }
.task-log-identity code { font-size: 11px; }
.task-log-identity > strong, .task-log-identity > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-log-details { border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.task-log-details summary { min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--ink-secondary); cursor: pointer; font-size: 12px; font-weight: 680; }
.task-log-details summary::marker { color: var(--accent); }
.task-log-details summary small { color: var(--ink-tertiary); font-size: 10px; font-weight: 400; }
.task-log-details .detail-list { max-height: 170px; overflow: auto; padding: 0 12px 8px; scrollbar-gutter: stable; }
.task-log-details .detail-list > div { grid-template-columns: 104px minmax(0,1fr); padding: 7px 0; font-size: 11px; }
.task-log-workspace { min-height: 0; min-width: 0; display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.task-log-toolbar { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px; border-bottom: 1px solid var(--line-soft); }
.task-log-tabs { min-width: 0; display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.task-log-tabs button { min-height: 32px; flex: 0 0 auto; padding: 0 10px; border-radius: 8px; color: var(--ink-tertiary); background: transparent; font-size: 11px; font-weight: 680; }
.task-log-tabs button:hover { color: var(--ink); background: var(--surface-inset); }
.task-log-tabs button[aria-selected="true"] { color: var(--accent-strong); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(31,106,77,.10); }
.task-log-panes, .task-log-pane { min-width: 0; min-height: 0; height: 100%; }
.task-log-dialog .log-view { width: 100%; height: 100%; min-height: 0; max-height: none; overflow: auto; border-radius: 0; scrollbar-gutter: stable; scrollbar-color: var(--ink-tertiary) var(--surface-inset); }
.task-log-dialog .log-view::-webkit-scrollbar { width: 12px; height: 12px; }
.task-log-dialog .log-view::-webkit-scrollbar-track { background: var(--surface-inset); }
.task-log-dialog .log-view::-webkit-scrollbar-thumb { background: var(--ink-tertiary); border: 3px solid var(--surface-inset); border-radius: 8px; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--ink-tertiary); }
.detail-list dd { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.detail-list.result { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.clipboard-helper { position: fixed; inset: auto auto 0 -9999px; opacity: 0; }

.login-view { min-height: 100dvh; place-content: center; padding: 24px; background: radial-gradient(circle at 50% -20%, #dcece2 0, transparent 48%), var(--canvas-warm); }
.login-card { width: min(390px,100%); display: grid; gap: 12px; padding: 24px; border-radius: var(--radius-dialog); background: var(--surface); box-shadow: var(--shadow-panel); }
.login-card .brand-mark { margin-bottom: 4px; }
.login-card h1 { font-size: 25px; }
.login-card > p.muted { margin-bottom: 6px; font-size: 12px; }

@media (max-width: 1180px) {
  .metric-strip { grid-template-columns: repeat(4,1fr); }
  .metric:nth-child(4) { border-right: 0; }
  .metric:nth-child(-n+4) { border-bottom: 1px solid var(--line-soft); }
}

@media (max-width: 820px) {
  .exchange-layout { grid-template-columns: 1fr; gap: 28px; }
  .exchange-intro { max-width: 620px; }
  .exchange-intro h2 { font-size: 34px; }
  .admin-view.visible { display: block; }
  .sidebar { position: sticky; z-index: 8; width: 100%; height: auto; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); overflow: hidden; }
  .sidebar-brand { display: none; }
  #admin-nav { display: flex; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
  #admin-nav button { flex: 0 0 auto; min-height: 40px; }
  #admin-nav button.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .sidebar-bottom { display: none; }
  .admin-main, .admin-topbar { width: 100%; max-width: 100%; }
  .admin-topbar { top: 61px; }
  .bulk-toolbar { top: 139px; }
  .admin-content { padding: 18px 14px 40px; }
  .table-shell { overflow-x: auto; }
  .table-shell th:first-child, .table-shell td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); }
  .table-shell th:nth-child(2), .table-shell td:nth-child(2) { position: sticky; left: 42px; z-index: 2; background: var(--surface); box-shadow: 7px 0 10px -10px rgba(23,34,28,.45); }
  .logs-table-shell { overflow: visible; border-radius: 0; background: transparent; box-shadow: none; }
  .logs-table-shell .logs-table, .logs-table-shell .logs-table tbody { display: block; width: 100%; min-width: 0; }
  .logs-table-shell .logs-table thead { display: none; }
  .logs-table-shell .logs-table tbody { display: grid; gap: 10px; }
  .logs-table-shell .logs-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 14px; padding: 12px 14px; border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-panel); }
  .logs-table-shell .logs-table td { min-width: 0; display: block; padding: 7px 0; border: 0; }
  .logs-table-shell .logs-table td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--ink-tertiary); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
  .logs-table-shell .logs-table th:first-child, .logs-table-shell .logs-table td:first-child,
  .logs-table-shell .logs-table th:nth-child(2), .logs-table-shell .logs-table td:nth-child(2) { position: static; left: auto; z-index: auto; background: transparent; box-shadow: none; }
  .logs-table-shell .logs-table .logs-task-cell, .logs-table-shell .logs-table .logs-action-cell { grid-column: 1 / -1; }
  .logs-table-shell .logs-table .logs-task-cell { padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
  .logs-table-shell .logs-table .logs-action-cell { padding-top: 10px; text-align: left; }
  .logs-table-shell .logs-table .logs-action-cell button { width: 100%; }
  .logs-table-shell .logs-table td[colspan] { grid-column: 1 / -1; padding: 24px 8px; }
  .logs-table-shell .logs-table td[colspan]::before { content: none; }
  .logs-table-shell > .pager { margin-top: 10px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-panel); }
}

@media (max-width: 600px) {
  .public-header { width: calc(100% - 28px); min-height: 68px; }
  .public-content { width: calc(100% - 28px); padding: 30px 0 52px; }
  .public-header h1 { font-size: 16px; }
  .header-link { min-height: 40px; padding: 0 11px; font-size: 12px; }
  .exchange-intro h2 { font-size: 29px; }
  .exchange-card { padding: 16px; }
  .usage-history-head { align-items: center; }
  .usage-table { table-layout: auto; }
  .usage-table thead { display: none; }
  .usage-table, .usage-table tbody, .usage-table tr, .usage-table td { display: block; width: 100%; }
  .usage-table tr { padding: 9px 11px; border-bottom: 1px solid var(--line-soft); }
  .usage-table tr:last-child { border-bottom: 0; }
  .usage-table td { display: block; padding: 5px 0; border: 0; }
  .usage-table td::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--ink-tertiary); font-size: 11px; font-weight: 600; }
  .usage-table td[colspan="4"] { display: block; padding: 8px 0; }
  .usage-table td[colspan="4"]::before { content: none; }
  .steps { gap: 4px; font-size: 0; }
  .steps li { gap: 4px; }
  .steps span { font-size: 11px; }
  .admin-topbar { padding: 10px 14px; }
  .admin-topbar .topbar-actions { position: absolute; right: 14px; }
  #admin-user { display: none; }
  .page-head { min-height: 0; align-items: stretch; flex-direction: column; gap: 12px; }
  .page-head > button { align-self: flex-start; }
  .page-head h2 { font-size: 20px; }
  .metric-strip { grid-template-columns: repeat(2,1fr); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-child(-n+6) { border-bottom: 1px solid var(--line-soft); }
  .filter-bar, .bulk-toolbar { align-items: flex-start; flex-direction: column; }
  .bulk-toolbar { position: static; }
  .pager { align-items: flex-start; flex-direction: column; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .full { grid-column: auto; }
  .modal-card footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-wide { width: calc(100% - 20px); }
  .task-log-dialog { width: calc(100% - 20px); height: calc(100dvh - 20px); }
  .task-log-dialog .modal-body { gap: 9px; padding: 10px; }
  .task-log-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .task-log-summary-item { min-height: 58px; padding: 8px 10px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
  .task-log-summary-item:nth-child(3) { border-right: 0; }
  .task-log-summary-item:nth-child(4) { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .task-log-identity { grid-column: 1 / -1; border-right: 0; }
  .task-log-toolbar { align-items: stretch; flex-wrap: wrap; gap: 7px; }
  .task-log-tabs { width: 100%; }
  .task-log-tabs button { min-width: 0; min-height: 36px; flex: 1 1 0; padding: 0 5px; white-space: nowrap; }
  .task-log-toolbar > .secondary-button { margin-left: auto; }
  .task-log-details summary small { display: none; }
  .code-block { min-height: 220px; max-height: 440px; padding: 13px; font-size: 13px; }
  .primary-button, .secondary-button, .danger-button, .header-link { min-height: 44px; }
  .compact { min-height: 40px; }
}

@media (max-height: 520px) {
  .task-log-dialog .modal-card header, .task-log-dialog .modal-card footer { padding-top: 8px; padding-bottom: 8px; }
  .task-log-dialog .modal-body { gap: 6px; padding: 6px 12px; }
  .task-log-summary { height: 44px; }
  .task-log-summary-item { height: 44px; min-height: 44px; overflow: hidden; padding: 5px 9px; }
  .task-log-summary-item > span { font-size: 9px; }
  .task-log-summary-item > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .task-log-summary-item > small { display: none; }
  .task-log-details summary { min-height: 30px; padding: 4px 10px; }
  .task-log-details summary small { display: none; }
  .task-log-details .detail-list { max-height: 50px; }
  .task-log-toolbar { gap: 7px; padding: 4px 6px; }
  .task-log-tabs button { min-height: 30px; padding: 0 8px; }
  .task-log-toolbar > .secondary-button { min-height: 30px; }
}

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