/* GateH · 数玩 UI Kit — component styles */
@import url('../design-system/colors_and_type.css');

* { box-sizing: border-box; }
html, body, #root { margin: 0; min-height: 100%; }
body { background: var(--bg-page); color: var(--fg1); font-family: var(--font-sans); font-size: 14px; }
button { font-family: inherit; cursor: pointer; border: none; background: none; padding: 0; color: inherit; }
input, select { font-family: inherit; }

/* Shell */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; transition: grid-template-columns .2s var(--ease-out); }
.app.collapsed { grid-template-columns: 64px 1fr; }
.app.mobile { grid-template-columns: 1fr; }

.sidebar { background: #FFFFFF; border-right: 1px solid var(--border-1); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; z-index: 20; }
.sidebar-brand { height: 56px; display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--border-1); gap: 10px; flex-shrink: 0; }
.sidebar-brand .wm { height: 20px; }
.sidebar-brand .mk { height: 28px; display: none; }
.app.collapsed .sidebar-brand { justify-content: center; padding: 0; }
.app.collapsed .sidebar-brand .wm { display: none; }
.app.collapsed .sidebar-brand .mk { display: block; }
.nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; color: var(--fg2); font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; }
.nav-item:hover { background: var(--bg-hover); color: var(--fg1); }
.nav-item.active { background: var(--brand-1); color: var(--brand-6); }
.app.collapsed .nav-item { justify-content: center; padding: 10px; }
.app.collapsed .nav-label { display: none; }
.sidebar-foot { padding: 8px; border-top: 1px solid var(--border-1); }
.collapse-btn { width: 100%; height: 32px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--fg3); border-radius: 4px; font-size: 12px; }
.collapse-btn:hover { background: var(--bg-hover); color: var(--fg2); }

/* Topbar */
.topbar { height: 56px; background: #FFFFFF; border-bottom: 1px solid var(--border-1); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 15; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--fg2); font-size: 14px; }
.user-avatar { width: 28px; height: 28px; border-radius: 999px; background: var(--brand-1); color: var(--brand-6); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; }
.icon-btn { width: 32px; height: 32px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg2); transition: background .15s; }
.icon-btn:hover { background: var(--bg-hover); color: var(--fg1); }
.divider-v { width: 1px; height: 20px; background: var(--border-1); }

/* Main */
.main { min-width: 0; display: flex; flex-direction: column; }
.content { padding: 24px; flex: 1; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 16px; border-radius: 4px; font-size: 14px; font-weight: 500; transition: all .15s; border: 1px solid transparent; white-space: nowrap; }
.btn-primary { background: var(--brand-6); color: #FFF; }
.btn-primary:hover { background: var(--brand-7); }
.btn-primary:active { background: var(--brand-8); }
.btn-secondary { background: #FFF; color: var(--fg1); border-color: var(--border-2); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-3); }
.btn-text { color: var(--brand-6); padding: 0 8px; }
.btn-text:hover { background: var(--brand-1); }
.btn-danger { background: var(--danger-6); color: #FFF; }
.btn-danger:hover { background: var(--danger-7); }
.btn-lg { height: 40px; padding: 0 20px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Inputs */
.input, .select { height: 32px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: 4px; background: #FFF; color: var(--fg1); font-size: 14px; outline: none; transition: all .15s; width: 100%; }
.input:hover, .select:hover { border-color: var(--border-3); }
.input:focus, .select:focus { border-color: var(--brand-6); box-shadow: 0 0 0 3px rgba(22,119,255,.12); }
.input::placeholder { color: var(--fg3); }
.input.lg { height: 40px; }
.input.error { border-color: var(--danger-6); }
.input.error:focus { box-shadow: 0 0 0 3px rgba(245,63,63,.12); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--fg2); font-weight: 500; }
.field-error { font-size: 12px; color: var(--danger-6); }
.input-suffix { position: relative; display: flex; align-items: center; }
.input-suffix .input { padding-right: 28px; }
.input-suffix .suf { position: absolute; right: 10px; color: var(--fg3); font-size: 13px; pointer-events: none; }

/* Cards */
.card { background: #FFF; border: 1px solid var(--border-1); border-radius: 8px; box-shadow: var(--shadow-card); }
.card.pad { padding: 20px 24px; }
.card-head { padding: 16px 24px; border-bottom: 1px solid var(--border-1); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px 24px; }

/* Stat cards */
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 16px; }
.stat-grid.two { grid-template-columns: repeat(2, 1fr); }
.stat-grid.four { grid-template-columns: repeat(4, 1fr); }
.stat-card { background: #FFF; border: 1px solid var(--border-1); border-radius: 8px; padding: 20px 24px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 10px; }
.stat-label { font-size: 13px; color: var(--fg2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 32px; font-weight: 600; color: var(--fg1); line-height: 1.1; letter-spacing: -0.01em; }
.stat-value .u { font-size: 13px; color: var(--fg3); margin-left: 4px; font-weight: 400; }
.stat-value.danger { color: var(--danger-6); }
.stat-meta { font-size: 12px; color: var(--fg3); }

/* Banner */
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.banner.danger { background: var(--danger-1); color: var(--danger-7); border: 1px solid #FBACA3; }
.banner.danger .icon { color: var(--danger-6); flex-shrink: 0; margin-top: 2px; }
.banner .close { margin-left: auto; color: var(--fg3); cursor: pointer; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border-1); margin-bottom: 16px; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--fg2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tab:hover { color: var(--fg1); }
.tab.active { color: var(--brand-6); border-bottom-color: var(--brand-6); }

/* Segmented / Time filter */
.segmented { display: inline-flex; border: 1px solid var(--border-2); border-radius: 4px; overflow: hidden; background: #FFF; }
.segmented button { padding: 0 16px; height: 32px; font-size: 13px; color: var(--fg2); font-weight: 500; border-right: 1px solid var(--border-1); white-space: nowrap; }
.segmented button:last-child { border-right: none; }
.segmented button.active { background: var(--brand-6); color: #FFF; }
.segmented button:hover:not(.active) { background: var(--bg-hover); color: var(--fg1); }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Table */
.table-wrap { background: #FFF; border: 1px solid var(--border-1); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-card); }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th { background: #F7F8FA; color: var(--fg2); font-weight: 500; font-size: 13px; text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border-1); white-space: nowrap; }
.data-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border-1); color: var(--fg1); white-space: nowrap; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #FAFBFC; }
.data-table .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; }
.data-table .right { text-align: right; }
.t-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable .sort-ind { margin-left: 4px; color: var(--fg4); }
.data-table th.sortable.asc .sort-ind, .data-table th.sortable.desc .sort-ind { color: var(--brand-6); }

/* Badges / tags */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 2px; font-size: 12px; font-weight: 500; background: var(--bg-muted); color: var(--fg2); }
.tag.brand { background: var(--brand-1); color: var(--brand-6); }
.tag.success { background: var(--success-1); color: var(--success-6); }
.tag.warning { background: var(--warning-1); color: var(--warning-6); }
.tag.danger { background: var(--danger-1); color: var(--danger-6); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 14px 16px; border-top: 1px solid var(--border-1); font-size: 13px; color: var(--fg2); }
.pagination .total { margin-right: auto; }
.page-btn { min-width: 28px; height: 28px; padding: 0 8px; border: 1px solid var(--border-1); border-radius: 4px; background: #FFF; font-size: 13px; color: var(--fg1); }
.page-btn:hover { border-color: var(--brand-6); color: var(--brand-6); }
.page-btn.active { background: var(--brand-6); color: #FFF; border-color: var(--brand-6); }
.page-btn:disabled { color: var(--fg4); cursor: not-allowed; border-color: var(--border-1); }
.page-size { height: 28px; padding: 0 8px; border: 1px solid var(--border-1); border-radius: 4px; font-size: 13px; color: var(--fg1); background: #FFF; }

/* Empty */
.empty { padding: 80px 20px; text-align: center; color: var(--fg3); }
.empty-illus { width: 120px; height: 80px; margin: 0 auto 12px; background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 80"><rect x="20" y="20" width="80" height="48" rx="4" fill="%23F2F3F5" stroke="%23E5E6EB"/><rect x="30" y="32" width="40" height="4" rx="2" fill="%23E5E6EB"/><rect x="30" y="44" width="60" height="4" rx="2" fill="%23E5E6EB"/><rect x="30" y="56" width="30" height="4" rx="2" fill="%23E5E6EB"/></svg>') center/contain no-repeat; }
.empty-text { font-size: 13px; color: var(--fg3); }

/* Modal */
.modal-mask { position: fixed; inset: 0; background: rgba(29,33,41,.45); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px); }
.modal { background: #FFF; border-radius: 8px; box-shadow: var(--shadow-modal); width: 420px; max-width: 90vw; overflow: hidden; }
.modal-head { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-1); }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; color: var(--fg2); font-size: 14px; }
.modal-foot { padding: 12px 20px; display: flex; justify-content: flex-end; gap: 8px; background: #FAFBFC; }

/* Toast */
.toast-host { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: #FFF; padding: 10px 16px; border-radius: 4px; box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: 8px; font-size: 14px; border: 1px solid var(--border-1); animation: slideDown .22s var(--ease-out); }
.toast.success { color: var(--success-7); }
.toast.success .icon { color: var(--success-6); }
.toast.error { color: var(--danger-7); }
.toast.error .icon { color: var(--danger-6); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Login page */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #E8F3FF 0%, #F7F8FA 60%, #FFF 100%); display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden; }
.login-page::before { content: ""; position: absolute; top: -200px; right: -200px; width: 500px; height: 500px; border-radius: 50%; background: radial-gradient(circle, rgba(22,119,255,.08) 0%, transparent 70%); pointer-events: none; }
.login-page::after { content: ""; position: absolute; bottom: -200px; left: -200px; width: 500px; height: 500px; border-radius: 50%; background: radial-gradient(circle, rgba(22,119,255,.06) 0%, transparent 70%); pointer-events: none; }
.login-card { width: 420px; max-width: 100%; background: #FFF; border-radius: 12px; box-shadow: 0 20px 60px rgba(22,119,255,.12), 0 0 1px rgba(0,0,0,.08); padding: 40px; position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.login-brand img { height: 28px; }
.login-title { font-size: 22px; font-weight: 600; margin: 24px 0 6px; letter-spacing: -0.01em; }
.login-sub { font-size: 13px; color: var(--fg3); margin-bottom: 32px; }
.login-fields { display: flex; flex-direction: column; gap: 20px; }
.login-foot { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; color: var(--fg3); font-size: 12px; }

/* KPI section */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.section-title { font-size: 14px; font-weight: 600; color: var(--fg1); display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 3px; height: 14px; background: var(--brand-6); border-radius: 2px; }

/* Config cards grid */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.config-card { background: #FFF; border: 1px solid var(--border-1); border-radius: 8px; box-shadow: var(--shadow-card); overflow: hidden; }
.config-head { padding: 16px 20px; border-bottom: 1px solid var(--border-1); display: flex; align-items: center; justify-content: space-between; }
.config-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.config-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.config-kv { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #FAFBFC; border-radius: 6px; border: 1px solid var(--border-1); }
.config-kv .k { font-size: 13px; color: var(--fg2); }
.config-kv .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 16px; }
.config-kv .v.danger { color: var(--danger-6); }
.config-foot { padding: 12px 20px; background: #FAFBFC; border-top: 1px solid var(--border-1); display: flex; justify-content: flex-end; gap: 8px; }

/* Mini bar chart */
.chart-card { background: #FFF; border: 1px solid var(--border-1); border-radius: 8px; box-shadow: var(--shadow-card); padding: 20px 24px; }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 0 4px; border-bottom: 1px dashed var(--border-1); }
.bar { flex: 1; background: linear-gradient(180deg, var(--brand-6), var(--brand-4)); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; transition: opacity .15s; }
.bar:hover { opacity: .8; }
.bar-labels { display: flex; gap: 6px; padding: 8px 4px 0; }
.bar-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--fg3); }

/* ========== extensions for Config / Filters / Dashboard variants / Tweaks ========== */

/* Banner variants */
.banner.info { background: var(--brand-1); color: var(--brand-8); border: 1px solid var(--brand-2); }
.banner.info .icon { color: var(--brand-6); flex-shrink: 0; margin-top: 2px; }

/* Project dot */
.proj-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Filter bar */
.filter-bar { background: #FFF; border: 1px solid var(--border-1); border-radius: 8px; padding: 16px 20px; box-shadow: var(--shadow-card); margin-bottom: 16px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.filter-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border-1); }
.daterange, .amount-range { display: flex; align-items: center; gap: 6px; }
.daterange input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: 4px; background: #FFF; font: inherit; color: var(--fg1); outline: none; }
.daterange input:hover { border-color: var(--border-3); }
.daterange input:focus { border-color: var(--brand-6); box-shadow: 0 0 0 3px rgba(22,119,255,.12); }
.daterange .sep, .amount-range .sep { color: var(--fg3); font-size: 12px; }
.amount-range .input-suffix, .amount-range .input { flex: 1; min-width: 0; }

/* Compact data table (used in chart-table layout) */
.data-table.compact thead th, .data-table.compact tbody td { padding: 10px 16px; }

/* Dashboard project card (side-by-side layout) */
.proj-card { background: #FFF; border: 1px solid var(--border-1); border-radius: 8px; box-shadow: var(--shadow-card); padding: 18px 20px 20px; }
.proj-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.proj-card-title { font-size: 15px; font-weight: 600; }

/* Mirror (分块对比) */
.mirror-grid { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 0; background: #FFF; border: 1px solid var(--border-1); border-radius: 8px; box-shadow: var(--shadow-card); overflow: hidden; }
.mirror-divider { background: var(--border-1); }
.mirror-col { padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; }
.mirror-head { display: flex; align-items: center; gap: 10px; }
.mirror-title { font-size: 15px; font-weight: 600; }
.mirror-hero { padding: 4px 0; }
.mirror-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 14px 0; border-top: 1px dashed var(--border-1); border-bottom: 1px dashed var(--border-1); }
.mirror-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 20px; margin-top: 4px; letter-spacing: -.01em; }
.mirror-num.is-danger { color: var(--danger-6); }
.mirror-usage .usage-bar { height: 8px; background: var(--bg-muted); border-radius: 999px; overflow: hidden; }
.mirror-usage .usage-fill { height: 100%; border-radius: 999px; transition: width .25s var(--ease-out); }

/* Line chart + legend */
.line-chart { display: block; }
.chart-legend { margin-top: 10px; font-size: 12px; color: var(--fg2); display: flex; align-items: center; }
.lg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* Top props rows */
.top-row { padding: 10px 0; border-bottom: 1px dashed var(--border-1); }
.top-row:last-child { border-bottom: none; }
.top-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.top-rank { font-family: var(--font-num); color: var(--fg3); font-weight: 600; width: 22px; }
.top-name { color: var(--fg1); font-weight: 500; }
.top-val { margin-left: auto; font-weight: 600; }
.top-bar { height: 4px; background: var(--bg-muted); border-radius: 999px; overflow: hidden; }
.top-bar-fill { height: 100%; border-radius: 999px; }

/* Export modal checks */
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border-1); border-radius: 6px; font-size: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.check-row:hover { border-color: var(--brand-6); }
.check-row.req { background: #FAFBFC; cursor: default; }
.check-row input[type="checkbox"] { accent-color: var(--brand-6); width: 14px; height: 14px; }

/* Tweaks floating panel */
.tweaks-fab { position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px; border-radius: 999px; background: var(--brand-6); color: #FFF; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(22,119,255,.3); z-index: 150; }
.tweaks-fab:hover { background: var(--brand-7); }
.tweaks-panel { position: fixed; right: 20px; bottom: 76px; width: 320px; background: #FFF; border: 1px solid var(--border-1); border-radius: 10px; box-shadow: var(--shadow-modal); z-index: 150; overflow: hidden; }
.tweaks-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border-1); }
.tweaks-head .ttl { font-size: 14px; font-weight: 600; }
.tweaks-head .ttl::before { content: ""; display: inline-block; width: 3px; height: 12px; background: var(--brand-6); border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.tweaks-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.tweak-row { display: flex; flex-direction: column; gap: 6px; }
.tweak-row .lbl { font-size: 12px; color: var(--fg2); font-weight: 500; }
.tweak-row .hint { font-size: 11px; color: var(--fg3); }
.tweak-seg { display: flex; border: 1px solid var(--border-2); border-radius: 4px; overflow: hidden; }
.tweak-seg button { flex: 1; height: 28px; font-size: 12px; color: var(--fg2); border-right: 1px solid var(--border-1); background: #FFF; }
.tweak-seg button:last-child { border-right: none; }
.tweak-seg button.active { background: var(--brand-6); color: #FFF; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { display: none; }
.switch .slider { position: absolute; inset: 0; background: var(--bg-active); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; background: #FFF; border-radius: 999px; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.switch input:checked + .slider { background: var(--brand-6); }
.switch input:checked + .slider::before { left: 18px; }
.tweak-switch-row { display: flex; align-items: center; justify-content: space-between; }

/* Mobile */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 260px; top: 0; bottom: 0; transition: left .2s var(--ease-out); box-shadow: 0 0 0 1px var(--border-1); }
  .app.drawer-open .sidebar { left: 0; }
  .app.drawer-open::before { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .stat-grid.four, .stat-grid.two { grid-template-columns: 1fr; }
  .config-grid { grid-template-columns: 1fr; }
  .config-row { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .right { margin-left: 0; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .tabs { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  .tab { flex: 0 0 auto; }
  .search { width: 100%; }
  .config-foot { justify-content: stretch; }
  .config-foot .btn { width: 100%; }
  .modal { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; display: flex; flex-direction: column; }
  .modal-body { flex: 1; overflow: auto; }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; height: 40px; }
  .data-table thead th, .data-table tbody td { padding: 10px 12px; font-size: 13px; }
  .login-card { padding: 28px 24px; }
}
