/* ==========================================================================
   Cloudsline HRIS stylesheet
   Brand: navy #121a52, sky blue #0a9ef0, cyan #7fdcf7
   Edit the variables below to retheme the whole system.
   ========================================================================== */
:root {
  --navy: #121a52;
  --navy-2: #1d2a78;
  --blue: #0a9ef0;
  --blue-d: #0670c9;
  --cyan: #7fdcf7;
  --bg: #f2f6fc;
  --card: #ffffff;
  --text: #17203f;
  --muted: #6a7593;
  --border: #e2e8f3;
  --soft: #f6f9fe;
  --green: #11a065;
  --green-bg: #e5f7ef;
  --amber: #c98600;
  --amber-bg: #fff4dc;
  --red: #d93b3f;
  --red-bg: #fde9ea;
  --violet: #6b4fd8;
  --violet-bg: #efebff;
  --blue-bg: #e3f3fe;
  --gray-bg: #eef1f6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(18, 26, 82, .05), 0 6px 20px rgba(18, 26, 82, .06);
  --sidebar-w: 268px;
  --font: 'Poppins', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue-d); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; color: var(--navy); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease;
}
.brand { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.brand img { height: 46px; display: block; }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.nav-section { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #9aa4bf; padding: 16px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #3b4566; font-weight: 500; font-size: 13.5px;
  position: relative; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--soft); color: var(--navy); text-decoration: none; }
.nav-link.active { background: linear-gradient(90deg, var(--blue-bg), #f0f8ff); color: var(--blue-d); }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--blue); }
.nav-link .icon { width: 18px; height: 18px; }
.nav-badge { margin-left: auto; font-style: normal; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 8px; }
.sidebar-foot { padding: 10px 12px 16px; border-top: 1px solid var(--border); }
.sidebar-overlay { display: none; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 14px 28px;
  background: rgba(242, 246, 252, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-title h1 { font-size: 1.25rem; margin: 0; }
.topbar-sub { color: var(--muted); font-size: 12px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border); padding: 5px 14px 5px 5px; border-radius: 999px; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip-text strong { font-size: 13px; color: var(--navy); }
.user-chip-text span { font-size: 11px; color: var(--muted); }
.icon-btn.menu-btn { display: none; }
.show-mobile { display: none; }
.content { padding: 24px 28px 32px; flex: 1; width: 100%; max-width: 1400px; }
.app-footer { padding: 16px 28px 24px; color: var(--muted); font-size: 12px; }

/* ---------- Cards and grid ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: 18px 20px 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 20px; }

.stat { display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-icon.blue { background: var(--blue-bg); color: var(--blue-d); }
.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.amber { background: var(--amber-bg); color: var(--amber); }
.stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat-icon.violet { background: var(--violet-bg); color: var(--violet); }
.stat-icon.navy { background: #e6e9f7; color: var(--navy); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat-value { font-size: 1.45rem; font-weight: 700; color: var(--navy); line-height: 1.2; }
.stat-value small { font-size: 12px; font-weight: 500; color: var(--muted); }

.hero {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 24px 26px; color: #fff; margin-bottom: 20px;
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 45%, var(--blue-d) 100%);
  box-shadow: 0 10px 30px rgba(18, 26, 82, .25);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -40px; width: 320px; height: 320px; opacity: .25;
  background: repeating-linear-gradient(115deg, transparent 0 18px, rgba(127, 220, 247, .7) 18px 22px);
  transform: skewX(-12deg);
}
.hero h2 { color: #fff; font-size: 1.35rem; margin-bottom: 4px; }
.hero p { color: #cfe7fb; margin: 0; }
.hero-inner { position: relative; z-index: 1; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.hero .avatar { border: 3px solid rgba(255, 255, 255, .5); }

/* ---------- Clock widget ---------- */
.clock-card { text-align: center; }
.clock-time { font-size: 2.4rem; font-weight: 700; color: var(--navy); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.clock-date { color: var(--muted); margin-bottom: 14px; }
.clock-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.clock-log { display: flex; justify-content: space-around; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.clock-log div { display: flex; flex-direction: column; }
.clock-log span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.clock-log strong { color: var(--navy); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; line-height: 1.2; white-space: nowrap; transition: all .15s;
  background: var(--soft); color: var(--navy); border-color: var(--border);
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-d)); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(10, 158, 240, .3); }
.btn-navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-outline-danger { background: #fff; color: var(--red); border-color: #f3c3c5; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue-d); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 13px 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { background: #fff; border: 1px solid var(--border); border-radius: 10px; width: 40px; height: 40px; display: inline-grid; place-items: center; cursor: pointer; color: var(--navy); }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: #3b4566; margin-bottom: 5px; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month],
input[type=datetime-local], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d6deec; border-radius: var(--radius-sm); font-family: inherit; font-size: 14px;
  background: #fff; color: var(--text); transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(10, 158, 240, .15); }
textarea { min-height: 90px; resize: vertical; }
input[type=file] { font-size: 13px; max-width: 100%; }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; cursor: pointer; margin-right: 12px; }
.check input { width: 16px; height: 16px; accent-color: var(--blue-d); }
.form-section { font-size: 12px; font-weight: 700; color: var(--blue-d); text-transform: uppercase; letter-spacing: .07em; margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 200px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--soft); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcff; }
.table tfoot td { font-weight: 700; background: var(--soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.person { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.person > div strong { display: block; color: var(--navy); font-weight: 600; }
.person > div > span { display: block; font-size: 12px; color: var(--muted); }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: #b8c3da; margin-bottom: 6px; }

/* ---------- Badges, avatars, alerts ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue-d); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.badge-gray { background: var(--gray-bg); color: #59627c; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-grid; place-items: center; }
.avatar-sm { width: 34px; height: 34px; font-size: 12px; }
.avatar-lg { width: 72px; height: 72px; font-size: 22px; }
.avatar-xl { width: 110px; height: 110px; font-size: 34px; }
.avatar-initials { line-height: 1; text-align: center; background: linear-gradient(135deg, var(--blue), var(--navy-2)); color: #fff; font-weight: 600; }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.alert span { flex: 1; }
.alert-success { background: var(--green-bg); color: #0b7a4c; border-color: #bfe9d5; }
.alert-danger { background: var(--red-bg); color: #a92a2e; border-color: #f6c6c8; }
.alert-warning { background: var(--amber-bg); color: #8a5c00; border-color: #f4dda5; }
.alert-info { background: var(--blue-bg); color: #0b5a99; border-color: #bfe2fb; }
.alert-close { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* ---------- Lists, key value, tabs ---------- */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 16px; border: 0; background: none; font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none !important; }
.tab.active { color: var(--blue-d); border-bottom-color: var(--blue); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.announcement { padding: 14px 16px; border-radius: 12px; background: var(--soft); border: 1px solid var(--border); margin-bottom: 10px; }
.announcement.pinned { background: linear-gradient(90deg, #eef8ff, #fff); border-color: #c7e6fc; }
.announcement h4 { margin: 0 0 4px; font-size: 14px; }
.announcement p { margin: 0; white-space: pre-line; color: #3b4566; }

/* ---------- Bars ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-fill { width: 100%; max-width: 38px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--cyan), var(--blue)); min-height: 3px; }
.bar small { font-size: 11px; color: var(--muted); }
.bar b { font-size: 11px; color: var(--navy); }
.progress { height: 8px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: 999px; }

/* ---------- Modal ---------- */
dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: 0 30px 80px rgba(18, 26, 82, .3); color: var(--text); }
dialog.modal::backdrop { background: rgba(18, 26, 82, .45); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-head button { margin-left: auto; }
.modal-body { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: #fff; }
.auth-art { position: relative; overflow: hidden; color: #fff; isolation: isolate;
  background: radial-gradient(120% 90% at 8% 100%, rgba(10, 158, 240, .32), transparent 60%), var(--navy); }
.auth-net, .auth-video { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; }
.auth-video { object-fit: cover; opacity: .55; }
.auth-motion-btn { position: absolute; left: clamp(32px, 5vw, 72px); top: 24px; z-index: 2; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .8); display: grid; place-items: center; cursor: pointer; }
.auth-motion-btn:hover, .auth-motion-btn:focus-visible { background: rgba(255, 255, 255, .18); color: #fff; outline: 2px solid var(--cyan); outline-offset: 2px; }
.auth-art-text { position: absolute; left: clamp(32px, 5vw, 72px); right: 32px; bottom: clamp(36px, 7vh, 80px); }
.auth-clock { font-weight: 300; font-size: clamp(72px, 9vw, 140px); line-height: .95; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.auth-clock .ampm { font-size: .26em; font-weight: 500; letter-spacing: .02em; margin-left: .35em; color: var(--cyan); vertical-align: .9em; }
.auth-date { margin-top: 14px; font-size: clamp(16px, 1.4vw, 20px); color: rgba(255, 255, 255, .78); }
.auth-tagline { margin: 34px 0 0; max-width: 28ch; font-size: clamp(20px, 2vw, 28px); font-weight: 500; line-height: 1.3; color: #fff; }
.auth-tagline::before { content: ""; display: block; width: 44px; height: 3px; border-radius: 3px; background: var(--blue); margin-bottom: 16px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 22px; background: linear-gradient(180deg, #f7fbff, #fff); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box .logo { height: 70px; margin-bottom: 18px; }
.auth-box h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-box .field { margin-bottom: 14px; }
.auth-foot { margin-top: 22px; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- Payslip ---------- */
.payslip { max-width: 820px; margin: 0 auto; }
.payslip-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 14px; border-bottom: 3px solid var(--navy); flex-wrap: wrap; }
.payslip-head img { height: 54px; }
.payslip-title { text-align: right; }
.payslip-title h2 { margin: 0; letter-spacing: .1em; }
.net-pay { margin-top: 16px; padding: 16px 20px; border-radius: 12px; background: linear-gradient(120deg, var(--navy), var(--blue-d)); color: #fff; display: flex; justify-content: space-between; align-items: center; }
.net-pay strong { font-size: 1.6rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(18, 26, 82, .4); z-index: 35; }
  .main { margin-left: 0; }
  .icon-btn.menu-btn { display: inline-grid; }
  .show-mobile { display: block; }
  .hide-mobile { display: none !important; }
  .topbar { padding: 10px 14px; }
  .content { padding: 16px 14px 24px; }
  .app-footer { padding: 12px 14px 20px; }
  .grid-3 { grid-template-columns: 1fr; }
  .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .grid-4.stats-compact, .grid-5.stats-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stats-compact .stat { flex-direction: column; align-items: flex-start; gap: 8px; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .user-chip-text { display: none; }
  .user-chip { padding: 3px; }
  .topbar-title h1 { font-size: 1.05rem; }
  .card { padding: 16px; border-radius: 12px; }
  .card.card-flush { padding: 0; }
  .card-flush .card-head { padding: 14px 14px 0; }
  .card-head .actions { margin-left: 0; width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .filters .field, .filters .field.grow { min-width: 0; flex: 1 1 100%; }
  .filters .btn { flex: 1; }
  .clock-time { font-size: 2rem; }
  .form-actions .btn { flex: 1; }
  /* Turn tables into stacked cards on phones */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--border); border-radius: 12px; margin: 10px 0; padding: 6px 4px; background: #fff; }
  table.stack td { border: 0; padding: 6px 12px; display: block; text-align: right; overflow: hidden; overflow-wrap: anywhere; }
  table.stack td::before { content: attr(data-label); float: left; margin-right: 12px; font-weight: 600; color: var(--muted); font-size: 12px; text-align: left; }
  table.stack td.num { text-align: right; }
  table.stack td[data-label=""]::before { content: none; }
  table.stack td:empty { display: none; }
  table.stack .person { min-width: 0; text-align: left; }
  table.stack tfoot { display: block; }
  table.stack tfoot tr { display: flex; flex-wrap: wrap; }
  .card-flush table.stack { padding: 0 10px; }
  .hero { padding: 20px; }
  .net-pay strong { font-size: 1.3rem; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .app-footer, .no-print, .alert { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .net-pay { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Admin dashboard: pending approval tiles ---------- */
/* Columns follow the width of the card itself (5, 3 or 2 per row). */
.approvals-card { container-type: inline-size; }
.approval-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.approval-tiles > .card { padding: 14px 12px; min-width: 0; text-decoration: none; }
.approval-tiles > .card:hover { border-color: var(--blue); }
.approval-tiles .stat { flex-direction: column; align-items: flex-start; gap: 10px; }
.approval-tiles .stat-icon { width: 40px; height: 40px; }
.approval-tiles .stat > div:last-child { min-width: 0; }
.approval-tiles .stat-label { line-height: 1.3; white-space: nowrap; font-size: 11.5px; }
@container (max-width: 600px) { .approval-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (max-width: 420px) { .approval-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==========================================================================
   Version 1.6: security, checklists, 13th month, year end, installable app
   ========================================================================== */
.progress-wrap { width: 100%; min-width: 150px; }
.progress-wrap .progress { margin-bottom: 4px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: 999px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input:not([type=checkbox]) { flex: 1 1 160px; min-width: 0; }
.input-sm { padding: 6px 9px !important; font-size: 13px !important; min-height: 0 !important; }
td .inline-form .input-sm { max-width: 150px; }
.code-input { font-size: 1.25rem !important; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue-d); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.auth-box .center a { font-weight: 500; }
.btn-ms { background: #fff; border: 1px solid #c9d3e3; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.btn-ms:hover { background: var(--soft); border-color: var(--blue); }
.or-line { display: flex; align-items: center; gap: 10px; margin: 14px 0 12px; color: var(--muted); font-size: 12px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Account security */
.steps { padding-left: 20px; margin: 0; }
.steps > li { margin-bottom: 16px; line-height: 1.55; }
.qr-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 10px; padding: 12px; background: var(--soft); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.qr { width: 180px; height: 180px; background: #fff; border-radius: 8px; padding: 4px; flex: 0 0 auto; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { display: inline-block; margin-top: 4px; padding: 6px 10px; background: #fff; border: 1px dashed var(--border); border-radius: 6px; font-size: 15px; letter-spacing: .06em; word-break: break-all; }
.recovery-card { border: 2px solid var(--amber); }
.recovery-codes { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.recovery-codes li { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; background: var(--soft); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; text-align: center; }

/* Checklists */
.checklist { border-top: 1px solid var(--border); }
.check-item { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.check-item.done .check-main strong { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(106, 117, 147, .5); }
.check-item.mine { background: linear-gradient(90deg, var(--blue-bg), transparent 60%); }
.check-main { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 320px; min-width: 0; margin: 0; cursor: pointer; }
.check-main > span { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; line-height: 1.4; }
.check-main input[type=checkbox] { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--green); flex: 0 0 auto; }
.check-extra { display: flex; gap: 6px; align-items: center; flex: 0 1 300px; }
.check-extra input { flex: 1; min-width: 0; }
.tick { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); background: #fff; color: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.tick .icon { width: 16px; height: 16px; }
.tick.on { background: var(--green); border-color: var(--green); color: #fff; }
.tick.static { cursor: default; }
button.tick:hover { border-color: var(--green); color: var(--green); }
button.tick.on:hover { color: #fff; }

/* Year end summary */
.ye-table td { padding: 9px 12px; }
.ye-table .ye-head td { background: var(--navy); color: #fff; font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
.ye-table .ye-sub td { font-weight: 700; background: var(--soft); }
.ye-table .ye-total td { font-weight: 700; color: var(--navy); background: var(--blue-bg); font-size: 15px; }

/* Install the app */
.install-card { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; box-shadow: var(--shadow); }
.install-card[hidden], .install-hint[hidden], [data-install][hidden] { display: none !important; }
.install-icon img { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); display: block; }
.install-card .grow { flex: 1; min-width: 0; }
.install-hint { margin-top: 18px; display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); }
.install-hint .icon { width: 16px; height: 16px; }

/* Running as an installed app: respect the phone notch and home bar */
html.standalone .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
html.standalone .sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
html.standalone .app-footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
html.standalone .auth-panel { padding-top: max(24px, env(safe-area-inset-top)); }
@media print {
  .recovery-card { border: 0; }
  .check-item.mine { background: none; }
}

/* ---------- Attendance calendar ---------- */
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.cal-key { display: inline-flex; align-items: center; gap: 6px; }
.cal-key strong { color: var(--text); }
.cal-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 1px solid transparent; }
.cal-months { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 22px; }
.cal-title { font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-wd { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-cell { position: relative; min-height: 92px; border-radius: 10px; padding: 6px 7px; border: 1px solid var(--border); background: #fff; text-align: left;
  display: flex; flex-direction: column; gap: 2px; font: inherit; color: var(--text); overflow: hidden; min-width: 0; }
button.cal-cell { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.cal-cell:hover, button.cal-cell.cal-picked { outline: 2px solid var(--blue); outline-offset: 1px; }
.cal-blank { border: 0; background: transparent; }
.cal-out { background: var(--soft); color: #b5bdd0; }
.cal-num { font-weight: 700; font-size: 13px; }
.cal-status { font-size: 11px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-time, .cal-extra { font-size: 10.5px; line-height: 1.25; color: inherit; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-today .cal-num { background: var(--navy); color: #fff; border-radius: 999px; padding: 0 7px; align-self: flex-start; }
.cal-present, .cal-dot.cal-present { background: #dff5ea; border-color: #9fdcbc; color: #0b6b44; }
.cal-late, .cal-dot.cal-late { background: #fff3cf; border-color: #f2cf6b; color: #8a5a00; }
.cal-absent, .cal-dot.cal-absent { background: #fde3e4; border-color: #f3a6a9; color: #a8262b; }
.cal-incomplete, .cal-dot.cal-incomplete { background: #ffe8d6; border-color: #f6b483; color: #9a4a0b; }
.cal-leave, .cal-dot.cal-leave { background: var(--blue-bg); border-color: #9fd3f7; color: #0b5ea8; }
.cal-holiday, .cal-dot.cal-holiday { background: var(--violet-bg); border-color: #c8bbf5; color: #4c35b0; }
.cal-rest, .cal-dot.cal-rest { background: var(--gray-bg); border-color: #dde2ec; color: #7a849c; }
.cal-none { background: #fff; }
.cal-detail { margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: var(--soft); border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.cal-detail strong { color: var(--text); }
@media (max-width: 640px) {
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 48px; padding: 4px; border-radius: 8px; align-items: center; justify-content: center; }
  .cal-status, .cal-time, .cal-extra { display: none; }
  .cal-num { font-size: 13px; }
  .cal-wd { font-size: 10px; }
}
@media print {
  .cal-cell { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cal-detail { display: none; }
}

.cal-dot.cal-present { background: #11a065; border-color: #11a065; }
.cal-dot.cal-late { background: #e0a800; border-color: #e0a800; }
.cal-dot.cal-absent { background: #d93b3f; border-color: #d93b3f; }
.cal-dot.cal-incomplete { background: #ef7d22; border-color: #ef7d22; }
.cal-dot.cal-leave { background: #0a9ef0; border-color: #0a9ef0; }
.cal-dot.cal-holiday { background: #6b4fd8; border-color: #6b4fd8; }
.cal-dot.cal-rest { background: #b9c1d3; border-color: #b9c1d3; }

/* ---------- Privacy notice and clock location (v1.7) ---------- */
.privacy-card { max-width: 860px; }
.privacy-text { line-height: 1.65; }
.privacy-text h3 { color: var(--navy); font-size: 1rem; margin: 18px 0 6px; }
.privacy-text ul { padding-left: 20px; margin: 6px 0 10px; }
.privacy-text li { margin-bottom: 4px; }
.privacy-accept { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.privacy-accept .check { align-items: flex-start; line-height: 1.5; }
.privacy-accept .check input { margin-top: 3px; flex: 0 0 auto; }
.geo-status { margin-top: 8px; text-align: center; }
.geo-error { color: var(--red); font-weight: 600; }
.map-link { display: inline-flex; align-items: center; gap: 3px; margin-right: 10px; white-space: nowrap; }
.map-link .icon { width: 14px; height: 14px; }
.loc-links { margin-top: 3px; }
.app-footer a { color: inherit; text-decoration: underline; }
/* Sign in page on tablets and phones: the clock panel becomes a compact band above the form */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-art { display: block; min-height: 210px; height: 30vh; max-height: 300px; }
  .auth-art-text { left: 24px; bottom: 24px; }
  .auth-clock { font-size: clamp(54px, 15vw, 84px); }
  .auth-date { margin-top: 6px; font-size: 15px; }
  .auth-tagline { display: none; }
  .auth-panel { align-items: flex-start; padding-top: 28px; }
}
html.standalone .auth-art { padding-top: env(safe-area-inset-top); }

/* ---------- Sign in page, full screen version (v1.7.1) ----------
   The animated network fills the whole screen; the form floats on it as a card. */
.auth { position: relative; display: flex; align-items: center; justify-content: flex-end; min-height: 100vh; min-height: 100dvh;
  padding: clamp(20px, 6vw, 110px); background: radial-gradient(120% 90% at 8% 100%, rgba(10, 158, 240, .32), transparent 60%), var(--navy); }
.auth-art { position: absolute; inset: 0; height: auto; max-height: none; min-height: 0; background: transparent; border: 0; display: block; }
.auth-panel { position: relative; z-index: 1; width: min(440px, 100%); padding: clamp(28px, 4vw, 44px); background: #fff; border-radius: 20px;
  box-shadow: 0 30px 80px rgba(4, 10, 40, .45), 0 2px 6px rgba(4, 10, 40, .2); align-items: stretch; }
.auth-box { max-width: none; }
@media (max-width: 960px) {
  .auth { flex-direction: column; justify-content: flex-start; align-items: stretch; padding: calc(176px + env(safe-area-inset-top)) 16px 24px; }
  .auth-art { display: block; height: auto; max-height: none; min-height: 0; }
  .auth-art-text { left: 24px; right: 24px; bottom: auto; top: calc(30px + env(safe-area-inset-top)); }
  .auth-clock { font-size: clamp(54px, 16vw, 84px); }
  .auth-panel { padding: 28px 22px; width: 100%; max-width: 480px; margin: 0 auto; }
}
@media (max-width: 960px) { .auth-motion-btn { left: auto; right: 16px; top: calc(16px + env(safe-area-inset-top)); } }
