/* Attendance Portal — design system lifted from the approved prototype.
   Palette: primary #0b5cab · teal #0f9b8e · ink #11253f · navy #0c1726 */

:root {
  --blue: #0b5cab;
  --blue-soft: #e8f0fb;
  --blue-light: #5aa2e8;
  --teal: #0f9b8e;
  --ink: #11253f;
  --navy: #0c1726;
  --navy-line: #1c2c44;
  --bg: #eef2f7;
  --card: #ffffff;
  --line: #e4ebf3;
  --line-soft: #eef2f7;
  --muted: #64748b;
  --faint: #94a3b8;
  --green: #16a34a;
  --green-soft: #e7f6ec;
  --amber: #d97706;
  --amber-soft: #fdf1e3;
  --red: #dc2626;
  --red-soft: #fdeaea;
  --mono: 'Spline Sans Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; }

/* ---- primitives ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.card-sm { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  white-space: nowrap;
}
.pill-blue  { background: var(--blue-soft);  color: var(--blue); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-red   { background: var(--red-soft);   color: var(--red); }
.pill-grey  { background: var(--line-soft);  color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.avatar {
  border-radius: 50%; color: #fff; display: inline-flex; flex-shrink: 0;
  align-items: center; justify-content: center; font-weight: 700;
}
.kicker { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }

.btn {
  border: none; cursor: pointer; font-weight: 700; font-size: 14px;
  padding: 11px 20px; border-radius: 12px; transition: all .18s;
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 10px 22px -10px rgba(11,92,171,.7); }
.btn-primary:hover { background: #094a8a; }
.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 10px 22px -10px rgba(15,155,142,.7); }
.btn-teal:hover { background: #0c7f75; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--faint); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  border: none; transition: all .15s;
}
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

input[type=text], input[type=password], input[type=email], input[type=date],
input[type=time], input[type=number], select, textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line);
  border-radius: 11px; font-family: inherit; font-size: 14px; color: var(--ink);
  background: #fff; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
label { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin: 0 0 6px 2px; }

.flash {
  background: var(--green-soft); color: var(--green); border: 1px solid #bfe6cd;
  padding: 11px 15px; border-radius: 12px; font-weight: 700; font-size: 13px; margin-bottom: 16px;
}
.flash-error { background: var(--red-soft); color: var(--red); border-color: #f3c1c1; }

/* ---- console shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--navy); color: #cdd9e8;
  padding: 26px 18px; display: flex; flex-direction: column; gap: 3px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; margin: 6px 6px 30px; }
.sidebar .brand-badge {
  width: 34px; height: 34px; border-radius: 9px; background: var(--blue);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 16px;
}
.sidebar .brand-name { font-weight: 800; font-size: 17px; color: #fff; }
.sidebar .brand-name span { color: var(--blue-light); }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px;
  color: #8499b3; font-weight: 600; font-size: 14px; text-decoration: none; transition: all .15s;
}
.nav-item:hover { color: #cdd9e8; background: rgba(255,255,255,.04); }
.nav-item.active { background: #16263e; color: #fff; font-weight: 700; }
.nav-section { font-size: 10px; font-weight: 800; letter-spacing: 1.2px; color: #51677f; margin: 18px 13px 6px; text-transform: uppercase; }
.sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 14px 8px 2px; border-top: 1px solid var(--navy-line); }
.main { flex: 1; padding: 34px 40px 60px; overflow-x: auto; min-width: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-head .kicker-blue { font-size: 13px; font-weight: 700; color: var(--blue); letter-spacing: .3px; }
.page-head h1 { margin: 4px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -.6px; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.stat .label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .3px; }
.stat .value { font-size: 30px; font-weight: 800; margin-top: 6px; }
.stat .value small { font-size: 16px; color: var(--faint); font-weight: 700; }

.table-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; min-width: 900px; }
table.grid thead th {
  background: #f6f9fc; color: var(--muted); font-size: 11px; font-weight: 700;
  letter-spacing: .6px; text-align: left; padding: 14px 14px; text-transform: uppercase; white-space: nowrap;
}
table.grid tbody td { padding: 13px 14px; border-top: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
table.grid tbody tr:hover { background: #fafcfe; }

.emp-cell { display: flex; align-items: center; gap: 11px; }
.emp-cell .avatar { width: 36px; height: 36px; font-size: 13px; }
.emp-cell .name { font-weight: 700; white-space: nowrap; }
.emp-cell .role { font-size: 12px; color: var(--faint); }

/* ---- employee portal (mobile-first) ---- */
.portal { max-width: 430px; margin: 0 auto; padding: 14px 16px 90px; min-height: 100vh; }
.portal-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 4px 18px; }
.portal-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; letter-spacing: -.2px; }
.portal-brand .badge {
  width: 30px; height: 30px; border-radius: 8px; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.portal-brand span.accent { color: var(--blue); }

.big-clock { font-family: var(--mono); font-size: 50px; font-weight: 600; letter-spacing: -1px; line-height: 1; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 13px;
  padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.check-btn {
  width: 100%; border: none; cursor: pointer; font-weight: 800; font-size: 17px;
  padding: 18px; border-radius: 16px; color: #fff; transition: all .2s; margin-bottom: 16px;
}
.check-btn.in  { background: var(--teal); box-shadow: 0 12px 24px -8px rgba(15,155,142,.55); }
.check-btn.out { background: var(--red);  box-shadow: 0 12px 24px -8px rgba(220,38,38,.45); }
.check-btn:disabled { opacity: .6; cursor: wait; }

.map-box {
  position: relative; height: 142px; background: #e8eef4;
  background-image: linear-gradient(#dde6ef 1px, transparent 1px), linear-gradient(90deg, #dde6ef 1px, transparent 1px);
  background-size: 34px 34px; overflow: hidden;
}
.map-road-h { position: absolute; left: -8%; top: 38%; width: 120%; height: 16px; transform: rotate(-14deg); background: #d6e0eb; }
.map-road-v { position: absolute; left: 30%; top: -10%; width: 14px; height: 120%; background: #d6e0eb; transform: rotate(8deg); }
.geofence {
  position: absolute; left: 50%; top: 50%; width: 128px; height: 128px;
  transform: translate(-50%,-50%); border-radius: 50%;
}
@keyframes pulseRing { 0% { transform: scale(.7); opacity: .55; } 70%, 100% { transform: scale(1.5); opacity: 0; } }
.geo-pulse { position: absolute; inset: 0; border-radius: 50%; animation: pulseRing 2.4s ease-out infinite; }
.map-pin {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px;
  border-radius: 50% 50% 50% 0; rotate: -45deg; transform: translate(-50%, -100%);
  box-shadow: 0 3px 8px rgba(15,155,142,.5);
}
.map-pin::after {
  content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 8px; height: 8px; background: #fff; border-radius: 50%;
}

.timeline-item { display: flex; gap: 12px; margin-bottom: 14px; }
.timeline-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}

.eod { background: var(--navy); border-radius: 18px; padding: 17px 18px; margin-bottom: 16px; color: #cdd9e8; }
.eod .row { border-top: 1px solid var(--navy-line); padding-top: 12px; margin-top: 12px; }

/* ---- auth screens ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--blue); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 34px 30px; box-shadow: 0 30px 60px -20px rgba(12,23,38,.5); }
.pin-input { font-family: var(--mono); font-size: 22px; letter-spacing: 8px; text-align: center; }

/* ---- printable report ---- */
.sheet {
  width: 794px; max-width: 100%; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 20px 50px -24px rgba(17,37,63,.35); padding: 54px 56px; margin: 0 auto;
}
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .sheet { box-shadow: none; border: none; padding: 0; }
  .main { padding: 0; }
}

/* ---- details-powered modals (no JS build step) ---- */
@keyframes popIn { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
details.dmodal > summary { list-style: none; cursor: pointer; display: inline-flex; }
details.dmodal > summary::-webkit-details-marker { display: none; }
details.dmodal[open] > .dmodal-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(12,23,38,.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dmodal-card {
  background: #fff; border-radius: 20px; padding: 26px; width: 452px; max-width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px -20px rgba(12,23,38,.55);
  animation: popIn .2s ease-out; text-align: left; cursor: default;
}
.dmodal-title { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.dmodal-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.dmodal-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #12873d; }

/* printable report set */
@media print {
  .report-doc { page-break-after: always; }
  .report-doc:last-child { page-break-after: auto; }
}

/* ---- responsive ---- */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 10px 14px; overflow-x: auto; gap: 6px; }
  .sidebar .brand { margin: 0 10px 0 0; }
  .sidebar .brand-name, .sidebar .me, .nav-section { display: none; }
  .nav-item { white-space: nowrap; padding: 9px 12px; }
  .main { padding: 20px 16px 50px; }
  .page-head h1 { font-size: 22px; }
}
