:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;
    --text: #101828;
    --text-muted: #667085;
    --text-faint: #98a2b3;
    --primary: #2f5bea;
    --primary-hover: #2546bd;
    --primary-soft: #eaf0fe;
    --success-bg: #e7f6ec;
    --success-text: #166534;
    --error-bg: #fdecec;
    --error-text: #b42318;
    --info-bg: #eaf0fe;
    --info-text: #2546bd;
    --warning-bg: #fdf3e7;
    --warning-text: #b54708;
    --radius: 10px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

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

/* ---------------- Top bar ---------------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}
.brand-name { font-size: 15px; }
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.user-email {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ---------------- Layout ---------------- */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px 48px;
}
.footer {
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 13px;
}
.footer .container { padding: 16px; }

/* ---------------- Cards ---------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
.auth-wrap {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.auth-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.auth-icon svg { width: 26px; height: 26px; }
.auth-card h1 { font-size: 20px; margin: 0 0 8px; }
.auth-card .sub { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }
.auth-meta { color: var(--text-faint); font-size: 12px; margin-top: 16px; }
.auth-meta p { margin: 4px 0; }

/* ---------------- Forms ---------------- */
.field { text-align: left; margin-bottom: 14px; }
.field label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-size: 16px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 91, 234, 0.15);
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    line-height: 1.5;
}
.badge-admin { background: var(--info-bg); color: var(--info-text); }

/* ---------------- Flash ---------------- */
.flash {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 16px;
}
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-error   { background: var(--error-bg);   color: var(--error-text); }
.flash-info    { background: var(--info-bg);    color: var(--info-text); }

/* ---------------- Generic page intro ---------------- */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.page-head h1 { font-size: 22px; margin: 0; }

.note { color: var(--text-muted); font-size: 14px; }

@media (max-width: 480px) {
    .user-email { max-width: 32vw; }
    .card { padding: 20px; }
}

/* ================================================================
   Fase 3 — Requisição e confirmação
   ================================================================ */

/* ---------------- Requisição: tipo de documento ---------------- */
.req-card { max-width: 600px; }

.field-group { border: none; margin: 0 0 14px; padding: 0; }
.field-legend {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.type-toggle {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.type-option {
    flex: 1;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    user-select: none;
}
.type-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.type-option:hover { border-color: var(--primary); color: var(--primary); }
.type-option--active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

/* ---------------- Forms: extras ---------------- */
.field-hint {
    display: block;
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 4px;
}
.req-mark { color: var(--error-text); }

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    margin-bottom: 20px;
}
.check-row input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.check-hint { color: var(--text-faint); font-size: 13px; display: block; }
.req-actions { margin-top: 4px; }
.error-list { margin: 0; padding: 0 0 0 18px; }
.error-list li { margin-bottom: 4px; }

/* ---------------- Confirmação ---------------- */
.confirm-card {
    max-width: 560px;
    text-align: center;
}
.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success-text);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.confirm-label {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 4px;
}
.confirm-number {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--primary);
    margin: 0 0 10px;
    font-variant-numeric: tabular-nums;
}
.copy-btn { margin-bottom: 22px; }

.confirm-meta {
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 0 0 20px;
}
.confirm-row {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.confirm-row:last-child { border-bottom: none; }
.confirm-row dt {
    width: 120px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-weight: 400;
}
.confirm-row dd { margin: 0; color: var(--text); }

.confirm-email-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 20px;
    text-align: left;
}
.notice--ok   { background: var(--success-bg); color: var(--success-text); }
.notice--warn { background: var(--warning-bg); color: var(--warning-text); }

.confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------------- Badges de tipo e estado ---------------- */
.badge-type--oficio      { background: var(--info-bg);    color: var(--info-text);    }
.badge-type--informacao  { background: var(--success-bg); color: var(--success-text); }
.badge-status--rascunho  { background: var(--warning-bg); color: var(--warning-text); }
.badge-status--carregado { background: var(--success-bg); color: var(--success-text); }

@media (max-width: 480px) {
    .confirm-number { font-size: 24px; }
    .confirm-row dt { width: 90px; }
    .confirm-actions .btn { width: 100%; }
}

/* ================================================================
   Fase 4 — Lista, detalhe, filtros, paginação
   ================================================================ */

/* ── Acessibilidade ── */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ── Barra de filtros ── */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}
.filter-search {
    position: relative;
}
.filter-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    pointer-events: none;
}
.filter-search-input {
    padding-left: 38px;
}
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.select {
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s;
}
.select:focus { border-color: var(--primary); }

/* ── Sumário ── */
.list-summary {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 12px;
}

/* ── Tabela (visível em ecrãs ≥ 640 px) ── */
.table-wrap {
    display: none;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.doc-table thead {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.doc-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.doc-table th a {
    color: var(--text-muted);
    text-decoration: none;
}
.doc-table th a:hover { color: var(--primary); }
.th-actions { width: 40px; }

.doc-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}
.doc-table tbody tr:last-child { border-bottom: none; }
.doc-table tbody tr:hover { background: var(--bg); }
.doc-table td { padding: 11px 14px; vertical-align: middle; }

.doc-number {
    font-weight: 600;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    white-space: nowrap;
}
.badge-inline { margin-left: 6px; }

.td-clamp {
    display: block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.td-owner { font-size: 13px; color: var(--text-muted); }
.td-date  { font-size: 13px; white-space: nowrap; }
.td-nowrap { white-space: nowrap; }
.td-subject { max-width: 280px; }
.td-dest    { max-width: 160px; }
.td-actions { text-align: center; }
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: background .15s, color .15s;
}
.action-btn:hover { background: var(--bg); color: var(--primary); }

/* ── Cards móveis (visíveis por omissão, escondidos em ecrãs largos) ── */
.doc-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.doc-card {
    display: block;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.doc-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47,91,234,.08);
    text-decoration: none;
}
.doc-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.doc-card-subject {
    font-size: 15px;
    font-weight: 500;
    margin: 0 0 8px;
    line-height: 1.4;
}
.doc-card-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.doc-card-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Estado vazio ── */
.empty-state {
    text-align: center;
    padding: 36px 24px;
}
.empty-state--inline { padding: 20px 0; }
.empty-icon {
    color: var(--text-faint);
    margin: 0 auto 12px;
    display: block;
}
.empty-title {
    font-size: 15px;
    color: var(--text-muted);
    margin: 0 0 14px;
}

/* ── Paginação ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 14px;
    text-decoration: none;
    transition: border-color .15s, background .15s, color .15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-btn--active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}
.page-ellipsis {
    font-size: 14px;
    color: var(--text-faint);
    padding: 0 4px;
}

/* ── Detalhe de documento ── */
.page-head-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}
.back-link:hover { color: var(--primary); }
.page-title-doc {
    font-size: 22px;
    margin: 0;
    font-variant-numeric: tabular-nums;
}
.page-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.doc-detail-card { margin-bottom: 0; }
.doc-number-lg {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

/* ── Formulário de edição inline ── */
.edit-form { margin-top: 4px; }
.edit-form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* ── Zona de perigo (admin) ── */
.card-danger {
    border-color: #fecdca;
    background: #fff;
}
.card-danger .section-title { color: var(--error-text); }
.btn-danger {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: #fecdca;
}
.btn-danger:hover { background: #fecdca; }

/* ── Layout adaptativo ── */
@media (min-width: 640px) {
    .table-wrap  { display: block; }
    .doc-cards   { display: none; }
    .filter-bar  { flex-direction: row; align-items: flex-start; }
    .filter-search { flex: 1; }
    .page-head-left { flex-direction: row; align-items: center; gap: 16px; }
    .back-link { border-right: 1px solid var(--border); padding-right: 16px; }
}
@media (max-width: 639px) {
    .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-head-actions { width: 100%; }
    .edit-form-actions .btn { flex: 1; }
}

/* ================================================================
   Fase 5 — Upload, histórico de versões, ficheiros
   ================================================================ */

/* ── Zona de drag-and-drop ── */
.drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-bottom: 12px;
    outline: none;
}
.drop-zone:hover,
.drop-zone:focus,
.drop-zone--over {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.drop-zone svg { color: var(--text-faint); margin: 0 auto 10px; display: block; }
.drop-zone-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0 0 4px;
}
.drop-zone-hint {
    font-size: 12px;
    color: var(--text-faint);
    margin: 0;
    word-break: break-all;
}

/* ── Pré-visualização de ficheiros seleccionados ── */
.file-preview-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.file-preview-item svg { color: var(--text-faint); flex-shrink: 0; }
.fp-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fp-size { color: var(--text-faint); white-space: nowrap; flex-shrink: 0; }

/* ── Botões de upload ── */
.upload-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.upload-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0 16px;
}

/* ── Versões ── */
.version-block { margin-bottom: 16px; }
.version-block:last-child { margin-bottom: 0; }
.version-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.version-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}
.version-meta {
    font-size: 12px;
    color: var(--text-faint);
}

/* ── Lista de ficheiros por versão ── */
.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    transition: background .1s;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--bg); }

.file-icon { color: var(--text-faint); flex-shrink: 0; display: flex; }
.file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-size {
    font-size: 12px;
    color: var(--text-faint);
    white-space: nowrap;
    flex-shrink: 0;
}
.file-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.action-btn--danger { color: var(--error-text); }
.action-btn--danger:hover { background: var(--error-bg); }

/* ── Responsivo ── */
@media (max-width: 480px) {
    .drop-zone { padding: 20px 12px; }
    .file-item { flex-wrap: wrap; }
    .file-name { min-width: 0; width: calc(100% - 80px); }
    .upload-actions .btn { flex: 1; }
}

/* ================================================================
   Fase 6 — Administração
   ================================================================ */

/* ── Layout admin ── */
.admin-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.admin-nav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.admin-nav-inner::-webkit-scrollbar { display: none; }

.admin-nav-link {
    display: inline-block;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    transition: color .15s, border-color .15s;
}
.admin-nav-link:hover { color: var(--primary); text-decoration: none; }
.admin-nav-link--active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.admin-nav-link--back {
    margin-left: auto;
    color: var(--text-faint);
    font-size: 12px;
}

.admin-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.admin-page-head { margin-bottom: 20px; }
.admin-page-head h1 { font-size: 22px; margin: 0 0 4px; }

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 4px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-sub   { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* ── Type breakdown bar ── */
.type-breakdown { display: flex; flex-direction: column; gap: 10px; }
.type-breakdown-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.breakdown-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}
.breakdown-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width .4s ease;
    min-width: 2px;
}
.breakdown-count { font-size: 13px; color: var(--text-muted); width: 30px; text-align: right; }

/* ── Shortcut cards ── */
.admin-shortcuts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}
.shortcut-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.shortcut-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47,91,234,.08);
    text-decoration: none;
    color: var(--primary);
}
.shortcut-card svg { color: var(--primary); flex-shrink: 0; }

/* ── User list extras ── */
.user-email-cell {
    font-size: 14px;
    word-break: break-all;
}
.badge-token {
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: 10px;
    padding: 1px 6px;
    margin-left: 6px;
}
.text-muted-sm { font-size: 13px; color: var(--text-muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-warn { color: var(--warning-text); border-color: #fde68a; }
.btn-warn:hover { background: var(--warning-bg); }

/* ── User cards (mobile) ── */
.user-card { margin-bottom: 0; }
.user-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
}
.user-card-meta {
    font-size: 12px;
    color: var(--text-faint);
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.user-card-actions { display: flex; gap: 8px; }

/* ── Audit log ── */
.audit-action {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
}
.audit-action--auth { background: var(--info-bg);    color: var(--info-text);    }
.audit-action--doc  { background: var(--success-bg); color: var(--success-text); }
.audit-action--file { background: var(--warning-bg); color: var(--warning-text); }
.audit-action--admin { background: var(--error-bg);  color: var(--error-text);   }

.td-desc {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

.audit-card { padding: 12px 16px; margin-bottom: 0; }
.audit-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
}
.audit-user { font-size: 13px; color: var(--text-muted); margin: 0 0 4px; }
.audit-desc { font-size: 13px; color: var(--text); margin: 0; }

/* ── Counter page ── */
.form-static {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

/* ── Responsive ── */
@media (min-width: 640px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .admin-shortcuts { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 639px) {
    .admin-shortcuts { grid-template-columns: repeat(2, 1fr); }
    .shortcut-card { flex-direction: column; text-align: center; gap: 8px; }
    .admin-nav-link--back { display: none; }
}
