/* =====================================================================
   NTV Timesheet — simple, light, professional. Clockify-inspired.
   ===================================================================== */

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --border: #E4E7EC;
  --border-2: #EEF0F4;
  --text: #1A2230;
  --muted: #5C6675;
  --faint: #909AA8;
  --accent: #2F6FED;
  --accent-strong: #2559C9;
  --accent-soft: #E9F0FE;
  --pos: #0E8A54;
  --pos-soft: #E3F3EB;
  --warn: #A8620C;
  --warn-soft: #FBF0E1;
  --danger: #CF3327;
  --danger-soft: #FCE8E6;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20,30,50,.05);
  --shadow: 0 1px 2px rgba(20,30,50,.05), 0 10px 24px -14px rgba(20,30,50,.18);
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, 'SF Mono', Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.05rem; } h3 { font-size: 1rem; }
.mono, .chip, .rail, .etime, .ehrs, .calc, .num, td.mono, .stat strong, .ot-tag, .barval { font-family: var(--mono); font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 5px; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.nav-inner { max-width: 1080px; margin: 0 auto; padding: 0 22px; display: flex; align-items: center; gap: 20px; min-height: 58px; flex-wrap: wrap; }
.nav-title { font-weight: 700; font-size: 1rem; }
.nav-inner nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav-inner nav a { color: var(--muted); font-weight: 500; font-size: .92rem; padding: 7px 13px; border-radius: 7px; }
.nav-inner nav a:hover { color: var(--text); background: var(--surface-2); }
.nav-inner nav a.on { color: var(--accent-strong); background: var(--accent-soft); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-user { color: var(--muted); font-weight: 500; font-size: .9rem; }

/* layout */
.wrap { max-width: 1080px; margin: 0 auto; padding: 26px 22px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { margin: 5px 0 0; color: var(--muted); font-size: .93rem; }
.mnav { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; box-shadow: var(--shadow-sm); }
.mnav strong { min-width: 146px; text-align: center; font-size: .92rem; font-weight: 600; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 1.15rem; cursor: pointer; }
.icon-btn:hover { background: var(--border-2); color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.card + .card, section + section { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow-sm); }
.stat .label { display: block; color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat strong { display: block; margin-top: 5px; font-size: 1.4rem; font-weight: 600; }
.stat.pos strong { color: var(--pos); } .stat.ot strong { color: var(--warn); }

/* buttons & forms */
.btn { font-family: var(--sans); font-size: .9rem; font-weight: 600; color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: 8px; padding: 9px 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .13s ease, border-color .13s ease; }
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.wide { width: 100%; justify-content: center; }
.btn.sm { padding: 7px 12px; font-size: .84rem; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); border-color: #D5DAE3; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #B62A20; border-color: #B62A20; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); }
input, select, textarea { font-family: var(--sans); font-size: .95rem; color: var(--text); width: 100%; margin-top: 5px; padding: 9px 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
input[type="time"], input[type="number"] { font-family: var(--mono); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--faint); }
.frow { display: flex; gap: 12px; flex-wrap: wrap; }
.frow label { flex: 1 1 120px; } .frow label.grow { flex: 2 1 200px; }
.ferr { color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 9px 12px; font-size: .87rem; margin: 12px 0 0; }
.empty { color: var(--muted); font-style: italic; padding: 20px 4px; text-align: center; }
.empty.sm { padding: 8px 2px; text-align: left; }

/* colour swatches */
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.swatch { width: 24px; height: 24px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }

/* clock / timer bar */
.clockbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.clockbar .dot { width: 10px; height: 10px; border-radius: 50%; background: #CBD2DD; flex: 0 0 auto; }
.clockbar.on .dot { background: var(--pos); box-shadow: 0 0 0 4px var(--pos-soft); animation: pulse 1.3s ease infinite; }
.clockbar .clk-label { color: var(--muted); font-weight: 500; }
.clockbar .clk-time { font-family: var(--mono); font-size: 1.1rem; font-weight: 600; }
.clockbar .grow { flex: 1; }

/* calendar */
.cal-wrap { overflow-x: auto; margin: -4px; padding: 4px; }
.cal { width: 100%; min-width: 700px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.cal th { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 4px 10px 9px; text-align: left; }
.cal th.rail-h, .cal td.rail { width: 104px; text-align: right; }
.cal td { border-top: 1px solid var(--border-2); vertical-align: top; height: 92px; padding: 6px 9px; background: var(--surface); }
.cal td.pad { background: var(--surface-2); }
.cal td.wknd { background: #FCFCFE; }
.cal td.day.click { cursor: pointer; transition: background .12s ease, box-shadow .12s ease; }
.cal td.day.click:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); border-radius: 8px; }
.cal td.day .num { font-weight: 600; font-size: .8rem; color: var(--faint); }
.cal td.day.has .num { color: var(--text); }
.cal td.day.today .num { color: #fff; background: var(--accent); border-radius: 7px; display: inline-grid; place-items: center; min-width: 22px; height: 21px; padding: 0 5px; }
.chip { display: inline-block; margin: 6px 0 0 6px; font-size: .78rem; font-weight: 600; color: var(--pos); background: var(--pos-soft); border-radius: 6px; padding: 2px 7px; vertical-align: top; }
.daymeta { margin-top: 5px; }
.dots { display: inline-flex; gap: 3px; margin-right: 5px; vertical-align: middle; }
.pdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dnote { font-size: .72rem; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal td.rail { background: var(--surface-2); font-size: .82rem; color: var(--muted); }
.cal td.rail b { color: var(--text); font-weight: 600; }
.cal td.rail .rail-none { color: var(--faint); }
.cal td.rail.ot { background: var(--warn-soft); }
.ot-tag { display: block; margin-top: 3px; font-size: .68rem; font-weight: 600; color: var(--warn); }
.cal tfoot td { border-top: 2px solid var(--text); padding: 11px 10px; background: var(--surface); }
.cal tfoot .tot-label { text-align: right; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cal tfoot td.rail.tot { background: var(--text); color: #fff; font-weight: 600; font-size: .95rem; border-radius: 0 0 8px 0; }

/* tabs */
.tabs { display: inline-flex; gap: 3px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; box-shadow: var(--shadow-sm); }
.tab { font-family: var(--sans); font-size: .9rem; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 999px; padding: 7px 18px; cursor: pointer; }
.tab:hover { color: var(--text); } .tab.on { color: #fff; background: var(--text); }

/* project / tag chips */
.etag { font-size: .74rem; font-weight: 600; color: #fff; background: var(--c, var(--muted)); border-radius: 5px; padding: 2px 7px; }
.etag2 { font-size: .74rem; font-weight: 600; color: var(--muted); background: var(--border-2); border-radius: 5px; padding: 2px 7px; }
.cdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: middle; }
.chip-cat { font-size: .68rem; font-weight: 600; color: var(--muted); background: var(--border-2); border-radius: 999px; padding: 2px 8px; }

/* filter bar */
.filterbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filterbar label { flex: 0 1 auto; min-width: 140px; }
.filterbar .grow { flex: 1; }

/* tables */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
table.report { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.report th { text-align: left; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 8px 12px 11px; border-bottom: 1px solid var(--border); }
table.report td { padding: 11px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
table.report tbody tr:last-child td { border-bottom: 0; }
table.report td.mono { font-family: var(--mono); }
table.report td.strong { font-weight: 600; color: var(--pos); }
table.report td.ot { color: var(--warn); font-weight: 600; }
table.report .ta-r { text-align: right; }
table.report tfoot td { border-top: 2px solid var(--text); font-weight: 700; padding-top: 12px; }
tr.rowlink { cursor: pointer; } tr.rowlink:hover td { background: var(--surface-2); }
tr.rowlink.sel td { background: var(--accent-soft); } tr.rowlink.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.name-cell { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.rowbtn { background: none; border: 0; font-family: var(--sans); font-size: .82rem; font-weight: 600; cursor: pointer; padding: 0; }
.rowbtn.edit { color: var(--accent); } .rowbtn.del { color: var(--danger); } .rowbtn:hover { text-decoration: underline; }
.linkbtn { background: none; border: 0; color: var(--danger); font-family: var(--sans); font-size: .84rem; font-weight: 600; cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.you-tag { color: var(--faint); font-style: italic; font-size: .84rem; }
.pill { display: inline-block; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; margin-left: 7px; }

/* report bars (group totals) */
.barrow { display: grid; grid-template-columns: 180px 1fr 92px; gap: 12px; align-items: center; padding: 7px 0; }
.barrow .blabel { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bartrack { background: var(--border-2); border-radius: 999px; height: 12px; overflow: hidden; }
.barfill { height: 100%; border-radius: 999px; background: var(--accent); }
.barval { text-align: right; font-weight: 600; font-size: .9rem; }

/* modal / dialogs */
.overlay { position: fixed; inset: 0; background: rgba(20,30,50,.44); display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px 16px; z-index: 60; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: 0 24px 60px -18px rgba(20,30,50,.4); width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; padding: 22px; animation: rise .18s ease; }
.modal header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.modal-kicker { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin-bottom: 3px; }
.modal .x { background: none; border: 0; font-size: 1.5rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.modal .x:hover { color: var(--text); }
.entry-list { margin-bottom: 14px; }
.entry-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 6px; font-size: .9rem; background: var(--surface-2); }
.entry-row.editing { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.etime em { color: var(--faint); font-style: normal; font-size: .78rem; }
.ehrs { font-weight: 600; color: var(--pos); font-family: var(--mono); }
.enote { color: var(--muted); flex: 1; min-width: 40px; }
.entry-form { border-top: 1px solid var(--border); padding-top: 14px; }
.or { display: flex; align-items: center; text-align: center; color: var(--faint); font-size: .77rem; margin: 13px 0; gap: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.entry-form footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; }
.calc { color: var(--pos); font-weight: 600; margin-right: auto; }
.modal.confirm { max-width: 430px; }
.modal.confirm h3 { margin-bottom: 8px; }
.confirm-body { color: var(--muted); margin: 0 0 18px; line-height: 1.55; }
.confirm-foot { display: flex; justify-content: flex-end; gap: 10px; }

/* toasts */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: #fff; font-size: .9rem; font-weight: 500; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
.toast.in { opacity: 1; transform: translateY(0); }

/* login */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 22px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 1.5rem; } .login-card .sub { color: var(--muted); margin: 6px 0 22px; }
.login-card label { margin-top: 13px; } .login-card .btn { margin-top: 20px; }
.cred-note { margin-top: 22px; border: 1px dashed #CDD4DE; border-radius: 11px; overflow: hidden; }
.cred-note summary { cursor: pointer; list-style: none; padding: 11px 13px; font-size: .82rem; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; }
.cred-note summary::-webkit-details-marker { display: none; }
.cred-note summary::after { content: 'Show'; color: var(--accent); } .cred-note[open] summary::after { content: 'Hide'; }
.cred-note .cred-body { padding: 0 13px 13px; }
.cred-note table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.cred-note td { padding: 4px 6px; border-top: 1px solid var(--border-2); } .cred-note td:first-child { color: var(--muted); }
.cred-note code { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-size: .76rem; }
.cred-warn { margin: 9px 0 0; font-size: .73rem; color: var(--warn); }

/* motion & responsive */
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 680px) {
  .wrap { padding: 20px 16px 52px; }
  .page-head { align-items: flex-start; }
  .nav-user { display: none; }
  .cal td { height: 72px; }
  .barrow { grid-template-columns: 120px 1fr 76px; }
}
