:root {
    --bg-mist: #edf7f8;
    --bg-sand: #f8f2e8;
    --panel: rgba(255, 255, 255, 0.84);
    --panel-strong: #ffffff;
    --ink: #183038;
    --muted: #627982;
    --line: rgba(24, 48, 56, 0.12);
    --line-strong: rgba(24, 48, 56, 0.18);
    --aqua: #0d8b88;
    --aqua-deep: #0b5d67;
    --gold: #dd9d42;
    --mint: #d8f4ef;
    --pearl: #fefcf7;
    --danger: #b94c58;
    --shadow: 0 24px 60px rgba(15, 47, 58, 0.14);

    --brand-from: #1e3a8a;
    --brand-mid: #1d4ed8;
    --brand-to: #2563eb;
    --brand-gradient: linear-gradient(135deg, var(--brand-from) 0%, var(--brand-mid) 50%, var(--brand-to) 100%);
    --brand-gradient-horizontal: linear-gradient(90deg, var(--brand-from) 0%, var(--brand-to) 100%);
    --brand-text: #ffffff;
    --brand-text-muted: rgba(255, 255, 255, 0.92);
    --brand-hover: rgba(255, 255, 255, 0.14);
    --brand-active: rgba(255, 255, 255, 0.22);
    --brand-border: rgba(255, 255, 255, 0.16);
    --brand-shadow: 0 20px 44px rgba(30, 58, 138, 0.28);
}

html[data-theme="dark"] {
    --bg-mist: #0b1220;
    --bg-sand: #0f172a;
    --panel: rgba(24, 35, 60, 0.78);
    --panel-strong: #1b2540;
    --ink: #e8eef7;
    --muted: #9fb1c6;
    --line: rgba(245, 247, 250, 0.1);
    --line-strong: rgba(245, 247, 250, 0.18);
    --aqua: #3db7b4;
    --aqua-deep: #5fd1ce;
    --gold: #e0b15e;
    --mint: rgba(59, 130, 246, 0.18);
    --pearl: #101a2b;
    --shadow: 0 24px 60px rgba(5, 10, 25, 0.48);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--ink);
}

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

.app-body {
    background:
        radial-gradient(circle at top left, rgba(13, 139, 136, 0.13), transparent 28%),
        radial-gradient(circle at bottom right, rgba(221, 157, 66, 0.18), transparent 34%),
        linear-gradient(135deg, #f9f4ec 0%, #edf8f6 52%, #ecf1fb 100%);
}

.auth-body {
    background:
        radial-gradient(circle at 15% 20%, rgba(13, 139, 136, 0.22), transparent 18%),
        radial-gradient(circle at 85% 18%, rgba(221, 157, 66, 0.24), transparent 16%),
        radial-gradient(circle at 75% 82%, rgba(11, 93, 103, 0.2), transparent 20%),
        linear-gradient(145deg, #eff8f6 0%, #f7efe5 48%, #eef4fb 100%);
}

.shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    border-right: 1px solid var(--brand-border);
    background: var(--brand-gradient);
    color: var(--brand-text);
    box-shadow: var(--brand-shadow);
    height: 100vh;
    position: sticky;
    top: 0;
    min-height: 0;
}

.sidebar .brand strong {
    color: var(--brand-text);
}

.sidebar .brand p {
    color: var(--brand-text-muted);
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.brand p {
    margin: 2px 0 0;
    color: var(--brand-text-muted);
    font-size: 0.82rem;
}

.brand strong {
    font-size: 0.98rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--aqua), var(--aqua-deep));
    color: white;
    font-weight: 700;
    letter-spacing: 0.06em;
    font-size: 0.88rem;
    box-shadow: 0 10px 24px rgba(13, 139, 136, 0.28);
}

.sidebar .nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    margin-right: -4px;
}

.nav::-webkit-scrollbar {
    width: 6px;
}

.nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 3px;
}

.nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

.sidebar .nav a.nav-link,
a.nav-link {
    display: block;
    margin: 0;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--brand-text-muted);
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar .nav a.nav-link:hover,
a.nav-link:hover {
    background: var(--brand-hover);
    color: #ffffff;
}

.sidebar .nav a.nav-link.active,
a.nav-link.active {
    background: var(--brand-active);
    color: #ffffff;
    font-weight: 700;
    box-shadow: inset 3px 0 0 #ffffff;
}

.sidebar .nav a.nav-link-nested {
    padding: 7px 10px;
    font-size: 0.92rem;
}

.sidebar-footer {
    flex: 0 0 auto;
    padding-top: 20px;
    margin-top: 16px;
}

.sidebar-user {
    margin: 0 0 12px;
    color: var(--brand-text-muted);
    font-size: 0.95rem;
}

.sidebar-footer {
    border-top: 1px solid var(--brand-border);
    margin-top: auto;
}

.content {
    padding: 28px 32px 40px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.topbar-eyebrow,
.eyebrow {
    margin: 0 0 10px;
    color: var(--aqua);
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.topbar-title,
.compact-title {
    margin: 0;
    font-size: clamp(1.35rem, 1.8vw, 1.7rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    font-weight: 700;
}

.content h1 {
    margin: 0;
    font-size: clamp(1.4rem, 2vw, 1.85rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    font-weight: 700;
    color: #0a0a0a;
}

/* All headings inside the content area are solid dark black */
.content h1,
.content h2,
.content h3,
.content h4,
.tab-header h2,
.tab-header h3,
.section-heading h2,
.summary-card h2,
.search-card h2,
.auth-card h2,
.topbar-title,
.compact-title,
.mini-heading,
.profile-menu-header strong {
    color: #0a0a0a;
}

/* The topbar title + subtitle also dark */
.topbar-subtitle {
    color: #2a2a2a;
}

.auth-card h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.topbar-subtitle,
.lede,
.auth-lede,
.panel-copy {
    color: var(--muted);
    line-height: 1.7;
}

.topbar-subtitle {
    max-width: none;
    margin: 4px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.88rem;
    line-height: 1.4;
}

.profile-chip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    min-width: 240px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.profile-chip p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--gold), var(--aqua));
    color: white;
    font-weight: 700;
}

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

.spotlight {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 420px);
    gap: 24px;
}

.spotlight-copy {
    padding: 8px 0;
}

.lede,
.auth-lede {
    margin-top: 18px;
    max-width: 60ch;
    font-size: 1.03rem;
}

.search-card,
.summary-card,
.auth-card,
.login-panel,
.workbench,
.tab-panel {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.search-card,
.summary-card,
.tab-panel,
.workbench-nav {
    padding: 24px;
}

.search-form {
    display: flex;
    gap: 12px;
    margin: 12px 0 10px;
}

.metric-label,
.field-label {
    color: var(--muted);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.dashboard-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.dashboard-grid .summary-card h2 {
    font-size: 1.8rem !important;
    font-weight: 700;
    color: var(--brand-from);
    margin: 6px 0 4px;
}

.summary-card h2 {
    margin: 10px 0 10px;
    font-size: 1.2rem;
}

.summary-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.workbench {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    overflow: hidden;
}

.workbench-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-right: 1px solid var(--line);
    background: rgba(255, 252, 247, 0.78);
}

.workbench-content {
    display: grid;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
}

.section-heading h2,
.tab-header h2,
.search-card h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.content h2 {
    font-size: 1.05rem;
    font-weight: 600;
}

.content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 10px;
}

.lede,
.auth-lede {
    font-size: 0.92rem;
}

.panel-copy {
    font-size: 0.88rem;
}

.summary-card h2 {
    font-size: 1rem !important;
    margin: 8px 0;
}

.summary-card p {
    font-size: 0.85rem;
}

.tab-link {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    color: var(--muted);
    font-weight: 600;
    background: transparent;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tab-link:hover,
.tab-link.active {
    background: var(--mint);
    color: var(--aqua-deep);
    transform: translateX(2px);
}

.tab-link.active-soft {
    background: rgba(216, 244, 239, 0.55);
    color: var(--aqua-deep);
}

.tab-link-title {
    color: var(--ink);
    font-size: 0.97rem;
}

.tab-link-meta {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 500;
}

.tab-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

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

@media (max-width: 1100px) {
    .field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .field-grid {
        grid-template-columns: 1fr;
    }
}

.field-card {
    display: grid;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.68);
}

.field-card strong {
    font-size: 0.95rem;
    line-height: 1.4;
}

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

.compact-list {
    gap: 12px;
}

.table-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.68);
}

.table-row strong {
    display: block;
    margin-top: 6px;
    line-height: 1.5;
}

.mini-section {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.mini-section h3 {
    margin: 0;
    font-size: 1.1rem;
}

.module-workbench {
    grid-template-columns: 280px minmax(0, 1fr);
}

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

.module-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.module-card {
    align-content: start;
}

.module-card p {
    margin: 0;
}

.module-table-row {
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.auth-card {
    width: min(1080px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 420px);
    gap: 22px;
    padding: 22px;
}

.auth-card-compact {
    width: min(560px, 100%);
    grid-template-columns: 1fr;
}

.auth-copy {
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-highlights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 26px;
}

.auth-highlight {
    padding: 18px;
    border-radius: 18px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
}

.auth-highlight strong {
    display: block;
    margin-top: 8px;
    font-size: 1.04rem;
}

.auth-highlight-title {
    color: var(--muted);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-panel {
    position: relative;
    padding: 28px;
    background: rgba(255, 255, 255, 0.92);
}

.login-panel-full {
    padding: 34px;
}

.panel-topline {
    width: 72px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--aqua), var(--gold));
    margin-bottom: 22px;
}

.login-panel h2 {
    margin: 0 0 8px;
    font-size: 1.8rem;
}

.auth-form {
    display: grid;
    gap: 10px;
    margin-top: 22px;
}

.auth-form label {
    font-weight: 600;
    font-size: 0.95rem;
}

.input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line-strong);
    outline: none;
    background: #fbfdff;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
    border-color: rgba(13, 139, 136, 0.58);
    box-shadow: 0 0 0 4px rgba(13, 139, 136, 0.12);
}

.input-reveal {
    position: relative;
}

.input-reveal .input {
    padding-right: 64px;
}

.input-reveal-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: #0d8b88;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.input-reveal-btn:hover {
    background: rgba(13, 139, 136, 0.08);
}

.subresource-form {
    background: #f8fafc;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.subresource-form .field-grid.tight {
    gap: 10px;
    margin-bottom: 12px;
}

.subresource-form .field-card {
    padding: 8px 10px;
    background: #ffffff;
}

.subresource-form .input {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    padding-top: 6px;
}

.optional-hint {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 400;
    margin-left: 8px;
    text-transform: none;
    letter-spacing: 0;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.danger-button {
    color: #b91c1c;
    border-color: rgba(185, 28, 28, 0.3);
}

.danger-button:hover {
    background: rgba(185, 28, 28, 0.08);
}

.field-hint {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 4px;
    display: block;
}

.comment-row {
    border-left: 3px solid var(--brand-from);
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.comment-row.comment-internal {
    border-left-color: #f59e0b;
    background: #fef3c7;
}

.comment-row .comment-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.comment-row .comment-body {
    color: var(--ink);
    white-space: pre-wrap;
}

.form-row,
.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.form-row {
    margin: 6px 0 8px;
}

.action-row {
    margin-top: 20px;
}

.hero-actions {
    margin-top: 22px;
    justify-content: flex-start;
}

.wrap-row {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 6px;
}

.password-panel {
    max-width: 760px;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.95rem;
}

.primary-button,
.ghost-button {
    border: 0;
    border-radius: 16px;
    font: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.primary-button {
    padding: 14px 18px;
    background: var(--brand-gradient);
    color: var(--brand-text);
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 16px 30px rgba(30, 58, 138, 0.32);
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 38px rgba(30, 58, 138, 0.4);
}

.ghost-button:hover {
    transform: translateY(-1px);
}

.ghost-button {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--brand-text);
    border: 1px solid var(--brand-border);
    font-weight: 600;
}

.ghost-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.content .ghost-button,
.tab-panel .ghost-button,
.workbench-content .ghost-button,
.action-row .ghost-button {
    background: rgba(255, 255, 255, 0.7);
    color: var(--brand-mid);
    border-color: var(--line);
}

.content .ghost-button:hover,
.tab-panel .ghost-button:hover,
.workbench-content .ghost-button:hover,
.action-row .ghost-button:hover {
    background: #ffffff;
    color: var(--brand-from);
}

.compact-button,
.inline-button {
    width: auto;
    padding: 10px 14px;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.workbench-nav .inline-button {
    width: 100%;
    margin-bottom: 4px;
}

.check-card {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.panel-callout {
    padding: 10px 14px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 12px;
    color: var(--brand-from);
}

.panel-callout .panel-copy {
    margin: 0;
    color: var(--brand-from);
    font-weight: 500;
}

/* Compact page-stack spacing */
.page-stack.compact {
    gap: 14px;
}

/* Toolbar: thin row with search + stats + action */
.toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.toolbar-search {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1 1 260px;
    min-width: 220px;
    margin: 0;
}

.toolbar-search .input {
    flex: 1 1 auto;
    min-width: 0;
}

.toolbar-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.14);
    color: var(--brand-from);
    font-weight: 700;
    font-size: 0.92rem;
}

.stat-chip em {
    font-style: normal;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Tall workbench: give more vertical room to the data pane */
.tall-workbench {
    min-height: 70vh;
}

/* Workbench nav + section-heading tight variants */
.workbench-nav.compact {
    padding: 14px 12px;
    gap: 4px;
}

.section-heading.tight {
    margin-bottom: 4px;
}

.section-heading.tight h2 {
    font-size: 0.95rem;
    margin: 2px 0 0;
}

/* Inline horizontal tab strip inside workbench-content */
.inline-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow-x: auto;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.inline-tab {
    padding: 6px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.inline-tab:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--brand-from);
}

.inline-tab.active {
    background: var(--brand-gradient);
    color: #ffffff;
}

.inline-tab-spacer {
    flex: 1 1 auto;
}

/* Dense tab panel — smaller padding so tables breathe */
.tab-panel.dense {
    padding: 14px 18px;
    margin-bottom: 12px;
}

.tab-header.tight {
    margin-bottom: 10px;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-header.tight h2 {
    font-size: 1.1rem;
    margin: 0;
}

/* Status chips for active/verified badges */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chip-positive {
    background: rgba(13, 139, 136, 0.14);
    color: var(--aqua-deep);
    border: 1px solid rgba(13, 139, 136, 0.3);
}

.chip-muted {
    background: rgba(98, 121, 130, 0.14);
    color: var(--muted);
    border: 1px solid rgba(98, 121, 130, 0.28);
}

/* Wide field card spans 2+ columns in a 3-col grid */
.field-card-wide {
    grid-column: span 2;
}

@media (max-width: 1100px) {
    .field-card-wide { grid-column: span 2; }
}

@media (max-width: 720px) {
    .field-card-wide { grid-column: 1 / -1; }
}

.mini-heading {
    margin-top: 14px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

/* Data table — compact, zebra-striped */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.data-table thead th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    border-bottom: 1px solid var(--line-strong);
    background: rgba(37, 99, 235, 0.04);
}

.data-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    vertical-align: top;
}

.data-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.05);
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr.active {
    background: rgba(37, 99, 235, 0.09);
}

/* Quick-link chips for module pages */
.quick-links-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.quick-link-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(15, 47, 58, 0.06);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-link-chip:hover {
    transform: translateY(-1px);
    border-color: var(--brand-to);
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.14);
}

.quick-link-chip .quick-link-cta {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--brand-from);
}

.quick-link-chip strong {
    font-size: 0.98rem;
    color: #0a0a0a;
    margin-top: 2px;
}

.quick-link-chip p {
    margin: 2px 0 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Compact schema table reference */
.table-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 4px 14px;
    margin-top: 6px;
}

.table-ref-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.85rem;
}

.table-ref-item code {
    color: var(--brand-from);
    font-weight: 700;
    font-family: ui-monospace, Consolas, Menlo, monospace;
    font-size: 0.82rem;
    background: rgba(37, 99, 235, 0.06);
    padding: 1px 6px;
    border-radius: 4px;
    flex: 0 0 auto;
}

.table-ref-item span {
    color: var(--muted);
}

.mini-button {
    padding: 10px 12px;
    font-size: 0.92rem;
}

.text-link {
    color: var(--aqua-deep);
    font-weight: 600;
}

.text-link-inline {
    display: inline-flex;
    margin-top: 18px;
}

.form-error,
.field-error {
    color: var(--danger);
    font-size: 0.92rem;
}

.form-error:empty,
.field-error:empty {
    display: none;
}

.status-banner {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--mint);
    border: 1px solid rgba(13, 139, 136, 0.18);
    color: var(--aqua-deep);
}

.error-card {
    max-width: 720px;
}

code {
    font-family: Consolas, "Courier New", monospace;
}

@media (max-width: 1100px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .spotlight,
    .field-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .shell,
    .workbench,
    .auth-card,
    .auth-highlights {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .content {
        padding: 24px;
    }

    .topbar {
        flex-direction: column;
    }

    .profile-chip {
        min-width: 0;
    }

    .workbench-nav {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .auth-shell {
        padding: 18px;
    }
}

@media (max-width: 640px) {
    .content,
    .sidebar,
    .auth-copy,
    .login-panel,
    .login-panel-full,
    .search-card,
    .summary-card,
    .tab-panel,
    .workbench-nav,
    .workbench-content {
        padding: 20px;
    }

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

    .search-form,
    .form-row,
    .action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .primary-button,
    .compact-button {
        width: 100%;
    }
}

/* ========================================================================
   Sidebar nav-group (collapsible submodule section)
   ======================================================================== */
.nav-group {
    display: grid;
    gap: 2px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--brand-border);
}

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 6px 12px;
    margin-bottom: 2px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--brand-text-muted);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-group-header:hover {
    background: var(--brand-hover);
    color: var(--brand-text);
}

.nav-group-caret {
    transition: transform 0.2s ease;
    display: inline-block;
}

.nav-group.nav-group-open .nav-group-caret {
    transform: rotate(90deg);
}

.nav-group-items {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding-left: 8px;
    border-left: 2px solid var(--brand-border);
    margin-left: 10px;
}

.nav-group.nav-group-open .nav-group-items {
    display: flex;
}

.nav-link-nested {
    padding: 6px 10px;
    font-size: 0.85rem;
}

/* ========================================================================
   Topbar actions (theme toggle + profile menu)
   ======================================================================== */
.topbar-lead {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    backdrop-filter: blur(18px);
    color: var(--brand-mid);
}

.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--brand-to);
    color: var(--brand-from);
}

.theme-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.theme-icon-dark { display: none; }
.theme-icon-light { display: inline; }

html[data-theme="dark"] .theme-icon-dark { display: inline; }
html[data-theme="dark"] .theme-icon-light { display: none; }
html[data-theme="dark"] .theme-toggle { color: var(--brand-text); }

/* ========================================================================
   Profile chip + dropdown menu
   ======================================================================== */
.profile-chip {
    position: relative;
    padding: 0;
    min-width: auto;
    border: 0;
    border-radius: 22px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    min-width: 220px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.profile-trigger:hover {
    transform: translateY(-1px);
    border-color: var(--brand-to);
}

.profile-chip-text {
    display: grid;
    gap: 2px;
    text-align: left;
    flex: 1 1 auto;
    min-width: 0;
}

.profile-chip-text strong {
    font-size: 0.98rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-chip-text p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.profile-caret {
    color: var(--muted);
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.profile-menu-open .profile-caret {
    transform: rotate(180deg);
}

.profile-avatar {
    background: var(--brand-gradient);
    box-shadow: 0 10px 20px rgba(30, 58, 138, 0.35);
}

.profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 240px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 24px 54px rgba(15, 47, 58, 0.22);
    padding: 10px;
    display: none;
    z-index: 120;
}

.profile-menu-open .profile-menu {
    display: grid;
    gap: 2px;
}

.profile-menu-header {
    padding: 12px 14px 14px;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 2px;
    margin-bottom: 6px;
}

.profile-menu-header strong {
    color: var(--ink);
}

.profile-menu-header span {
    color: var(--muted);
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--ink);
    font: inherit;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.profile-menu-item:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--brand-from);
}

.profile-menu-separator {
    height: 1px;
    margin: 6px 8px;
    background: var(--line);
}

.profile-menu-form {
    margin: 0;
}

.profile-menu-item-danger {
    color: var(--danger);
}

.profile-menu-item-danger:hover {
    background: rgba(185, 76, 88, 0.12);
    color: var(--danger);
}

/* ========================================================================
   Hamburger + drawer overlay (mobile)
   ======================================================================== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    backdrop-filter: blur(18px);
    cursor: pointer;
    flex: 0 0 auto;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--brand-mid);
    border-radius: 2px;
    margin: 0 auto;
}

.drawer-close {
    display: none;
    align-self: flex-start;
    margin-left: auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    color: var(--brand-text);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(9, 17, 35, 0.5);
    z-index: 90;
}

.shell.drawer-open .drawer-overlay {
    display: block;
}

@media (max-width: 960px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-110%);
        transition: transform 0.28s ease;
        z-index: 100;
    }

    .shell.drawer-open .sidebar {
        transform: translateX(0);
    }

    .hamburger {
        display: inline-flex;
        align-items: center;
    }

    .drawer-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .profile-chip-text {
        display: none;
    }

    .profile-trigger {
        min-width: auto;
        padding: 10px;
    }
}

@media (max-width: 640px) {
    .topbar {
        flex-wrap: wrap;
    }

    .topbar-actions {
        gap: 10px;
    }

    .theme-toggle {
        width: 44px;
        height: 44px;
    }
}

/* ========================================================================
   Dark-theme adjustments for key surfaces that hard-code whites
   ======================================================================== */
html[data-theme="dark"] body {
    color: var(--ink);
}

html[data-theme="dark"] .app-body {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.22), transparent 30%),
        radial-gradient(circle at bottom right, rgba(61, 183, 180, 0.16), transparent 32%),
        linear-gradient(145deg, #0b1220 0%, #0f172a 50%, #121b33 100%);
}

html[data-theme="dark"] .search-card,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .workbench,
html[data-theme="dark"] .tab-panel,
html[data-theme="dark"] .profile-trigger {
    background: var(--panel);
    border-color: var(--line-strong);
    color: var(--ink);
}

html[data-theme="dark"] .profile-menu {
    background: var(--panel-strong);
    border-color: var(--line-strong);
}

html[data-theme="dark"] .profile-menu-item {
    color: var(--ink);
}

html[data-theme="dark"] .profile-menu-item:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--brand-to);
}

html[data-theme="dark"] .theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--line-strong);
}

html[data-theme="dark"] .hamburger {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--line-strong);
}

html[data-theme="dark"] .hamburger span {
    background: var(--brand-to);
}

html[data-theme="dark"] .input,
html[data-theme="dark"] textarea.input,
html[data-theme="dark"] select.input {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--line-strong);
    color: var(--ink);
}

html[data-theme="dark"] .data-table {
    color: var(--ink);
}

html[data-theme="dark"] .content h1,
html[data-theme="dark"] .content h2,
html[data-theme="dark"] .content h3,
html[data-theme="dark"] .content h4,
html[data-theme="dark"] .tab-header h2,
html[data-theme="dark"] .tab-header h3,
html[data-theme="dark"] .section-heading h2,
html[data-theme="dark"] .summary-card h2,
html[data-theme="dark"] .search-card h2,
html[data-theme="dark"] .auth-card h2,
html[data-theme="dark"] .topbar-title,
html[data-theme="dark"] .compact-title,
html[data-theme="dark"] .mini-heading,
html[data-theme="dark"] .profile-menu-header strong {
    color: #f1f5f9;
}

html[data-theme="dark"] .topbar-subtitle {
    color: #cbd5e1;
}

html[data-theme="dark"] .data-table th {
    color: var(--muted);
}

html[data-theme="dark"] .data-table tr:hover {
    background: rgba(255, 255, 255, 0.04);
}
