@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap');

:root {
    --bg: #f4efe4;
    --bg-soft: #fbf8f2;
    --surface: #fffdf8;
    --surface-strong: #ffffff;
    --border: #dfd3bb;
    --border-strong: #c5b38f;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #174e3b;
    --primary-dark: #103427;
    --secondary: #7c5d2e;
    --danger: #991b1b;
    --warning: #9a6700;
    --shadow: 0 20px 50px rgba(59, 46, 21, 0.08);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    direction: rtl;
    background:
        radial-gradient(circle at top right, rgba(23, 78, 59, 0.08), transparent 20%),
        radial-gradient(circle at left, rgba(124, 93, 46, 0.08), transparent 18%),
        var(--bg);
    color: var(--text);
    font-family: 'Noto Naskh Arabic', Tahoma, sans-serif;
    line-height: 1.8;
}

a {
    color: inherit;
    text-decoration: none !important;
}

button,
input,
textarea {
    font: inherit;
}

.site-shell {
    width: min(1240px, calc(100% - 32px));
    margin: 24px auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    padding: 20px 24px;
    border: 1px solid rgba(223, 211, 187, 0.9);
    border-radius: 28px;
    background: rgba(255, 253, 248, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Logo link — no underline, subtle hover lift */
a.brand-link {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 18px;
    padding: 6px 10px 6px 6px;
    margin: -6px -10px -6px -6px;
    transition: background 0.18s ease, transform 0.18s ease;
    outline-offset: 4px;
}

a.brand-link:hover,
a.brand-link:focus {
    background: rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
    text-decoration: none !important;
}

a.brand-link:hover .brand-badge {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 700;
    letter-spacing: 1px;
    flex-shrink: 0;
    transition: box-shadow 0.18s ease;
}

.brand-title {
    margin: 0;
    font-family: 'Amiri', serif;
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.2;
    color: var(--text);
}

.brand-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar-nav a,
.user-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none !important;
}

.topbar-nav a:hover,
.topbar-nav a:focus,
.topbar-nav a:visited,
.user-chip:hover,
.user-chip:focus,
.user-chip:visited {
    text-decoration: none !important;
}

/* Hard override to prevent any underline in top navigation */
.topbar-nav a,
.topbar-nav a:hover,
.topbar-nav a:focus,
.topbar-nav a:active,
.topbar-nav a:visited,
.topbar-nav a *,
.topbar-nav a:hover *,
.topbar-nav a:focus *,
.topbar-nav a:active *,
.topbar-nav a:visited * {
    text-decoration: none !important;
    border-bottom: 0 !important;
    box-shadow: none;
}

.user-chip {
    background: #f7f8fa;
    border-color: #dbe2ea;
    color: #1f2937;
    font-weight: 700;
}

.topbar-nav a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.link-danger:hover {
    color: var(--danger) !important;
    border-color: rgba(153, 27, 27, 0.35) !important;
}

.page-content {
    display: grid;
    gap: 24px;
}

.flash,
.inline-error {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid transparent;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.flash-success {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.24);
    color: #166534;
}

.flash-error,
.inline-error {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.24);
    color: #991b1b;
}

.dashboard-hero,
.app-card,
.auth-panel,
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dashboard-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 26px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--secondary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.dashboard-hero h2,
.auth-panel h2,
.card-head h2,
.empty-state h3 {
    margin: 0 0 8px;
    font-family: 'Amiri', serif;
    font-size: clamp(28px, 4vw, 36px);
    line-height: 1.2;
}

.dashboard-hero p,
.card-head p,
.auth-panel p,
.empty-state p,
.muted-text {
    margin: 0;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.limit-badge,
.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #f6efe2;
    color: var(--secondary);
    border: 1px solid rgba(124, 93, 46, 0.22);
    font-size: 14px;
}

.status-chip-muted {
    background: #eef2f7;
    color: #475569;
    border-color: rgba(71, 85, 105, 0.18);
}

.status-chip-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.24);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.stat-card {
    padding: 22px;
}

.stat-card-highlight {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 243, 233, 0.98)),
        var(--surface);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: clamp(24px, 3vw, 34px);
    font-family: 'Amiri', serif;
}

.stat-card small {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.account-shell {
    display: grid;
    gap: 22px;
}

.account-header-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 26px;
    border: 1px solid #dde3eb;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.account-header-copy {
    max-width: 720px;
}

.account-header-copy h2 {
    margin: 0 0 8px;
    font-family: 'Amiri', serif;
    font-size: clamp(30px, 4vw, 38px);
}

.account-header-copy p {
    margin: 0;
    color: #667085;
}

.account-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.account-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
    gap: 22px;
}

.account-content-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.account-profile-card {
    padding: 26px;
    border-color: #dfe5ec;
}

.account-profile-top {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.account-avatar-minimal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: #eef3f8;
    color: #24364b;
    font-family: 'Amiri', serif;
    font-size: 28px;
    font-weight: 700;
    border: 1px solid #d7e0ea;
}

.account-profile-text h3 {
    margin: 0 0 4px;
    font-size: 24px;
    font-family: 'Amiri', serif;
    word-break: break-word;
}

.account-profile-text p {
    margin: 0;
    color: #667085;
}

.account-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.account-summary-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #d9e2eb;
    background: #f7f9fb;
    color: #344054;
    font-size: 14px;
}

.account-inline-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.account-inline-stat {
    padding: 16px;
    border: 1px solid #e6ebf1;
    border-radius: 14px;
    background: #fbfcfd;
}

.account-inline-stat span {
    display: block;
    margin-bottom: 8px;
    color: #667085;
    font-size: 13px;
}

.account-inline-stat strong {
    display: block;
    font-size: 18px;
    font-family: 'Amiri', serif;
}

.account-status-list {
    display: grid;
    gap: 14px;
}

.account-status-item {
    padding: 18px;
    border: 1px solid #e6ebf1;
    border-radius: 14px;
    background: #fcfcfd;
}

.account-status-item span {
    display: block;
    margin-bottom: 8px;
    color: #667085;
    font-size: 13px;
}

.account-status-item strong {
    display: block;
    margin-bottom: 6px;
    font-size: 22px;
    font-family: 'Amiri', serif;
}

.account-status-item small {
    color: #667085;
    font-size: 13px;
    line-height: 1.7;
}

.account-info-table,
.account-action-list {
    display: grid;
    gap: 12px;
}

.account-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border: 1px solid #e6ebf1;
    border-radius: 14px;
    background: #fcfcfd;
}

.account-info-row span {
    color: #667085;
}

.account-info-row strong {
    text-align: left;
    word-break: break-word;
}

.account-action-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #ffffff;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.account-action-link:hover {
    border-color: #c8d3df;
    background: #fafbfd;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.account-action-link div {
    display: grid;
    gap: 4px;
}

.account-action-link strong {
    font-size: 20px;
    font-family: 'Amiri', serif;
}

.account-action-link span {
    color: #667085;
}

.account-action-link b {
    color: #475467;
    font-weight: 700;
    white-space: nowrap;
}

.account-action-link-danger {
    border-color: #f3d0d0;
    background: #fff8f8;
}

.account-action-link-danger:hover {
    border-color: #e8b4b4;
    background: #fff4f4;
}

.app-card {
    padding: 24px;
}

.card-head,
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.toolbar {
    flex-wrap: wrap;
}

.page-grid {
    display: grid;
    grid-template-columns: minmax(0, 480px) minmax(0, 1fr);
    gap: 24px;
}

.document-form,
.stack-form {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    font-weight: 700;
    color: #374151;
}

.field input,
.field select,
.field textarea,
.select-field select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.select-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(23, 78, 59, 0.12);
}

.field textarea {
    min-height: 240px;
    resize: vertical;
}

.field-hint {
    color: var(--muted);
    font-size: 13px;
}

.field-full {
    grid-column: 1 / -1;
}

.document-editor-grid {
    align-items: start;
}

.template-switcher {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
    gap: 16px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #e6ebf1;
    border-radius: 16px;
    background: #fbfcfd;
}

.template-switcher-note {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-radius: 14px;
    background: #f5f8fb;
    color: #475467;
}

.sections-stack {
    display: grid;
    gap: 16px;
}

.section-field {
    padding: 16px;
    border: 1px solid #e6ebf1;
    border-radius: 16px;
    background: #fcfcfd;
}

.section-field textarea {
    min-height: 150px;
}

.field-error {
    color: var(--danger);
    font-size: 14px;
}

.form-actions,
.table-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(16, 52, 39, 0.08);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.btn-secondary {
    background: #f3ede2;
    color: var(--secondary);
    border-color: rgba(124, 93, 46, 0.22);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-danger {
    background: rgba(153, 27, 27, 0.08);
    border-color: rgba(153, 27, 27, 0.24);
    color: var(--danger);
}

.btn-small {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
}

.btn-block {
    width: 100%;
}

.table-wrap {
    overflow: auto;
}

.documents-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

.documents-table th,
.documents-table td {
    padding: 16px 14px;
    border-bottom: 1px solid #eee5d5;
    text-align: right;
    vertical-align: middle;
}

.documents-table th {
    color: var(--secondary);
    background: #fbf8f1;
    font-weight: 700;
}

.inline-form {
    margin: 0;
}

.account-list {
    display: grid;
    gap: 12px;
}

.account-page .app-card,
.account-page .stat-card {
    border-color: #dfe5ec;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.account-main-grid {
    align-items: start;
}

.account-panel {
    overflow: hidden;
}

.account-hero {
    align-items: stretch;
    gap: 24px;
    background:
        radial-gradient(circle at top left, rgba(23, 78, 59, 0.1), transparent 24%),
        radial-gradient(circle at bottom right, rgba(124, 93, 46, 0.1), transparent 22%),
        var(--surface);
}

.account-hero-copy {
    display: grid;
    align-content: center;
    gap: 14px;
    max-width: 660px;
}

.account-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.account-soft-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #334155;
    font-size: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.account-identity-card {
    min-width: min(360px, 100%);
    padding: 22px;
    border-radius: 22px;
    border: 1px solid rgba(23, 78, 59, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 240, 228, 0.92));
    box-shadow: 0 18px 36px rgba(51, 42, 22, 0.08);
}

.account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-family: 'Amiri', serif;
    font-size: 34px;
    font-weight: 700;
    box-shadow: 0 14px 24px rgba(23, 78, 59, 0.18);
}

.account-identity-text {
    display: grid;
    gap: 4px;
    margin-bottom: 18px;
}

.account-identity-text strong {
    font-size: 24px;
    font-family: 'Amiri', serif;
}

.account-identity-text span {
    color: var(--muted);
    word-break: break-word;
}

.account-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.account-meta-grid div {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #eadfc8;
}

.account-meta-grid span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
}

.account-meta-grid strong {
    font-size: 18px;
    font-family: 'Amiri', serif;
}

.account-stats-grid {
    margin-top: -6px;
}

.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid #eee5d5;
    border-radius: 16px;
    background: linear-gradient(180deg, #fffdfa, #fffaf2);
}

.account-row span {
    color: var(--muted);
}

.account-row strong {
    text-align: left;
}

.quick-actions {
    display: grid;
    gap: 12px;
}

.usage-stack {
    display: grid;
    gap: 16px;
}

.helper-note {
    padding: 14px 16px;
    border-radius: 16px;
    background: #f7f1e6;
    border: 1px solid #ead9b8;
    color: #6b5a34;
}

.helper-note-strong {
    background: linear-gradient(135deg, rgba(23, 78, 59, 0.1), rgba(124, 93, 46, 0.12));
    border-color: rgba(23, 78, 59, 0.15);
    color: #244133;
}

.action-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.action-tile {
    display: grid;
    gap: 10px;
    min-height: 170px;
    padding: 22px;
    border-radius: 20px;
    border: 1px solid #eadfc8;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 244, 235, 0.98));
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.action-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(23, 78, 59, 0.26);
    box-shadow: 0 16px 34px rgba(63, 49, 22, 0.1);
}

.action-tile strong {
    font-size: 24px;
    font-family: 'Amiri', serif;
}

.action-tile span {
    color: var(--muted);
}

.action-tile-accent {
    background: linear-gradient(135deg, rgba(23, 78, 59, 0.94), rgba(124, 93, 46, 0.92));
    border-color: transparent;
}

.action-tile-accent strong,
.action-tile-accent span {
    color: #fff;
}

.action-tile-danger {
    background: linear-gradient(135deg, rgba(153, 27, 27, 0.95), rgba(127, 29, 29, 0.92));
    border-color: transparent;
}

.action-tile-danger strong,
.action-tile-danger span {
    color: #fff;
}

.table-note {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.role-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 700;
}

.role-badge-admin {
    background: rgba(23, 78, 59, 0.1);
    color: var(--primary);
    border-color: rgba(23, 78, 59, 0.2);
}

.role-badge-user {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.18);
}

.status-badge-pending {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.24);
}

.status-badge-approved {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.24);
}

.status-badge-rejected {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
    border-color: rgba(220, 38, 38, 0.24);
}

.admin-user-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    align-items: end;
    gap: 10px;
}

.select-field {
    display: grid;
    gap: 6px;
}

.select-field span {
    font-size: 13px;
    font-weight: 700;
    color: #4b5563;
}

.empty-state {
    padding: 28px;
    text-align: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 245, 237, 0.96));
    border: 1px dashed var(--border-strong);
    border-radius: 18px;
}

.preview-frame {
    overflow: auto;
    padding: 10px;
    border-radius: 18px;
    background: linear-gradient(180deg, #f1eadb, #ebe2d1);
    border: 1px solid #d7c8ab;
}

.preview-frame .pv-page {
    box-shadow: 0 18px 40px rgba(45, 35, 15, 0.15);
}

.auth-page .topbar {
    margin-bottom: 28px;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
    gap: 24px;
}

.auth-panel {
    padding: 28px;
}

.auth-panel-accent {
    background:
        linear-gradient(135deg, rgba(23, 78, 59, 0.95), rgba(124, 93, 46, 0.94)),
        var(--surface);
    color: #fff;
}

.auth-panel-accent p,
.auth-panel-accent .feature-list,
.auth-panel-accent .metric-strip span {
    color: rgba(255, 255, 255, 0.9);
}

.feature-list {
    margin: 22px 0 0;
    padding: 0 20px 0 0;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.metric-strip div {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.metric-strip strong {
    display: block;
    margin-bottom: 4px;
    font-size: 18px;
}

.auth-switch {
    margin-top: 18px !important;
    color: var(--muted);
}

.auth-switch a {
    color: var(--primary);
    font-weight: 700;
}

@media (max-width: 1100px) {
    .stats-grid,
    .auth-layout,
    .page-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero,
    .topbar,
    .card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .account-header-panel,
    .account-profile-top,
    .account-info-row,
    .account-action-link {
        flex-direction: column;
        align-items: flex-start;
    }

    .account-overview-grid,
    .account-content-grid,
    .account-inline-stats,
    .account-meta-grid,
    .action-tiles {
        grid-template-columns: 1fr;
    }

    .account-hero {
        align-items: stretch;
    }

    .account-meta-grid,
    .action-tiles {
        grid-template-columns: 1fr;
    }

    .account-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .template-switcher {
        grid-template-columns: 1fr;
    }

    .admin-user-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .site-shell {
        width: min(100% - 18px, 100%);
        margin: 12px auto 24px;
    }

    .topbar,
    .app-card,
    .auth-panel,
    .dashboard-hero,
    .stat-card {
        padding: 18px;
        border-radius: 18px;
    }

    .topbar-nav,
    .form-actions,
    .table-actions,
    .hero-actions,
    .toolbar {
        width: 100%;
    }

    .topbar-nav a,
    .user-chip,
    .btn {
        width: 100%;
    }

    .metric-strip {
        grid-template-columns: 1fr;
    }
}

/* Professional UI refresh */
:root {
    --ui-accent: #0f7c58;
    --ui-accent-dark: #0b5f44;
    --ui-soft: #f3f8f6;
    --ui-border: #d6e1ee;
}

body {
    background:
        radial-gradient(circle at 8% 12%, rgba(15, 124, 88, 0.1), transparent 22%),
        radial-gradient(circle at 92% 90%, rgba(176, 132, 58, 0.12), transparent 24%),
        linear-gradient(180deg, #f7f5ef 0%, #f2f6fb 100%);
}

.site-shell {
    width: min(1280px, calc(100% - 32px));
}

.topbar {
    border: 1px solid var(--ui-border);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.brand-badge {
    box-shadow: 0 12px 22px rgba(15, 124, 88, 0.28);
}

.topbar-nav a,
.user-chip {
    border-color: #d2dbea;
    background: #ffffff;
    font-weight: 600;
    transition: all 0.2s ease;
}

.topbar-nav a:hover,
.user-chip:hover {
    border-color: var(--ui-accent);
    color: var(--ui-accent);
    background: var(--ui-soft);
    transform: translateY(-1px);
}

.dashboard-hero,
.app-card,
.auth-panel,
.stat-card {
    border-color: var(--ui-border);
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.dashboard-hero {
    background:
        radial-gradient(circle at 0% 0%, rgba(15, 124, 88, 0.1), transparent 28%),
        radial-gradient(circle at 100% 100%, rgba(176, 132, 58, 0.12), transparent 30%),
        #ffffff;
}

.stat-card {
    border-radius: 18px;
}

.btn {
    font-weight: 700;
    letter-spacing: 0.1px;
    border-radius: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ui-accent), var(--ui-accent-dark));
    border-color: var(--ui-accent-dark);
}

.btn-secondary {
    background: #eef5f9;
    border-color: #d7e2ef;
    color: #334155;
}

.btn-outline {
    border-color: #c9d5e5;
    color: #334155;
}

.btn-danger {
    background: #fff3f3;
    border-color: #f2caca;
}

.field input,
.field select,
.field textarea,
.select-field select {
    border-color: #d1dceb;
    border-radius: 12px;
    background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.select-field select:focus {
    border-color: var(--ui-accent);
    box-shadow: 0 0 0 4px rgba(15, 124, 88, 0.12);
}

.table-wrap {
    border: 1px solid #dce5f1;
    border-radius: 14px;
    overflow: auto;
    background: #fff;
}

.documents-table {
    min-width: 960px;
}

.documents-table th {
    background: #f3f7fc;
    color: #334155;
    border-bottom: 1px solid #dce5f1;
}

.documents-table td {
    border-bottom: 1px solid #e9eef5;
}

.documents-table tbody tr:hover {
    background: #f8fbff;
}

.card-head h2,
.dashboard-hero h2,
.auth-panel h2 {
    letter-spacing: 0.2px;
}

.empty-state {
    border: 1px dashed #cfd9e7;
    border-radius: 16px;
    padding: 20px;
    background: #f9fbff;
}

@media (max-width: 720px) {
    .site-shell {
        width: min(100% - 16px, 100%);
    }

    .table-wrap {
        border-radius: 12px;
    }
}

/* =========================
   Full Website UI Upgrade
   ========================= */
:root {
    --ux-bg: #f4f7fb;
    --ux-surface: #ffffff;
    --ux-surface-soft: #f8fbff;
    --ux-text: #0f172a;
    --ux-muted: #5b6475;
    --ux-border: #d7e1ef;
    --ux-primary: #0b6bcb;
    --ux-primary-dark: #07529c;
    --ux-success: #0f7c58;
    --ux-warm: #b7791f;
    --ux-danger: #b42318;
    --ux-shadow-sm: 0 10px 22px rgba(15, 23, 42, 0.05);
    --ux-shadow-md: 0 18px 42px rgba(15, 23, 42, 0.08);
    --ux-radius: 16px;
}

body {
    color: var(--ux-text);
    background:
        radial-gradient(circle at 4% 8%, rgba(11, 107, 203, 0.1), transparent 24%),
        radial-gradient(circle at 95% 92%, rgba(183, 121, 31, 0.12), transparent 26%),
        var(--ux-bg);
}

.site-shell {
    width: min(1320px, calc(100% - 28px));
    margin: 16px auto 28px;
}

.topbar {
    position: sticky;
    top: 8px;
    z-index: 50;
    border: 1px solid var(--ux-border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: var(--ux-shadow-md);
}

.brand-badge {
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ux-primary), var(--ux-success));
}

.brand-title {
    font-size: clamp(27px, 3.5vw, 36px);
}

.brand-subtitle {
    color: var(--ux-muted);
}

.topbar-nav {
    gap: 10px;
}

.topbar-nav a,
.user-chip {
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #cfdced;
    background: #fff;
    color: #1f2937;
    font-weight: 600;
    transition: all 0.2s ease;
}

.topbar-nav a:hover,
.topbar-nav a:focus,
.user-chip:hover,
.user-chip:focus {
    border-color: var(--ux-primary);
    background: #eef6ff;
    color: var(--ux-primary);
    transform: translateY(-1px);
}

.dashboard-hero,
.auth-panel,
.app-card,
.stat-card,
.account-header-panel,
.account-profile-card,
.account-status-item,
.account-inline-stat,
.account-info-row,
.account-action-link {
    border: 1px solid var(--ux-border);
    border-radius: var(--ux-radius);
    background: var(--ux-surface);
    box-shadow: var(--ux-shadow-sm);
}

.dashboard-hero {
    padding: 28px;
    background:
        radial-gradient(circle at 3% 10%, rgba(11, 107, 203, 0.1), transparent 25%),
        radial-gradient(circle at 96% 90%, rgba(15, 124, 88, 0.1), transparent 28%),
        var(--ux-surface);
}

.dashboard-hero h2,
.auth-panel h2,
.card-head h2 {
    color: #0b1220;
}

.eyebrow {
    color: var(--ux-primary-dark);
    letter-spacing: 0.3px;
}

.stats-grid {
    gap: 14px;
}

.stat-card {
    padding: 18px;
}

.stat-card strong {
    color: #0b1220;
}

.app-card {
    padding: 20px;
}

.card-head {
    margin-bottom: 14px;
}

.btn {
    min-height: 42px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.15px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ux-primary), var(--ux-primary-dark));
    border-color: var(--ux-primary-dark);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 12px 22px rgba(11, 107, 203, 0.25);
}

.btn-secondary {
    background: #f2f7fd;
    border-color: #d4e2f3;
    color: #24415f;
}

.btn-outline {
    border-color: #c7d5e8;
    color: #334155;
}

.btn-danger {
    background: #fff4f3;
    border-color: #f6ceca;
    color: var(--ux-danger);
}

.btn-small {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 10px;
}

.field span,
.form-label {
    font-weight: 700;
    color: #1e293b;
}

.field input,
.field select,
.field textarea,
.select-field select,
.form-control,
.form-select {
    border: 1px solid #cedaeb;
    border-radius: 12px;
    background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.select-field select:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--ux-primary);
    box-shadow: 0 0 0 4px rgba(11, 107, 203, 0.12);
    outline: none;
}

.table-wrap {
    border: 1px solid #d9e3f0;
    border-radius: 14px;
    background: #fff;
    overflow: auto;
}

.documents-table {
    min-width: 980px;
    table-layout: auto;
}

.documents-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f3f8ff;
    color: #1f3b59;
    border-bottom: 1px solid #d8e4f2;
}

.documents-table td {
    border-bottom: 1px solid #e9eff7;
    line-height: 1.55;
}

.documents-table tbody tr:hover {
    background: #f9fbff;
}

.documents-table td .table-note {
    margin-top: 4px;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
}

.auth-panel-accent {
    background:
        radial-gradient(circle at 10% 14%, rgba(11, 107, 203, 0.14), transparent 28%),
        radial-gradient(circle at 88% 86%, rgba(15, 124, 88, 0.14), transparent 30%),
        #f7fbff;
}

.metric-strip {
    gap: 12px;
}

.empty-state {
    border: 1px dashed #c7d6eb;
    border-radius: 14px;
    padding: 22px;
    background: var(--ux-surface-soft);
}

.stack-form {
    gap: 14px;
}

.auth-panel .stack-form,
.account-panel .stack-form {
    margin-top: 10px;
}

.field input,
.field select,
.field textarea,
.select-field select,
.form-control,
.form-select {
    min-height: 44px;
}

.field textarea,
.form-control.report-textarea {
    min-height: 150px;
}

.account-content-grid {
    align-items: start;
}

.account-action-link {
    border-radius: 12px;
}

.account-action-link b {
    color: #334155;
}

.account-action-link-danger b {
    color: #8a1c13;
}

.admin-user-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}

.admin-user-form .select-field {
    min-width: 0;
}

.admin-user-form .btn {
    width: 100%;
}

.table-actions {
    row-gap: 8px;
}

.role-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid transparent;
    font-size: 13px;
}

.status-badge-pending {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
}

.status-badge-approved {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

.status-badge-rejected {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fecdd3;
}

.role-badge-admin {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.role-badge-user {
    background: #f8fafc;
    color: #334155;
    border-color: #dbeafe;
}

.skeleton,
.loading-card {
    position: relative;
    overflow: hidden;
    background: #eef3f8;
    border-radius: 12px;
}

.skeleton::after,
.loading-card::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.flash,
.inline-error {
    border-radius: 12px;
    box-shadow: none;
}

.status-badge,
.role-badge,
.status-chip,
.limit-badge {
    border-radius: 999px;
    font-weight: 700;
}

@media (max-width: 991px) {
    .auth-layout,
    .page-grid,
    .account-overview-grid,
    .account-content-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        position: static;
    }
}

@media (max-width: 720px) {
    .site-shell {
        width: min(100% - 14px, 100%);
    }

    .dashboard-hero,
    .app-card,
    .auth-panel,
    .stat-card,
    .topbar {
        border-radius: 14px;
    }
}

/* Final UX polish and accessibility */
:root {
    --focus-ring: 0 0 0 3px rgba(11, 107, 203, 0.22);
}

*,
*::before,
*::after {
    -webkit-tap-highlight-color: transparent;
}

a,
button,
input,
select,
textarea {
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.topbar-nav a,
.topbar-nav a:hover,
.topbar-nav a:focus,
.topbar-nav a:active,
.topbar-nav a:visited,
.topbar-nav a *,
.topbar-nav a:hover *,
.topbar-nav a:focus *,
.topbar-nav a:active *,
.topbar-nav a:visited * {
    text-decoration: none !important;
}

.topbar {
    gap: 16px;
}

.topbar-nav a,
.user-chip {
    white-space: nowrap;
}

.brand-badge {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.4px;
}

.hero-actions,
.table-actions,
.form-actions,
.toolbar {
    gap: 10px;
}

.app-card,
.auth-panel,
.dashboard-hero {
    overflow: hidden;
}

.documents-table th,
.documents-table td {
    font-size: 15px;
}

.documents-table td {
    color: #1f2937;
}

.documents-table td:first-child,
.documents-table th:first-child {
    padding-right: 16px;
}

.empty-state h3 {
    margin-bottom: 6px;
}

.field-error {
    margin-top: 2px;
    font-weight: 600;
}

.flash {
    border-width: 1px;
}

.auth-switch a {
    color: var(--ux-primary);
    font-weight: 700;
}

.auth-switch a:hover {
    color: var(--ux-primary-dark);
}

.metric-strip > div {
    border: 1px solid #d3e2f3;
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.72);
}

.metric-strip strong {
    display: block;
    line-height: 1.2;
}

.metric-strip span {
    color: #516174;
}

@media (max-width: 991px) {
    .topbar {
        padding: 16px;
    }

    .brand-block {
        width: 100%;
    }

    .topbar-nav {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-user-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .topbar-nav a,
    .user-chip,
    .btn {
        justify-content: center;
    }

    .documents-table {
        min-width: 860px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero,
    .card-head {
        align-items: stretch;
    }

    .hero-actions .btn,
    .card-head .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Pixel-perfect final override layer */
:root {
    --pp-radius: 14px;
    --pp-radius-lg: 18px;
    --pp-gap: 16px;
}

/* Restore blue brand theme */
:root {
    --primary: #0b6bcb;
    --primary-dark: #07529c;
    --secondary: #1f3b59;
    --ux-primary: #0b6bcb;
    --ux-primary-dark: #07529c;
    --ux-success: #0b6bcb;
}

body {
    background:
        radial-gradient(circle at 4% 8%, rgba(11, 107, 203, 0.12), transparent 24%),
        radial-gradient(circle at 95% 92%, rgba(59, 130, 246, 0.12), transparent 26%),
        #f4f7fb;
}

.brand-badge {
    background: linear-gradient(135deg, #0b6bcb, #07529c) !important;
}

.topbar-nav a:hover,
.topbar-nav a:focus,
.user-chip:hover,
.user-chip:focus {
    border-color: #0b6bcb !important;
    background: #eef6ff !important;
    color: #0b6bcb !important;
}

.btn-primary,
.mission-step-card .btn-success,
.mission-step-card .btn-primary {
    background: linear-gradient(135deg, #0b6bcb, #07529c) !important;
    border-color: #07529c !important;
}

.btn-primary:hover {
    box-shadow: 0 12px 22px rgba(11, 107, 203, 0.28) !important;
}

.eyebrow {
    color: #07529c !important;
}

.page-content {
    gap: 20px;
}

.topbar {
    align-items: center;
    border-radius: var(--pp-radius-lg);
}

.topbar-nav {
    row-gap: 8px;
}

.topbar-nav a,
.user-chip {
    min-height: 38px;
    padding: 8px 13px;
}

.dashboard-hero,
.app-card,
.auth-panel,
.stat-card {
    border-radius: var(--pp-radius-lg);
}

.dashboard-hero,
.card-head,
.toolbar {
    gap: var(--pp-gap);
}

.stats-grid {
    gap: 12px;
}

.stat-card {
    padding: 16px;
}

.field input,
.field select,
.field textarea,
.select-field select,
.form-control,
.form-select {
    border-radius: 10px;
}

.btn {
    border-radius: 10px;
}

.btn-small {
    min-height: 32px;
    padding: 6px 10px;
}

.documents-table th,
.documents-table td {
    padding: 12px 11px;
}

.documents-table th {
    font-size: 14px;
}

.documents-table td {
    font-size: 14px;
}

.table-actions {
    gap: 8px;
}

.empty-state {
    border-radius: var(--pp-radius);
    padding: 18px;
}

.account-info-row,
.account-status-item,
.account-inline-stat,
.account-action-link {
    border-radius: 12px;
}

@media (max-width: 991px) {
    .topbar {
        padding: 14px;
    }

    .topbar-nav a,
    .user-chip {
        min-height: 36px;
    }
}

@media (max-width: 720px) {
    .site-shell {
        margin-top: 10px;
    }

    .topbar-nav a,
    .user-chip,
    .btn {
        width: 100%;
    }

    .dashboard-hero,
    .app-card,
    .auth-panel,
    .stat-card,
    .topbar {
        border-radius: 12px;
    }
}

/* Final no-underline lock for top navigation */
.topbar-nav a,
.user-chip {
    text-decoration: none !important;
}

.topbar-nav a:hover,
.topbar-nav a:focus,
.topbar-nav a:active,
.topbar-nav a:visited {
    text-decoration: none !important;
}

/* Blue Lock: force blue-only palette */
:root {
    --primary: #0b6bcb !important;
    --primary-dark: #07529c !important;
    --secondary: #1f4f82 !important;
    --ui-accent: #0b6bcb !important;
    --ui-accent-dark: #07529c !important;
    --ux-primary: #0b6bcb !important;
    --ux-primary-dark: #07529c !important;
    --ux-success: #0b6bcb !important;
    --ux-warm: #3b82f6 !important;
}

body {
    background:
        radial-gradient(circle at 4% 8%, rgba(11, 107, 203, 0.12), transparent 24%),
        radial-gradient(circle at 95% 92%, rgba(59, 130, 246, 0.12), transparent 26%),
        #f4f7fb !important;
}

.brand-badge,
.account-avatar,
.btn-primary,
.mission-step-card .btn-success,
.mission-step-card .btn-primary {
    background: linear-gradient(135deg, #0b6bcb, #07529c) !important;
    border-color: #07529c !important;
}

.eyebrow,
.documents-table th,
.btn-secondary {
    color: #1f4f82 !important;
}

.limit-badge,
.status-chip {
    background: #eef6ff !important;
    border-color: #cfe2f8 !important;
    color: #1f4f82 !important;
}
