/* =============================================================================
   Portal Stylesheet — dark & light themes
   ============================================================================= */

/* ── Custom properties ────────────────────────────────────────────────────────── */
:root {
    --topbar-h: 58px;
    --radius:    8px;
    --radius-sm: 5px;
    --radius-lg: 12px;
    --font:      -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
    --ease:      0.18s ease;
}

/* DARK THEME (default) */
html, [data-theme="dark"] {
    --bg:          #0e0f17;
    --surface:     #14151e;
    --surface-2:   #1b1c29;
    --surface-3:   #222336;
    --surface-4:   #2a2c40;
    --border:      #2a2c40;
    --border-s:    #1f2032;
    --text:        #dfe0f0;
    --muted:       #787a9e;
    --dim:         #424468;
    --accent:      #4f8ef7;
    --accent-h:    #6ba4f9;
    --accent-bg:   rgba(79,142,247,.10);
    --success:     #4ecb82;
    --success-bg:  rgba(78,203,130,.10);
    --warning:     #f0a830;
    --warning-bg:  rgba(240,168,48,.10);
    --danger:      #f55454;
    --danger-bg:   rgba(245,84,84,.10);
    --shadow:      0 4px 24px rgba(0,0,0,.55);
    --shadow-sm:   0 2px 10px rgba(0,0,0,.40);
    --shadow-lg:   0 8px 48px rgba(0,0,0,.65);
}

/* LIGHT THEME */
[data-theme="light"] {
    --bg:          #f1f2f8;
    --surface:     #ffffff;
    --surface-2:   #f5f6fc;
    --surface-3:   #ecedf5;
    --surface-4:   #e0e1f0;
    --border:      #d6d8eb;
    --border-s:    #e8e9f5;
    --text:        #191b2e;
    --muted:       #585a80;
    --dim:         #9698b8;
    --accent:      #3d7bf5;
    --accent-h:    #2467e8;
    --accent-bg:   rgba(61,123,245,.08);
    --success:     #28a85e;
    --success-bg:  rgba(40,168,94,.08);
    --warning:     #c8890a;
    --warning-bg:  rgba(200,137,10,.08);
    --danger:      #d83333;
    --danger-bg:   rgba(216,51,51,.08);
    --shadow:      0 4px 24px rgba(0,0,0,.09);
    --shadow-sm:   0 2px 10px rgba(0,0,0,.06);
    --shadow-lg:   0 8px 48px rgba(0,0,0,.14);
}

/* ── Reset & base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--ease), color var(--ease);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }

/* ── Topbar ───────────────────────────────────────────────────────────────────── */
.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border-s);
    display: flex;
    align-items: center;
    padding: 0 18px;
    z-index: 1000;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
    text-decoration: none;
    color: var(--text);
}

.topbar-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
}

.topbar-name {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    color: var(--text);
}

.topbar-sep {
    width: 1px;
    height: 26px;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 4px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}

.topbar-nav-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.topbar-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    transition: background var(--ease), color var(--ease);
    text-decoration: none;
}

.topbar-link:hover { background: var(--surface-3); color: var(--text); }
.topbar-link.active { background: var(--accent-bg); color: var(--accent); }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.topbar-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--dim);
    padding: 6px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--ease), color var(--ease);
}
.topbar-icon-btn:hover { background: var(--surface-3); color: var(--muted); }

/* Mobile hamburger */
.topbar-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--muted);
    border-radius: var(--radius-sm);
}

.topbar-mobile-menu {
    display: none;
    position: fixed;
    top: var(--topbar-h);
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    z-index: 998;
    box-shadow: var(--shadow);
    flex-direction: column;
    gap: 2px;
}

.topbar-mobile-menu.open { display: flex; }
.topbar-mobile-menu .topbar-link { padding: 10px 12px; }

/* ── Page content ─────────────────────────────────────────────────────────────── */
.page-content {
    margin-top: var(--topbar-h);
    min-height: calc(100vh - var(--topbar-h));
}

/* ── Dashboard ────────────────────────────────────────────────────────────────── */
.dashboard {
    padding: 24px;
    max-width: 1440px;
    margin: 0 auto;
}

.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    align-items: start;
}

/* ── Widget card ──────────────────────────────────────────────────────────────── */
.widget-card {
    background: var(--surface);
    border: 1px solid var(--border-s);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--ease), border-color var(--ease);
    position: relative;
    cursor: default;
}

.widget-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--border);
}

.widget-card[draggable="true"] { cursor: grab; }
.widget-card.is-dragging { opacity: .45; cursor: grabbing; }
.widget-card.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-bg), var(--shadow);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border-s);
}

.widget-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.widget-drag-icon {
    color: var(--dim);
    line-height: 0;
    opacity: .6;
    transition: opacity var(--ease);
}
.widget-card:hover .widget-drag-icon { opacity: 1; }

.widget-body { padding: 18px; }

/* ── Weather widget ───────────────────────────────────────────────────────────── */
.wx-main {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.wx-icon { font-size: 3.2rem; line-height: 1; }

.wx-temp-wrap {}
.wx-temp {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.05em;
}
.wx-unit { font-size: 1.3rem; color: var(--muted); font-weight: 400; }
.wx-desc { font-size: .88rem; color: var(--muted); margin-top: 3px; }

.wx-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border-s);
}

.wx-meta-item { display: flex; flex-direction: column; gap: 2px; }
.wx-meta-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.wx-meta-value { font-size: .9rem; font-weight: 600; }

/* ── Traffic widget ───────────────────────────────────────────────────────────── */
.traffic-route { display: flex; flex-direction: column; gap: 8px; }

.traffic-endpoint { display: flex; align-items: flex-start; gap: 10px; }

.traffic-dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 800;
    flex-shrink: 0; margin-top: 3px;
}
.traffic-dot.from { background: var(--accent-bg); color: var(--accent); }
.traffic-dot.to   { background: var(--success-bg); color: var(--success); }

.traffic-ep-label { font-size: .7rem; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.traffic-ep-addr  { font-size: .88rem; color: var(--text); }

.traffic-line {
    display: flex; align-items: center; gap: 10px;
    padding-left: 6px;
}
.traffic-line-dot {
    width: 2px; height: 24px;
    background: var(--border);
    border-radius: 1px;
    margin-left: 12px;
}

.traffic-result {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-s);
}
.traffic-duration {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -.04em;
}
.traffic-duration span { font-size: .95rem; font-weight: 400; color: var(--muted); margin-left: 4px; }
.traffic-note { font-size: .74rem; color: var(--dim); margin-top: 4px; }

/* ── Snippet widget ───────────────────────────────────────────────────────────── */
.snippet-lang {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--dim); margin-bottom: 8px;
}

.snippet-code {
    background: var(--bg);
    border: 1px solid var(--border-s);
    border-radius: var(--radius);
    padding: 14px;
    font-family: var(--font-mono);
    font-size: .82rem;
    line-height: 1.7;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 260px;
    color: var(--text);
    white-space: pre;
}

/* override hljs bg so it respects our surface */
.hljs { background: transparent !important; padding: 0 !important; }

/* ── News widget ──────────────────────────────────────────────────────────────── */
.news-item {
    padding: 9px 0;
    border-bottom: 1px solid var(--border-s);
}
.news-item:first-child { padding-top: 0; }
.news-item:last-child  { border-bottom: none; padding-bottom: 0; }

.news-item-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
}
.news-item-title a { color: var(--text); }
.news-item-title a:hover { color: var(--accent); }
.news-item-date { font-size: .73rem; color: var(--dim); margin-top: 2px; }

/* ── HTML widget ──────────────────────────────────────────────────────────────── */
.html-widget-content { font-size: .9rem; line-height: 1.75; color: var(--text); }

/* ── Widget states ────────────────────────────────────────────────────────────── */
.widget-loading {
    display: flex; align-items: center; gap: 10px;
    color: var(--muted); font-size: .88rem; padding: 8px 0;
}
.spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--surface-3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.widget-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: .84rem;
    line-height: 1.5;
}

/* ── Iframe homepage ──────────────────────────────────────────────────────────── */
.iframe-wrap {
    width: 100%;
    height: calc(100vh - var(--topbar-h));
}
.iframe-wrap iframe {
    width: 100%; height: 100%; border: none; display: block;
}

/* ── News page ────────────────────────────────────────────────────────────────── */
.news-page {
    padding: 32px 24px;
    max-width: 860px;
    margin: 0 auto;
}

.news-page-title {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -.03em;
    margin-bottom: 28px;
}

.news-card {
    background: var(--surface);
    border: 1px solid var(--border-s);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--ease);
}
.news-card:hover { box-shadow: var(--shadow); }

.news-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.news-card-title {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

.news-card-date {
    font-size: .76rem;
    color: var(--dim);
    white-space: nowrap;
    flex-shrink: 0;
}

.news-card-img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 14px;
}

.news-card-body {
    font-size: .9rem;
    line-height: 1.8;
    color: var(--muted);
    white-space: pre-wrap;
}

/* ── Admin layout ─────────────────────────────────────────────────────────────── */
.admin-wrap {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border-s);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
}

.admin-sidebar-top {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border-s);
}

.admin-portal-name {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.admin-portal-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--dim);
}

.admin-nav {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    font-size: .87rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: background var(--ease), color var(--ease);
    white-space: nowrap;
}

.admin-nav-link:hover { background: var(--surface-3); color: var(--text); }

.admin-nav-link.active {
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

.admin-nav-link svg { flex-shrink: 0; width: 16px; height: 16px; opacity: .7; }
.admin-nav-link.active svg { opacity: 1; }

.admin-nav-divider { height: 1px; background: var(--border-s); margin: 6px 0; }

.admin-sidebar-foot {
    padding: 10px 8px;
    border-top: 1px solid var(--border-s);
}

.admin-main {
    flex: 1;
    padding: 32px;
    min-width: 0;
    max-width: 860px;
}

.admin-section-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -.03em;
    margin-bottom: 24px;
}

/* ── Card ─────────────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border-s);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 22px;
    border-bottom: 1px solid var(--border-s);
}

.card-title {
    font-size: .88rem;
    font-weight: 700;
}

.card-body { padding: 22px; }

.card-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-s);
}

/* ── Forms ────────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-hint {
    font-size: .74rem;
    color: var(--dim);
    margin-top: 5px;
    line-height: 1.45;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: .9rem;
    outline: none;
    appearance: none;
    transition: border-color var(--ease), box-shadow var(--ease);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--dim); }

.form-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: var(--font-mono);
    font-size: .84rem;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b6b8a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 34px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.form-check-label { font-size: .9rem; color: var(--text); }

/* ── Buttons ──────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .875rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background var(--ease), color var(--ease), box-shadow var(--ease), border-color var(--ease);
    white-space: nowrap;
    user-select: none;
}

.btn svg { flex-shrink: 0; width: 16px; height: 16px; }
.btn-sm  { padding: 6px 13px; font-size: .82rem; }
.btn-sm svg { width: 14px; height: 14px; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-h);
    color: #fff;
    box-shadow: 0 3px 14px rgba(79,142,247,.35);
}

.btn-secondary {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-4); color: var(--text); }

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--muted);
    padding: 7px 12px;
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px;
    background: var(--surface-3);
    color: var(--muted);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--ease), color var(--ease);
    flex-shrink: 0;
}
.btn-icon:hover { background: var(--surface-4); color: var(--text); }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-icon svg { width: 15px; height: 15px; display: block; }

/* ── Tables ───────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }

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

th {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--dim);
}

td { color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.td-actions { display: flex; align-items: center; gap: 6px; }

/* ── Flash messages ───────────────────────────────────────────────────────────── */
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.flash.success { background: var(--success-bg); color: var(--success); }
.flash.error   { background: var(--danger-bg);  color: var(--danger);  }
.flash.info    { background: var(--accent-bg);  color: var(--accent);  }
.flash.warning { background: var(--warning-bg); color: var(--warning); }

/* ── Badges ───────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-accent  { background: var(--accent-bg);  color: var(--accent);  }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-muted   { background: var(--surface-3);  color: var(--muted);   }
.badge-warning { background: var(--warning-bg); color: var(--warning); }

/* ── Empty state ──────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state-icon { font-size: 2.4rem; margin-bottom: 14px; opacity: .5; }
.empty-state p { font-size: .9rem; line-height: 1.6; }

/* ── Install wizard ───────────────────────────────────────────────────────────── */
.install-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.install-box { width: 100%; max-width: 500px; }

.install-brand {
    text-align: center;
    margin-bottom: 32px;
}
.install-brand-name {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -.04em;
    color: var(--text);
}
.install-brand-sub {
    color: var(--muted);
    font-size: .88rem;
    margin-top: 4px;
}

/* Steps indicator */
.install-steps {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
}

.install-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.install-step::after {
    content: '';
    position: absolute;
    top: 13px;
    left: calc(50% + 14px);
    right: calc(-50% + 14px);
    height: 2px;
    background: var(--border);
    transition: background var(--ease);
}
.install-step:last-child::after { display: none; }
.install-step.done::after,
.install-step.active::after { background: var(--accent); }

.install-step-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: .76rem; font-weight: 700;
    color: var(--muted);
    z-index: 1;
    margin-bottom: 6px;
    transition: all var(--ease);
}
.install-step.active .install-step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.install-step.done   .install-step-num { background: var(--success); border-color: var(--success); color: #fff; }

.install-step-label {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--dim);
    text-align: center;
}
.install-step.active .install-step-label { color: var(--accent); }
.install-step.done   .install-step-label { color: var(--success); }

.install-card {
    background: var(--surface);
    border: 1px solid var(--border-s);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}
.install-card-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 6px; }
.install-card-desc  { color: var(--muted); font-size: .88rem; margin-bottom: 24px; line-height: 1.6; }

.install-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-s);
}

/* ── Login ────────────────────────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-box { width: 100%; max-width: 370px; }
.login-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em; text-align: center; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--muted); font-size: .87rem; margin-bottom: 28px; }

/* ── Sortable list (admin) ────────────────────────────────────────────────────── */
.sortable-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.sortable-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-s);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: box-shadow var(--ease), border-color var(--ease);
}
.sortable-item:hover { border-color: var(--border); }
.sortable-item.dragging { opacity: .4; }
.sortable-item.drag-over-top    { border-top: 2px solid var(--accent); }
.sortable-item.drag-over-bottom { border-bottom: 2px solid var(--accent); }

.sort-handle {
    cursor: grab;
    color: var(--dim);
    flex-shrink: 0;
    line-height: 0;
    padding: 2px;
}
.sort-handle:hover { color: var(--muted); }
.sort-handle:active { cursor: grabbing; }

/* ── Theme picker ─────────────────────────────────────────────────────────────── */
.theme-options { display: flex; gap: 12px; }

.theme-option {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    cursor: pointer;
}
.theme-option input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }

.theme-swatch {
    width: 78px; height: 52px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: border-color var(--ease);
}
.theme-option input:checked ~ .theme-swatch { border-color: var(--accent); }

.theme-swatch-bar { height: 14px; flex-shrink: 0; }
.theme-swatch-body { flex: 1; display: flex; gap: 3px; padding: 3px; }
.theme-swatch-card { flex: 1; border-radius: 2px; }

.theme-swatch.dark .theme-swatch-bar  { background: #14151e; }
.theme-swatch.dark .theme-swatch-body { background: #0e0f17; }
.theme-swatch.dark .theme-swatch-card { background: #1b1c29; }

.theme-swatch.light .theme-swatch-bar  { background: #fff; }
.theme-swatch.light .theme-swatch-body { background: #f1f2f8; }
.theme-swatch.light .theme-swatch-card { background: #fff; }

.theme-swatch-label { font-size: .76rem; color: var(--muted); font-weight: 500; }

/* ── Logo upload row ──────────────────────────────────────────────────────────── */
.logo-row { display: flex; align-items: center; gap: 16px; }

.logo-preview-box {
    width: 68px; height: 68px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}
.logo-preview-box img { width: 100%; height: 100%; object-fit: contain; }
.logo-preview-box .logo-empty { font-size: 1.6rem; opacity: .3; }

/* ── Misc helpers ─────────────────────────────────────────────────────────────── */
.text-muted  { color: var(--muted); }
.text-dim    { color: var(--dim); }
.text-danger { color: var(--danger); }
.text-sm     { font-size: .82rem; }
.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.ml-auto { margin-left: auto; }

/* ── Responsive ───────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .admin-sidebar { display: none; }
    .admin-main { padding: 20px; max-width: 100%; }
}

@media (max-width: 768px) {
    .topbar-nav,
    .topbar-nav-right,
    .topbar-sep { display: none; }
    .topbar-hamburger { display: flex; }

    .widget-grid { grid-template-columns: 1fr; gap: 14px; }
    .dashboard { padding: 16px; }
    .news-page { padding: 20px 16px; }
    .form-row { grid-template-columns: 1fr; }
    .install-step-label { display: none; }
}
