:root {
    color-scheme: light;
    --page: #f7f8fa;
    --surface: #ffffff;
    --ink: #182230;
    --muted: #667085;
    --line: #e4e7ec;
    --accent: #1f3a5f;
    --accent-soft: #edf2f8;
    --status: #b7791f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.page-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 32px 20px;
}

.setup-card {
    width: min(100%, 460px);
    padding: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgb(16 24 40 / 4%);
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.eyebrow {
    margin: 28px 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
}

h1 {
    margin: 0;
    font-size: clamp(28px, 7vw, 34px);
    letter-spacing: -.03em;
}

.message {
    margin: 16px 0 24px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.65;
}

.status {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status);
}

.login-link {
    display: inline-flex;
    margin-top: 20px;
    text-decoration: none;
}

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

.auth-form label {
    margin-top: 6px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
}

.auth-form input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #cfd4dc;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.auth-form input:focus {
    border-color: var(--accent);
    outline: 3px solid rgb(37 99 235 / 14%);
}

.primary-button,
.secondary-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.primary-button {
    margin-top: 12px;
    background: var(--accent);
    color: #fff;
}

.primary-button:hover { background: #152c49; }

.secondary-button {
    background: #fff;
    color: var(--accent);
}

.secondary-button:hover { background: var(--accent-soft); }

.form-error {
    margin: 18px 0 0;
    padding: 12px 14px;
    border: 1px solid #fecdca;
    border-radius: 8px;
    background: #fff4f2;
    color: #b42318;
    font-size: 14px;
    line-height: 1.5;
}

footer {
    position: fixed;
    right: 20px;
    bottom: 18px;
    left: 20px;
    color: #98a2b3;
    font-size: 12px;
    text-align: center;
}

a { color: var(--accent); }

.admin-layout { min-height: 100vh; }
.admin-header {
    display: flex;
    min-height: 72px;
    align-items: center;
    gap: 28px;
    padding: 12px clamp(20px, 4vw, 56px);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.admin-brand { color: var(--ink); font-size: 16px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.admin-brand span { color: var(--muted); font-weight: 500; }
.admin-header nav { display: flex; flex: 1; gap: 8px; }
.admin-header nav a, .text-button, .table-action {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    text-decoration: none;
}
.admin-header nav a:hover, .text-button:hover, .table-action:hover { background: var(--accent-soft); color: var(--accent); }
.admin-header form { margin-left: auto; }
.text-button { cursor: pointer; }
.admin-content { width: min(100% - 40px, 1180px); margin: 0 auto; padding: 40px 0 64px; }
.admin-content .eyebrow { margin-top: 0; }
.admin-content h1 { font-size: clamp(26px, 4vw, 32px); }
.narrow-content { max-width: 760px; }
.page-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading-row .eyebrow { margin-bottom: 8px; }
.page-heading-row .primary-button { margin-top: 0; text-decoration: none; }
.admin-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 30px; }
.summary-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0 28px; }
.summary-card { display: grid; gap: 8px; min-height: 96px; align-content: center; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; }
.summary-card span { color: var(--muted); font-size: 13px; }
.summary-card strong { font-size: 25px; line-height: 1.1; }
.summary-card:hover { border-color: #b8c6d8; }
.summary-alert { border-color: #fecdca; }
.admin-card { display: grid; min-height: 150px; align-content: start; gap: 10px; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.admin-card:hover { border-color: #b8c6d8; box-shadow: 0 8px 24px rgb(16 24 40 / 5%); }
.admin-card strong { font-size: 20px; }
.admin-card > span:last-child, .card-label, .field-hint, .category-count { color: var(--muted); font-size: 13px; line-height: 1.5; }
.card-label { color: var(--accent); font-weight: 700; }
.table-tools { display: flex; gap: 10px; margin: 20px 0 16px; }
.table-tools input, .category-add input, .category-rename input, .admin-form > input:not([type=hidden]) {
    min-width: 0;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #cfd4dc;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}
.table-tools input { flex: 1; }
.table-tools select { min-height: 46px; padding: 10px 12px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.table-tools .secondary-button { min-width: 90px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
.table-empty { padding: 30px; color: var(--muted); text-align: center; }
.table-subtitle { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.table-action { min-height: 36px; color: var(--accent); font-weight: 600; }
.state-pill { display: inline-flex; min-height: 28px; align-items: center; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.state-active { background: #ecfdf3; color: #067647; }
.state-inactive { background: #f2f4f7; color: #667085; }
.success-message { margin: 18px 0; padding: 12px 14px; border: 1px solid #abefc6; border-radius: 8px; background: #f6fef9; color: #067647; font-size: 14px; line-height: 1.5; }
.admin-form { display: grid; gap: 10px; margin-top: 24px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.admin-form > label:not(.check-row) { margin-top: 8px; font-size: 14px; font-weight: 600; }
.admin-form > input:focus, .table-tools input:focus, .category-add input:focus, .category-rename input:focus { border-color: var(--accent); outline: 3px solid rgb(37 99 235 / 14%); }
.readonly-number { display: flex; justify-content: space-between; padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--muted); font-size: 14px; }
.readonly-number strong { color: var(--accent); }
.category-fieldset { display: grid; gap: 8px; margin: 12px 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.category-fieldset legend { padding: 0 6px; font-size: 14px; font-weight: 700; }
.category-fieldset .field-hint { margin: 0 0 4px; }
.check-row { display: flex; min-height: 44px; align-items: center; gap: 10px; color: var(--ink); font-size: 14px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.checkbox-row { display: flex; min-height: 48px; align-items: center; gap: 10px; font-weight: 600; }
.checkbox-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.check-row.is-muted { color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.form-actions a { text-decoration: none; }
.form-actions .primary-button, .form-actions .secondary-button { margin-top: 0; }
.category-add { display: flex; gap: 10px; margin: 24px 0; }
.category-add input { flex: 1; }
.category-add .primary-button { margin-top: 0; }
.category-list { display: grid; gap: 10px; }
.settings-tabs { display: flex; gap: 6px; margin: 22px 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.settings-tabs a { display: inline-flex; min-height: 42px; align-items: center; padding: 0 14px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.settings-tabs a:hover { background: var(--accent-soft); color: var(--accent); }
.settings-tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.settings-panel h2 { margin: 24px 0 8px; font-size: 20px; }
.category-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.category-rename { display: flex; flex: 1; align-items: center; gap: 10px; }
.category-rename input { flex: 1; }
.category-rename .secondary-button { min-height: 42px; }
.text-danger { color: #b42318; }
.empty-state { display: grid; justify-items: center; margin-top: 48px; padding: 48px 24px; border: 1px dashed #cfd4dc; border-radius: 12px; background: var(--surface); text-align: center; }
.empty-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.empty-state h2 { margin: 20px 0 4px; font-size: 19px; }
.empty-state p { margin: 8px 0 0; color: var(--muted); line-height: 1.6; }
.form-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 8px 0; }
.form-grid-two > div { display: grid; gap: 8px; align-content: start; }
.admin-form select, .admin-form textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.admin-form textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.admin-form textarea:focus, .admin-form select:focus { border-color: var(--accent); outline: 3px solid rgb(37 99 235 / 14%); }
.notice-form { gap: 12px; }
.individual-pick { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.individual-pick summary { min-height: 44px; cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 700; }
.employee-picker { display: grid; max-height: 360px; overflow: auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 34px 0 14px; }
.section-heading .eyebrow { margin: 0 0 6px; }
.section-heading h2 { margin: 0; font-size: 22px; }
.notice-preview { margin: 18px 0; padding: 20px 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.notice-preview .eyebrow { margin: 0 0 10px; }
.notice-copy { color: var(--ink); font-size: 15px; line-height: 1.8; white-space: normal; overflow-wrap: anywhere; }
.notice-preview > p:not(.eyebrow) { line-height: 1.7; }
.notice-meta, .deadline-note { color: var(--muted); font-size: 14px; }
.deadline-note { margin: -10px 0 20px; }
.notice-document { position: relative; isolation: isolate; overflow: hidden; margin: 24px 0; padding: clamp(22px, 5vw, 48px); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.notice-document-header { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.notice-document h2 { margin: 24px 0; font-size: clamp(21px, 4vw, 28px); line-height: 1.3; }
.watermark-overlay { position: absolute; z-index: -0; inset: 0; display: grid; place-items: center; transform: rotate(-25deg); color: var(--accent); font-size: clamp(20px, 5vw, 48px); font-weight: 800; opacity: .10; pointer-events: none; white-space: nowrap; }
.notice-document > :not(.watermark-overlay) { position: relative; z-index: 1; }
.sign-form, .signature-complete { display: grid; gap: 14px; margin: 24px 0; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.acknowledge-row { display: flex; min-height: 48px; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
.acknowledge-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.signature-label { font-size: 14px; font-weight: 700; }
#signature-canvas { display: block; width: 100%; height: 180px; border: 1px dashed #98a2b3; border-radius: 8px; background: #fff; touch-action: none; }
.signature-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.signature-actions .primary-button { margin: 0; }
.signature-complete { display: block; }
.signature-complete p { margin: 10px 0 0; color: var(--muted); }
.employee-overview { display: flex; align-items: center; justify-content: space-between; margin: 20px 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); }
.employee-overview strong { color: var(--accent); font-size: 24px; }
.employee-notice-list { display: grid; gap: 12px; }
.employee-notice-card { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; }
.employee-notice-card:hover { border-color: #b8c6d8; box-shadow: 0 5px 16px rgb(16 24 40 / 4%); }
.employee-notice-card > strong { font-size: 18px; }
.notice-card-top { display: flex; gap: 8px; }
.employee-card-meta { color: var(--muted); font-size: 13px; }
.state-late { background: #fff4ed; color: #b54708; }
.list-toolbar { display: flex; justify-content: space-between; margin: 16px 0 10px; }
.filter-tabs { display: flex; gap: 6px; }
.filter-tabs a { display: inline-flex; min-height: 40px; align-items: center; padding: 0 13px; border-radius: 8px; color: var(--muted); font-size: 14px; text-decoration: none; }
.filter-tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.employee-header .employee-identity { color: var(--muted); font-size: 14px; }
.employee-header form { margin-left: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
    .admin-header { flex-wrap: wrap; gap: 8px 16px; padding: 12px 20px; }
    .admin-header nav { order: 3; width: 100%; overflow-x: auto; }
    .admin-header nav a { padding-inline: 10px; }
    .admin-header > form { margin-left: auto; }
    .admin-content { width: min(100% - 32px, 1180px); padding-top: 28px; }
    .admin-cards { grid-template-columns: 1fr; }
    .page-heading-row { align-items: flex-start; flex-direction: column; }
    .page-heading-row .primary-button { width: 100%; }
    .category-item, .category-rename { align-items: stretch; flex-direction: column; }
    .category-rename { width: 100%; }
    .category-rename .secondary-button { width: 100%; }
    .category-item > form:last-child { align-self: flex-end; }
    .category-add { flex-direction: column; }
    .category-add .primary-button { width: 100%; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions a, .form-actions button { width: 100%; }
    .employee-header .employee-identity { order: 3; width: 100%; }
    .summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid-two { grid-template-columns: 1fr; }
    .signature-actions { align-items: stretch; flex-direction: column-reverse; }
    .signature-actions .primary-button { width: 100%; }
    .notice-document-header { flex-direction: column; }
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --page: #101828;
        --surface: #182230;
        --ink: #f2f4f7;
        --muted: #aab4c0;
        --line: #344054;
        --accent: #9dbbe2;
        --accent-soft: #25354a;
        --status: #fdb022;
    }
    .auth-form input, .table-tools input, .category-add input, .category-rename input,
    .admin-form > input:not([type=hidden]), .admin-form select, .admin-form textarea { border-color: #475467; background: #101828; color: var(--ink); }
    .secondary-button { border-color: #607a9b; background: #182230; color: #c5d9f2; }
    .secondary-button:hover, .admin-header nav a:hover, .text-button:hover, .table-action:hover { background: #25354a; }
    .primary-button { border-color: #315377; background: #315377; color: #fff; }
    .primary-button:hover { background: #42698f; }
    .form-error { border-color: #7a271a; background: #351b1c; color: #fda29b; }
    .success-message { border-color: #05603a; background: #102a22; color: #75e0a7; }
    .table-tools select { border-color: #475467; background: #101828; color: var(--ink); }
    .state-active { background: #103b2d; color: #75e0a7; }
    .state-inactive { background: #344054; color: #d0d5dd; }
    .brand-mark { background: #315377; }
    #signature-canvas { background: #f9fafb; }
    .state-late { background: #3b2418; color: #fdba74; }
}

@media (max-width: 520px) {
    .setup-card { padding: 28px 24px; }
    footer { position: static; margin-top: 24px; }
}

