/* ── surfaces.css ─────────────────────────────
   Admin, settings, editor, stat cards, data tables
   ──────────────────────────────────────────── */

/* ── Admin Storage Panel ────────────────────── */

.admin-storage-card {
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.admin-storage-card h4 { margin: 0 0 10px 0; font-size: 14px; }
.admin-storage-desc { font-size: 12px; color: var(--text-3); margin: 0 0 10px 0; }
.admin-storage-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.admin-storage-item { display: flex; flex-direction: column; gap: 2px; }
.admin-storage-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-storage-value { font-size: 14px; font-weight: 500; }


/* ── Settings Surface ────────────────────── */

.surface-settings {
    display: flex; height: 100%; overflow: hidden;
}
.settings-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; border-bottom: 1px solid var(--border);
    background: var(--bg-surface); flex-shrink: 0;
}
.settings-topbar-back {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; color: var(--text-3);
    cursor: pointer; font-family: inherit; font-size: 13px;
    padding: 4px 8px; border-radius: 6px; transition: color 0.12s;
}
.settings-topbar-back:hover { color: var(--text); }
.settings-topbar-sep { width: 1px; height: 20px; background: var(--border); }
.settings-topbar-title { font-size: 15px; font-weight: 600; }
.settings-nav {
    width: 220px; flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--bg-surface);
    padding: 12px 8px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
}
.settings-nav-link {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 8px;
    color: var(--text-2); text-decoration: none;
    font-size: 13px; font-weight: 500; transition: all 0.12s;
    border: none; background: none; cursor: pointer;
    font-family: inherit; width: 100%; text-align: left;
}
.settings-nav-link:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.settings-nav-link.active { background: var(--accent-dim); color: var(--accent); }
.settings-nav-sep { margin: 8px 0; border-top: 1px solid var(--border); }
.settings-content { flex: 1; overflow-y: auto; padding: 28px; }
.settings-content h2 { font-size: 18px; font-weight: 600; margin: 0 0 20px; }
.settings-content .settings-section {
    background: none; border: none; border-radius: 0;
    padding: 0 0 16px; margin-bottom: 20px; max-width: 560px;
}
.settings-content .settings-section h3 {
    font-size: 14px; font-weight: 600; margin: 0 0 14px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.settings-section {
    margin-bottom: 24px; padding: 20px;
    background: var(--bg-surface); border-radius: 10px;
    border: 1px solid var(--border);
}
.settings-section h3 {
    font-size: 15px; font-weight: 600; margin: 0 0 16px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.settings-placeholder {
    padding: 40px 20px; color: var(--text-3);
    text-align: center; font-size: 13px;
}

/* ── Admin Surface ───────────────────────── */

.surface-admin {
    display: flex; flex-direction: column; height: 100%; overflow: hidden;
}
.admin-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; border-bottom: 1px solid var(--border);
    background: var(--bg-surface); flex-shrink: 0;
}
.admin-topbar-back {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; color: var(--text-3);
    cursor: pointer; font-family: inherit; font-size: 13px;
    padding: 4px 8px; border-radius: 6px; transition: color 0.12s;
}
.admin-topbar-back:hover { color: var(--text); }
.admin-topbar-sep { width: 1px; height: 20px; background: var(--border); }
.admin-topbar-title { font-size: 15px; font-weight: 600; }
.admin-category-tabs {
    display: flex; gap: 1px; padding: 3px;
    background: var(--bg); border-radius: 10px;
    border: 1px solid var(--border); margin-left: auto;
}
.admin-cat-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 7px; border: none;
    cursor: pointer; font-size: 13px; font-weight: 500;
    font-family: inherit; background: transparent; color: var(--text-3);
    transition: all 0.12s;
}
.admin-cat-btn.active { background: var(--bg-raised); color: var(--text); }
.admin-cat-btn:hover { color: var(--text-2); }
.admin-body { display: flex; flex: 1; min-height: 0; }
.admin-nav {
    width: 200px; background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0;
}
.admin-nav-link {
    display: flex; padding: 8px 12px; border-radius: 8px;
    border: none; cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 500; width: 100%;
    text-align: left; transition: all 0.12s;
    background: transparent; color: var(--text-2);
    text-decoration: none;
}
.admin-nav-link:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.admin-nav-link.active { background: var(--accent-dim); color: var(--accent); }
.admin-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-content-header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.admin-content-header h2 { font-size: 16px; font-weight: 600; margin: 0; }
.admin-search {
    display: flex; align-items: center; gap: 7px;
    background: var(--input-bg, var(--bg)); border-radius: 8px;
    padding: 6px 10px; border: 1px solid var(--border); width: 220px;
}
.admin-search input {
    background: none; border: none; color: var(--text);
    font-size: 12px; font-family: inherit; flex: 1; outline: none;
}
.admin-content-body { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Data Tables ─────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 10px 14px; text-align: left; font-weight: 600;
    font-size: 11px; color: var(--text-3); text-transform: uppercase;
    letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 10px 14px; font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: var(--bg-hover); }

/* ── Editor Surface ──────────────────────── */

.surface-editor {
    display: flex; flex-direction: column; height: 100%; overflow: hidden;
}
.editor-topbar {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-bottom: 1px solid var(--border);
    background: var(--bg-surface); flex-shrink: 0;
}
.editor-topbar-back {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; color: var(--text-3);
    cursor: pointer; font-family: inherit; font-size: 13px;
    padding: 4px 8px; border-radius: 6px;
}
.editor-topbar-back:hover { color: var(--text); }
.editor-body { display: flex; flex: 1; min-height: 0; }
.editor-tree {
    width: 220px; background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; flex-shrink: 0;
}
.editor-tree-header {
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 6px;
}
.editor-tree-files { flex: 1; overflow-y: auto; padding: 4px 0; }
.editor-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.editor-tabs {
    display: flex; align-items: center;
    background: var(--bg-raised); border-bottom: 1px solid var(--border);
    flex-shrink: 0; overflow-x: auto; min-height: 33px;
}
.editor-tab {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; cursor: pointer; font-size: 12px;
    white-space: nowrap; border-right: 1px solid var(--border);
    background: transparent; color: var(--text-3);
    border-bottom: 2px solid transparent;
    border-top: none; border-left: none;
    font-family: inherit;
}
.editor-tab.active {
    background: var(--bg); color: var(--text);
    border-bottom-color: var(--accent);
}
.editor-content { flex: 1; overflow: auto; }
.editor-statusbar {
    display: flex; align-items: center; gap: 14px;
    padding: 3px 12px; background: var(--bg-surface);
    border-top: 1px solid var(--border); flex-shrink: 0;
    font-size: 11px; color: var(--text-3);
    font-family: var(--mono);
}
/* ── Stat Cards Grid ──────────────────────── */
.stat-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px;
}
.stat-card-label { font-size: 11px; color: var(--text-3); font-weight: 500; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-card-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ── Bar Chart ───────────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 140px; }
.bar-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-chart-val { font-size: 10px; color: var(--text-3); font-family: var(--mono); }
.bar-chart-track { width: 100%; background: var(--accent-dim); border-radius: 4px; position: relative; height: 100px; }
.bar-chart-fill { position: absolute; bottom: 0; left: 0; right: 0; background: var(--accent); border-radius: 4px; transition: height 0.3s ease; }
.bar-chart-label { font-size: 10px; color: var(--text-3); }

/* ── Admin Settings Form (flat sections, prototype match) ── */
.admin-settings-form { max-width: 600px; }
.admin-settings-form .settings-section {
    background: none; border: none; border-radius: 0;
    padding: 0 0 16px; margin-bottom: 20px;
}
.admin-settings-form .settings-section h3 {
    font-size: 14px; font-weight: 600; margin: 0 0 14px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.admin-settings-form .toggle-label { margin-bottom: 8px; }

/* ── Toggle Switch ────────────────────────── */
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text-1); }
.toggle-label input[type="checkbox"] { display: none; }
.toggle-track {
    position: relative; width: 36px; height: 20px; flex-shrink: 0;
    background: var(--text-3); border-radius: 10px; transition: background 0.2s;
}
.toggle-track::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; border-radius: 50%;
    background: #fff; transition: transform 0.2s;
}
.toggle-label input:checked + .toggle-track { background: var(--accent); }
.toggle-label input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle-hint { font-size: 11px; color: var(--text-3); margin-left: 46px; margin-top: 2px; }

/* ── Admin Table ─────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.admin-table th {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--border);
    font-weight: 600; white-space: nowrap;
}
.admin-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tbody tr { transition: background var(--transition); }
.admin-table tbody tr:hover { background: var(--bg-hover); }
.admin-table-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; font-size: 12px; color: var(--text-3);
}
.admin-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
    background: var(--accent-dim); color: var(--accent);
}
.admin-user-name { font-weight: 600; font-size: 13px; }
.admin-user-handle { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.admin-user-time { color: var(--text-3); font-size: 12px; font-family: var(--mono); }
.admin-actions-cell { white-space: nowrap; text-align: right; }

/* ── Provider Cards ──────────────────────── */
.provider-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.provider-card {
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 16px; cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition);
}
.provider-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.provider-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.provider-card-name { font-weight: 600; font-size: 14px; }
.provider-card-meta { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }


@media (max-width: 768px) {
    .settings-nav { width: 160px; font-size: 12px; padding: 12px 8px; }
    .settings-content { padding: 16px; }
    .admin-nav { width: 160px; }
    .admin-content-body { padding: 16px; }
    .editor-tree { width: 180px; }
}

/* =====================================================
   v0.23.1 — Three-section sidebar (Projects/Channels/Chats)
   ===================================================== */

/* Scrollable nav container */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Section wrapper */
.sb-section { margin-bottom: 2px; }

/* Section header row */
.sb-section-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px 4px 10px;
    cursor: pointer;
    user-select: none;
}
.sb-section-header:hover .sb-section-add { opacity: 1; }
.sidebar.collapsed .sb-section-header { justify-content: center; padding: 6px 0; }

.sb-section-arrow {
    font-size: 9px;
    color: var(--text-3);
    width: 10px;
    flex-shrink: 0;
}
.sidebar.collapsed .sb-section-arrow { display: none; }

.sb-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    flex: 1;
}
.sidebar.collapsed .sb-section-label { display: none; }

.sb-section-add {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: opacity 0.1s, color 0.1s;
    flex-shrink: 0;
}
.sb-section-add:hover { color: var(--text); }
.sidebar.collapsed .sb-section-add { display: none; }

.sb-section-body { /* no extra padding — children handle it */ }

.sb-section-empty {
    font-size: 11px;
    color: var(--text-3);
    padding: 4px 14px 8px;
    font-style: italic;
}
.sidebar.collapsed .sb-section-empty { display: none; }

/* ── Projects section items ── */

.sb-proj-group { margin-bottom: 1px; }
.sb-proj-group.drag-over .sb-proj-header { background: var(--accent-dim); }

.sb-proj-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 6px;
    margin: 0 4px;
    transition: background 0.1s;
}
.sb-proj-header:hover { background: var(--bg-hover); }
.sb-proj-group.active .sb-proj-header {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--accent);
}
.sb-proj-group.active .sb-proj-name { color: var(--accent); font-weight: 600; }
.sb-proj-group.active .sb-proj-dot { background: var(--accent); }
.sb-proj-pin { font-size: 11px; margin-left: auto; opacity: 0.75; flex-shrink: 0; }

.sidebar.collapsed .sb-proj-header { justify-content: center; padding: 5px 0; margin: 0 6px; }

.sb-proj-arrow { font-size: 9px; color: var(--text-3); flex-shrink: 0; }
.sidebar.collapsed .sb-proj-arrow { display: none; }

.sb-proj-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-3);
    flex-shrink: 0;
}

.sb-proj-name {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar.collapsed .sb-proj-name { display: none; }

.sb-proj-count {
    font-size: 10px;
    color: var(--text-3);
    min-width: 14px;
    text-align: right;
}
.sidebar.collapsed .sb-proj-count { display: none; }

.sb-proj-menu {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
    border-radius: 4px;
    transition: opacity 0.1s;
}
.sb-proj-header:hover .sb-proj-menu { opacity: 1; }
.sidebar.collapsed .sb-proj-menu { display: none; }

.sb-proj-empty {
    font-size: 11px;
    color: var(--text-3);
    padding: 4px 10px 6px 28px;
    font-style: italic;
}

.sb-show-archived {
    background: none;
    border: none;
    font-size: 11px;
    color: var(--text-3);
    cursor: pointer;
    padding: 4px 14px 6px;
    font-family: inherit;
    display: block;
    width: 100%;
    text-align: left;
}
.sb-show-archived:hover { color: var(--text-2); }

/* ── Channels section items ── */

.sb-channel-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 6px;
    margin: 0 4px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-2);
    position: relative;
    transition: background 0.1s;
}
.sb-channel-item:hover { background: var(--bg-hover); color: var(--text); }
.sb-channel-item.active { background: var(--bg-raised); color: var(--text); }
.sidebar.collapsed .sb-channel-item { justify-content: center; padding: 5px 0; margin: 0 6px; }

.sb-ch-menu {
    visibility: hidden; background: none; border: none; color: var(--text-3); cursor: pointer;
    font-size: 14px; padding: 0 4px; line-height: 1; border-radius: 3px; margin-left: auto;
}
.sb-ch-menu:hover { color: var(--text); background: var(--bg-hover); }
.sb-channel-item:hover .sb-ch-menu { visibility: visible; }
.sidebar.collapsed .sb-ch-menu { display: none; }

.sb-ch-icon { color: var(--text-3); flex-shrink: 0; display: flex; }
.sb-ch-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar.collapsed .sb-ch-name { display: none; }

.sb-presence {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-3);
    flex-shrink: 0;
}
.sb-presence.online { background: var(--success-light, #22c55e); }

.sb-unread {
    font-size: 10px;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
    flex-shrink: 0;
}

