/* Sporelytics Time — layout: fixed brand sidebar, calendar-first workspace, right-hand context rail.
   Palette is lifted from the logo: the five rising bars (moss, teal, deep navy, amber, coral). */
:root {
  --moss: #4E7133; --teal: #237176; --navy: #084763; --amber: #DE8738; --coral: #DE4146; --ink: #1C2840;
  --bg: #F3F6F8; --surface: #FFFFFF; --surface-2: #F7F9FB; --surface-3: #EDF1F5;
  --line: #DFE5EC; --line-strong: #C9D2DC;
  --text: #1C2840; --text-2: #4C5B70; --text-3: #7C8A9C;
  --primary: #084763; --primary-hover: #0A587A; --primary-soft: #E3EEF3; --on-primary: #FFFFFF;
  --ok: #3F7A3A; --ok-soft: #E6F1E3; --warn: #B5651D; --warn-soft: #FBEEDD; --bad: #C8323A; --bad-soft: #FBE6E7; --info-soft: #E2F0F1;
  --weekend: #F4F6F9; --holiday: #FFF6EA; --today-ring: #DE8738;
  --shadow-1: 0 1px 2px rgba(28,40,64,.06); --shadow-2: 0 8px 28px rgba(28,40,64,.14); --shadow-3: 0 20px 60px rgba(28,40,64,.25);
  --radius: 10px; --radius-sm: 6px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --display: "Outfit", "Inter", "Segoe UI", system-ui, sans-serif;
  --sidebar-w: 236px;
}
:root[data-theme="dark"] {
  --bg: #0E1620; --surface: #16212E; --surface-2: #1B2837; --surface-3: #223244;
  --line: #2A3A4D; --line-strong: #3A4D63;
  --text: #E8EEF4; --text-2: #B3C0CF; --text-3: #8194A8;
  --primary: #3E9BC0; --primary-hover: #55AECF; --primary-soft: #17364A; --on-primary: #06131C;
  --ok: #7FC077; --ok-soft: #1C3320; --warn: #EBA763; --warn-soft: #3A2A17; --bad: #F0767C; --bad-soft: #3D1D20; --info-soft: #17343A;
  --weekend: #131D29; --holiday: #2A2418; --ink: #E8EEF4;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 8px 28px rgba(0,0,0,.5); --shadow-3: 0 20px 60px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; } h2 { font-size: 17px; font-weight: 600; } h3 { font-size: 14.5px; font-weight: 600; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.muted { color: var(--text-3); } .small { font-size: 12.5px; } .num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }

/* boot */
.boot { height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; }
.boot-bars { display: flex; gap: 5px; align-items: flex-end; height: 26px; }
.boot-bars i { width: 7px; border-radius: 2px; animation: rise 1s ease-in-out infinite alternate; }
.boot-bars i:nth-child(1) { background: var(--moss); height: 30%; } .boot-bars i:nth-child(2) { background: var(--teal); height: 50%; animation-delay: .1s; }
.boot-bars i:nth-child(3) { background: var(--navy); height: 70%; animation-delay: .2s; } .boot-bars i:nth-child(4) { background: var(--amber); height: 85%; animation-delay: .3s; }
.boot-bars i:nth-child(5) { background: var(--coral); height: 100%; animation-delay: .4s; }
@keyframes rise { from { transform: scaleY(.5); } to { transform: scaleY(1); } } .boot-bars i { transform-origin: bottom; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; }
.brand img { width: 38px; height: 38px; object-fit: contain; }
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] .auth-logo { background: #fff; border-radius: 8px; padding: 3px; }
.brand b { font-family: var(--display); font-weight: 800; letter-spacing: .09em; font-size: 14.5px; color: var(--ink); display: block; line-height: 1.1; }
.brand span { font-size: 11px; color: var(--text-3); letter-spacing: .14em; text-transform: uppercase; }
.nav { padding: 8px 10px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; text-decoration: none; margin-bottom: 1px; }
.nav a svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a .count { margin-left: auto; background: var(--coral); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); padding: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; text-decoration: none; color: inherit; }
.me:hover { background: var(--surface-3); text-decoration: none; }
.me .n { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .me .r { font-size: 11.5px; color: var(--text-3); text-transform: capitalize; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; overflow: auto; padding: 20px 24px 40px; }
@media (min-width: 821px) { .shell.nav-hidden { grid-template-columns: 1fr; } .shell.nav-hidden .sidebar { display: none; } }
.announce { background: var(--warn-soft); color: var(--warn); padding: 8px 24px; font-weight: 500; font-size: 13px; border-bottom: 1px solid var(--line); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 13px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); } .btn.primary:hover { background: var(--primary-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; } .btn.danger { color: var(--bad); border-color: var(--bad); } .btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; } .btn.lg { padding: 10px 18px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-3); } .icon-btn svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .dot { position: absolute; top: 3px; right: 2px; background: var(--coral); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--text-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; } .seg button.on { background: var(--primary); color: var(--on-primary); } .seg button:hover:not(.on) { background: var(--surface-3); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; background: var(--surface); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }
select.inline, input.inline { width: auto; }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 12.5px; color: var(--text-2); }
label.field .hint { font-weight: 400; color: var(--text-3); font-size: 12px; }
label.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; cursor: pointer; } label.check input { margin-top: 3px; accent-color: var(--primary); }
label.check .hint { display: block; font-weight: 400; color: var(--text-3); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; } .form-grid .full { grid-column: 1 / -1; }
.form-grid h3 { grid-column: 1 / -1; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); } .form-grid h3:first-child { border: 0; padding-top: 0; margin-top: 0; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card.pad { padding: 16px 18px; } .card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); } .card-head h2, .card-head h3 { flex: 1; }
.grid { display: grid; gap: 14px; } .cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.auto-cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.empty { text-align: center; color: var(--text-3); padding: 36px 16px; }
.empty b { display: block; color: var(--text-2); font-family: var(--display); font-size: 15px; margin-bottom: 4px; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.pill.approved { background: var(--ok-soft); color: var(--ok); } .pill.pending, .pill.submitted, .pill.cancel_requested { background: var(--warn-soft); color: var(--warn); }
.pill.auto { background: var(--info-soft); color: var(--teal); } .pill.due { background: var(--amber); color: #fff; } .pill.overdue { background: var(--coral); color: #fff; }
.pill.denied, .pill.rejected { background: var(--bad-soft); color: var(--bad); } .pill.cancelled, .pill.draft, .pill.not_started { background: var(--surface-3); color: var(--text-3); }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 11.5px; flex: none; font-family: var(--display); letter-spacing: .02em; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; } .avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.note { border-radius: 8px; padding: 9px 12px; font-size: 13px; display: flex; gap: 8px; }
.note.warn { background: var(--warn-soft); color: var(--warn); } .note.bad { background: var(--bad-soft); color: var(--bad); } .note.ok { background: var(--ok-soft); color: var(--ok); } .note.info { background: var(--info-soft); color: var(--text-2); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; } .tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.multi { position: relative; display: inline-block; min-width: 0; }
.multi-btn { display: inline-flex; align-items: center; gap: 8px; justify-content: space-between; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; background: var(--surface); cursor: pointer; font-size: 13px; max-width: 260px; width: 100%; }
.multi-btn:hover { background: var(--surface-2); } .multi-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .multi-caret { color: var(--text-3); font-size: 11px; }
.multi-btn[aria-expanded=true] { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: -1px; }
.multi-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 220px; max-width: 320px; max-height: 300px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); padding: 6px; }
.multi-menu.flip { left: auto; right: 0; }
.multi-menu label.check { padding: 6px 8px; border-radius: 6px; font-weight: 500; font-size: 13px; align-items: center; } .multi-menu label.check:hover { background: var(--surface-3); } .multi-menu label.check input { margin-top: 0; }
.multi-sep { height: 1px; background: var(--line); margin: 4px 0; }
.field .multi { display: block; } .field .multi-btn { max-width: none; padding: 7px 10px; font-size: 14px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .filters input[type=search] { max-width: 240px; } .filters select, .filters input[type=date] { width: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; padding-bottom: 1px; }
.tabs button { border: 0; background: none; padding: 9px 14px; font-weight: 600; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-color: var(--primary); } .tabs button:hover { color: var(--text); }
.tabs .count { background: var(--coral); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; margin-left: 5px; }

/* modal / drawer / toast / popover */
.overlay { position: fixed; inset: 0; background: rgba(15,25,40,.45); display: grid; place-items: start center; padding: 6vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-3); width: min(620px, 100%); animation: pop .16s ease-out; }
.modal.wide { width: min(860px, 100%); } .modal.xwide { width: min(1120px, 100%); } .ts-table td:first-child { white-space: nowrap; } .modal.narrow { width: min(440px, 100%); }
@keyframes pop { from { transform: translateY(8px); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); } .modal-head h2 { flex: 1; }
.modal-body { padding: 18px 20px; } .modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 90; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-2); font-weight: 500; animation: pop .2s; max-width: 90vw; }
:root[data-theme="dark"] .toast { background: #E8EEF4; color: #0E1620; }
.toast.bad { background: var(--coral); color: #fff; } .toast.ok { background: var(--moss); color: #fff; }
.popover { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); width: 340px; max-width: calc(100vw - 20px); max-height: 70vh; overflow: auto; }
.menu a, .menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 14px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--text); text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-3); }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; } .notif:hover { background: var(--surface-2); }
.notif .n-del { width: 26px; height: 26px; flex: none; opacity: .45; } .notif:hover .n-del, .notif .n-del:focus-visible { opacity: 1; } .notif .n-del svg { width: 14px; height: 14px; }
.notif.unread { background: var(--primary-soft); } .notif b { display: block; font-size: 13px; } .notif p { margin: 2px 0 0; color: var(--text-2); font-size: 12.5px; white-space: pre-line; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-size: 34px; line-height: 1.12; font-weight: 700; max-width: 12em; } .auth-art p { opacity: .8; max-width: 30em; font-size: 15px; }
.auth-bars { display: flex; align-items: flex-end; gap: 14px; height: 240px; }
.auth-bars i { flex: 1; border-radius: 4px 4px 0 0; } .auth-bars i:nth-child(1) { height: 14%; background: #6E9A4C; } .auth-bars i:nth-child(2) { height: 36%; background: #3A9A9F; }
.auth-bars i:nth-child(3) { height: 58%; background: #2A7FA6; } .auth-bars i:nth-child(4) { height: 80%; background: var(--amber); } .auth-bars i:nth-child(5) { height: 100%; background: var(--coral); }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.auth-logo { width: 96px; margin-bottom: 4px; }

/* ---------- calendar ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-toolbar h2 { font-size: 21px; font-weight: 700; min-width: 190px; }
.cal-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; } .cal-filters select { width: auto; padding: 5px 8px; font-size: 13px; }
.month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); user-select: none; }
.dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.dow div { padding: 7px 10px; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.week { position: relative; border-bottom: 1px solid var(--line); min-height: 118px; } .week:last-child { border-bottom: 0; }
.day-bg { position: absolute; top: 0; bottom: 0; width: calc(100% / 7); border-right: 1px solid var(--line); padding: 5px 7px; cursor: pointer; overflow: hidden; }
.day-bg:nth-child(7) { border-right: 0; } .day-bg.weekend { background: var(--weekend); } .day-bg.holiday { background: var(--holiday); } .day-bg.other .dn { opacity: .38; }
.day-bg.sel { background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); } .day-bg:hover .add { opacity: 1; }
.day-bg .dn { font-family: var(--display); font-weight: 600; font-size: 13px; display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 99px; }
.day-bg.today .dn { background: var(--navy); color: #fff; box-shadow: 0 0 0 2px var(--today-ring); } :root[data-theme="dark"] .day-bg.today .dn { background: var(--primary); color: var(--on-primary); }
.day-bg .add { position: absolute; right: 6px; top: 6px; opacity: 0; color: var(--text-3); font-weight: 700; font-size: 15px; line-height: 1; }
.day-tag { font-size: 10.5px; font-weight: 600; color: var(--warn); margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: calc(100% - 34px); vertical-align: middle; }
.day-tag.blk { color: var(--bad); }
.week-bars { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 21px; row-gap: 2px; padding: 32px 0 6px; pointer-events: none; }
.bar { pointer-events: auto; margin: 0 3px; border-radius: 5px; padding: 0 7px; font-size: 11.5px; font-weight: 600; line-height: 21px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; display: flex; align-items: center; gap: 5px; min-width: 0; }
.bar:hover { filter: brightness(1.08); } .bar span { overflow: hidden; text-overflow: ellipsis; }
.bar.pending { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.28) 0 6px, transparent 6px 12px); opacity: .85; }
.bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; } .bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.bar.time { background: var(--surface) !important; color: var(--text); border: 1px solid var(--line-strong); border-left: 4px solid var(--c); padding-left: 5px; line-height: 19px; }
.bar.half { width: calc(50% - 4px); } .bar.half.pm { margin-left: calc(50% + 1px); }
.bar.mine { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.75); }
.more { pointer-events: auto; font-size: 11px; font-weight: 600; color: var(--text-3); padding: 0 8px; cursor: pointer; line-height: 21px; } .more:hover { color: var(--primary); }
.rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.rail .card { padding: 14px 16px; } .rail h3 { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.bal-row { margin-bottom: 11px; } .bal-row:last-child { margin-bottom: 0; }
.bal-row .t { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 500; margin-bottom: 4px; gap: 8px; } .bal-row .t b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; } .meter i { display: block; height: 100%; } .meter i.p { opacity: .4; }
.out-row { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px; cursor: pointer; } .out-row .w { color: var(--text-3); font-size: 12px; }
.legend label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12.5px; cursor: pointer; } .legend input { accent-color: var(--primary); }

/* timeline */
.tl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow-1); max-height: calc(100vh - 230px); user-select: none; }
.tl-grid { display: grid; min-width: max-content; }
.tl-name { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 10px; display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; }
.tl-head { position: sticky; top: 0; z-index: 4; background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: center; font-size: 10.5px; color: var(--text-3); padding: 4px 0; font-weight: 600; }
.tl-head b { display: block; font-size: 12.5px; color: var(--text); font-family: var(--display); } .tl-head.today b { color: #fff; background: var(--navy); border-radius: 99px; width: 22px; margin: auto; }
.tl-head.corner { left: 0; z-index: 5; text-align: left; padding: 8px 10px; border-right: 1px solid var(--line); }
.tl-dept { grid-column: 1 / -1; background: var(--surface-3); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); padding: 5px 10px; border-bottom: 1px solid var(--line); }
.tl-dept span { position: sticky; left: 10px; display: inline-block; }
.tl-cell { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 34px; cursor: pointer; }
.tl-cell.weekend { background: var(--weekend); } .tl-cell.holiday { background: var(--holiday); } .tl-cell.sel { background: var(--primary-soft); } .tl-cell.today { box-shadow: inset 2px 0 0 var(--today-ring); }
.tl-bar { z-index: 2; align-self: center; height: 22px; margin: 0 2px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 600; padding: 0 6px; line-height: 22px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.tl-bar.pending { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.3) 0 6px, transparent 6px 12px); opacity: .85; }
.tl-bar.time { height: 10px; align-self: end; margin-bottom: 3px; padding: 0; }
/* year */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.mini { padding: 12px 14px; } .mini h3 { margin-bottom: 8px; cursor: pointer; } .mini h3:hover { color: var(--primary); }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; font-size: 11.5px; text-align: center; }
.mini-grid span { aspect-ratio: 1; display: grid; place-items: center; border-radius: 5px; font-variant-numeric: tabular-nums; } .mini-grid .h { color: var(--text-3); font-size: 10px; font-weight: 600; }
.mini-grid .we { color: var(--text-3); } .mini-grid .hol { box-shadow: inset 0 0 0 1.5px var(--amber); } .mini-grid .lv { color: #fff; font-weight: 700; cursor: pointer; } .mini-grid .td { text-decoration: underline; font-weight: 800; }

/* requests */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type-chip { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; background: var(--surface); text-align: left; display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 12.5px; line-height: 1.25; }
.type-chip small { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; } .type-chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.type-chip.on { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); } .type-chip .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); flex: none; font-size: 15px; }
.preview { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.preview .big { font-family: var(--display); font-size: 20px; font-weight: 700; }
.bal-card { padding: 16px; position: relative; overflow: hidden; } .bal-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--c); }
.bal-card .v { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.1; margin: 6px 0 2px; } .bal-card .v small { font-size: 13px; font-weight: 500; color: var(--text-3); }
.bal-card dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 10px 0 0; font-size: 12.5px; color: var(--text-2); } .bal-card dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; } .kv dt { color: var(--text-3); font-size: 12.5px; } .kv dd { margin: 0; font-weight: 500; }
.timeline-ev { display: flex; gap: 10px; padding: 8px 0; } .timeline-ev .b { flex: 1; min-width: 0; } .timeline-ev p { margin: 2px 0 0; color: var(--text-2); white-space: pre-line; }
.appr { display: flex; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; } .appr:last-child { border-bottom: 0; }
.appr .info { flex: 1; min-width: 0; } .appr .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stat { padding: 14px 16px; } .stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; } .stat .v { font-family: var(--display); font-size: 26px; font-weight: 700; }

/* timesheet */
.ts-table input[type=number] { width: 84px; text-align: right; padding: 6px 7px; } .ts-table td { padding-top: 6px; padding-bottom: 6px; } .ts-table input[type=text] { min-width: 130px; } .ts-table select { min-width: 150px; }
.ts-table th.day { text-align: right; } .ts-table th.day.off, .ts-table td.off { background: var(--weekend); } .ts-table th.day b { display: block; color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; font-family: var(--display); }
.ts-table tfoot td { font-weight: 700; background: var(--surface-2); } .ts-table td.leave { color: var(--text-2); font-style: italic; }
.clock { display: flex; align-items: center; gap: 10px; }
.seg-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; margin: 2px 0; white-space: nowrap; } .ts-table .seg-row input[type=time] { width: 112px; min-width: 112px; padding: 5px 6px; flex: none; }
.ts-table td:has(> .seg-row) { min-width: 300px; } .modal .ts-table th, .modal .ts-table td { padding-left: 9px; padding-right: 9px; }
.seg-row .seg-x { width: 24px; height: 24px; opacity: .55; } .seg-row .seg-x:hover { opacity: 1; } .seg-row .seg-x svg { width: 13px; height: 13px; } .clock .live { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: pulse 1.4s infinite; } @keyframes pulse { 50% { opacity: .3; } }
.barcell { display: flex; align-items: center; gap: 8px; } .barcell i { height: 8px; border-radius: 99px; display: block; min-width: 2px; }
.person-card { padding: 14px; display: flex; gap: 12px; align-items: center; } .person-card .st { font-size: 12px; font-weight: 600; display: block; } .person-card .grow { overflow-wrap: anywhere; }

@media (max-width: 1100px) { .cal-layout { grid-template-columns: 1fr; } .rail { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } .cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; } .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-3); }
  .sidebar.open { transform: none; } .content { padding: 14px 12px 40px; } .topbar { padding: 10px 12px; } .topbar .hide-sm { display: none; }
  .auth { grid-template-columns: 1fr; } .auth-art { display: none; } .form-grid, .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .week { min-height: 86px; } .bar { font-size: 10px; padding: 0 3px; margin: 0 1px; } .day-tag { display: none; } .dow div { padding: 6px 4px; font-size: 10px; } .kv { grid-template-columns: 100px 1fr; }
  .appr { flex-direction: column; } .cal-toolbar h2 { min-width: 0; font-size: 18px; }
}

/* ---------------------------------------------------------------- AI assistant */
.ai-fab { position: fixed; right: 20px; bottom: 20px; z-index: 44; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 14px; border: 0; border-radius: 23px; background: var(--primary); color: var(--on-primary); font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-2); }
.ai-fab:hover { background: var(--primary-hover); }
.ai-panel { position: fixed; right: 20px; bottom: 20px; z-index: 45; width: min(400px, calc(100vw - 24px)); height: min(620px, calc(100vh - 40px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-3); overflow: hidden; }
.ai-panel[hidden], .ai-fab[hidden] { display: none; }
.ai-panel header { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.ai-badge { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: var(--on-primary); }
.ai-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.ai-hello { color: var(--text-2); line-height: 1.5; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ai-msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); line-height: 1.5; align-self: flex-start; overflow-wrap: anywhere; }
.ai-msg.me { align-self: flex-end; background: var(--primary); border-color: var(--primary); color: var(--on-primary); white-space: pre-wrap; }
.ai-msg.err { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.ai-msg a { color: var(--primary); font-weight: 600; text-decoration: underline; }
.ai-msg p { margin: 0 0 6px; } .ai-msg p:last-child, .ai-msg ul:last-child { margin-bottom: 0; } .ai-msg ul { margin: 0 0 6px; padding-left: 18px; }
.ai-draft { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.ai-draft .dot-c { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ai-wait { display: flex; gap: 5px; padding: 13px 14px; } .ai-wait span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: ai-blink 1.2s infinite both; } .ai-wait span:nth-child(2) { animation-delay: .2s; } .ai-wait span:nth-child(3) { animation-delay: .4s; }
@keyframes ai-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
#ai-form { display: flex; gap: 8px; padding: 10px 12px 6px; border-top: 1px solid var(--line); align-items: flex-end; }
#ai-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; field-sizing: content; }
.ai-foot { padding: 0 12px 9px; font-size: 11px; color: var(--text-3); text-align: center; }
@media (max-width: 820px) { .ai-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; } .ai-fab span { display: none; } .ai-fab { padding: 0; width: 46px; justify-content: center; right: 14px; bottom: 14px; } }
@media print { #ai-host { display: none; } }
