/* ============================================================
   8D SCAR — Stars Microelectronics (SMT) brand theme
   Colors, fonts and layout aligned to the istars system.
   ============================================================ */
@font-face { font-family:"Gotham"; src:url("/fonts/Gotham-Book.otf") format("opentype"); font-weight:400; font-display:swap; }
@font-face { font-family:"Gotham"; src:url("/fonts/Gotham-Medium.otf") format("opentype"); font-weight:500; font-display:swap; }
@font-face { font-family:"Gotham"; src:url("/fonts/Gotham-Bold.otf") format("opentype"); font-weight:700; font-display:swap; }
@font-face { font-family:"DBX"; src:url("/fonts/DBHelvethaicaX.ttf") format("truetype"); font-weight:400; font-display:swap; }
@font-face { font-family:"DBX"; src:url("/fonts/DBHelvethaicaX-Med.ttf") format("truetype"); font-weight:500; font-display:swap; }
@font-face { font-family:"DBX"; src:url("/fonts/DBHelvethaicaX-Bd.ttf") format("truetype"); font-weight:700; font-display:swap; }

:root {
    /* Official SMT Corporate Identity palette */
    --teal:       #008A6C;   /* brand teal green — primary */
    --teal-700:   #00715A;
    --dark-blue:  #292660;   /* brand dark blue */
    --dark-blue-2:#363273;
    --green:      #95CC79;   /* brand green */
    --blue:       #0172A9;   /* brand blue — links/accent */

    --sidebar:    #292660;   /* dark blue chrome (white logo sits on this) */
    --sidebar-2:  #363273;
    --gold:       #FFBF36;   /* nav accent (matches deployed istars) */
    --primary:    #008A6C;   /* primary buttons */
    --primary-700:#00715A;

    --bg:        #F4F6F8;
    --surface:   #FFFFFF;
    --border:    #E4E8EF;
    --border-2:  #CBD3DF;
    --text:      #1F2A37;
    --muted:     #6B7480;

    --success:#067647; --success-bg:#E7F6EC;
    --warning:#B54708; --warning-bg:#FEF3E2;
    --danger: #B42318; --danger-bg:#FDECEA;
    --info:   #0172A9; --info-bg:#E4F0F8;

    --radius:    8px;
    --radius-lg: 12px;
    --shadow:    0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
    --sidebar-w: 224px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Gotham","DBX","Segoe UI",system-ui,Arial,sans-serif;
    font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.55;
}
h1,h2,h3,h4 { font-weight: 700; color: var(--text); margin: 0 0 .5rem; }
h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- App shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar); color: #fff; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar__logo { padding: 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar__logo img { height: 48px; width: auto; display: block; }

/* Long file name: truncate, reveal full on hover (native title tooltip) */
.fname { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.sidebar__nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.sidebar__nav a {
    color: var(--gold); font-weight: 500; font-size: 14px;
    padding: 10px 12px; border-radius: var(--radius); display: flex; align-items: center; gap: 9px; text-decoration: none;
}
.sidebar__nav a:hover { background: var(--sidebar-2); text-decoration: none; }
.sidebar__nav a.active { background: var(--sidebar-2); }

/* Sidebar groups (mockup Rev 18): module -> sub-pages, future modules greyed out */
.sidebar__label { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.45); padding: 4px 12px 6px; }
.sidebar__nav .nav-main { font-size: 15px; font-weight: 700; }
.sidebar__nav .nav-group { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; }
.sidebar__nav a.nav-sub { color: rgba(255,255,255,.78); font-size: 13px; padding: 8px 12px 8px 28px; position: relative; }
.sidebar__nav a.nav-sub::before { content: ""; position: absolute; left: 16px; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.18); }
.sidebar__nav a.nav-sub.active { background: var(--teal); color: #fff; }
.sidebar__nav .nav-soon { color: rgba(255,255,255,.5); padding: 10px 12px; display: flex; align-items: center; gap: 8px; cursor: default; }
.soon-chip { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: rgba(255,255,255,.14); color: rgba(255,255,255,.8); border-radius: 999px; padding: 2px 8px; }
.sidebar__nav--foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar__nav--foot a.nav-sub::before { display: none; }
.sidebar__nav--foot a.nav-sub { padding-left: 12px; }

/* Edit / View access (owner SQE + managers edit; everyone else view-only) */
.access-chip { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: #F1F2F4; color: #6B7280; }
.access-chip--edit { background: #E7F5F1; color: var(--teal); }
.readonly form, .readonly button { display: none !important; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 54px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; }
.topbar__title { font-weight: 500; color: var(--muted); font-size: 14px; }
.content { padding: 22px; max-width: 1120px; width: 100%; }

/* ---- Section header (teal bar, like istars) ---- */
.section-head { background: var(--teal); color: #fff; border-radius: var(--radius-lg); padding: 14px 20px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { color: #fff; margin: 0; font-size: 20px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }

/* ---- KPI ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kpi__label { font-size: 13px; color: var(--muted); }
.kpi__value { font-size: 24px; font-weight: 700; margin-top: 2px; }

/* ---- Buttons ---- */
.btn, button {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-2); border-radius: var(--radius);
    padding: 8px 14px; font-size: 14px; font-family: inherit; cursor: pointer; text-decoration: none;
    transition: background .12s, border-color .12s;
}
.btn:hover, button:hover { background: var(--bg); text-decoration: none; }
.btn--primary, button.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--primary:hover, button.btn--primary:hover { background: var(--primary-700); }
/* Button placed on the teal section header — white so it stands out */
.btn--onhead, a.btn--onhead { background: #fff; color: var(--teal-700); border-color: #fff; font-weight: 500; }
.btn--onhead:hover, a.btn--onhead:hover { background: #F0FAF7; }
.btn--sm { padding: 5px 10px; font-size: 13px; }
/* Reject / return buttons: light red everywhere (UAT 2026-11-04) */
.btn--reject, button.btn--reject { background: var(--danger-bg); color: var(--danger); border-color: #F5C2B5; }
.btn--reject:hover, button.btn--reject:hover { background: #FAD4CF; }

/* ---- Forms ---- */
label { font-size: 13px; color: var(--text); }
input, select, textarea {
    font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border-2); border-radius: var(--radius); padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--info-bg); }
textarea { width: 100%; resize: vertical; }
.form-row { margin-bottom: 14px; }
.form-row > label { display: block; margin-bottom: 4px; font-weight: 500; }
.field-grid { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }

/* ---- Tables ---- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--border); }
table.data tbody td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
table.data tbody tr:hover { background: var(--bg); }

table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv th { text-align: left; font-weight: 500; color: var(--muted); padding: 7px 10px 7px 0; width: 130px; vertical-align: top; }
table.kv td { padding: 7px 16px 7px 0; }

.card table:not(.data):not(.kv) { width: 100%; border-collapse: collapse; font-size: 14px; }
.card table:not(.data):not(.kv) th, .card table:not(.data):not(.kv) td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.card table:not(.data):not(.kv) th { color: var(--muted); font-weight: 500; }

/* ---- Chips ---- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--muted); }
.chip--success { background: var(--success-bg); color: var(--success); }
.chip--warning { background: var(--warning-bg); color: var(--warning); }
.chip--danger  { background: var(--danger-bg);  color: var(--danger); }
.chip--info    { background: var(--info-bg);    color: var(--info); }
.chip--brand   { background: var(--teal); color: #fff; }

/* ---- Vertical 8D stepper (istars detail style) ---- */
.vstepper { display: flex; flex-direction: column; gap: 0; }
.vstep { display: flex; align-items: center; gap: 10px; position: relative; padding: 6px 0; }
.vstep__dot { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border-2); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; flex-shrink: 0; }
.vstep--done .vstep__dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.vstep--current .vstep__dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.vstep__label { font-size: 13px; color: var(--text); }
.vstep:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 32px; width: 1px; height: 12px; background: var(--border-2); }

/* horizontal stepper (compact) */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; }
.step { font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: var(--radius); background: var(--bg); color: var(--muted); }
.step--done { background: var(--success-bg); color: var(--success); }
.step--current { background: var(--teal); color: #fff; }

.block { border-top: 1px solid var(--border); padding: 14px 0; }
.block:first-of-type { border-top: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---- Standalone pages (supplier portal / response) ---- */
.app-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; background: var(--dark-blue); color: #fff; flex-wrap: wrap; }
.app-bar__brand img { display: block; }
.app-bar__user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: rgba(255,255,255,.85); }
.app-bar__user a { color: #fff; }
.app-bar__user button { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); padding: 5px 12px; font-size: 13px; }
.app-bar__user button:hover { background: rgba(255,255,255,.1); }
.container { margin: 0 auto; padding: 22px 16px; width: 100%; }

/* ---- Top bar user menu ---- */
.usermenu { display: flex; align-items: center; gap: 12px; }
.usermenu__name { font-weight: 500; font-size: 13px; text-align: right; line-height: 1.25; }
.usermenu__role { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.usermenu form { margin: 0; }
.env-pill { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--warning); background: var(--warning-bg); border: 1px solid #F7D8B0; border-radius: 999px; padding: 2px 10px; }

/* ---- New SCAR / Edit draft form (mockup Rev 18 cards) ---- */
.form-card__title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; color: var(--dark-blue, #292660); }
.form-card__num { width: 26px; height: 26px; border-radius: 7px; background: var(--sidebar); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.field-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.field-grid-2 input:not([type=checkbox]), .field-grid-2 select,
.field-grid-3 input, .form-row input { width: 100%; }
@media (max-width: 760px) { .field-grid-2, .field-grid-3 { grid-template-columns: 1fr; } }

/* Page-level messages */
.notice { border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.notice--warning { background: var(--warning-bg); color: var(--warning); border-color: #F7D8B0; }
.notice--danger { background: var(--danger-bg); color: var(--danger); border-color: #F5C2B5; }
.notice--success { background: var(--success-bg); color: var(--success); border-color: #B7E1C6; }

/* Attachments: drop zone + chips (form) and thumbnails (details) */
.dropzone { border: 1.5px dashed #AEB8C6; border-radius: 12px; padding: 18px; text-align: center; background: #FAFBFC; cursor: pointer; font-size: 13px; color: var(--muted); }
.dropzone:hover, .dropzone:focus, .dropzone.drag { border-color: var(--teal); background: #F2FBF8; color: var(--teal); outline: none; }
.dropzone b { color: var(--sidebar); }
.file-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.file-chip { display: flex; align-items: center; gap: 8px; background: #F4F6FA; border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; font-size: 12px; font-weight: 400; max-width: 100%; }
.file-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.file-chip__icon { font-size: 22px; line-height: 1; }
.file-chip .fname { max-width: 170px; }
.file-chip .fsize { color: var(--muted); font-size: 11px; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.thumb { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; text-decoration: none; color: inherit; background: #fff; }
.thumb:hover { border-color: var(--teal); text-decoration: none; }
.thumb img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; background: #F4F6FA; }
.thumb__doc { height: 100px; display: flex; align-items: center; justify-content: center; font-size: 40px; background: #F4F6FA; border-radius: 6px; }
.thumb__name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 3D / 8D rounds */
.vstep-group { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 8px 0 2px; }
.vstep-group:first-child { margin-top: 0; }
.vstep--locked { opacity: .5; }
.round-panel { border-left: 4px solid var(--teal); }
.round-panel--inline { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--teal); border-radius: 8px; background: #FAFBFC; font-size: 13px; }

/* My Pending Action */
.nav-badge { margin-left: auto; background: #F59E0B; color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 8px; }
.action-chip { display: inline-block; font-size: 12px; font-weight: 700; color: #B45309; background: #FFF7ED; border: 1px solid #FED7AA; border-radius: 999px; padding: 3px 10px; text-decoration: none; }
.action-chip:hover { text-decoration: none; background: #FFEDD5; }

/* Details: progress tracker + history (right column) */
.detail-side { flex: 0 0 270px; min-width: 0; }
.next-step { font-size: 13px; margin-bottom: 10px; line-height: 1.6; }
.trk { list-style: none; margin: 0; padding: 0; }
.trk li { position: relative; padding: 5px 0 5px 24px; font-size: 12.5px; color: #9AA1AC; }
.trk li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #CBD2DC; background: #fff; }
.trk li.done { color: var(--text, #222A35); }
.trk li.done::before { background: var(--teal); border-color: var(--teal); }
.trk li.cur { color: var(--sidebar); font-weight: 700; }
.trk li.cur::before { background: #F59E0B; border-color: #F59E0B; }
.log-item { font-size: 12.5px; padding: 8px 0; border-bottom: 1px solid var(--border); line-height: 1.45; }
.log-item:last-child { border-bottom: none; }
.log-comment { margin-top: 3px; padding: 4px 8px; background: #FFF7ED; border-radius: 6px; color: #7C2D12; }
@media (max-width: 1100px) { .detail-side { display: none; } }

/* Dashboard summary */
.summary-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.summary-controls { display: flex; gap: 10px; align-items: center; margin: 0; }
.seg { display: inline-flex; background: #F1F2F4; border-radius: 10px; padding: 3px; gap: 2px; }
.seg__btn { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 6px 14px; border-radius: 8px; text-decoration: none; }
.seg__btn:hover { text-decoration: none; color: var(--sidebar); }
.seg__btn.active { background: #fff; color: var(--sidebar); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.num-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.num-card { border-radius: 12px; padding: 14px 18px; }
.num-card--total { background: #F4F6FA; } .num-card--open { background: #FFF7ED; } .num-card--closed { background: #E7F5F1; }
.num-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.num-card--open .num-label { color: #B45309; } .num-card--closed .num-label { color: var(--teal); }
.num-value { font-size: 30px; font-weight: 800; margin-top: 4px; }

/* Report view (read-only 8D report) */
.report-timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 14px; }
.report-timeline > div { background: #F7F9FB; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.report-timeline .muted { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.report-timeline__tat { background: #E7F5F1 !important; } .report-timeline__tat b { color: var(--teal); }
.report-timeline--pairs { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.report-timeline--pairs > .report-pair { flex-direction: row; gap: 0; padding: 0; }
.report-pair > div { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
.report-pair > div + div { border-left: 1px dashed var(--border); }
.d-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.d-head h3 { margin: 0; }
.d-num { width: 30px; height: 30px; border-radius: 8px; background: var(--sidebar); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 800; flex-shrink: 0; }
.d1-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.d1-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.d1-value { font-weight: 600; }
.d1-value--placeholder { color: #B45309; font-style: italic; }
.why-box { background: #FAFBFC; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.report-actions { margin: 0; padding-left: 18px; line-height: 1.6; }
.report-actions li { margin-bottom: 10px; }
.action-id { display: inline-block; font-size: 10.5px; font-weight: 800; color: var(--teal); background: #E7F5F1; border-radius: 5px; padding: 1px 6px; margin-right: 7px; }
.action-meta { display: block; font-size: 12px; color: var(--muted); }
.photo-btn { display: inline-block; margin: 4px 6px 0 0; font-size: 12px; font-weight: 700; color: var(--sidebar); background: #F4F6FA; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; text-decoration: none; }
.lightbox { display: none; position: fixed; inset: 0; background: rgba(20,20,25,.82); z-index: 999; align-items: center; justify-content: center; padding: 40px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.lightbox__caption { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; }

/* ---- Home: module cards + Supplier Audit ---- */
.sidebar__nav a.nav-home { padding-left: 12px; margin-bottom: 6px; }
.sidebar__nav a.nav-home::before { display: none; }
.module-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; max-width: 900px; }
.module-card { display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 26px 24px; color: inherit; border-top: 5px solid var(--teal); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.module-card:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.10); }
.module-card__title { font-size: 22px; font-weight: 800; color: var(--sidebar); }
.module-card__sub { color: #6b7280; font-size: 13px; }
.module-card__stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.module-card__pending { color: #b45309; font-weight: 700; }
.q-table td, .q-table th { text-align: center; }
.q-table td:first-child, .q-table th:first-child { text-align: left; }
.finding-row.sel td { background: #EEF7F4; }
.answer-box { background: #F8FAFC; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; margin: 4px 0 10px; }
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .content { padding: 12px !important; }
  table.data { display: block; overflow-x: auto; }
}
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cal-month { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; min-height: 70px; }
.cal-month__name { font-weight: 800; color: var(--sidebar); font-size: 13px; margin-bottom: 4px; }
.cal-item { display: block; font-size: 12px; border: 1px solid var(--teal); border-radius: 7px; padding: 3px 6px; margin-top: 4px; color: inherit; background: #EEF7F4; }
.cal-item--plan { border-style: dashed; border-color: #94a3b8; background: #fff; }
.cal-item:hover { text-decoration: none; filter: brightness(.97); }
.num-cards--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .num-cards, .num-cards--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- shared widgets (wwwroot/js/site.js) ---- */
.notice--in-card { margin: 0 0 10px; }
table.data thead th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
table.data thead th.th-sort::after { content: " 95"; color: #C4CBD6; font-size: 11px; }
table.data thead th.th-sort.asc::after { content: " B2"; color: var(--primary); }
table.data thead th.th-sort.desc::after { content: " BC"; color: var(--primary); }
table.data tr.edit-row td { padding-top: 0; border-bottom-style: dashed; }

.date-text { width: 130px; }
.dp-pop { position: absolute; z-index: 1000; width: 244px; background: #fff; border: 1px solid var(--border); border-radius: 10px;
          box-shadow: 0 8px 24px rgba(16, 24, 40, .14); padding: 8px; font-size: 13px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-head button, .dp-foot button { padding: 2px 10px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-dow { color: var(--muted); font-size: 11px; padding: 2px 0; }
.dp-day { padding: 5px 0; border: 0; background: none; border-radius: 6px; }
.dp-day:hover { background: var(--bg); }
.dp-today { outline: 1px solid var(--primary); }
.dp-sel, .dp-sel:hover { background: var(--primary); color: #fff; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 6px; }

.file-pick { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; position: relative; max-width: 100%; }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-pick__name { font-size: 12px; color: var(--muted); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick:focus-within .btn { outline: 2px solid var(--primary); }

.card-year { font-size: 13px; padding: 3px 6px; margin-left: 8px; }

.typeahead { position: relative; }
.typeahead__list { position: absolute; z-index: 900; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--border);
                   border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); max-height: 260px; overflow-y: auto; margin-top: 2px; }
.typeahead__item { padding: 7px 10px; cursor: pointer; font-size: 13px; }
.typeahead__item:hover, .typeahead__item.active { background: var(--bg); }
.typeahead__item b { color: var(--primary); font-weight: 600; }
.typeahead__new { border-top: 1px solid var(--border); color: var(--primary); }

.num-card--cancelled { background: var(--danger-bg); } .num-card--cancelled .num-label, .num-card--cancelled .num-value { color: var(--danger); }
