    /* [Civil ID Design System] Токены выровнены с dashboard —
       единая палитра, типографика и role-цвета по всей экосистеме Civil. */
    :root {
        --bg-base: #0A0A0C;
        --bg-surface: #131316;
        --bg-surface-raised: #1A1A1E;
        --bg-surface-hover: #202024;
        --border: #232328;
        --border-soft: #1C1C20;
        --text-primary: #E8E6E3;
        --text-secondary: #ABA9A6;
        --text-muted: #6E6C72;

        --accent: #C81E4D;
        --accent-hover: #E2386A;
        --accent-soft: rgba(200,30,77,0.12);
        --accent-border: rgba(200,30,77,0.35);

        --gold: #D4AF6A;
        --gold-soft: rgba(212,175,106,0.12);

        --role-head: #C81E4D;
        --role-head-soft: rgba(200,30,77,0.12);
        --role-deputy: #B5793A;
        --role-deputy-soft: rgba(181,121,58,0.12);
        --role-founder: #6E6CD9;
        --role-founder-soft: rgba(110,108,217,0.12);
        --role-manager: #2F9E7A;
        --role-manager-soft: rgba(47,158,122,0.12);

        --danger: #E5484D;
        --danger-soft: rgba(229,72,77,0.1);
        --warning: #D8A03D;
        --success: #2F9E7A;

        --font-display: 'Fraunces', serif;
        --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        --font-mono: 'JetBrains Mono', monospace;

        --radius-sm: 6px;
        --radius-md: 8px;
        --radius-lg: 12px;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; }
    html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
    body {
        background: var(--bg-base);
        color: var(--text-primary);
        font-family: var(--font-body);
        line-height: 1.5;
        -webkit-font-smoothing: antialiased;
        font-size: 14px;
    }
    button, input, select, textarea { font-family: inherit; }

    /* ОЧЕНЬ ТОНКИЙ фон — почти незаметный */
    body::before {
        content: "";
        position: fixed;
        inset: 0;
        background: radial-gradient(ellipse 1000px 800px at 80% -10%, rgba(200,30,77,0.04), transparent);
        pointer-events: none;
        z-index: 0;
    }

    h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.011em; color: var(--text-primary); }

    ::-webkit-scrollbar { width: 8px; height: 8px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background: #33333A; }

    .icon-svg { display: inline-block; vertical-align: -0.15em; flex-shrink: 0; color: inherit; }
    .icon-svg svg { display: block; }

    .screen { display: none; width: 100%; min-height: 100vh; position: relative; z-index: 1; }
    .screen.active { display: block; animation: fadeIn 0.25s ease; }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

    #loading-view { display: none; align-items: center; justify-content: center; min-height: 100vh; }
    #loading-view.active { display: flex; }
    .loader-spinner {
        width: 28px; height: 28px;
        border: 2px solid var(--border);
        border-top-color: var(--accent);
        border-radius: 50%;
        animation: spin 0.7s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    #auth-view.active { display: flex; align-items: center; justify-content: center; padding: 24px; }
    .auth-card {
        position: relative; overflow: hidden; width: 100%; max-width: 400px;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 36px 28px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.2);
    }
    .auth-logo {
        width: 48px; height: 48px; border-radius: 10px;
        background: var(--accent);
        display:flex; align-items:center; justify-content:center;
        margin: 0 auto 18px; color: #fff;
        box-shadow: 0 4px 12px rgba(200,30,77,0.3);
    }
    .auth-title { font-family: var(--font-display); text-align: center; font-size: 22px; font-weight: 600; margin-bottom: 6px; }
    .auth-subtitle { text-align: center; font-size: 13px; color: var(--text-secondary); margin-bottom: 26px; }

    .card {
        position: relative;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 20px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.2);
        margin-bottom: 16px;
        transition: border-color 0.15s ease;
    }
    .card:hover { border-color: #2F2F36; }
    .card-title {
        font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
        color: var(--text-muted); margin-bottom: 16px; display:flex; align-items:center; gap:8px;
    }
    .card-title .icon-svg { color: var(--text-muted); }

    /* Stagger для карточек */
    .stagger > * {
        opacity: 0;
        transform: translateY(6px);
        animation: staggerIn 0.35s ease forwards;
        animation-delay: calc(var(--i, 0) * 30ms);
    }
    @keyframes staggerIn {
        to { opacity: 1; transform: translateY(0); }
    }

    .form-group { margin-bottom: 14px; position: relative; }
    .form-group label {
        display: block; font-size: 12px; color: var(--text-secondary);
        margin-bottom: 6px; font-weight: 500;
    }
    .form-control {
        width: 100%;
        background: var(--bg-base);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 9px 12px;
        color: var(--text-primary);
        font-size: 13px;
        transition: border-color 0.15s, background 0.15s;
    }
    .form-control:focus {
        outline: none;
        border-color: var(--accent);
        background: var(--bg-surface);
    }
    .form-control::placeholder { color: var(--text-muted); }

    .btn-primary {
        background: var(--accent);
        color: #fff;
        border: none;
        width: 100%;
        padding: 10px 14px;
        border-radius: var(--radius-sm);
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: background 0.15s, transform 0.1s;
        margin-top: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
    .btn-primary:active:not(:disabled) { transform: translateY(0.5px); }
    .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

    .btn-secondary {
        background: transparent;
        color: var(--text-primary);
        border: 1px solid var(--border);
        padding: 9px 14px;
        border-radius: var(--radius-sm);
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: background 0.15s, border-color 0.15s;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .btn-secondary:hover { background: var(--bg-surface-raised); border-color: #33333A; }

    .auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-muted); }
    .auth-switch span { color: var(--accent-hover); cursor: pointer; font-weight: 500; }
    .auth-switch span:hover { text-decoration: underline; }

    .app-shell { display: flex; align-items: flex-start; min-height: 100vh; }
    .sidebar {
        width: 220px; flex-shrink: 0;
        background: var(--bg-surface);
        border-right: 1px solid var(--border);
        display: flex; flex-direction: column;
        padding: 16px 12px;
        position: sticky; top: 0; height: 100vh;
        overflow-y: auto; z-index: 10;
    }
    .sidebar-top {
        display: flex; align-items: center; justify-content: space-between;
        margin-bottom: 20px; padding: 4px 6px;
    }
    .brand {
        font-weight: 600; font-size: 14px;
        display: flex; align-items: center; gap: 8px;
        color: var(--text-primary);
        letter-spacing: -0.01em;
    }
    .brand-mark {
        width: 22px; height: 22px; border-radius: 5px;
        background: var(--accent);
        display:flex; align-items:center; justify-content:center;
        color: #fff;
    }
    .sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
    .nav-link {
        display: flex; align-items: center; gap: 10px;
        padding: 7px 10px;
        border-radius: var(--radius-sm);
        color: var(--text-secondary);
        font-size: 13px; font-weight: 500;
        cursor: pointer; background: none; border: none;
        text-align: left; width: 100%;
        transition: background 0.12s, color 0.12s;
    }
    .nav-link:hover { background: var(--bg-surface-raised); color: var(--text-primary); }
    .nav-link.active { background: var(--bg-surface-raised); color: var(--text-primary); }
    .nav-link .icon-svg { width: 16px; height: 16px; }
    .nav-link.admin-link { color: var(--role-head); }
    .nav-link.admin-link:hover { background: var(--role-head-soft); }
    .nav-link.admin-link.active { background: var(--role-head-soft); color: var(--role-head); }
    .nav-link.admin-link.is-deputy { color: var(--role-deputy); }
    .nav-link.admin-link.is-deputy:hover, .nav-link.admin-link.is-deputy.active { background: var(--role-deputy-soft); color: var(--role-deputy); }
    .nav-link.admin-link.is-viewer { color: var(--role-founder); }
    .nav-link.admin-link.is-viewer:hover, .nav-link.admin-link.is-viewer.active { background: var(--role-founder-soft); color: var(--role-founder); }
    .sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-soft); }

    .main-content { flex: 1; min-width: 0; padding: 24px 28px 48px; max-width: 1100px; }
    .content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 10px; }
    .greeting {
        font-family: var(--font-display);
        font-size: 19px; font-weight: 600;
        color: var(--text-primary);
        display: flex; align-items: center; gap: 10px;
        flex-wrap: wrap; min-width: 0;
        letter-spacing: -0.011em;
    }
    .greeting span#current-user-name { overflow-wrap: break-word; }

    .head-crown {
        display: none; align-items: center; gap: 5px;
        font-size: 10px; font-weight: 600; letter-spacing: 0.4px;
        text-transform: uppercase;
        color: var(--role-head);
        background: var(--role-head-soft);
        border: 1px solid rgba(229,72,77,0.15);
        padding: 3px 8px; border-radius: 10px;
        flex-shrink: 0;
    }
    .head-crown.role-deputy { color: var(--role-deputy); background: var(--role-deputy-soft); border-color: rgba(181,121,58,0.15); }
    .head-crown.role-viewer { color: var(--role-founder); background: var(--role-founder-soft); border-color: rgba(110,108,217,0.15); }

    .mobile-topbar {
        display: none;
        align-items: center; justify-content: space-between;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border-soft);
        position: sticky; top: 0;
        background: rgba(11,11,14,0.92);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        z-index: 30;
    }

    .notif-bell {
        position: relative;
        background: transparent;
        border: 1px solid var(--border);
        width: 34px; height: 34px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        display: flex; align-items: center; justify-content: center;
        flex-shrink: 0;
        transition: background 0.12s, border-color 0.12s;
        color: var(--text-secondary);
    }
    .notif-bell:hover { background: var(--bg-surface-raised); color: var(--text-primary); border-color: #33333A; }
    .notif-badge {
        position: absolute; top: -4px; right: -4px;
        background: var(--accent); color: #fff;
        font-size: 9px; font-weight: 600;
        min-width: 14px; height: 14px; border-radius: 7px;
        display: none; align-items: center; justify-content: center;
        padding: 0 3px;
        border: 2px solid var(--bg-base);
    }
    .notif-dropdown {
        position: fixed; display: none;
        max-height: 380px; overflow-y: auto;
        width: 320px; max-width: 90vw;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 8px; z-index: 200;
        box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    }
    .notif-dropdown.open { display: block; }
    .notif-dropdown-title {
        display: flex; justify-content: space-between; align-items: center;
        font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
        color: var(--text-muted);
        padding: 8px 10px 10px;
        border-bottom: 1px solid var(--border-soft);
        margin-bottom: 4px;
    }
    .notif-item {
        display: flex; gap: 10px;
        padding: 8px 10px;
        border-radius: var(--radius-sm);
        font-size: 12px; color: var(--text-secondary);
        transition: background 0.12s;
    }
    .notif-item:hover { background: var(--bg-surface-raised); }
    .notif-item.unread { background: var(--bg-surface-raised); color: var(--text-primary); }
    .notif-icon {
        flex-shrink: 0;
        width: 28px; height: 28px;
        border-radius: var(--radius-sm);
        background: var(--bg-surface-hover);
        display:flex; align-items:center; justify-content:center;
        color: var(--text-secondary);
    }
    .notif-item.unread .notif-icon { color: var(--accent-hover); }
    .notif-text { line-height: 1.4; overflow-wrap: break-word; flex: 1; min-width: 0; }
    .notif-item-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
    .notif-empty {
        text-align: center; color: var(--text-muted);
        padding: 28px 12px; font-size: 12px;
        display:flex; flex-direction:column; align-items:center; gap:8px;
    }

    /* Stats */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        gap: 12px;
        margin-bottom: 20px;
    }
    .stat-box {
        background: var(--bg-surface);
        border: 1px solid var(--border);
        padding: 14px 16px;
        border-radius: var(--radius-md);
        transition: border-color 0.15s;
        min-width: 0;
    }
    .stat-box:hover { border-color: #33333A; }
    .stat-box p {
        font-size: 11px; color: var(--text-muted);
        text-transform: uppercase; letter-spacing: 0.4px;
        margin-bottom: 4px; font-weight: 500;
    }
    .stat-box h3 {
        font-size: 20px; color: var(--text-primary);
        font-weight: 600; letter-spacing: -0.02em;
        overflow-wrap: break-word;
        font-variant-numeric: tabular-nums;
    }
    .stat-box.role-box { border-left: 2px solid var(--accent); }
    .stat-box.role-box.gold { border-left-color: var(--role-head); }
    .stat-box.role-box.silver { border-left-color: var(--role-deputy); }
    .stat-box.role-box.viewer { border-left-color: var(--role-founder); }

    .grid-layout { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; }
    .tab-content { display: none; }
    .tab-content.active { display: block; }

    /* Leaderboard */
    .leaderboard-table { width: 100%; border-collapse: collapse; }
    .leaderboard-table th {
        color: var(--text-muted); font-size: 10px; font-weight: 600;
        padding: 6px 0 10px; border-bottom: 1px solid var(--border-soft);
        text-transform: uppercase; letter-spacing: 0.5px; text-align: left;
    }
    .leaderboard-table td {
        padding: 10px 0; font-size: 13px;
        border-bottom: 1px solid var(--border-soft);
        text-align: left;
    }
    .leaderboard-table tr:last-child td { border-bottom: none; }
    .points-badge {
        background: var(--role-manager-soft);
        border: 1px solid rgba(47,158,122,0.2);
        padding: 2px 7px;
        border-radius: 10px;
        font-weight: 500; color: var(--role-manager);
        font-size: 11px; white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }
    .medal {
        display: inline-flex; align-items: center; justify-content: center;
        width: 22px; height: 22px; border-radius: 50%;
        font-size: 10px; font-weight: 600;
        font-variant-numeric: tabular-nums;
    }
    .medal-gold { background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(212,175,106,0.25); }
    .medal-silver { background: rgba(148,163,184,0.1); color: #94A3B8; border: 1px solid rgba(148,163,184,0.2); }
    .medal-bronze { background: rgba(181,121,58,0.1); color: #B5793A; border: 1px solid rgba(181,121,58,0.2); }

    .pass-strength { height: 3px; width: 100%; background: var(--border-soft); margin-top: 6px; border-radius: 2px; overflow: hidden; display: none; }
    .pass-strength-bar { height: 100%; width: 0%; transition: all 0.25s; background: var(--danger); }

    /* Tasks */
    .task-card {
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 14px;
        margin-bottom: 10px;
        transition: border-color 0.12s;
    }
    .task-card:hover { border-color: #33333A; }
    .task-card.status-done { opacity: 0.65; }
    .task-card.status-done .task-title { text-decoration: line-through; color: var(--text-secondary); }
    .task-status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
    .status-pill, .status-select {
        padding: 3px 9px;
        border-radius: 10px;
        font-size: 11px; font-weight: 500;
        border: 1px solid;
        background: transparent;
        display:inline-flex; align-items:center; gap:5px;
    }
    .status-select { cursor: pointer; }
    .status-dot { width: 6px; height: 6px; border-radius: 50%; display:inline-block; }
    .status-todo { color: var(--text-muted); border-color: var(--border); background: var(--bg-surface-raised); }
    .status-todo .status-dot { background: var(--text-muted); }
    .status-in_progress { color: #3B82F6; border-color: rgba(59,130,246,0.25); background: rgba(59,130,246,0.08); }
    .status-in_progress .status-dot { background: #3B82F6; }
    .status-done { color: var(--role-manager); border-color: rgba(47,158,122,0.25); background: var(--role-manager-soft); }
    .status-done .status-dot { background: var(--role-manager); }
    .task-due { font-size: 11px; color: var(--text-muted); display:inline-flex; align-items:center; gap:4px; }
    .task-due.overdue { color: var(--danger); font-weight: 500; }
    .task-title { font-weight: 500; font-size: 14px; color: var(--text-primary); margin-bottom: 3px; overflow-wrap: break-word; letter-spacing: -0.005em; }
    .task-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.5; }
    .task-assignee-note { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 4px; }
    .task-avatars { display: flex; }
    .task-avatar {
        width: 24px; height: 24px; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        font-size: 10px; font-weight: 600; color: #fff;
        border: 2px solid var(--bg-surface);
        margin-left: -6px; flex-shrink: 0;
    }
    .task-avatar:first-child { margin-left: 0; }
    .task-avatar.todo { box-shadow: 0 0 0 1px var(--border); opacity: 0.5; }
    .task-avatar.pending { box-shadow: 0 0 0 1.5px var(--role-deputy); }
    .task-avatar.confirmed { box-shadow: 0 0 0 1.5px var(--role-manager); }
    .task-avatar.clickable { cursor: pointer; transition: transform 0.12s; }
    .task-avatar.clickable:hover { transform: scale(1.08); }
    .task-progress-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
    .task-progress-frac { font-size: 11px; color: var(--text-muted); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
    .task-progress-bar { height: 3px; background: var(--border-soft); border-radius: 2px; margin-top: 6px; overflow: hidden; }
    .task-progress-fill { height: 100%; background: var(--accent); transition: width 0.3s ease; }
    .task-mark-btn {
        margin-top: 10px;
        background: var(--role-manager-soft);
        border: 1px solid rgba(47,158,122,0.25);
        color: var(--role-manager);
        padding: 6px 12px;
        border-radius: var(--radius-sm);
        font-size: 12px; font-weight: 500;
        cursor: pointer;
        display:inline-flex; align-items:center; gap:5px;
        transition: background 0.12s;
    }
    .task-mark-btn:hover { background: rgba(47,158,122,0.12); }
    .task-pending-note, .task-confirmed-note {
        margin-top: 10px; font-size: 12px; color: var(--text-secondary);
        display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    }
    .task-cancel-btn {
        background: none; border: none;
        color: var(--accent-hover);
        font-size: 11px; cursor: pointer;
        text-decoration: underline;
        padding: 0;
    }
    .task-footer {
        display: flex; align-items: center; gap: 10px;
        margin-top: 10px; padding-top: 8px;
        border-top: 1px solid var(--border-soft);
        flex-wrap: wrap;
    }
    .comments-toggle-btn {
        background: none; border: none;
        color: var(--text-secondary);
        font-size: 12px; cursor: pointer;
        padding: 0;
        display:inline-flex; align-items:center; gap:4px;
        transition: color 0.12s;
    }
    .comments-toggle-btn:hover { color: var(--text-primary); }
    .task-comments { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-soft); animation: fadeIn 0.15s ease; }
    .comments-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
    .comment-item { display: flex; gap: 8px; }
    .comment-avatar {
        width: 22px; height: 22px; border-radius: 50%;
        flex-shrink: 0;
        display: flex; align-items: center; justify-content: center;
        font-size: 9px; font-weight: 600; color: #fff;
    }
    .comment-body { font-size: 12px; min-width: 0; overflow-wrap: break-word; flex: 1; }
    .comment-head { color: var(--text-muted); font-size: 11px; margin-bottom: 2px; }
    .comment-head b { color: var(--text-primary); font-weight: 500; }
    .comment-text { color: var(--text-secondary); line-height: 1.5; }
    .comment-input-row {
        display: flex; align-items: center; gap: 6px;
        border-bottom: 1px solid var(--border-soft);
        padding-bottom: 6px;
    }
    .comment-input-row .comment-input {
        flex: 1; min-width: 0;
        background: none; border: none;
        color: var(--text-primary);
        font-size: 12px; padding: 4px 0;
    }
    .comment-input-row .comment-input:focus { outline: none; }
    .comment-input-row .comment-input::placeholder { color: var(--text-muted); }
    .comment-send-btn {
        background: none; border: none;
        color: var(--accent-hover);
        cursor: pointer; padding: 4px;
        flex-shrink: 0;
        display:flex; align-items:center;
        transition: color 0.12s;
    }
    .comment-send-btn:hover { color: var(--accent); }

    /* Logs */
    .log-row {
        display: flex; justify-content: space-between; align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-soft);
        gap: 10px;
    }
    .log-row:last-child { border-bottom: none; }
    .log-row > div:first-child { flex: 1 1 auto; min-width: 0; }
    .log-row .points-badge { flex-shrink: 0; }
    .log-row-title { font-size: 13px; font-weight: 500; color: var(--text-primary); overflow-wrap: break-word; }
    .log-row-meta {
        font-size: 11px; color: var(--text-muted);
        margin-top: 2px; overflow-wrap: break-word;
        display:flex; align-items:center; gap:4px; flex-wrap:wrap;
    }
    .log-row-meta a {
        color: var(--accent-hover);
        text-decoration: none;
        display:inline-flex; align-items:center; gap:3px;
    }
    .log-row-meta a:hover { text-decoration: underline; }
    .log-assistant-block { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
    .log-assistant-block:last-child { border-bottom: none; margin-bottom: 0; }
    .log-task-item {
        font-size: 12px; color: var(--text-secondary);
        padding: 3px 0 3px 4px; overflow-wrap: break-word;
        display:flex; align-items:center; gap:6px;
    }

    /* Admin */
    .admin-list { display: flex; flex-direction: column; gap: 12px; }
    .admin-row { padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
    .admin-row:last-child { border-bottom: none; padding-bottom: 0; }
    .admin-row-name { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 8px; overflow-wrap: break-word; }
    .admin-row-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
    .role-select, .points-input {
        background: var(--bg-base);
        border: 1px solid var(--border);
        color: var(--text-primary);
        border-radius: var(--radius-sm);
        padding: 6px 10px;
        font-size: 12px;
    }
    .role-select { flex: 1 1 120px; min-width: 0; }
    .points-input { flex: 0 1 90px; min-width: 0; }
    .save-row-btn, .delete-row-btn, .view-row-btn {
        flex: 0 0 auto;
        padding: 6px 11px;
        border-radius: var(--radius-sm);
        font-size: 12px; font-weight: 500;
        cursor: pointer;
        transition: background 0.12s, border-color 0.12s;
        border: 1px solid;
        display:inline-flex; align-items:center; gap:4px;
    }
    .save-row-btn { background: var(--role-manager-soft); border-color: rgba(47,158,122,0.25); color: var(--role-manager); }
    .save-row-btn:hover { background: rgba(47,158,122,0.14); }
    .delete-row-btn { background: rgba(229,72,77,0.06); border-color: rgba(229,72,77,0.2); color: var(--danger); }
    .delete-row-btn:hover { background: rgba(229,72,77,0.1); }
    .view-row-btn { background: transparent; border-color: var(--border); color: var(--text-secondary); }
    .view-row-btn:hover { background: var(--bg-surface-raised); color: var(--text-primary); border-color: #33333A; }
    .admin-row-profile {
        margin-top: 10px; padding: 12px 14px;
        background: var(--bg-base);
        border: 1px solid var(--border-soft);
        border-radius: var(--radius-sm);
        font-size: 12px; color: var(--text-secondary);
        display: flex; flex-direction: column; gap: 4px;
        overflow-wrap: break-word;
    }
    .admin-row-profile b { color: var(--text-primary); font-weight: 500; }
    .xp-chart-wrap {
        margin-top: 10px;
        background: var(--bg-surface);
        border: 1px solid var(--border-soft);
        border-radius: var(--radius-sm);
        padding: 12px 8px 4px;
        height: 140px;
        position: relative;
    }
    .xp-chart-wrap canvas { max-height: 100%; }
    .xp-chart-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); font-size: 11px; }
    .xp-chart-loading { display: flex; align-items: center; justify-content: center; height: 100%; }
    .xp-chart-loading .skel { width: 90%; height: 70%; border-radius: 6px; }
    .role-lock-note { font-size: 11px; color: var(--text-muted); }

    /* Settings */
    .settings-list { display: flex; flex-direction: column; gap: 14px; }
    .settings-item {
        display: flex; justify-content: space-between; align-items: center;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border-soft);
        gap: 10px; flex-wrap: wrap;
    }
    .settings-item:last-child { border-bottom: none; padding-bottom: 0; }
    .settings-info h4 {
        font-size: 13px; font-weight: 500;
        margin-bottom: 3px;
        display:flex; align-items:center; gap:6px;
        color: var(--text-primary);
    }
    .settings-info p { font-size: 12px; color: var(--text-muted); }

    /* Task editor */
    .task-editor {
        background: var(--bg-base);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 14px;
        margin-top: 10px;
        display: flex; flex-direction: column; gap: 10px;
    }
    .task-editor-row { display: flex; gap: 8px; flex-wrap: wrap; }
    .task-editor-row > * { flex: 1 1 160px; min-width: 0; }
    .tasks-section-title {
        font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
        color: var(--text-muted); font-weight: 600;
        margin: 20px 0 10px;
        display:flex; align-items:center; gap:6px;
    }
    .tasks-section-title:first-child { margin-top: 0; }
    .tasks-done-toggle {
        display: flex; align-items: center; gap: 6px;
        font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
        color: var(--text-muted); font-weight: 600;
        margin: 20px 0 10px; cursor: pointer;
        padding: 8px 0;
        border-top: 1px solid var(--border-soft);
        user-select: none;
    }
    .tasks-done-toggle:hover { color: var(--text-secondary); }
    .tasks-done-list { animation: fadeIn 0.15s ease; }
    .tasks-empty { text-align: center; color: var(--text-muted); padding: 28px 0; font-size: 13px; }

    /* Shimmer skeletons */
    .skel {
        background: linear-gradient(90deg, var(--bg-surface-raised) 0%, var(--bg-surface-hover) 50%, var(--bg-surface-raised) 100%);
        background-size: 200% 100%;
        border-radius: 4px;
        animation: shimmer 1.3s linear infinite;
    }
    @keyframes shimmer {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
    .skel-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
    .skel-row .skel.avatar { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
    .skel-row .skel.line { height: 10px; flex: 1; }
    .skel-row .skel.line.short { flex: 0 0 60px; }
    .skel-row .skel.badge { width: 56px; height: 18px; border-radius: 10px; flex-shrink: 0; }
    .skel-task-card {
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 14px; margin-bottom: 10px;
        min-height: 80px;
    }
    .skel-task-card .skel.line { height: 12px; margin-bottom: 8px; }
    .skel-task-card .skel.line.w60 { width: 60%; }
    .skel-task-card .skel.line.w90 { width: 90%; }

    /* Pagination */
    .pagination-row {
        display: flex; align-items: center; justify-content: center; gap: 12px;
        margin-top: 14px; padding-top: 12px;
        border-top: 1px solid var(--border-soft);
    }
    .page-btn {
        background: var(--bg-surface);
        border: 1px solid var(--border);
        color: var(--text-secondary);
        width: 30px; height: 30px;
        border-radius: var(--radius-sm);
        cursor: pointer; font-size: 13px;
        display: flex; align-items: center; justify-content: center;
        transition: background 0.12s, border-color 0.12s;
    }
    .page-btn:hover:not(:disabled) { background: var(--bg-surface-raised); color: var(--text-primary); border-color: #33333A; }
    .page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
    .page-indicator { font-size: 11px; color: var(--text-muted); min-width: 50px; text-align: center; font-variant-numeric: tabular-nums; }

    /* Empty state */
    .empty-state {
        display: flex; flex-direction: column; align-items: center; text-align: center;
        padding: 36px 16px; color: var(--text-muted);
    }
    .empty-state .empty-icon { margin-bottom: 10px; opacity: 0.5; color: var(--text-muted); }
    .empty-state .empty-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
    .empty-state .empty-desc { font-size: 12px; margin-bottom: 14px; max-width: 280px; line-height: 1.5; }
    .empty-state .btn-primary { width: auto; padding: 8px 14px; margin-top: 0; font-size: 12px; }

    /* Toast */
    #toast {
        position: fixed; bottom: 20px; left: 50%;
        transform: translateX(-50%) translateY(80px);
        background: var(--bg-surface);
        border: 1px solid var(--border);
        color: var(--text-primary);
        padding: 10px 16px;
        border-radius: var(--radius-md);
        font-size: 12px; font-weight: 500;
        max-width: 90vw;
        transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
        z-index: 9999;
        opacity: 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        display: flex; align-items: center; gap: 8px;
    }
    #toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

    /* Analytics */
    .heatmap-wrap { margin-top: 8px; overflow-x: auto; padding-bottom: 2px; }
    .heatmap-legend {
        display:flex; align-items:center; gap:4px;
        font-size: 10px; color:var(--text-muted);
        margin-top: 8px; justify-content:flex-end;
        font-weight: 500;
    }
    .heatmap-legend-cell { width:10px; height:10px; border-radius:2px; }
    .analytics-grid {
        display:grid;
        grid-template-columns: 1fr 1fr;
        gap:12px;
        margin-top:12px;
    }
    .mini-chart-wrap {
        background: var(--bg-base);
        border: 1px solid var(--border-soft);
        border-radius: var(--radius-md);
        padding: 14px;
        height: 200px;
        position: relative;
        display:flex; flex-direction:column;
    }
    .mini-chart-head { display:flex; justify-content:space-between; align-items:center; margin-bottom: 4px; }
    .mini-chart-title { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 500; }
    .mini-chart-value { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
    .mini-chart-trend {
        font-size: 11px; font-weight: 500;
        display:inline-flex; align-items:center; gap:3px;
        padding: 2px 6px; border-radius: 8px;
    }
    .trend-up { color: var(--role-manager); background: var(--role-manager-soft); }
    .trend-down { color: var(--danger); background: rgba(229,72,77,0.08); }
    .mini-chart-body { flex:1; position:relative; min-height: 0; margin-top: 8px; }

    /* Offline banner */
    .offline-banner {
        position: fixed; top: 12px; left: 50%;
        transform: translateX(-50%) translateY(-60px);
        background: var(--role-deputy);
        color: #fff;
        padding: 8px 14px;
        border-radius: var(--radius-sm);
        font-size: 12px; font-weight: 500;
        z-index: 9998;
        transition: transform 0.25s;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        display:flex; align-items:center; gap:6px;
    }
    .offline-banner.show { transform: translateX(-50%) translateY(0); }

    .bottom-nav { display: none; }

    @media (max-width: 860px) {
        .sidebar { display: none; }
        .mobile-topbar { display: flex; }
        .main-content { padding: 14px 14px 92px; }
        .grid-layout { grid-template-columns: 1fr; gap: 14px; }
        .analytics-grid { grid-template-columns: 1fr; }
        .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
        .stat-box { padding: 12px; }
        .stat-box h3 { font-size: 17px; }
        .bottom-nav {
            display: flex; position: fixed;
            bottom: 0; left: 0; right: 0;
            background: rgba(11,11,14,0.95);
            backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
            border-top: 1px solid var(--border);
            padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
            z-index: 40;
            justify-content: space-around;
        }
        .bottom-nav-btn {
            display: flex; flex-direction: column;
            align-items: center; gap: 2px;
            background: none; border: none;
            color: var(--text-muted);
            font-size: 10px;
            padding: 6px 4px;
            border-radius: var(--radius-sm);
            flex: 1; min-width: 0;
            cursor: pointer;
            transition: color 0.12s;
        }
        .bottom-nav-btn .icon { font-size: 17px; display:flex; align-items:center; justify-content:center; }
        .bottom-nav-btn.active { color: var(--accent-hover); }
    }
