/* Clewdr dashboard: warm Claude-inspired surfaces with a clay accent. */
:root {
    color-scheme: light;
    --sidebar-bg: #f1eee7;
    --bg: #f7f5f0;
    --surface: #fffefa;
    --card: #fffefa;
    --input-bg: #fffefa;
    --hover: #f1eee7;
    --border: #e5e1d8;
    --border-hi: #c9c1b5;
    --divider: #e9e5dc;
    --overlay: #f7f5f0;
    --text: #262522;
    --text-dim: #625e57;
    --text-mute: #8a857c;
    --accent: #c96442;
    --accent-dim: #b65334;
    --accent-hi: #da7957;
    --success: #39816b;
    --warn: #b37b32;
    --danger: #b64a3c;
    --danger-hi: #d15c4d;
    --card-border: #e7e2d9;
    --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 8px;
}
[data-theme="dark"] {
    color-scheme: dark;
    --sidebar-bg: #201f1c;
    --bg: #1c1b19;
    --surface: #242320;
    --card: #292824;
    --input-bg: #201f1c;
    --hover: #302e29;
    --border: #403d36;
    --border-hi: #5a554c;
    --divider: #393630;
    --overlay: #22211e;
    --text: #f1eee7;
    --text-dim: #c1bbb0;
    --text-mute: #938d82;
    --accent: #dc8666;
    --accent-dim: #c96e4d;
    --accent-hi: #eda182;
    --success: #78b39d;
    --warn: #d6a956;
    --danger: #e17b6e;
    --danger-hi: #f09183;
    --card-border: #403d36;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: #c9644230; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: #aaa49a; border: 2px solid var(--bg); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #817a70; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, .h1 { font-size: 25px; font-weight: 550; line-height: 1.25; }
h2, .h2 { font-size: 18px; font-weight: 600; }
h3, .h3 { font-size: 16px; font-weight: 600; }
h4, .h4 { font-size: 14px; font-weight: 600; }
a, .link { color: var(--accent-dim); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-dim { color: var(--text-dim); }
.text-mute { color: var(--text-mute); }
.text-mono { font-family: var(--mono); }
.row, .row-sm, .row-lg, .row-start, .row-btw, .row-wrap { display: flex; align-items: center; gap: 10px; }
.row-sm { gap: 6px; }
.row-lg { gap: 22px; }
.row-start { align-items: flex-start; }
.row-btw { justify-content: space-between; }
.row-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.stack, .stack-sm, .stack-lg { display: flex; flex-direction: column; }
.stack { gap: 16px; }
.stack-sm { gap: 8px; }
.stack-lg { gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.btn { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; font-weight: 550; }
.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--border-hi); }
.btn-primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #fffefa; }
.btn-primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: #b64a3c55; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.btn-xs { min-height: 26px; padding: 3px 7px; font-size: 12px; }
.label { display: block; margin-bottom: 5px; color: var(--text-dim); font-size: 13px; }
.input, .textarea, input:not([type=checkbox]), select, textarea { width: 100%; min-height: 38px; padding: 8px 10px; background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.textarea, textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.checkbox-row { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; cursor: pointer; }
.alert { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.alert-success { color: var(--success); background: color-mix(in srgb, var(--success) 8%, var(--surface)); border-color: color-mix(in srgb, var(--success) 30%, var(--border)); }
.alert-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.alert-info { color: var(--accent-dim); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.alert-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); }
.app-shell { min-height: 100dvh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; flex-direction: column; width: 228px; background: var(--sidebar-bg); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 11px; min-height: 78px; padding: 20px 24px; color: var(--text); text-decoration: none; font-size: 20px; font-weight: 650; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.sidebar nav { padding: 8px 14px; }
.tabs { display: flex; flex-direction: column; gap: 5px; }
.tab { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text-dim); text-align: left; font-size: 14px; }
.nav-icon { width: 18px; height: 18px; flex: none; display: grid; place-items: center; }
.nav-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: #c9644218; color: var(--accent-dim); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 18px 16px; border-top: 1px solid var(--border); }
.sidebar-foot p { margin: 0 0 12px; color: var(--text-mute); font-size: 12px; }
.workspace { min-height: 100dvh; margin-left: 228px; display: flex; flex-direction: column; }
.topbar { min-height: 94px; display: flex; align-items: center; gap: 16px; padding: 18px 32px; background: var(--bg); border-bottom: 1px solid var(--border); }
.page-title { min-width: 0; flex: 1; }
.page-title h1 { margin: 0 0 3px; }
.page-title p { margin: 0; color: var(--text-mute); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.content-area { width: 100%; max-width: 1500px; margin: 0 auto; padding: 26px 32px 40px; }
.page-content { min-width: 0; }
.section-tabs { margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.sub-tabs { display: flex; gap: 20px; margin: 0; }
.sub-tab { min-height: 42px; padding: 8px 2px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--text-mute); font-size: 13px; }
.sub-tab:hover { color: var(--text); }
.sub-tab.active { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
.login-shell { min-height: 100dvh; display: grid; place-content: center; gap: 25px; padding: 24px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 650; }
.login-brand img { width: 28px; height: 28px; }
.login-brand small { color: var(--text-mute); font-size: 12px; font-weight: 400; }
.login-panel { width: min(440px, calc(100vw - 32px)); padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.lang-btn { min-height: 30px; padding: 4px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--text-dim); font-size: 12px; font-weight: 550; }
.lang-btn.on { background: #c9644218; color: var(--accent-dim); }
.lang-btn:hover { background: var(--hover); }
.toast { position: fixed; z-index: 60; top: 18px; right: 20px; max-width: min(480px, calc(100vw - 32px)); display: flex; gap: 14px; align-items: center; padding: 11px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px #17130f22; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-close { padding: 0 3px; border: 0; background: transparent; color: var(--text-mute); font-size: 18px; }
.cookie-section { margin-bottom: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.section-title { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.section-title-valid { color: var(--success); }
.section-title-exhausted { color: var(--warn); }
.section-title-invalid { color: var(--danger); }
.section-empty { margin: 0; color: var(--text-mute); font-size: 13px; }
.cookie-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--divider); }
.cookie-row:last-child { border-bottom: 0; }
.cookie-row .text-mono { color: var(--text-dim) !important; }
.icon-del, .icon-copy { min-width: 30px; min-height: 30px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--text-mute); }
.icon-del { color: var(--danger); }
.icon-del:hover, .icon-copy:hover { background: var(--hover); }
.config-section { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.config-section + .config-section { margin-top: 14px; }
.config-section-title { margin-bottom: 5px; font-size: 15px; font-weight: 600; }
.config-section-desc { margin-bottom: 12px; color: var(--text-mute); font-size: 13px; }
.progress { height: 6px; margin-top: 5px; overflow: hidden; background: var(--hover); border-radius: 4px; }
.progress-bar { height: 100%; min-width: 0; border-radius: 4px; transition: width 300ms ease; }
.progress-bar.low { background: var(--success); }
.progress-bar.mid { background: var(--warn); }
.progress-bar.high { background: var(--danger); }
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.progress-label span:first-child { color: var(--text-dim); }
.progress-label span:last-child { color: var(--text-mute); }
.loading { padding: 24px 0; color: var(--text-mute); text-align: center; }
.details summary { color: var(--text-mute); cursor: pointer; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-overlay { display: none; }
.mobile-menu { display: none; }
@media (max-width: 900px) {
    .sidebar { width: 210px; }
    .workspace { margin-left: 210px; }
    .topbar { padding-right: 22px; padding-left: 22px; }
    .content-area { padding: 22px; }
}
@media (max-width: 680px) {
    .sidebar { z-index: 45; width: min(290px, 84vw); transform: translateX(-102%); transition: transform 180ms ease; box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: 12px 0 30px #17130f20; }
    .workspace { margin-left: 0; }
    .topbar { min-height: 74px; gap: 10px; padding: 12px 16px; }
    .mobile-menu { width: 36px; min-width: 36px; display: inline-flex; padding: 0; }
    .topbar-actions { gap: 5px; }
    .content-area { padding: 18px 16px 28px; }
    .nav-overlay { position: fixed; inset: 0; z-index: 40; display: block; width: 100%; height: 100%; border: 0; background: #17130f55; }
    .grid-2 { grid-template-columns: 1fr; }
    .row-btw { align-items: flex-start; gap: 12px; }
}
@media (max-width: 420px) {
    .topbar { flex-wrap: wrap; }
    .page-title h1 { font-size: 21px; }
    .page-title p { max-width: 215px; }
    .topbar-actions { gap: 2px; }
    .content-area { padding-right: 12px; padding-left: 12px; }
    .config-section { padding: 14px; }
    .cookie-row { gap: 6px; }
}
@media print { body { background: #fff; color: #000; } }
