/* ══════════════════════════════════════════════════════════════════════════
   Peter Silie Admin — window content
   Everything that lives inside a window: toolbars, tables, forms, detail
   panes. Same tokens as desktop.css, so themes apply here for free.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Layout inside a window ──────────────────────────────────────────────── */

.pane { display: flex; flex-direction: column; height: 100%; }

.pane-split { display: grid; grid-template-columns: minmax(240px, 1.15fr) 1.35fr; height: 100%; min-height: 0; }
.pane-split > * { min-width: 0; min-height: 0; overflow: auto; }
.pane-split > :first-child { border-right: 1px solid var(--border); }

.toolbar {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    position: sticky; top: 0; z-index: 2;
    backdrop-filter: blur(12px);
}

.scroll { flex: 1; overflow: auto; min-height: 0; }
.pad    { padding: 14px 16px; }
.stack  { display: flex; flex-direction: column; gap: 12px; }
.row    { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ── Controls ────────────────────────────────────────────────────────────── */

.btn {
    padding: 5px 12px;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    background: var(--surface-3);
    color: var(--text);
    font-size: 12.5px; font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background .13s, border-color .13s, transform .08s;
}
.btn:hover  { background: var(--surface-solid); border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    border-color: transparent; color: var(--accent-ink); font-weight: 640;
}
.btn-primary:hover { filter: brightness(1.09); border-color: transparent; }

.btn-danger {
    background: color-mix(in srgb, var(--danger) 20%, transparent);
    border-color: color-mix(in srgb, var(--danger) 55%, transparent);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-sm { padding: 3px 9px; font-size: 11.5px; }

.input, .select, .textarea {
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .13s, box-shadow .13s;
    min-width: 0;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}
.input-search { flex: 1; min-width: 130px; }
.textarea { width: 100%; resize: vertical; min-height: 76px; font-family: var(--mono); font-size: 12px; line-height: 1.55; }
.select { cursor: pointer; }
option { background: var(--surface-solid); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 11px; color: var(--text-dim); letter-spacing: .3px; }
.field .input, .field .select, .field .textarea { width: 100%; }
.field-hint { font-size: 11px; color: var(--text-faint); }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; cursor: pointer; }
.switch input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
    position: sticky; top: 0; z-index: 1;
    text-align: left; font-weight: 600; font-size: 11px;
    letter-spacing: .4px; text-transform: uppercase;
    color: var(--text-dim);
    padding: 8px 12px;
    background: var(--surface-solid);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--surface-2);
    vertical-align: top;
    max-width: 340px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.table tbody tr { cursor: default; }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-clickable:hover { background: var(--surface-2); }
.table tbody tr.is-selected { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 11.5px; }
.table td.mono, .table th.mono { font-family: var(--mono); font-size: 11.5px; }
.table-wrap { overflow: auto; }

/* ── Key/value detail lists ──────────────────────────────────────────────── */

.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 5px 14px; font-size: 12.5px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv dd.mono { font-family: var(--mono); font-size: 11.5px; }

.card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    overflow: hidden;
}
.card-head {
    padding: 9px 13px;
    border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 640; letter-spacing: .2px;
    display: flex; align-items: center; gap: 7px;
    background: var(--surface-2);
}
.card-body { padding: 12px 13px; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 13px; border-top: 1px solid var(--border); }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

.stat { text-align: left; }
.stat-value { font-size: 25px; font-weight: 640; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 1px 7px; border-radius: 20px;
    font-size: 10.5px; font-weight: 640; letter-spacing: .3px;
    border: 1px solid var(--border-strong);
    background: var(--surface-3);
    color: var(--text-dim);
    white-space: nowrap;
}
.badge-ok     { color: var(--ok);     border-color: color-mix(in srgb, var(--ok) 50%, transparent);     background: color-mix(in srgb, var(--ok) 16%, transparent); }
.badge-warn   { color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 50%, transparent);   background: color-mix(in srgb, var(--warn) 16%, transparent); }
.badge-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.badge-accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.tabs {
    flex: 0 0 auto;
    display: flex; gap: 2px; padding: 7px 10px 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 5px 12px 7px;
    border: 0; background: none; color: var(--text-dim);
    font-size: 12.5px; cursor: pointer; white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Misc ────────────────────────────────────────────────────────────────── */

.muted  { color: var(--text-dim); }
.faint  { color: var(--text-faint); }
.mono   { font-family: var(--mono); }
.small  { font-size: 11.5px; }
.center { text-align: center; }
.title  { font-size: 13px; font-weight: 640; margin: 0 0 2px; }

.empty {
    padding: 30px 20px; text-align: center;
    color: var(--text-faint); font-size: 12.5px;
}
.empty-icon { font-size: 26px; display: block; margin-bottom: 8px; opacity: .55; }

.notice {
    padding: 9px 12px; border-radius: 8px;
    font-size: 12px; line-height: 1.55;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-dim);
}
.notice-warn {
    border-color: color-mix(in srgb, var(--warn) 45%, transparent);
    background: color-mix(in srgb, var(--warn) 12%, transparent);
    color: var(--text);
}
.notice-danger {
    border-color: color-mix(in srgb, var(--danger) 45%, transparent);
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--text);
}

.spinner {
    width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid var(--surface-3); border-top-color: var(--accent);
    animation: spin .7s linear infinite;
    display: inline-block; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--text-faint); }
.dot-ok     { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.dot-bad    { background: var(--danger); box-shadow: 0 0 7px var(--danger); }

/* Live log console */
.console {
    flex: 1; min-height: 0; overflow: auto;
    padding: 10px 13px;
    background: color-mix(in srgb, #000 55%, var(--surface-solid));
    font-family: var(--mono); font-size: 11.5px; line-height: 1.65;
    white-space: pre-wrap; overflow-wrap: anywhere;
}
html[data-mode="light"] .console { background: #10161a; color: #dbe6e4; }
.log-info  { color: #9fb0ae; }
.log-warn  { color: #ffd166; }
.log-error { color: #ff8b81; }
.log-debug { color: #6fd6e8; }
.log-hit   { background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 3px; }

/* Scrollbars — thin and unobtrusive, like the platform's overlay bars */
.scroll::-webkit-scrollbar, .win-body::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar, .console::-webkit-scrollbar,
.pane-split > *::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll::-webkit-scrollbar-thumb, .win-body::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb, .console::-webkit-scrollbar-thumb,
.pane-split > *::-webkit-scrollbar-thumb {
    background: var(--surface-3); border-radius: 6px; border: 2px solid transparent; background-clip: content-box;
}
.scroll::-webkit-scrollbar-thumb:hover, .win-body::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }
