/* ============================================================================
   IPDS — ระบบบันทึกข้อมูลสถานที่ฝึกงาน
   Visual system: "แฟ้มเอกสารราชการ" — a departmental document file.
   Ground is celadon (ศิลาดล); panels are paper; ink is near-black green.
   Seal vermilion (ชาด) is reserved for conferred state, flags and deletion —
   it never decorates. Sarabun is the Thai official-document face; Anuphan
   carries headings; mono carries codes, hours and dates.
   Responsive + keyboard accessible (NFR-01, NFR-02).
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    --paper:        #e6eae2;
    --card:         #ffffff;
    --tint:         #f1f4ed;
    --tint-deep:    #dfe6da;

    --ink:          #16211d;
    --ink-soft:     #2b3a33;
    --muted:        #5d6c65;
    --rule:         #c7d0c4;
    --rule-soft:    #e2e7dd;

    --seal:         #b1362a;
    --seal-tint:    #fbeeec;
    --forest:       #1b5a44;
    --forest-tint:  #e8f1ec;
    --ochre:        #8f610d;
    --ochre-tint:   #faf1de;
    --slate:        #575c78;
    --slate-tint:   #eeeef5;

    --font-display: 'Anuphan', 'Noto Sans Thai', 'Leelawadee UI', 'Segoe UI', sans-serif;
    --font-body:    'Sarabun', 'Noto Sans Thai', 'Leelawadee UI', Tahoma, sans-serif;
    --font-mono:    'IBM Plex Mono', 'Sarabun', ui-monospace, 'Courier New', monospace;

    --radius:       4px;
    --shell:        1140px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, legend {
    font-family: var(--font-display);
    line-height: 1.35;
    letter-spacing: .005em;
}

h1 { font-size: 1.7rem; font-weight: 700; margin: 0 0 .35rem; }
h2 { font-size: 1.35rem; font-weight: 600; margin: 0 0 .5rem; }
h3 { font-size: 1.08rem; font-weight: 600; margin: 0 0 .6rem; }
h4 { font-size: 1rem; font-weight: 600; margin: 1.2rem 0 .5rem; }

a { color: var(--forest); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

p { margin: 0 0 .8rem; }
hr { border: none; border-top: 1px solid var(--rule-soft); margin: 1.5rem 0; }
code { font-family: var(--font-mono); font-size: .92em; }

:focus-visible {
    outline: 2px solid var(--forest);
    outline-offset: 2px;
    border-radius: 2px;
}

.container { max-width: var(--shell); margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--muted); }
.inline { display: inline; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: .94em; }

/* ---------- Masthead (หัวกระดาษ) ---------- */
.masthead { background: var(--ink); color: #e8ece7; }

.masthead-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: .85rem;
    padding-bottom: .85rem;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    color: #fff;
    text-decoration: none;
    min-width: 0;
}
.wordmark-mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: .82rem;
    letter-spacing: .22em;
    padding: .3rem .1rem .3rem .32rem;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 2px;
    flex: none;
}
.wordmark-text {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: .01em;
    color: #d5ddd6;
}
.wordmark:hover .wordmark-text { color: #fff; }

.masthead-side {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    flex-wrap: wrap;
    font-size: .92rem;
}
.masthead-user { color: #b8c4bc; }
.masthead-user strong { color: #fff; font-weight: 600; }

.link-plain {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: #b8c4bc;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.link-plain:hover { color: #fff; }

/* Tab rail — the dividers of the file */
.tabrail { background: var(--tint); border-bottom: 1px solid var(--rule); }
.tabrail-inner {
    display: flex;
    gap: .25rem;
    overflow-x: auto;
    scrollbar-width: thin;
}
.tab {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: .95rem;
    color: var(--muted);
    text-decoration: none;
    padding: .7rem .9rem .55rem;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.tab:hover { color: var(--ink); background: rgba(22, 33, 29, .04); }
.tab.is-current { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* ---------- Notifications ---------- */
.notif { position: relative; }
.notif summary {
    cursor: pointer;
    list-style: none;
    color: #b8c4bc;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.notif summary::-webkit-details-marker { display: none; }
.notif summary:hover { color: #fff; }
.notif[open] summary { color: #fff; }

.badge {
    font-family: var(--font-mono);
    font-size: .72rem;
    font-weight: 500;
    background: var(--seal);
    color: #fff;
    border-radius: 2px;
    padding: .05rem .35rem;
}

.notif-list {
    position: absolute;
    right: 0;
    z-index: 40;
    margin-top: .6rem;
    width: min(340px, calc(100vw - 2.5rem));
    max-height: 380px;
    overflow-y: auto;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px -18px rgba(22, 33, 29, .5);
    padding: .35rem;
}
.notif-item {
    padding: .6rem .7rem;
    border-bottom: 1px solid var(--rule-soft);
    font-size: .9rem;
    line-height: 1.6;
}
.notif-item:last-of-type { border-bottom: none; }
.notif-item small { display: block; color: var(--muted); font-size: .8rem; }
.notif-item.unread { border-left: 3px solid var(--seal); background: var(--tint); }
.notif-list form { padding: .5rem .7rem .3rem; border-top: 1px solid var(--rule-soft); }

/* ---------- Page shell ---------- */
main.container { padding-top: 1.75rem; padding-bottom: 2.5rem; }

.page-head { margin: 0 0 1.4rem; }
.page-head h1 { margin-bottom: .25rem; }
.page-head p { margin: 0; color: var(--muted); }

.page-meta {
    display: flex;
    align-items: center;
    gap: .6rem 1.1rem;
    flex-wrap: wrap;
    margin: 0 0 1.4rem;
    color: var(--muted);
}
.page-meta strong { color: var(--ink); font-weight: 600; }

.footer {
    border-top: 1px solid var(--rule);
    padding: 1.25rem 1.25rem 2.5rem;
    color: var(--muted);
    font-size: .84rem;
    line-height: 1.7;
}

/* ---------- Panels ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1.35rem 1.4rem;
    margin: 0 0 1.25rem;
}

/* A leading heading becomes the file-divider label: tinted, full-bleed band */
.card > h3:first-child,
.card > h2:first-child,
.card > .card-head:first-child {
    margin: -1.35rem -1.4rem 1.2rem;
    padding: .7rem 1.4rem;
    background: var(--tint);
    border-bottom: 1px solid var(--rule);
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-head {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    flex-wrap: wrap;
}
.card-head h3 {
    margin: 0;
    background: none;
    padding: 0;
    border: none;
}
.card-head .spacer { margin-left: auto; }

.count-badge {
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: .05rem .45rem;
    white-space: nowrap;
}
.count-badge-warn { color: var(--ochre); border-color: #e2cd9e; background: var(--ochre-tint); }
.count-badge-alert { color: var(--seal); border-color: #e6bfba; background: var(--seal-tint); }

.hint { color: var(--muted); font-size: .85rem; line-height: 1.65; }
p.hint { margin: .5rem 0 .75rem; }
p.hint:last-child { margin-bottom: 0; }

.check-list { margin: 0 0 1.15rem; padding-left: 1.1rem; }
.check-list li { margin-bottom: .1rem; }

/* Fact pairs — label above value, used on record summaries */
.factlist { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 0; }
.factlist dt {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: .1rem;
}
.factlist dd { margin: 0; font-size: 1.02rem; }
.factlist .figure {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3rem;
    font-variant-numeric: tabular-nums;
}

.record-summary {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem 2rem;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 1.1rem;
}
.record-summary .stamp { margin: .2rem 1rem 0 0; }

/* ---------- Grids ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1.25rem; }

/* ---------- Forms ---------- */
label {
    display: block;
    font-weight: 600;
    font-size: .92rem;
    margin-bottom: .3rem;
    color: var(--ink-soft);
}

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=file], select, textarea {
    width: 100%;
    padding: .55rem .7rem;
    font: inherit;
    font-size: .97rem;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 3px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder, textarea::placeholder { color: #93a09a; }

input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=date]:focus, input[type=number]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--forest);
    box-shadow: 0 0 0 3px rgba(27, 90, 68, .13);
}

input:disabled, select:disabled, textarea:disabled {
    background: var(--tint);
    color: var(--muted);
    -webkit-text-fill-color: var(--muted);
}

textarea { min-height: 116px; resize: vertical; }

.field { margin-bottom: 1.15rem; }
.stack-sm { margin-top: .4rem; }
.field-error { color: var(--seal); font-size: .86rem; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .35rem;
}
.field.checkbox-row { margin-bottom: 1.15rem; }
.checkbox-row input { width: auto; accent-color: var(--forest); }
.checkbox-row label { margin: 0; font-weight: 400; font-size: .97rem; }

.date-select { display: flex; gap: .5rem; }
.date-select select { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: .92rem; }

/* Numbered sections of the paper form — Thai numerals carry the order */
fieldset {
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--card);
    padding: 1.4rem 1.4rem .5rem;
    margin: 0 0 1.25rem;
}
legend {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.08rem;
    font-weight: 600;
    margin-left: -.35rem;
    padding: .1rem .55rem;
    background: var(--card);
}
.sect-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid var(--ink);
    border-radius: 2px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    flex: none;
}
fieldset:disabled { opacity: .55; }
fieldset:disabled .sect-num { border-color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.4;
    padding: .55rem 1.2rem;
    border: 1px solid var(--ink);
    border-radius: 3px;
    background: var(--ink);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.btn:hover { background: #0c130f; border-color: #0c130f; color: #fff; }

.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--rule); }
.btn-secondary:hover { background: var(--tint); color: var(--ink); border-color: var(--ink); }

.btn-success { background: var(--forest); border-color: var(--forest); }
.btn-success:hover { background: #14432f; border-color: #14432f; }

.btn-danger { background: var(--seal); border-color: var(--seal); }
.btn-danger:hover { background: #8e2a20; border-color: #8e2a20; }

.btn-sm { font-size: .87rem; padding: .32rem .8rem; }

.btn-block { display: flex; width: 100%; padding: .7rem 1.2rem; font-size: 1rem; }

.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1rem; }

/* ---------- Alerts ---------- */
.alert {
    border: 1px solid var(--rule);
    border-left: 3px solid var(--ink);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: .8rem 1.1rem;
    margin: 0 0 1.25rem;
    font-size: .95rem;
    line-height: 1.7;
    background: var(--card);
}
.alert ul { margin: 0; padding-left: 1.2rem; }
.alert-success { background: var(--forest-tint); border-color: #bcd6c8; border-left-color: var(--forest); color: #113c2c; }
.alert-error   { background: var(--seal-tint);   border-color: #e6bfba; border-left-color: var(--seal);   color: #7e261c; }
.alert-warn    { background: var(--ochre-tint);  border-color: #e2cd9e; border-left-color: var(--ochre);  color: #6d4a09; }
.alert-info    { background: var(--tint);        border-color: var(--rule); border-left-color: var(--muted); color: var(--ink-soft); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card);
    font-size: .94rem;
}
th, td {
    padding: .6rem .75rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--rule-soft);
}
thead th {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .84rem;
    color: var(--muted);
    background: var(--tint);
    border-bottom: 1px solid var(--rule);
    white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fbfcfa; }
tr.incomplete td { background: var(--ochre-tint); }

/* Row-header tables (the record review sheet) */
.table-sheet tbody th {
    width: 220px;
    background: var(--tint);
    color: var(--ink-soft);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .9rem;
    border-right: 1px solid var(--rule);
    white-space: normal;
}

/* Full-bleed inside a panel */
.card > .table-wrap { margin: 1.2rem -1.4rem 0; width: calc(100% + 2.8rem); }
.card > .card-head + .table-wrap,
.card > h3:first-child + .table-wrap { margin-top: 0; }
.card > .table-wrap:last-child > table { margin-bottom: -1.35rem; }
.card > .table-wrap th:first-child,
.card > .table-wrap td:first-child { padding-left: 1.4rem; }
.card > .table-wrap th:last-child,
.card > .table-wrap td:last-child { padding-right: 1.4rem; }

/* Student name column — wide enough that a given name and surname stay on one
   line; the table scrolls sideways rather than breaking the name in two. */
.col-name { min-width: 14rem; }
.col-name .fullname { white-space: nowrap; }

/* Secondary line under a cell's main value (last sign-in, state date) */
.cell-sub { display: block; margin-top: .1rem; font-size: .78rem; line-height: 1.5; color: var(--muted); }
.cell-sub-alert { color: var(--seal); font-weight: 600; }

.num-col { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.row-action { text-align: right; white-space: nowrap; }
.table-empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* ---------- Filter toolbar ---------- */
.toolbar {
    display: flex;
    align-items: flex-end;
    gap: .85rem 1.1rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.4rem;
}
.toolbar-field label {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: .25rem;
}
.toolbar-field select { min-width: 168px; max-width: 320px; font-size: .92rem; }
.toolbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; }

.filter-row {
    display: flex;
    gap: .6rem .85rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: .5rem;
}
.filter-row [hidden] { display: none; }

/* Per-row edit forms inside tables */
.inline-form { display: flex; align-items: center; gap: .35rem; }
.inline-form input { width: auto; min-width: 0; max-width: 165px; font-size: .88rem; padding: .3rem .5rem; }
.filter-row input, .filter-row select { width: auto; font-size: .92rem; }
.filter-row .w-search { min-width: 210px; }
.filter-row .w-select { min-width: 170px; }

/* ---------- Tallies ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.stat { background: var(--card); padding: .9rem 1rem 1rem; }
.stat .num {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat .label {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .85rem;
    color: var(--muted);
}
.stat .dot { width: 9px; height: 9px; border-radius: 1px; background: var(--rule); flex: none; }
.stat-draft .dot            { background: #9aa89f; }
.stat-submitted .dot        { background: var(--ink); }
.stat-needs_revision .dot   { background: var(--ochre); }
.stat-approved .dot         { background: var(--forest); }
.stat-not_participating .dot{ background: var(--slate); }

/* ---------- Chips (dense lists) ---------- */
.status-pill, .track-pill, .qual-pill, .complete-pill {
    display: inline-block;
    font-size: .82rem;
    line-height: 1.5;
    padding: .05rem .5rem;
    border: 1px solid transparent;
    border-radius: 2px;
    white-space: nowrap;
}

.status-draft            { background: var(--tint); color: var(--muted); border-color: var(--rule); }
.status-submitted        { background: var(--card); color: var(--ink); border-color: var(--ink); }
.status-needs_revision   { background: var(--ochre-tint); color: var(--ochre); border-color: #e2cd9e; }
.status-approved         { background: var(--forest-tint); color: var(--forest); border-color: #bcd6c8; }
.status-not_participating{ background: var(--slate-tint); color: var(--slate); border-color: #cfd0e0; }

.track-internship { background: var(--tint); color: var(--ink-soft); border-color: var(--rule); }
.track-coop       { background: var(--slate-tint); color: var(--slate); border-color: #cfd0e0; }

.qual-passed     { background: var(--forest-tint); color: var(--forest); border-color: #bcd6c8; }
.qual-not_passed { background: var(--seal-tint); color: var(--seal); border-color: #e6bfba; }
.qual-unset      { background: var(--tint); color: var(--muted); border-color: var(--rule); }

.complete-yes { background: var(--forest-tint); color: var(--forest); border-color: #bcd6c8; }
.complete-no  { background: var(--ochre-tint); color: var(--ochre); border-color: #e2cd9e; }
.missing-list { display: block; margin-top: .25rem; max-width: 280px; font-size: .8rem; line-height: 1.55; }

/* ---------- ตรายาง — the seal. One per screen, where state is conferred ---- */
.stamp {
    position: relative;
    display: inline-block;
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.25;
    padding: .45rem 1.1rem;
    border: 2px solid currentColor;
    border-radius: 2px;
    transform: rotate(-2.5deg);
    transform-origin: left center;
    mix-blend-mode: multiply;
    opacity: .95;
}
.stamp::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid currentColor;
    border-radius: 1px;
    opacity: .55;
}
.stamp-draft             { color: #626d67; }
.stamp-submitted         { color: var(--ink); }
.stamp-needs_revision    { color: var(--ochre); }
.stamp-approved          { color: var(--forest); }
.stamp-not_participating { color: var(--slate); }

/* ---------- Hour tally — the number this whole system exists to get right --- */
.hours-panel {
    display: flex;
    align-items: baseline;
    gap: .5rem 1.25rem;
    flex-wrap: wrap;
    background: var(--tint);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 0 0 1.15rem;
}
.hours-figure { display: flex; align-items: baseline; gap: .4rem; }
.hours-figure .num {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}
.hours-unit { font-size: 1rem; color: var(--muted); }
.hours-caption {
    flex: 1 1 240px;
    font-family: var(--font-mono);
    font-size: .78rem;
    line-height: 1.6;
    color: var(--muted);
}
.hours-shortfall { flex: 1 1 100%; color: var(--ochre); font-size: .88rem; font-weight: 600; }
.hours-shortfall:empty { display: none; }

/* ---------- Company autocomplete ---------- */
.autocomplete { position: relative; }
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 25;
    background: var(--card);
    border: 1px solid var(--ink);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 264px;
    overflow-y: auto;
    box-shadow: 0 16px 32px -18px rgba(22, 33, 29, .5);
}
.autocomplete-item { padding: .5rem .7rem; cursor: pointer; border-bottom: 1px solid var(--rule-soft); }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--tint); }
.autocomplete-item small { display: block; color: var(--muted); font-size: .82rem; }

/* ---------- AI-assisted fields (FR-FORM-04) ---------- */
.ai-filled {
    background: #fdf6e3 !important;
    border-color: #d8b45e !important;
    box-shadow: inset 3px 0 0 #d8b45e;
}
.ai-legend {
    display: inline-block;
    background: #fdf6e3;
    border: 1px solid #d8b45e;
    border-radius: 2px;
    padding: 0 .4rem;
    font-size: .85rem;
}

/* ---------- Coordinator flags (FR-WF-01) ---------- */
.flagged {
    border-color: var(--seal) !important;
    background: var(--seal-tint) !important;
}
.flag-note { color: var(--seal); font-size: .86rem; font-weight: 600; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 2.75rem 1.25rem; }
.empty-state .empty-icon { font-size: 1.9rem; line-height: 1; margin-bottom: .6rem; }
.empty-state p { margin: .2rem 0; }

/* ---------- Collapsible ("ไม่ประสงค์ออกฝึก") ---------- */
.disclosure { padding: 0; }
.disclosure > summary {
    cursor: pointer;
    list-style: none;
    padding: .85rem 1.4rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .98rem;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before {
    content: "+";
    font-family: var(--font-mono);
    color: var(--muted);
}
.disclosure[open] > summary::before { content: "–"; }
.disclosure > summary:hover { background: var(--tint); }
.disclosure[open] > summary { border-bottom: 1px solid var(--rule); background: var(--tint); }
.disclosure-body { padding: 1.15rem 1.4rem 1.35rem; }

/* ---------- Sign-in ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
}
.auth-page main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.auth-wrap { display: flex; justify-content: center; padding: 2.5rem 0 3rem; }
.auth-page .alert { max-width: 430px; margin: 0 auto -1rem; width: 100%; }

.auth-card {
    width: 100%;
    max-width: 430px;
    padding: 2.1rem 2rem 2rem;
    margin: 0;
    box-shadow: 0 24px 48px -32px rgba(22, 33, 29, .45);
}
.auth-brand { margin-bottom: 1.6rem; }
.auth-eyebrow {
    font-family: var(--font-mono);
    font-size: .74rem;
    letter-spacing: .18em;
    color: var(--muted);
    margin-bottom: .5rem;
}
.auth-brand h2 { margin: 0 0 .2rem; font-size: 1.5rem; font-weight: 700; }
.auth-subtitle { margin: 0; color: var(--muted); font-size: .92rem; }
.auth-rule { border-top: 2px solid var(--ink); margin: 1rem 0 0; width: 2.5rem; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 2.9rem; }
.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0 .8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #93a09a;
}
.password-toggle:hover, .password-toggle.active { color: var(--forest); }

.auth-hint {
    margin-top: 1.5rem;
    padding: .9rem 1rem;
    background: var(--tint);
    border-left: 3px solid var(--ink);
    color: var(--ink-soft);
    font-size: .87rem;
    line-height: 1.75;
}
.auth-hint strong:first-child { display: block; margin-bottom: .1rem; }

.login-card { max-width: 480px; margin: 0 auto; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
    body { font-size: 16px; }
    h1 { font-size: 1.45rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .toolbar-field { flex: 1 1 100%; }
    .toolbar-field select { max-width: none; width: 100%; }
    .toolbar-actions { margin-left: 0; width: 100%; }
    .filter-row input, .filter-row select { width: 100%; }
    .masthead-side { width: 100%; margin-left: 0; }
    .card { padding: 1.15rem 1.1rem; }
    .card > h3:first-child,
    .card > h2:first-child,
    .card > .card-head:first-child { margin: -1.15rem -1.1rem 1rem; padding: .65rem 1.1rem; }
    .card > .table-wrap { margin: 1.2rem -1.1rem 0; width: calc(100% + 2.2rem); }
    .card > .table-wrap th:first-child,
    .card > .table-wrap td:first-child { padding-left: 1.1rem; }
    .card > .table-wrap th:last-child,
    .card > .table-wrap td:last-child { padding-right: 1.1rem; }
    .card > .table-wrap:last-child > table { margin-bottom: -1.15rem; }
    fieldset { padding: 1.2rem 1.1rem .4rem; }
    .disclosure > summary, .disclosure-body { padding-left: 1.1rem; padding-right: 1.1rem; }
    .hours-figure .num { font-size: 2.3rem; }
    .table-sheet tbody th { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
