:root {
    --bg: #eef3f8;
    --panel: #ffffff;
    --panel-strong: #f8fbfd;
    --text: #162235;
    --muted: #66758a;
    --border: #d9e2ec;
    --brand: #0c4ea2;
    --brand-2: #1495d3;
    --brand-dark: #082f74;
    --accent: #1aa4c8;
    --danger: #d94747;
    --soft: #e8f2fb;
    --success-soft: #e7f7ee;
    --shadow: 0 16px 38px rgba(15, 47, 87, 0.09);
    --radius: 8px;
}

[data-theme="dark"] {
    --bg: #0e1624;
    --panel: #141f31;
    --panel-strong: #19263a;
    --text: #edf4fb;
    --muted: #a8b5c6;
    --border: #2a3c55;
    --brand: #63b7ed;
    --brand-2: #42c3df;
    --brand-dark: #a6d9ff;
    --accent: #5ed1e8;
    --soft: #1d3148;
    --success-soft: #153729;
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.58), transparent 260px),
        var(--bg);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover { color: var(--brand-dark); }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.18; }
h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 800; }
h2 { font-size: 22px; font-weight: 750; }
h3 { font-size: 18px; font-weight: 750; }
p { line-height: 1.58; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
    min-height: 76px;
    padding: 12px 32px;
    border-bottom: 1px solid rgba(217, 226, 236, 0.86);
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    box-shadow: 0 8px 26px rgba(20, 42, 70, 0.05);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    min-width: 230px;
}

.brand img {
    display: block;
    width: 228px;
    max-width: 28vw;
    height: auto;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 11px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.nav a:hover {
    color: var(--brand);
    background: var(--soft);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page {
    width: min(1180px, calc(100% - 36px));
    margin: 28px auto 64px;
}

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

.hero-panel {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 24px;
    padding: 30px;
    margin-bottom: 22px;
}

.dashboard-hero {
    background:
        linear-gradient(120deg, rgba(12, 78, 162, 0.1), rgba(20, 149, 211, 0.08)),
        var(--panel);
}

.company-note {
    max-width: 720px;
    margin: 18px 0 0;
    color: var(--muted);
}

.quote-box {
    width: 340px;
    padding: 18px;
    border: 1px solid rgba(12, 78, 162, 0.13);
    border-radius: var(--radius);
    background: var(--soft);
}

.quote-box span, .eyebrow {
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.quote-box p { margin: 12px 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.cards-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { padding: 20px; }

.nav-card {
    position: relative;
    overflow: hidden;
    color: var(--text);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.nav-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.nav-card:hover {
    border-color: rgba(12, 78, 162, 0.3);
    box-shadow: 0 18px 34px rgba(15, 47, 87, 0.12);
    transform: translateY(-2px);
}

.nav-card p, .card p { color: var(--muted); }

.section { margin-top: 28px; }
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 0 18px;
}

.list { display: grid; gap: 12px; }
.list-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.pill, .chips span {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    color: var(--brand-dark);
    background: var(--soft);
    font-size: 12px;
    font-weight: 800;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.auth-layout {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 150px);
}

.auth-card {
    width: min(460px, 100%);
    padding: 32px;
}

.form {
    display: grid;
    gap: 14px;
}

.form label, .form p {
    display: grid;
    gap: 6px;
    margin: 0;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    background: var(--panel);
    font: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brand-2);
    outline: 3px solid rgba(20, 149, 211, 0.16);
}

button, .primary, .secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 7px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.primary {
    color: #fff;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.primary:hover { color: #fff; filter: brightness(0.96); }

.secondary, .icon-button {
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--border);
}

.secondary:hover, .icon-button:hover {
    color: var(--brand);
    border-color: rgba(12, 78, 162, 0.3);
    background: var(--soft);
}

.small { min-height: 34px; font-size: 14px; }
.link-button {
    color: var(--brand);
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.news-feed { display: grid; gap: 16px; }
.news-card .meta, .meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

.sentinel {
    padding: 24px;
    text-align: center;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

.filters {
    display: grid;
    grid-template-columns: 1fr 220px auto;
    gap: 12px;
    margin-bottom: 18px;
}

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

.employee-card { color: var(--text); }
.employee-card span, .employee-card small {
    display: block;
    color: var(--muted);
    margin-top: 8px;
}

.directory-shell {
    display: grid;
    gap: 18px;
}

.directory-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        linear-gradient(120deg, rgba(12, 78, 162, 0.11), rgba(20, 149, 211, 0.07)),
        var(--panel);
    box-shadow: var(--shadow);
}

.directory-heading .muted {
    max-width: 780px;
    margin: 0;
}

.directory-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

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

.directory-summary div {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
}

.directory-summary span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.directory-summary b {
    display: block;
    margin-top: 4px;
    color: var(--brand-dark);
    font-size: 28px;
    line-height: 1;
}

.support-strip {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 16px;
    border: 1px solid rgba(217, 71, 71, 0.22);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--panel) 82%, #fff1f1);
}

.support-title {
    display: grid;
    gap: 4px;
}

.support-title span {
    width: fit-content;
    padding: 3px 8px;
    border-radius: 6px;
    color: #fff;
    background: var(--danger);
    font-weight: 800;
    font-size: 12px;
}

.support-title strong { font-size: 16px; }

.support-contacts {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 0;
}

.support-contact {
    display: grid;
    gap: 4px;
    min-height: 0;
    min-width: 210px;
    padding: 10px 12px;
    border: 1px solid rgba(217, 71, 71, 0.18);
    border-radius: 7px;
    color: var(--text);
    background: var(--panel);
    text-align: left;
}

.support-contact span {
    overflow: hidden;
    font-size: 13px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-contact b {
    color: var(--danger);
    font-size: 14px;
}

.directory-search {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 280px auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
}

.directory-search label {
    display: grid;
    gap: 7px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.directory-search-actions {
    display: flex;
    gap: 8px;
}

.directory-table {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.directory-table-head,
.directory-row {
    display: grid;
    grid-template-columns: minmax(280px, 1.3fr) minmax(170px, .72fr) minmax(230px, .9fr);
    gap: 18px;
    align-items: center;
}

.directory-table-head {
    padding: 12px 18px;
    color: var(--muted);
    background: var(--panel-strong);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.directory-row {
    padding: 15px 18px;
    border-top: 1px solid var(--border);
}

.directory-row:hover {
    background: color-mix(in srgb, var(--soft) 46%, transparent);
}

.directory-person {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-width: 0;
    color: var(--text);
}

.directory-avatar, .avatar {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    font-size: 20px;
    font-weight: 800;
}

.directory-person strong,
.directory-person small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.directory-person small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.directory-department span {
    display: inline-flex;
    max-width: 100%;
    padding: 6px 9px;
    border-radius: 7px;
    color: var(--brand-dark);
    background: var(--soft);
    font-size: 13px;
    font-weight: 750;
}

.directory-contact-list {
    display: grid;
    gap: 6px;
    justify-items: start;
}

.directory-contact-list a {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.directory-contact-list button {
    min-height: 0;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    background: var(--panel-strong);
    font-size: 13px;
}

.empty-state {
    padding: 38px 18px;
    text-align: center;
}

.copy-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 1000;
    transform: translateX(-50%) translateY(10px);
    padding: 10px 22px;
    border-radius: 999px;
    color: #fff;
    background: #162235;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.profile {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 22px;
}

.profile .avatar {
    width: 72px;
    height: 72px;
    font-size: 30px;
}

dl {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 18px;
}

dt { color: var(--muted); }
.steps { display: grid; gap: 10px; }
.document { max-width: 780px; margin: 0 auto; }
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.message { padding: 12px; border-radius: 7px; background: var(--soft); }
.manager-note {
    padding: 12px;
    border-left: 4px solid var(--brand);
    background: var(--soft);
}

@media (max-width: 1040px) {
    .topbar {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .brand img { max-width: 310px; width: 100%; }
    .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .directory-heading { grid-template-columns: 1fr; }
    .directory-actions { justify-content: flex-start; }
    .directory-table-head { display: none; }
    .directory-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 760px) {
    .page { width: min(100% - 22px, 1180px); margin-top: 18px; }
    .topbar { padding: 12px 16px; }
    .hero-panel, .section-title { flex-direction: column; align-items: flex-start; }
    .quote-box { width: 100%; }
    .cards-grid, .employee-grid, .two-col, .filters, .profile, .directory-summary, .support-strip, .directory-search {
        grid-template-columns: 1fr;
    }
    .card, .hero-panel, .auth-card, .directory-heading { padding: 18px; }
    .nav { gap: 4px; }
    .nav a { padding: 7px 9px; }
    .directory-search-actions { flex-direction: column; align-items: stretch; }
    .support-contacts { flex-direction: column; }
    .support-contact { min-width: 0; }
    dl { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    h1 { font-size: 30px; }
    .top-actions { width: 100%; justify-content: space-between; }
    .directory-person { grid-template-columns: 42px minmax(0, 1fr); }
    .directory-avatar { width: 42px; height: 42px; }
    .directory-contact-list { justify-items: stretch; }
    .directory-contact-list button { width: 100%; }
}
