/* ── Base ── */
:root {
    /* Gece (default): the original dark panel with lifted contrast for the
       secondary text and borders. Every theme below redefines only these
       tokens; components never name a colour of their own. */
    color-scheme: dark;
    --bg: #0f1117;
    --bg2: #1a1d27;
    --bg3: #242836;
    --border: #2d3148;
    --text: #e8eaf3;
    --text2: #a2a6be;
    --primary: #5558e6;
    --primary-hover: #6d70f0;
    --on-primary: #ffffff;
    --link: #a5b4fc;
    --success: #22c55e;
    --danger: #f87171;
    --warning: #f59e0b;
    --info: #60a5fa;
    --topbar-bg: rgba(15, 17, 23, 0.92);
    --hover-tint: rgba(99, 102, 241, 0.06);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --radius: 8px;
}

/* Ferah — the calm white panel: soft off-white page, white cards, a muted
   sage-teal accent. Every text/background pair is >= 4.5:1 (body text 13:1,
   secondary 5.7:1, white on the accent 5.5:1, status colours 4.8:1+). */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f7f5;
    --bg2: #ffffff;
    --bg3: #edf1ee;
    --border: #d9e0db;
    --text: #1d2a24;
    --text2: #536159;
    --primary: #2f7564;
    --primary-hover: #245e50;
    --on-primary: #ffffff;
    --link: #2f7564;
    --success: #1f7346;
    --danger: #c0352b;
    --warning: #96560a;
    --info: #2563a8;
    --topbar-bg: rgba(245, 247, 245, 0.92);
    --hover-tint: rgba(47, 117, 100, 0.07);
    --shadow: 0 1px 3px rgba(29, 42, 36, 0.08);
}

/* Kum — warm paper tones for long sessions; same contrast floor. */
:root[data-theme="sand"] {
    color-scheme: light;
    --bg: #f6f1e7;
    --bg2: #fffbf3;
    --bg3: #efe6d6;
    --border: #e0d4bf;
    --text: #2e261b;
    --text2: #65584a;
    --primary: #8a5a2b;
    --primary-hover: #6f4620;
    --on-primary: #ffffff;
    --link: #8a5a2b;
    --success: #366c32;
    --danger: #b3382c;
    --warning: #865508;
    --info: #3a64a0;
    --topbar-bg: rgba(246, 241, 231, 0.92);
    --hover-tint: rgba(138, 90, 43, 0.07);
    --shadow: 0 1px 3px rgba(46, 38, 27, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* Components set their own `display`, which would otherwise beat the
   user-agent rule and leave a `hidden` element on screen. */
[hidden] { display: none !important; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-header small {
    color: var(--text2);
    font-size: 12px;
}

.nav-section {
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text2);
    letter-spacing: 1px;
    margin-top: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover, .nav-item.active {
    background: var(--bg3);
    color: var(--text);
    border-left-color: var(--primary);
}

.main {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    min-width: 0;
}

/* ── Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.stat-card .label {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
}

/* ── Tables ── */
.table-container {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead { background: var(--bg3); }

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text2);
    letter-spacing: 0.5px;
    font-weight: 600;
}

td { font-size: 14px; }

tr:hover { background: var(--hover-tint); }

/* ── Forms ── */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 6px;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.85; }
.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--info); }

/* ── Toolbar ── */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    max-width: 300px;
}

/* The form defaults stretch every control to 100%, which turns a row of
   filters into one control per line. */
.filter-select {
    width: auto;
    min-width: 150px;
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h2 {
    margin-bottom: 16px;
    font-size: 18px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ── Code / Result ── */
.result-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 12px;
}

/* ── Login ── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--primary);
}

.login-card p {
    text-align: center;
    color: var(--text2);
    margin-bottom: 24px;
    font-size: 14px;
}

/* ── Toast ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--info); color: white; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
}

.pagination button {
    padding: 6px 14px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
}

.pagination button.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* ── Progress Bar ── */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.error { background: var(--danger); }

/* ── Model Card ── */
.model-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}

.model-card:hover { border-color: var(--primary); }

.model-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.model-card-header h4 { font-size: 16px; font-weight: 600; }

.model-card-info {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 12px;
}

.model-card-info span { display: flex; align-items: center; gap: 4px; }

.model-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { opacity: 0.85; }

.model-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.model-status-dot.running { background: var(--success); box-shadow: 0 0 6px var(--success); }
.model-status-dot.ready { background: var(--info); }
.model-status-dot.downloading { background: var(--warning); animation: pulse 1.5s infinite; }
.model-status-dot.loading { background: var(--warning); animation: pulse 1s infinite; }
.model-status-dot.error { background: var(--danger); }
.model-status-dot.not_downloaded { background: var(--text2); }
.model-status-dot.stopping { background: var(--warning); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.ollama-banner {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.tab-bar {
    display: flex;
    gap: 4px;
    background: var(--bg3);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 20px;
}

.tab-bar button {
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text2);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.tab-bar button.active {
    background: var(--primary);
    color: white;
}

.tab-bar button:hover:not(.active) {
    color: var(--text);
    background: rgba(99, 102, 241, 0.1);
}

/* ── Navigation shell (admin_shell.js) ── */
.sidebar-search {
    margin: 0 12px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: calc(100% - 24px);
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text2);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
}
.sidebar-search:hover { border-color: var(--primary); color: var(--text); }
.sidebar-search kbd, .palette kbd {
    margin-left: auto;
    font-family: inherit;
    font-size: 11px;
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg3);
    color: var(--text2);
}

.nav-group { margin-top: 2px; }
.nav-group > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px 9px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text2);
    cursor: pointer;
    user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after {
    content: '▸';
    margin-left: auto;
    transition: transform 0.15s;
}
.nav-group[open] > summary::after { transform: rotate(90deg); }
.nav-group > summary:hover { color: var(--text); }
.nav-group .nav-item { padding: 8px 20px 8px 26px; font-size: 14px; }
.nav-group.has-active > summary { color: var(--primary-hover); }
.nav-icon { width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -24px -32px 20px;
    padding: 10px 32px;
    background: var(--topbar-bg);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
}
.crumbs { font-size: 13px; color: var(--text2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs strong { color: var(--text); font-weight: 600; }
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.menu-toggle { display: none; }

/* ── Command palette ── */
.palette-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 150;
    justify-content: center;
    align-items: flex-start;
    padding-top: 12vh;
}
.palette-overlay.active { display: flex; }
.palette {
    width: min(640px, calc(100% - 32px));
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
.palette input {
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 16px 18px;
    font-size: 16px;
    background: var(--bg2);
}
.palette-results { max-height: 55vh; overflow-y: auto; padding: 6px; }
.palette-heading { padding: 8px 12px 4px; font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.8px; }
.palette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.palette-item.selected, .palette-item:hover { background: var(--bg3); }
.palette-item .p-title { font-size: 14px; }
.palette-item .p-path { font-size: 12px; color: var(--text2); }
.palette-empty { padding: 18px; color: var(--text2); text-align: center; font-size: 14px; }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text2); }

/* ── Collapsible panels (panel() in admin_shell.js) ── */
details.panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
    scroll-margin-top: 70px;
}
details.panel > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius);
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
    content: '▸';
    color: var(--text2);
    transition: transform 0.15s;
    flex-shrink: 0;
}
details.panel[open] > summary::before { transform: rotate(90deg); }
details.panel > summary:hover { background: var(--hover-tint); }
details.panel[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.panel-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-meta { margin-left: auto; font-size: 13px; color: var(--text2); text-align: right; }
.panel-body { padding: 16px 18px; }
.panel-body > .stat-card:last-child, .panel-body > .table-container:last-child { margin-bottom: 0; }
details.panel details.panel, .stat-card > details.panel { background: var(--bg); }
.stat-card > details.panel { margin: 14px 0 0; }
details.panel.flash, .stat-card.flash { animation: flash 1.6s ease; }
@keyframes flash {
    0%, 40% { box-shadow: 0 0 0 2px var(--primary); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

details.help {
    margin: 8px 0 16px;
    font-size: 13px;
    color: var(--text2);
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius);
}
details.help > summary { cursor: pointer; padding: 8px 14px; color: var(--info); font-weight: 500; }
details.help > div { padding: 0 14px 12px; line-height: 1.6; }
details.help p + p { margin-top: 8px; }

.page-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0 0 16px;
    font-size: 12px;
    color: var(--text2);
}
.page-jump button {
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.page-jump button:hover { border-color: var(--primary); color: var(--primary-hover); }

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text2);
    margin: 18px 0 8px;
}
#page-content [id] { scroll-margin-top: 70px; }
.stat-link { cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.stat-link:hover { border-color: var(--primary); transform: translateY(-1px); }
.stat-link .label::after { content: ' →'; opacity: 0; transition: opacity 0.15s; }
.stat-link:hover .label::after { opacity: 1; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.attention-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.attention-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.attention-list li .btn { margin-left: auto; }

.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-row input[type="search"], .filter-row .filter-input { max-width: 320px; }
.filter-row label.inline { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; white-space: nowrap; }
.filter-row label.inline input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.muted { color: var(--text2); font-size: 13px; }

.sidebar-backdrop { display: none; }
.in-use-only [data-in-use="false"], .only-missing [data-ready="true"] { display: none !important; }
.only-missing details.panel:not(:has([data-ready="false"])) { display: none; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 120;
        box-shadow: 0 0 40px rgba(0,0,0,0.6);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 110;
    }
    .main { margin-left: 0; padding: 16px; min-width: 0; }
    .topbar { margin: -16px -16px 16px; padding: 10px 16px; }
    .menu-toggle { display: inline-flex; }
    .topbar-actions .btn-label { display: none; }
    .table-container { overflow-x: auto; }
    .panel-meta { display: none; }
}


/* ── Theme picker (topbar) ── */
.theme-select { width: auto; padding: 5px 8px; font-size: 12px; background: var(--bg2); }
body { transition: background-color 0.2s ease, color 0.2s ease; }

/* ── Keşfet (discover) page ── */
.disc-langs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.disc-chip {
    padding: 5px 12px; border-radius: 16px; border: 1px solid var(--border);
    background: var(--bg2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.disc-chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.disc-chip small { opacity: 0.75; margin-left: 4px; }
.disc-list {
    background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden;
}
.disc-list.inactive { opacity: 0.62; }
.disc-list-head { display: flex; gap: 10px; align-items: center; padding: 12px 14px; flex-wrap: wrap; }
.disc-list-head h4 { font-size: 15px; margin: 0; }
.disc-list-head .muted { flex-basis: 100%; }
.disc-list-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.disc-list-body { border-top: 1px solid var(--border); padding: 14px; background: var(--bg); }
.disc-error { color: var(--danger); font-size: 12px; flex-basis: 100%; }
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.disc-card {
    background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden; display: flex; flex-direction: column;
}
.disc-card.hidden-item { opacity: 0.5; }
.disc-thumb {
    aspect-ratio: 16 / 9; background: var(--bg3); display: flex; align-items: center;
    justify-content: center; font-size: 30px; overflow: hidden;
}
.disc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.disc-card-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.disc-card-title { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.disc-card-actions { display: flex; gap: 4px; padding: 0 8px 8px; flex-wrap: wrap; }
.disc-card-actions .btn { padding: 3px 8px; font-size: 11px; }
.disc-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; align-items: end; }
.disc-form .wide { grid-column: 1 / -1; }
.disc-form label.inline { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.disc-form label.inline input { width: auto; }
.disc-form textarea { font-family: inherit; min-height: 90px; }
.disc-preview { margin-top: 12px; }

/* Masked provider-secret field (app.js secretInput): text, not password, so
 * the browser never autofills the admin password into it. */
.secret-input { -webkit-text-security: disc; text-security: disc; font-family: monospace; }

/* ── Video Üretimi (video_gen_*.js) ──
 * Every box that receives a picture has a fixed size, so a late image never
 * pushes the page: the view stays where the owner clicked. */
.vg-intro { color: var(--text2); font-size: 13px; margin: 0 0 10px; line-height: 1.55; }
.vg-muted { color: var(--text2); font-size: 12px; font-weight: 400; }
.vg-ok { color: var(--success); font-size: 12px; }
.vg-warn { color: var(--warning); font-size: 12px; }
.vg-h { margin: 18px 0 8px; font-size: 15px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.vg-bar {
    display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 10px 0;
    padding: 10px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
    position: sticky; top: 56px; z-index: 5; box-shadow: var(--shadow);
}
.vg-bar label { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text2); }
.vg-bar select { width: auto; }
.vg-check input { width: auto; margin: 0; }
.vg-run { font-size: 13px; padding: 8px 12px; border-radius: var(--radius); background: var(--bg3); margin: 0 0 8px; }
.vg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; align-items: start; }
.vg-card {
    display: flex; gap: 10px; padding: 10px; background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0;
}
.vg-card.open { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.vg-card-thumb {
    flex: 0 0 auto; width: 72px; height: 128px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border);
    background: var(--bg3); color: var(--text2); font-size: 11px; display: flex; align-items: center;
    justify-content: center; cursor: zoom-in; padding: 0;
}
.vg-card-thumb.a-16x9 { width: 112px; height: 63px; }
.vg-card-thumb.a-1x1 { width: 96px; height: 96px; }
.vg-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vg-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.vg-card-title { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.vg-card-name { font-size: 12px; color: var(--text2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vg-card-status { font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.vg-card-progress { font-size: 12px; color: var(--text2); min-height: 0; }
.vg-card-progress.busy { color: var(--info); }
.vg-card-progress.ok { color: var(--success); }
.vg-card-progress.bad { color: var(--warning); }
.vg-card-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }
.vg-card-actions .btn-sm { padding: 3px 8px; }
.vg-tier { font-size: 10px; padding: 1px 6px; border-radius: 10px; background: var(--bg3); color: var(--text2); }
.vg-drawer {
    grid-column: 1 / -1; background: var(--bg); border: 1px solid var(--primary); border-radius: var(--radius);
    padding: 10px 12px;
}
.vg-drawer-head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.vg-drawer-close { margin-left: auto; }
.vg-pre { white-space: pre-wrap; font-size: 12px; background: var(--bg2); padding: 10px; border-radius: 6px; max-height: 340px; overflow: auto; }
.vg-cand-head { font-size: 13px; font-weight: 600; margin: 4px 0 8px; }
.vg-cand-grid { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.vg-cand {
    margin: 0; width: 200px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 6px; display: flex; flex-direction: column; gap: 6px;
}
.vg-cand.in-use { border-color: var(--success); box-shadow: 0 0 0 1px var(--success); }
.vg-cand.rejected .vg-cand-media { opacity: 0.82; }
.vg-cand-media {
    height: 260px; border-radius: 6px; background: var(--bg3); display: flex; align-items: center;
    justify-content: center; overflow: hidden; color: var(--text2); font-size: 11px;
}
.vg-cand-media img, .vg-cand-media video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.vg-cand figcaption { font-size: 11px; color: var(--text2); display: flex; flex-direction: column; gap: 4px; }
.vg-cand-top { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.vg-cand-meta { overflow-wrap: anywhere; }
.vg-cand-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.vg-cand-actions .btn-sm { padding: 2px 7px; font-size: 11px; }
.vg-cand-empty { font-size: 12px; color: var(--text2); }
.vg-task { font-size: 12px; margin: 2px 0; }
.vg-score { font-size: 11px; padding: 1px 7px; border-radius: 10px; white-space: nowrap; }
.vg-score.ok { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.vg-score.bad { background: rgba(245, 158, 11, 0.16); color: var(--warning); }
.vg-score.none { background: var(--bg3); color: var(--text2); }
.vg-review summary { cursor: pointer; font-size: 11px; color: var(--link); }
.vg-review ul { margin: 2px 0 4px 16px; padding: 0; }
.vg-review p { margin: 2px 0; color: var(--text); }
.vg-review-h { font-size: 11px; font-weight: 600; color: var(--text2); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.vg-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.vg-tag { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.vg-lightbox {
    position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.82); display: flex;
    flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; cursor: zoom-out;
}
.vg-lightbox img, .vg-lightbox video { max-width: 96vw; max-height: 88vh; border-radius: 8px; cursor: default; }
.vg-lightbox-title { color: #fff; font-size: 13px; }
@media (max-width: 768px) {
    .vg-bar { position: static; }
    .vg-grid { grid-template-columns: 1fr; }
    .vg-cand { width: calc(50% - 5px); }
}

/* Sunucu Geçmişi (pages/metrics_history.js): one empty <i> per bar / heatmap cell. */
.mh-bars { display: flex; align-items: flex-end; gap: 1px; border-bottom: 1px solid var(--border); }
.mh-bars > i { display: block; flex: 1 1 0; min-width: 2px; }
.mh-bars > i:hover { filter: brightness(1.2); outline: 1px solid var(--text2); }
.mh-bars > i.g, .mh-heat > i.g { background: repeating-linear-gradient(45deg, var(--bg3) 0 3px, transparent 3px 6px); opacity: 1; }
.mh-bars > i.g { height: 100%; }
.mh-axis { position: relative; height: 16px; }
.mh-axis > small { position: absolute; white-space: nowrap; font-size: 10px; color: var(--text2); }
.mh-heat { display: grid; grid-template-columns: 34px repeat(24, minmax(12px, 1fr)); gap: 2px; min-width: 360px; }
.mh-heat > small { font-size: 9px; color: var(--text2); }
.mh-heat > i { display: block; height: 18px; border-radius: 2px; background: var(--mh-c); }
.mh-tip { position: fixed; z-index: 1000; pointer-events: none; max-width: 340px; padding: 6px 8px; border-radius: 6px;
    background: var(--bg2); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow);
    font-size: 12px; line-height: 1.45; white-space: pre-line; }
