/* iAttendance: Codeon's design tokens (shared with Codeon HRMS). */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --primary-soft: #dbeafe;
  --primary-faint: #eff6ff;
  --green: #059669;
  --green-soft: #d1fae5;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --violet-soft: #ede9fe;
  --night: #0b1220;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: 12.5px; }
.label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- shell */
.topbar { background: var(--night); color: #cbd5e1; display: flex; align-items: center; gap: 18px; padding: 10px 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { color: #fff; display: block; font-size: 15px; }
.brand span { font-size: 11.5px; color: #94a3b8; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
#nav { display: flex; gap: 4px; flex-wrap: wrap; }
#nav a { color: #cbd5e1; text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: 13.5px; }
#nav a:hover { background: #1e293b; }
#nav a.on { background: var(--primary); color: #fff; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.ghost-link { color: #93c5fd; text-decoration: none; }
main { padding: 22px 24px 48px; display: grid; gap: 18px; max-width: 1360px; margin: 0 auto; }

.head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 23px; margin: 0; text-wrap: balance; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 13.5px; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); padding: 14px 0; text-align: center; }

.btn { border: 1px solid transparent; border-radius: 9px; padding: 8px 14px; font-weight: 600; font-size: 13.5px; background: var(--primary); color: #fff; }
.btn:hover { background: #1e40af; }
.btn.secondary { background: var(--card); border-color: var(--border); color: var(--text); }
.btn.secondary:hover { background: #f8fafc; }
.btn.danger { background: var(--red); }
.btn.ghost { background: transparent; border-color: #334155; color: #e2e8f0; padding: 6px 12px; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: default; }
.month-pick { display: flex; align-items: center; gap: 6px; }
.month-pick span { font-weight: 600; min-width: 132px; text-align: center; }

/* pills: colour + symbol + word */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.s-present, .s-approved, .s-in, .s-online { background: var(--green-soft); color: #065f46; }
.s-late, .s-pending, .s-submitted, .s-manager-approved, .s-more-details-required, .s-resubmitted { background: var(--amber-soft); color: #92400e; }
.s-half-day, .s-working { background: var(--primary-soft); color: #1e3a8a; }
.s-absent, .s-missing, .s-rejected, .s-blocked, .s-offline { background: var(--red-soft); color: #991b1b; }
.s-leave { background: var(--violet-soft); color: #5b21b6; }
.s-holiday, .s-out, .s-none, .s-withdrawn { background: #f1f5f9; color: #475569; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.s-in .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .s-in .dot { animation: none; } }

/* today */
.today { display: grid; gap: 16px; }
.today-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: start; }
.clock { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.clock .big { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.progress { position: relative; height: 12px; border-radius: 6px; background: #eef2f7; overflow: hidden; }
.progress .fill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--primary); border-radius: 6px 0 0 6px; width: 0; }
.progress .target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); left: 80%; }
.scale { position: relative; height: 16px; font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.scale span { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); }
.scale .s0 { left: 0; transform: none; }
.scale .s4 { left: 40%; }
.scale .s8 { left: 80%; }
.scale .s10 { left: 100%; transform: translateX(-100%); }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fact { background: #f8fafc; border-radius: 10px; padding: 10px 12px; }
.fact .v { font-size: 17px; font-weight: 700; margin-top: 3px; }
.fact .n { font-size: 12px; color: var(--muted); margin-top: 1px; }
.note { border-radius: 10px; padding: 10px 12px; font-size: 13px; background: #f8fafc; color: var(--muted); }
.note.warn { background: var(--amber-soft); color: #7c2d12; }
.note.bad { background: var(--red-soft); color: #7f1d1d; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; display: grid; gap: 3px; align-content: start; }
.tile .v { font-size: 22px; font-weight: 700; }
.tile .n { font-size: 12px; color: var(--muted); }
.tile.attention { border-color: #fca5a5; background: #fff7f7; }
.tile.attention .v { color: var(--red); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .strong { fill: var(--text); font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; align-items: center; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.sw-primary { background: var(--primary); }
.sw-today { background: var(--primary-soft); outline: 1px dashed var(--primary); }
.sw-grace { background: var(--amber-soft); }
.sw-line { height: 2px; vertical-align: 3px; background: var(--text); }
.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--text); color: #fff; border-radius: 8px; padding: 7px 10px; font-size: 12px; line-height: 1.4; max-width: 260px; box-shadow: 0 6px 20px rgba(15, 23, 42, .25); }
.tip b { display: block; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal .dow { font-size: 11px; color: var(--muted); text-align: center; font-weight: 600; }
.day { border: 1px solid var(--border); border-radius: 9px; padding: 6px 7px; min-height: 64px; display: grid; align-content: space-between; gap: 2px; background: var(--card); text-align: left; color: var(--text); }
.day:hover:not([disabled]) { border-color: #93c5fd; }
.day .d { font-size: 12px; font-weight: 700; }
.day .h { font-size: 12px; font-weight: 600; }
.day .t { font-size: 10.5px; font-weight: 600; }
.day.off, .day.future { background: #f8fafc; color: var(--faint); }
.day.sel { outline: 2px solid var(--primary); outline-offset: 1px; }
.day.k-present { box-shadow: inset 0 -3px 0 var(--green); } .day.k-present .t { color: #065f46; }
.day.k-late { box-shadow: inset 0 -3px 0 var(--amber); } .day.k-late .t { color: #92400e; }
.day.k-half-day { box-shadow: inset 0 -3px 0 var(--primary); } .day.k-half-day .t { color: #1e3a8a; }
.day.k-absent, .day.k-missing { box-shadow: inset 0 -3px 0 var(--red); border-color: #fca5a5; } .day.k-absent .t, .day.k-missing .t { color: #991b1b; }
.day.k-leave { box-shadow: inset 0 -3px 0 #7c3aed; } .day.k-leave .t { color: #5b21b6; }
.day.k-holiday .t { color: #475569; }
.day.k-today { box-shadow: inset 0 -3px 0 var(--primary); } .day.k-today .t { color: var(--primary); }

.detail { display: grid; gap: 14px; align-content: start; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 60px 1fr auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f1f5f9; align-items: center; font-size: 13px; }
.log li:last-child { border-bottom: 0; }
.log .time { font-weight: 700; }
.totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.totals div { background: #f8fafc; border-radius: 9px; padding: 8px 10px; }
.totals .v { font-weight: 700; font-size: 15px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.row-actions { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }

/* forms and modal */
.modal-root { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 520px; padding: 22px; box-shadow: 0 25px 60px rgba(0, 0, 0, .25); max-height: calc(100% - 32px); overflow: auto; }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 600; color: #334155; }
.field input, .field select, .field textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); width: 100%; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; z-index: 40; max-width: calc(100% - 32px); }
.toast.err { background: var(--red); }

/* sign-in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, #1e3a8a 0, #0b1220 60%); }
.signin-card { background: var(--card); border-radius: 16px; padding: 30px 28px; max-width: 420px; width: 100%; display: grid; gap: 14px; }
.signin-card h1 { font-size: 22px; }
.signin-card .btn { padding: 11px 16px; font-size: 14.5px; }

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .facts, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  main { padding: 16px 16px 40px; }
  .topbar { padding: 10px 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock .big { font-size: 32px; }
  .day { min-height: 54px; padding: 4px; }
  .day .t .w { display: none; }
  .cal { gap: 3px; }
  .pair { grid-template-columns: 1fr; }
}

.signin-card .brand b.brand-dark { color: var(--text); }
.signin-card .brand span { color: var(--muted); }
