:root {
    color-scheme: light;
    --navy: #172335;
    --navy-deep: #131e2e;
    --text: #182237;
    --muted: #546276;
    --canvas: #f3f6fa;
    --white: #fff;
    --line: #dce3ed;
    --accent: #b54016;
    --accent-hover: #94300e;
    --accent-quiet: #fff0df;
    --radius: 15px;
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 400 1rem/1.55 var(--font); }
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hover); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #d66632; outline-offset: 3px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 5; inset: 0 auto auto 0; padding: 0.75rem 1rem; background: var(--white); transform: translateY(-110%); }
.skip-link:focus { transform: none; }
.muted { color: var(--muted); }
.full-width { width: 100%; }

.workspace { display: grid; grid-template-columns: 242px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    background: var(--navy-deep);
    color: #f4f7fd;
}
.wordmark {
    display: inline-block;
    color: #f7faff;
    font-size: 1.86rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.065em;
    text-decoration: none;
}
.wordmark span { color: #f47c45; }
.wordmark:hover { color: #f7faff; }
.sidebar > .wordmark { align-self: flex-start; margin: 33px 24px 31px; }
.sidebar-links { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.sidebar-nav { display: grid; gap: 3px; }
.sidebar-footer { padding: 12px 0 20px; border-top: 1px solid #354154; }
.sidebar-footer form { margin: 0; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    border: 0;
    border-inline-start: 4px solid transparent;
    padding: 9px 13px 9px 18px;
    background: transparent;
    color: #e8edf5;
    text-align: left;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 535;
    line-height: 1.3;
}
.nav-link svg { width: 21px; height: 21px; flex: 0 0 21px; }
.nav-link:hover, .nav-link.current { background: #2b374a; color: #fff; }
.nav-link.current { border-inline-start-color: #f47c45; }
.mobile-menu { display: none; }

.topbar {
    height: 67px;
    padding: 0 35px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: var(--white);
    font-size: 0.94rem;
    font-weight: 590;
}
.profile {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #eaf0f7;
    color: #43536a;
}
.profile:hover { background: var(--accent-quiet); color: var(--accent); }
.profile svg { width: 21px; height: 21px; }
.main-content { max-width: 1270px; margin-inline: auto; padding: 40px 38px 54px; }
.page-heading { margin: 0 0 28px; }
.page-heading h1, .form-card h1, .login-content h1 { margin: 0; font-weight: 780; letter-spacing: -0.04em; line-height: 1.15; }
.page-heading h1 { font-size: clamp(1.95rem, 3.4vw, 2.76rem); }
.page-heading p { max-width: 54rem; margin: 8px 0 0; color: var(--muted); font-size: 1.08rem; }
.dashboard-heading { margin-bottom: 29px; }
.dashboard-heading h1 { font-size: clamp(2.2rem, 4.3vw, 3.04rem); }
.dashboard-heading p { font-size: clamp(1rem, 1.58vw, 1.22rem); }
.section-banner, .login-brand { position: relative; isolation: isolate; overflow: hidden; background: var(--navy); color: #fff; }
.section-banner { display: flex; min-height: 116px; align-items: center; padding: 23px 28px; margin-bottom: 20px; border-radius: var(--radius); }
.section-banner::before, .section-banner::after, .login-brand::before, .login-brand::after {
    position: absolute;
    z-index: -1;
    content: "";
    border-radius: 50%;
    pointer-events: none;
}
.section-banner::before { width: 260px; height: 260px; right: -107px; bottom: -162px; background: #60423b; }
.section-banner::after { width: 198px; height: 198px; right: -89px; bottom: -140px; background: #ce632c; }
.section-banner h2 { margin: 0; font-size: clamp(1.55rem, 2.7vw, 2.12rem); letter-spacing: -0.033em; }

.dashboard-cards, .directory-grid { display: grid; gap: 16px; }
.dashboard-cards, .directory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.section-card, .item-card { min-width: 0; padding: 21px; overflow-wrap: anywhere; }
.section-card { display: block; color: var(--text); text-decoration: none; transition: border-color .18s, box-shadow .18s; }
.section-card:hover { color: var(--text); border-color: #d28f73; box-shadow: 0 5px 22px #25120a0a; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; color: var(--accent); }
.card-top > svg { margin-block-start: 3px; width: 21px; height: 21px; }
.icon-tile { display: inline-grid; place-items: center; width: 45px; height: 45px; flex: 0 0 45px; border-radius: 11px; background: var(--accent-quiet); color: var(--accent); }
.section-card h2, .section-card h3, .item-card h2 { margin: 12px 0 5px; font-size: 1.16rem; font-weight: 760; letter-spacing: -0.022em; line-height: 1.26; }
.section-card p, .item-card p { margin: 0; font-size: 0.94rem; color: var(--muted); line-height: 1.45; }
.item-card p + p { margin-top: 5px; }
.item-card .action-link { margin-top: 11px; }
.action-link { display: inline-flex; align-items: center; gap: 7px; font-size: 0.95rem; font-weight: 700; }
.action-link svg { width: 17px; height: 17px; }
.contact-links { display: grid; gap: 5px; margin-top: 12px; }
.empty { padding: 44px 21px; text-align: center; }
.empty h2 { margin: 12px 0 0; font-size: 1.1rem; }
.empty p { margin: 3px 0 0; color: var(--muted); }
.article { max-width: 840px; padding: 24px 29px; }
.document-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.directory-toolbar, .heading-with-action { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.directory-toolbar { margin: 0 0 16px; }
.category-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.category-button {
    min-height: 42px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 650;
}
.category-button:hover { border-color: #d28f73; }
.category-button[aria-pressed="true"] { border-color: #d28f73; background: var(--accent-quiet); color: var(--accent); }
.search { display: flex; align-items: center; gap: 9px; min-height: 44px; width: min(100%, 390px); padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.search:focus-within { outline: 2px solid #c45123; outline-offset: 2px; }
.search svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--muted); }
.search input { min-width: 0; width: 100%; padding: 8px 0; border: 0; color: var(--text); background: transparent; outline: none; }
.search input:focus-visible { outline: none; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 0.93rem;
    text-align: center;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
}
.button:hover { background: var(--accent-hover); color: #fff; }
.button.secondary { border-color: #ccd5e2; background: var(--white); color: var(--text); }
.button.secondary:hover { background: #f0f4f9; color: var(--text); }
.button.disabled { cursor: default; opacity: 0.55; }
.text-button { border: 0; padding: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 0.2em; }
.back-link { display: inline-block; margin: 0 0 11px; font-size: 0.92rem; font-weight: 650; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.notice { margin: 0 0 17px; padding: 10px 14px; border: 1px solid; border-radius: 9px; font-size: 0.92rem; }
.notice p { margin: 0; }
.notice p + p { margin-top: 5px; }
.notice.error { border-color: #ecc1c0; background: #fff2f0; color: #92212a; }
.notice.success { border-color: #bbdec9; background: #ecf9f1; color: #17623a; }

.form-card { max-width: 770px; padding: 25px 28px 29px; }
.form-card h1 { font-size: clamp(1.55rem, 2.9vw, 2.04rem); margin: 0 0 21px; }
.form { display: grid; gap: 15px; }
.field { display: grid; gap: 5px; }
.field label { font-size: 0.92rem; font-weight: 685; }
.field input, .field textarea, .field select {
    width: 100%;
    min-width: 0;
    min-height: 43px;
    border: 1px solid #c9d3e1;
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--white);
    color: var(--text);
}
.field textarea { resize: vertical; }
.field small { color: var(--muted); font-size: 0.84rem; line-height: 1.35; }
.field [aria-invalid="true"] { border-color: #a92f34; }
.checkbox { display: flex; align-items: center; gap: 8px; width: fit-content; cursor: pointer; }
.checkbox input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.form-actions, .login-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; }
.form-actions { margin-top: 4px; }
.login-actions { margin-top: 17px; justify-content: space-between; font-size: 0.91rem; }

.table-card { overflow-x: auto; }
.table-card table { width: 100%; border-collapse: collapse; font-size: 0.92rem; text-align: left; }
.table-card th, .table-card td { padding: 12px 15px; border-bottom: 1px solid var(--line); }
.table-card th { color: var(--muted); font-weight: 690; background: #f8fafd; }
.table-card tr:last-child td { border-bottom: 0; }
.table-subject { font-weight: 690; }
.table-subject small { display: block; color: var(--muted); font-weight: 400; }
.table-action { text-align: right; }
.table-empty { margin: 0; padding: 19px; color: var(--muted); }
.state { display: inline-block; color: #455469; background: #eef2f8; border-radius: 5px; padding: 3px 7px; font-size: 0.8rem; white-space: nowrap; }
.state-on { color: #216341; background: #ebf7ee; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; font-size: 0.9rem; }

.guest-page { display: grid; place-items: center; min-height: 100dvh; padding: 26px; }
.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
    width: min(100%, 930px);
    min-height: 425px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--white);
    box-shadow: 0 18px 52px #18223710;
}
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: 42px; }
.login-brand .wordmark { font-size: 2.12rem; }
.login-brand p { margin: 18px 0 35px; color: #fff; font-size: clamp(1.8rem, 3.4vw, 2.58rem); font-weight: 770; line-height: 1.07; letter-spacing: -0.045em; }
.login-brand::before { width: 330px; height: 330px; right: -132px; bottom: -203px; background: #60423b; }
.login-brand::after { width: 228px; height: 228px; right: -85px; bottom: -155px; background: #ce632c; }
.login-content { align-self: center; min-width: 0; width: min(100%, 485px); padding: 40px 39px; margin: 0 auto; }
.login-content h1 { font-size: clamp(1.63rem, 3.1vw, 2.1rem); margin: 0 0 20px; }
.login-content .button { margin-top: 4px; }

@media (max-width: 1100px) {
    .workspace { grid-template-columns: 220px minmax(0, 1fr); }
    .main-content { padding-inline: 27px; }
    .topbar { padding-inline: 27px; }
    .dashboard-cards, .directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
    .workspace { display: block; }
    .sidebar { display: flex; flex-flow: row wrap; align-items: center; justify-content: space-between; position: relative; height: auto; overflow: visible; }
    .sidebar > .wordmark { align-self: center; margin: 15px 17px; font-size: 1.65rem; }
    .mobile-menu { display: inline-flex; gap: 7px; align-items: center; min-height: 39px; border: 1px solid #455267; border-radius: 8px; color: #fff; background: transparent; font-size: 0.9rem; margin: 8px 15px 8px 0; padding: 4px 10px; }
    .mobile-menu svg { width: 17px; height: 17px; }
    .sidebar-links { display: none; flex: 0 0 100%; }
    .sidebar.menu-open .sidebar-links { display: flex; }
    .sidebar-footer { padding: 4px 0 8px; }
    .topbar { height: 52px; padding-inline: 16px; }
    .profile { width: 33px; height: 33px; }
    .main-content { padding: 26px 16px 35px; }
    .section-banner { min-height: 96px; padding: 16px; }
    .section-card, .item-card { padding: 16px; }
    .form-card, .article { padding: 18px; }
}

@media (max-width: 560px) {
    .guest-page { padding: 13px; }
    .login-shell { grid-template-columns: minmax(0, 1fr); }
    .login-brand { min-height: 132px; padding: 19px 22px; }
    .login-brand .wordmark { font-size: 1.7rem; }
    .login-brand p { margin: 11px 0 0; font-size: 1.72rem; }
    .login-brand p br { display: none; }
    .login-content { padding: 25px 21px 28px; }
    .login-content h1 { margin-bottom: 15px; }
    .directory-grid { grid-template-columns: minmax(0, 1fr); }
    .table-card th, .table-card td { padding-inline: 9px; }
}

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

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