:root {
  --bg: #f4f6f8; --panel: #ffffff; --panel-2: #f1f5f9; --text: #0f172a; --muted: #5b6b80; --line: #dfe5ec;
  --brand: #0f766e; --brand-ink: #ffffff; --brand-soft: #ccfbf1; --danger: #c81e1e; --danger-soft: #fee2e2;
  --warn: #a16207; --warn-soft: #fef3c7; --ok: #15803d; --ok-soft: #dcfce7; --info-soft: #e0f2fe; --info: #0369a1; --sick: #b91c1c;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06); --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --panel: #111a2b; --panel-2: #0f1727; --text: #e8eef6; --muted: #9fb0c4; --line: #23324a;
    --brand: #2dd4bf; --brand-ink: #042f2e; --brand-soft: #134e4a; --danger: #f87171; --danger-soft: #3b1616;
    --warn: #fbbf24; --warn-soft: #3a2a0a; --ok: #4ade80; --ok-soft: #10301c; --info-soft: #0c2a3e; --info: #7dd3fc; --sick: #fca5a5;
    --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--brand); }
h1 { font-size: 24px; margin: 0 0 4px; line-height: 1.25; } h2 { font-size: 18px; margin: 0 0 12px; } h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 14px; } .right { text-align: right; } .nowrap { white-space: nowrap; } .grow { flex: 1; }
.wrapany { word-break: break-all; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.col { min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; }
.brand img { max-height: 32px; max-width: 120px; }
.brand .mark { width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav a:hover { background: var(--panel-2); }
.nav a.on { background: var(--brand-soft); font-weight: 600; }
.nav .sec { margin: 14px 10px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pill { background: var(--danger); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 7px; font-weight: 700; min-width: 20px; text-align: center; }
.main { padding: 24px 28px 60px; min-width: 0; max-width: 1200px; }
.topbar, .bottomnav, .scrim { display: none; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.who { padding: 10px; border-top: 1px solid var(--line); margin-top: 16px; }
.langsw { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.langsw button { border: 0; border-radius: 0; padding: 6px 14px; min-height: 36px; background: var(--panel); font-weight: 600; }
.langsw button.on { background: var(--brand); color: var(--brand-ink); }

/* panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
a.card { display: block; color: inherit; text-decoration: none; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.list { list-style: none; margin: 0; padding: 0; } .list li { padding: 8px 0; border-bottom: 1px solid var(--line); } .list li:last-child { border-bottom: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--brand)); margin-right: 6px; vertical-align: middle; }
.lrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 4px; background: var(--info-soft); color: var(--info); }

/* home */
.banner { display: block; padding: 14px 16px; border-radius: var(--radius); font-weight: 600; text-decoration: none; border: 1px solid transparent; }
.banner.ok { background: var(--ok-soft); color: var(--ok); } .banner.bad { background: var(--danger-soft); color: var(--danger); }
.banner.warn { background: var(--warn-soft); color: var(--warn); } .banner.info { background: var(--info-soft); color: var(--info); }
.bigbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bigbtn { display: flex; align-items: center; justify-content: center; min-height: 64px; border-radius: var(--radius); font-size: 19px; font-weight: 700; text-decoration: none; border: 2px solid var(--brand); color: var(--brand); background: var(--panel); text-align: center; padding: 8px; }
.bigbtn.primary { background: var(--brand); color: var(--brand-ink); }
.bigbtn.sick { border-color: var(--sick); color: var(--sick); }
.balbig .n { font-size: 40px; font-weight: 800; line-height: 1.1; } .balbig .n small { font-size: 16px; font-weight: 600; color: var(--muted); }
.balbig .l { color: var(--muted); font-size: 14px; } .balbig { border-left: 6px solid var(--brand); } .balbig.mc { border-left-color: var(--sick); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chipx { background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; font-size: 14px; }
.big-num-sm { font-size: 18px; font-weight: 700; }
.teamrow { padding: 6px 0; border-bottom: 1px solid var(--line); } .teamrow:last-of-type { border-bottom: 0; }

/* leave cards */
.lcards { display: grid; gap: 10px; }
.lcard { display: block; background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--muted); border-radius: var(--radius); color: inherit; text-decoration: none; box-shadow: var(--shadow); overflow: hidden; }
.lcard .lmain { display: block; padding: 12px 14px; color: inherit; text-decoration: none; }
.lcard .lact { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 14px 12px; }
.lcard.st-pending { border-left-color: var(--warn); } .lcard.st-approved { border-left-color: var(--ok); } .lcard.st-rejected { border-left-color: var(--danger); }
.lcard.st-cancel_requested { border-left-color: var(--info); }
.msgcard { padding: 12px 14px; } .msgcard.unread { font-weight: 600; }
.warnline { color: var(--warn); font-weight: 600; }
.ok-text { color: var(--ok); font-weight: 600; }
.ballist { display: grid; gap: 4px; } .balrow { display: flex; flex-wrap: wrap; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); } .balrow .full { flex-basis: 100%; }
.acard .big-line { margin: 8px 0 4px; font-size: 17px; }
.clash { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-size: 14px; }
.clash.some { background: var(--warn-soft); color: var(--warn); }

/* table */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--panel-2); font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* badges & buttons */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.pending { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.approved { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.rejected { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.cancel_requested { background: var(--info-soft); color: var(--info); border-color: transparent; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 8px 16px; min-height: 44px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 700; }
button.danger { color: var(--danger); border-color: var(--danger); } button.danger.solid { background: var(--danger); color: #fff; }
button.sm, .btn.sm { padding: 4px 12px; min-height: 38px; font-size: 15px; }
button.big { width: 100%; min-height: 54px; font-size: 18px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bigactions { margin-bottom: 14px; } .bigactions button { min-height: 50px; font-size: 17px; }
.x { border: 0; background: none; font-size: 26px; padding: 0 10px; min-height: 44px; }

/* forms */
label.f, fieldset.f { display: block; margin: 0 0 14px; border: 0; padding: 0; } label.f > span, fieldset.f > legend { display: block; font-size: 15px; font-weight: 700; margin-bottom: 6px; padding: 0; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid #b8c4d2; border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 46px; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); flex: none; }
input[type=color] { padding: 2px; height: 46px; }
input[type=file] { padding: 8px; }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 44px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; }
.fgrid .full { grid-column: 1 / -1; }
.hint { font-size: 14px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.msg { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; }
.msg.err { background: var(--danger-soft); color: var(--danger); font-weight: 600; } .msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.ok { background: var(--ok-soft); color: var(--ok); } .msg.info { background: var(--info-soft); color: var(--info); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar select, .toolbar input { width: auto; min-width: 120px; }
.picker { border: 1px solid var(--line); border-radius: 10px; max-height: 240px; overflow: auto; padding: 6px 10px; }
.picker label { display: flex; gap: 10px; align-items: center; min-height: 40px; }
.days7 { display: flex; gap: 12px; flex-wrap: wrap; } .days7 label { display: flex; gap: 4px; align-items: center; }
.pw { display: flex; gap: 6px; } .pw input { flex: 1; } .pw .eye { flex: none; min-width: 72px; }
details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: var(--brand); }
.applyform { max-width: 640px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.tile { position: relative; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile > span { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; font-weight: 700; min-height: 64px; justify-content: center; }
.tile > span small { font-weight: 500; color: var(--muted); }
.tile input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.tile input:focus-visible + span { outline: 3px solid var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; flex-wrap: wrap; }
.seg label { position: relative; } .seg input { position: absolute; opacity: 0; }
.seg label span, .seg a { display: flex; align-items: center; justify-content: center; padding: 10px 18px; min-height: 48px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text); background: var(--panel); }
.seg input:checked + span, .seg a.on { background: var(--brand); color: var(--brand-ink); }
.seg.small a { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.sent { text-align: center; } .sent .tick { font-size: 56px; color: var(--ok); line-height: 1; margin: 8px 0; }
.bigcode { font: 700 30px ui-monospace, monospace; letter-spacing: .12em; padding: 14px; background: var(--panel-2); border-radius: 10px; text-align: center; user-select: all; }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 400px; padding: 24px; }
.auth .brand { justify-content: center; font-size: 20px; flex-direction: column; text-align: center; }
.auth .brand img { max-height: 56px; max-width: 200px; }
.authtop { display: flex; justify-content: flex-end; margin-top: -8px; }

/* staff portal (home page with one tile per app) */
.portal { min-height: 100vh; }
.ptop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ptop .brand { padding: 0; }
.ptop .langsw { margin-top: 0; }
.pmain { max-width: 960px; margin: 0 auto; padding: 32px 20px 60px; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 22px 0 18px; }
.app { display: flex; flex-direction: column; gap: 4px; padding: 20px; min-height: 180px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.app:hover, .app:focus-visible { border-color: var(--brand); transform: translateY(-2px); }
.app .aicon { width: 60px; height: 60px; border-radius: 16px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; margin-bottom: 10px; }
.app .aname { font-size: 21px; font-weight: 700; }
.app .adesc { color: var(--muted); font-size: 15px; }
.app .abadges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.app .abadges .pill { padding: 2px 10px; font-size: 13px; }
.nav a.allapps { color: var(--muted); font-size: 14px; margin-bottom: 6px; justify-content: flex-start; gap: 8px; }
.topbar .allapps { font-size: 22px; min-width: 44px; min-height: 44px; display: grid; place-items: center; color: var(--text); text-decoration: none; border-radius: 8px; }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: start center; padding: 5vh 12px; overflow: auto; z-index: 60; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 900px; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 18px; }
.modal .body { padding: 18px; } .modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal textarea.in { margin-top: 4px; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: 12px; display: grid; gap: 8px; z-index: 99; width: min(92vw, 460px); }
.toast { background: var(--text); color: var(--bg); padding: 14px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; cursor: pointer; }
.toast.err { background: var(--danger); color: #fff; }

/* calendar */
.calbar .mname { min-width: 140px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cal .h { background: var(--panel-2); font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.cal .d { min-height: 100px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 6px; font-size: 13px; min-width: 0; }
.cal .d:nth-child(7n) { border-right: 0; }
.cal .d.out { background: var(--panel-2); }
.cal .d.rest { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--panel-2) 6px 12px); }
.cal .d.today .dn { background: var(--brand); color: var(--brand-ink); border-radius: 99px; padding: 0 7px; }
.cal .dn { font-weight: 700; display: inline-block; margin-bottom: 2px; }
.hol { color: var(--danger); font-weight: 700; font-size: 13px; }
.chip { display: block; border-radius: 6px; padding: 2px 6px; margin: 3px 0; color: #fff; background: var(--c, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; text-decoration: none; }
.chip.pending { background: transparent; color: var(--text); border: 2px dashed var(--c, #64748b); }
.daylist { display: grid; gap: 8px; }
.dayrow { display: grid; grid-template-columns: 70px 1fr; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.dayrow.today { border-color: var(--brand); border-width: 2px; }
.dayrow .chip { display: inline-block; margin: 3px 4px 3px 0; font-size: 15px; padding: 4px 10px; }

/* timeline */
.tl { list-style: none; padding: 0; margin: 0; } .tl li { padding: 6px 0 6px 18px; border-left: 2px solid var(--line); position: relative; }
.tl li::before { content: ''; position: absolute; left: -7px; top: 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.tl li.approve::before, .tl li.cancel_approve::before { background: var(--ok); } .tl li.reject::before, .tl li.cancel_reject::before { background: var(--danger); }
.tl li.wait::before { background: var(--warn); }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; margin: 0; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }

/* phones */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(84vw, 320px); z-index: 50; transform: translateX(-105%); transition: transform .2s; height: 100vh; box-shadow: var(--shadow); }
  .shell.open .side { transform: none; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 45; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar .langsw { margin-top: 0; }
  .topbar .menu { position: relative; font-size: 22px; min-width: 48px; }
  .dotbadge { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; background: var(--danger); border-radius: 50%; }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 60px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; text-align: center; line-height: 1.15; padding: 4px 2px; }
  .bottomnav a .ic { font-size: 22px; line-height: 1; }
  .bottomnav a.on { color: var(--brand); }
  .bottomnav .pill { position: absolute; top: 4px; left: 55%; }
  .main { padding: 16px 16px 96px; }
  .g2, .g3, .fgrid { grid-template-columns: 1fr; }
  .bigbtns { grid-template-columns: 1fr; }
  .cal .d { min-height: 64px; padding: 2px 3px; } .cal .chip { font-size: 11px; padding: 1px 3px; } .cal .h { padding: 4px 2px; text-align: center; }
  dl.kv { grid-template-columns: 1fr; gap: 0; } dl.kv dt { margin-top: 8px; font-size: 14px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .ptop { padding: 8px 12px; } .pmain { padding: 20px 16px 40px; }
  .app { min-height: 0; }
  .bigactions button { flex: 1 1 45%; }
  .toolbar select, .toolbar input { flex: 1 1 140px; }
}
@media print {
  .side, .topbar, .toolbar, .noprint, #toasts, .bottomnav { display: none !important; }
  .shell { display: block; } .main { padding: 0; } body { background: #fff; color: #000; }
  .tablewrap { border: 0; overflow: visible; } th { position: static; }
  table { font-size: 11px; }
  .overlay { position: static; background: none; padding: 0; } .modal footer, .modal header .x { display: none; }
}
.card.warnbox { border-color: var(--danger); }
