@import './theme.css';

/* =========================================================================
   WORKSCALE EMPLOYEE — DESIGN SYSTEM v2
   Mobile-first, dark-mode ready, modern Workscale blue
   Design tokens live in theme.css — this file is components only.
   ========================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Base ---------- */
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

button {
  font: inherit;
  color: inherit;
}

img, svg, video, canvas {
  max-width: 100%;
  display: block;
}
img[hidden], svg[hidden], video[hidden], canvas[hidden] { display: none !important; }

/* Lucide icons (icons.js) render inline with text as well as inside flex
   containers, so they need an inline display mode + baseline nudge. */
.lucide-icon {
  display: inline-block;
  vertical-align: -0.125em;
  flex: 0 0 auto;
}

/* ---------- Layout: Mobile-first shell ---------- */
#appShell { display: none; }

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
  background: var(--bg);
}

/* Mobile top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  height: calc(var(--topbar-h) + var(--safe-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(160%) blur(8px);
}

.topbar__title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  background: var(--primary);
  border-radius: 8px;
  padding: 4px;
  flex: 0 0 auto;
}

.topbar__subtitle {
  display: none;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--grad-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.86rem;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  flex: 0 0 auto;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--gray-100); }
:root[data-theme="dark"] .icon-btn:hover { background: rgba(255, 255, 255, 0.06); }

/* Main content area */
.main-wrapper {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.page-body {
  padding: clamp(12px, 4vw, 16px);
  padding-bottom: calc(var(--bottomnav-h) + clamp(12px, 4vw, 16px) + var(--safe-bottom));
  overflow-y: auto;
  flex: 1;
}

/* ---------- Bottom Navigation (Mobile) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  backdrop-filter: saturate(160%) blur(10px);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
}

.bottom-nav__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease-out), transform var(--t-fast);
  min-height: 56px;
}

.bottom-nav__item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.bottom-nav__item.is-active {
  color: var(--primary);
}

.bottom-nav__item.is-active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-pill);
}

.bottom-nav__item:active {
  transform: scale(0.94);
}

.bottom-nav__fab {
  position: relative;
  display: grid;
  place-items: center;
  margin-top: -28px;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-pill);
  background: var(--grad-brand);
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(31, 106, 187, 0.5);
  border: 4px solid var(--surface);
  font-size: 0.62rem;
}

.bottom-nav__fab svg {
  width: 26px;
  height: 26px;
}

.bottom-nav__fab.is-active::before { display: none; }

/* ---------- Sidebar (Desktop only) ---------- */
.sidebar { display: none; }

/* ---------- Drawer (Mobile menu) ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
.drawer[data-open="true"] { pointer-events: auto; }

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0;
  transition: opacity var(--t-med) var(--ease-out);
}
.drawer[data-open="true"] .drawer__backdrop { opacity: 1; }

.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform var(--t-med) var(--ease-out);
  display: flex;
  flex-direction: column;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  gap: 8px;
  overflow-y: auto;
}
.drawer[data-open="true"] .drawer__panel { transform: translateX(0); }

/* ---------- Brand logo (used in sidebar / drawer / splash / login) ---------- */
.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand-logo--sm { width: 32px; height: 32px; }

.drawer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.drawer__brand .brand-logo {
  background: var(--brand-700);
  border-radius: var(--radius-md);
  padding: 4px;
}

.drawer__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.drawer__avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: var(--grad-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.05rem;
  flex: 0 0 auto;
}

.drawer__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.drawer__role {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.drawer__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.drawer__item:hover,
.drawer__item.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}
.drawer__item svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.drawer__divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}

.card h2 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card--hero {
  background: var(--grad-hero);
  color: #fff;
  border: 0;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.card--hero::before {
  content: '';
  position: absolute;
  inset: -40% -20% auto auto;
  width: 70%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.15), transparent 60%);
  pointer-events: none;
}
.card--hero h2,
.card--hero p { color: #fff; }

.card--elevated { box-shadow: var(--shadow-md); }

.card-grid {
  display: grid;
  gap: 10px;
}
/* 2-col: collapses to 1-col only on truly tiny screens (< ~300px per col) */
.card-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Collapse 2-col to 1-col below 320px viewport */
@media (max-width: 319px) {
  .card-grid--2 { grid-template-columns: 1fr; }
}
@media (min-width: 768px) {
  .card-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid { gap: 14px; }
}

/* ---------- Stat Card ---------- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* Fluid padding: 10px on tight screens, 14px normally */
  padding: clamp(10px, 3.5vw, 14px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  width: 100%;
  min-height: 110px;          /* ensures equal-height columns */
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
button.stat-card { -webkit-appearance: none; appearance: none; }
.stat-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.stat-card__icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 2px;
  flex: 0 0 auto;
}
.stat-card__icon svg { width: 16px; height: 16px; }

.stat-card__label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card__value {
  font-size: clamp(1rem, 4vw, 1.15rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card__hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card--success .stat-card__icon { background: var(--success-bg); color: var(--success-fg); }
.stat-card--warning .stat-card__icon { background: var(--warning-bg); color: var(--warning-fg); }
.stat-card--danger  .stat-card__icon { background: var(--danger-bg);  color: var(--danger-fg); }
.stat-card--info    .stat-card__icon { background: var(--info-bg);    color: var(--info-fg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              filter var(--t-fast) var(--ease-out);
  min-height: 44px;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
  transition: transform var(--transition-bounce);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(47, 129, 214, 0.28);
}
.btn--primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn--danger {
  background: var(--danger);
  color: #fff;
}
.btn--danger:hover:not(:disabled) { filter: brightness(0.93); }

.btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.92);
}

.btn--ghost-light {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost-light.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn--full { width: 100%; }
.btn--lg { padding: 14px 20px; font-size: 1rem; min-height: 52px; }
.btn--sm { padding: 7px 11px; font-size: 0.8rem; min-height: 36px; }
.btn--table { padding: 6px 10px; font-size: 0.78rem; min-height: 32px; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* Big circular CTA (clock-in) */
.btn--clock {
  width: 100%;
  min-height: 80px;
  font-size: 1.15rem;
  font-weight: 800;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 12px 28px rgba(5, 150, 105, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  letter-spacing: 0.02em;
}
.btn--clock-out {
  background: linear-gradient(135deg, #f97316, #ea580c);
  box-shadow: 0 12px 28px rgba(234, 88, 12, 0.45);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ---------- Forms ---------- */
.form-stack {
  display: grid;
  gap: 12px;
}
.form-stack label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input,
select.input,
textarea.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--glass-bg-input);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 11px 12px;
  min-height: 44px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ---------- Section / typography ---------- */
.section-gap { margin-top: 16px; }

.section-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.error {
  color: var(--danger);
}

/* ---------- Status pills ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.status-pill--pending,
.status-pill--open {
  background: var(--warning-bg);
  color: var(--warning-fg);
}
.status-pill--approved,
.status-pill--resolved {
  background: var(--success-bg);
  color: var(--success-fg);
}
.status-pill--rejected,
.status-pill--declined {
  background: var(--danger-bg);
  color: var(--danger-fg);
}
.status-pill--cancelled {
  background: var(--gray-100);
  color: var(--gray-600);
}
:root[data-theme="dark"] .status-pill--cancelled {
  background: var(--gray-800);
  color: var(--gray-400);
}

/* ---------- Tables ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.data-table tr:last-child td { border-bottom: 0; }

/* ---------- DTR / timekeeping ---------- */
.camera-preview {
  width: 100%;
  border-radius: var(--radius-md);
  margin-top: 8px;
  aspect-ratio: 3 / 4;
  max-height: 70vh;
  background: #1f2f3d;
  object-fit: cover;
}
@media (min-width: 640px) {
  .camera-preview { aspect-ratio: 4 / 3; max-height: 60vh; }
}

.captured-image {
  display: none;
  width: 100%;
  border-radius: var(--radius-md);
  margin-top: 8px;
}
.captured-image--visible { display: block; }

.time-now {
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: #fff;
}

.dtr-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}
.dtr-toolbar__field {
  display: grid;
  gap: 6px;
  min-width: min(240px, 100%);
  flex: 1 1 240px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.dtr-log-item {
  white-space: nowrap;
  font-size: 0.8rem;
  line-height: 1.4;
}
.dtr-log-item + .dtr-log-item { margin-top: 4px; }

.status-box {
  background: var(--info-bg);
  color: var(--info-fg);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  font-size: 0.88rem;
}

/* ---------- KV display (profile 201) ---------- */
.info-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 14px;
}

.info-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.info-kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.info-kv:last-child { border-bottom: 0; }

.kv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 600px) {
  .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kv-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface);
}
.kv-key {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.kv-value {
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

/* ---------- Modal / Bottom sheet ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: grid;
  place-items: end center;
  padding: 0;
  animation: fade-in var(--t-med) var(--ease-out);
}
@media (min-width: 640px) {
  .modal-backdrop { place-items: center; padding: 16px; }
}
.modal-backdrop[hidden] { display: none !important; }

.modal-card {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-xl);
  padding: 20px 16px calc(20px + var(--safe-bottom));
  max-height: 92dvh;
  overflow-y: auto;
  animation: slide-up var(--t-med) var(--ease-out);
}
@media (min-width: 640px) {
  .modal-card {
    border-radius: var(--radius-lg);
    padding: 20px;
    animation: pop-in var(--transition-bounce);
  }
}

.modal-card::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: var(--gray-300);
  border-radius: var(--radius-pill);
  margin: -8px auto 12px;
}
@media (min-width: 640px) {
  .modal-card::before { display: none; }
}

.overwrite-confirm {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--warning);
  background: var(--warning-bg);
  color: var(--warning-fg);
  border-radius: var(--radius-md);
}
.overwrite-confirm__label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 600;
}

/* ---------- Login / splash ---------- */
.login-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 16px;
  background: radial-gradient(circle at 20% -10%, var(--brand-100), transparent 50%),
              radial-gradient(circle at 80% 110%, var(--brand-100), transparent 50%),
              var(--bg);
}
:root[data-theme="dark"] .login-wrapper {
  background: radial-gradient(circle at 20% -10%, rgba(74, 155, 234, 0.18), transparent 50%),
              radial-gradient(circle at 80% 110%, rgba(74, 155, 234, 0.12), transparent 50%),
              var(--bg);
}

.login-card {
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 28px 22px;
  text-align: center;
  overflow: auto;
}

.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: var(--primary);
  border-radius: 18px;
  padding: 12px;
  margin: 0 auto 12px;
  display: block;
  box-shadow: var(--shadow-md);
}

.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.login-subtitle {
  margin-top: 8px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.login-notice,
.login-footer {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.dev-login-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: left;
  min-width: 0;
}

.login-dev-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.login-dev-modes .btn { width: 100%; min-width: 0; }

.login-dev-section {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.login-dev-help {
  color: var(--text-muted);
  font-size: 0.82rem;
}
.login-dev-section label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.login-spinner {
  width: 36px;
  height: 36px;
  margin: 16px auto;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

#splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#splash.splash--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#splash-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: var(--primary);
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow-lg);
}
:root[data-theme="dark"] #splash-logo { background: var(--brand-700); }

#splash-wordmark {
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--primary);
  font-size: 1.05rem;
}

#splash-bar {
  width: 140px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  overflow: hidden;
}
#splash-bar::after {
  content: '';
  display: block;
  width: 40%;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--primary);
  animation: splash-slide 1.1s ease-in-out infinite;
}

/* ---------- Toast ---------- */
#toast-container {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottomnav-h) + 16px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}
@media (min-width: 768px) {
  #toast-container { left: auto; right: 20px; transform: none; bottom: 20px; }
}

.toast {
  background: var(--gray-900);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--success); }
.toast--error   { background: var(--danger); }
.toast--warning { background: var(--warning); color: #fff; }

/* ---------- Animations ---------- */
@keyframes splash-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes pop-in {
  0%   { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1);    opacity: 1; }
}

/* ---------- Skeleton loaders ---------- */
.skeleton {
  background: linear-gradient(90deg,
    var(--gray-100) 0%,
    var(--gray-200) 50%,
    var(--gray-100) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}
:root[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1c2638 0%, #243149 50%, #1c2638 100%);
  background-size: 200% 100%;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =========================================================================
   QUICK ACTION CARDS
   ========================================================================= */
.action-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: clamp(12px, 3.5vw, 16px);
  min-height: 80px;
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  box-shadow: var(--shadow-xs);
}
.action-card:hover  { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.action-card:active { transform: scale(0.97); }
.action-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.action-card__title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.action-card__desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* =========================================================================
   DESKTOP (≥ 768px)
   ========================================================================= */
@media (min-width: 768px) {
  body { font-size: 15px; }

  .app-shell {
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 1fr;
    gap: 14px;
    padding: 14px;
    min-height: 100vh;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--sidebar-bg);
    border-radius: var(--radius-lg);
    padding: 20px 14px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 14px;
    height: calc(100vh - 28px);
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    padding-bottom: 14px;
  }
  .brand-logo {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
  }
  .brand-logo--sm { width: 32px; height: 32px; }
  .brand-text { min-width: 0; }
  .brand-title {
    letter-spacing: 0.1em;
    font-weight: 800;
    font-size: 0.92rem;
    color: #e6f4ff;
  }
  .brand-subtitle {
    margin-top: 4px;
    font-size: 0.78rem;
    color: rgba(230, 244, 255, 0.62);
  }

  .nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
  }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: var(--radius-md);
    text-align: left;
    padding: 11px 14px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t-fast) var(--ease-out);
    width: 100%;
  }
  .nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
  .nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }
  .nav-item.is-active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 129, 214, 0.4);
  }

  .main-wrapper {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
  }

  .topbar {
    position: relative;
    background: var(--surface);
    height: auto;
    min-height: auto;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    align-items: start;
  }
  .topbar__title { font-size: 1.25rem; white-space: normal; overflow: visible; }
  .topbar__subtitle {
    display: block;
    margin-top: 0;
    font-size: 0.84rem;
    color: var(--text-muted);
    font-weight: 500;
  }
  .topbar__actions { display: none; }

  .page-body {
    padding: 22px;
    padding-bottom: 22px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
  }

  .bottom-nav { display: none; }

  .card-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .page-body { padding: 28px; }
  .card-grid { gap: 16px; }
}

/* ---------- Page-title used by old shell (legacy alias) ---------- */
.page-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.page-subtitle {
  margin-top: 2px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-center { text-align: center; }
.hidden-mobile { display: none; }
@media (min-width: 768px) {
  .hidden-mobile { display: initial; }
  .hidden-desktop { display: none; }
}

/* =========================================================================
   Sprint A — Timekeeping polish
   ========================================================================= */

/* Status dot inline (replaces emoji circles) */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}
.status-dot--in  { background: #22c55e; animation: pulse-dot 1.6s ease-in-out infinite; }
.status-dot--out { background: #f97316; }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  50%      { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
}

/* Hero today-status row */
.today-status { display: inline-flex; align-items: center; gap: 4px; }

/* Big clock-button dot replaces emoji */
.btn--clock { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.btn--clock__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22);
}
.btn--clock__dot--out { background: #fed7aa; }

/* Elapsed-time pill in hero */
.elapsed-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px);
}
.elapsed-pill[hidden] { display: none; }
.elapsed-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse-dot 1.6s ease-in-out infinite;
}

/* GPS chip states */
#gpsStatus[data-state="ok"]      { background: var(--success-bg); color: var(--success-fg); }
#gpsStatus[data-state="stale"]   { background: var(--warning-bg); color: var(--warning-fg); }
#gpsStatus[data-state="pending"] { background: var(--info-bg);    color: var(--info-fg); }

/* Selfie capture stage + countdown overlay */
.selfie-stage { position: relative; }
.selfie-countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 5rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
  background: rgba(15, 23, 42, 0.28);
  border-radius: var(--radius-md);
  pointer-events: none;
  animation: pop-in 220ms var(--ease-out);
}
.selfie-countdown[hidden] { display: none; }

/* DTR card list (mobile-friendly) */
.dtr-cards {
  display: grid;
  gap: 10px;
}
.dtr-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.dtr-card:hover { border-color: var(--primary-soft); box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,0.06)); }
.dtr-card--today {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary-soft), var(--surface) 60%);
}
.dtr-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.dtr-card__date {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.dtr-card__worked {
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
}
.dtr-card__row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.dtr-card__cell {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.dtr-card__label {
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}
.dtr-card__value {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge--info { background: var(--primary); color: #fff; }

/* status-pill tone modifiers used by payslip */
.status-pill--success { background: var(--success-bg); color: var(--success-fg); }
.status-pill--warning { background: var(--warning-bg); color: var(--warning-fg); }
.status-pill--info    { background: var(--info-bg);    color: var(--info-fg); }

/* =========================================================================
   Sprint B — Payslip detail
   ========================================================================= */
.payslip-toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.payslip-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .payslip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.payslip-card {
  display: block;
  text-align: left;
  width: 100%;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.payslip-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.payslip-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.payslip-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.payslip-card__head > :first-child {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
}
.payslip-card__head .status-pill { flex: 0 0 auto; }
.payslip-card__net {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-soft), transparent);
  margin-bottom: 10px;
}
.payslip-card__label { font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.payslip-card__amount { font-size: 1.45rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.payslip-card__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 0.86rem; }
.payslip-card__row strong { font-variant-numeric: tabular-nums; }
.payslip-card__cta { margin-top: 10px; font-size: 0.78rem; color: var(--primary); font-weight: 700; }

.payslip-detail { padding: 0 4px; }
.payslip-detail__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.payslip-detail__title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.payslip-detail__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.payslip-section { border-top: 1px solid var(--border); padding: 12px 0; }
.payslip-section__title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; margin: 0 0 8px; }
.payslip-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.payslip-line--total { border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 8px; font-weight: 700; }
.payslip-detail__net {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-700, var(--primary)));
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.payslip-detail__net strong { font-size: 1.5rem; letter-spacing: -0.02em; }

/* =========================================================================
   Sprint B — Request cards (leave / overtime / complaints)
   ========================================================================= */
.request-card { margin-bottom: 10px; }
.request-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.request-card__title { min-width: 0; flex: 1; }
.request-card__type { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.request-card__body {
  font-size: 0.88rem;
  color: var(--text-soft, var(--text-muted));
  white-space: pre-wrap;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 6px 0 10px;
}
.request-card__actions { margin-top: 10px; }

.req-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.req-meta__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
}
.req-meta__chip--ok   { background: var(--success-bg); color: var(--success-fg); }
.req-meta__chip--bad  { background: var(--danger-bg);  color: var(--danger-fg); }
.req-meta__chip--info { background: var(--info-bg);    color: var(--info-fg); }
.req-meta__remarks {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  border-left: 3px solid var(--gray-300);
  background: var(--surface-2);
  color: var(--text);
}
.req-meta__remarks--bad { border-left-color: var(--danger); background: var(--danger-bg); color: var(--danger-fg); }
.req-meta__remarks--ok  { border-left-color: var(--success); background: var(--success-bg); color: var(--success-fg); }

/* =========================================================================
   Sprint C — Dashboard "Needs Attention" callouts
   ========================================================================= */
.attention-list {
  display: grid;
  gap: 8px;
}
.attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.attention-item:hover { transform: translateX(2px); box-shadow: var(--shadow-sm, var(--shadow-md)); }
.attention-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.attention-item__icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.95rem;
}
.attention-item__text { flex: 1; min-width: 0; font-size: 0.88rem; line-height: 1.35; }
.attention-item__chev { color: var(--text-muted); font-size: 1.4rem; }
.attention-item--bad  { border-color: var(--danger); }
.attention-item--bad  .attention-item__icon { background: var(--danger-bg); color: var(--danger-fg); }
.attention-item--info .attention-item__icon { background: var(--info-bg);   color: var(--info-fg); }
.attention-item--ok   .attention-item__icon { background: var(--success-bg); color: var(--success-fg); }

/* Skeleton list / Error retry state */
.skeleton-list { display: grid; gap: 8px; }
.error-state {
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}
.error-state .error { color: inherit; font-weight: 600; }

/* Hide Firebase emulator warning banner */
.firebase-emulator-warning { display: none !important; }



/* =========================================================================
   Announcements + Calendar
   ========================================================================= */
.ann-pill {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: var(--radius-pill);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-soft); color: var(--text-muted);
}
.ann-pill--info    { background: var(--info-bg);    color: var(--info-fg); }
.ann-pill--success { background: var(--success-bg); color: var(--success-fg); }
.ann-pill--bad     { background: var(--danger-bg);  color: var(--danger-fg); }
.ann-pill--neutral { background: var(--surface-soft); color: var(--text-muted); }
.ann-pill--pin     { background: #fef3c7; color: #92400e; }
.ann-pill--new     { background: var(--primary); color: #fff; }

.ann-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.ann-card.is-pinned {
  border-left: 3px solid #f59e0b;
}
.ann-card.is-unread {
  border-left: 3px solid var(--primary);
  background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box;
}
.ann-card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 6px;
}
.ann-card__meta { display: flex; gap: 6px; flex-wrap: wrap; }
.ann-card__time { font-size: 0.78rem; color: var(--text-muted); }
.ann-card__title {
  margin: 2px 0 6px; font-size: 1.02rem; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
}
.ann-card__body {
  margin: 0 0 10px; font-size: 0.9rem; line-height: 1.5;
  color: var(--text); white-space: pre-wrap; word-break: break-word;
}
.ann-card__foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 0.76rem; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 8px;
}

/* Calendar */
.cal-card { padding: 14px 14px 16px; }
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.cal-title { margin: 0; font-size: 1.05rem; font-weight: 700; }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-dow {
  text-align: center; font-size: 0.7rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 6px 0 4px;
}
.cal-cell {
  position: relative; aspect-ratio: 1;
  background: var(--surface-soft); border: 1px solid transparent;
  border-radius: 8px; padding: 4px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: stretch;
  font: inherit; color: var(--text); text-align: left;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.cal-cell:hover { background: var(--surface); border-color: var(--border); }
.cal-cell--empty { visibility: hidden; cursor: default; }
.cal-cell.is-today { border-color: var(--primary); }
.cal-cell.is-today .cal-day { color: var(--primary); font-weight: 800; }
.cal-cell.is-selected { background: var(--info-bg); border-color: var(--primary); }
.cal-cell.has-events .cal-day { font-weight: 700; }
.cal-day { font-size: 0.82rem; }
.cal-dots {
  margin-top: auto; display: flex; gap: 3px; align-items: center; flex-wrap: wrap;
}
.cal-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
}
.cal-dot--info    { background: var(--info-fg); }
.cal-dot--success { background: var(--success-fg); }
.cal-dot--bad     { background: var(--danger-fg); }
.cal-more { font-size: 0.65rem; color: var(--text-muted); margin-left: 2px; }

.cal-event {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.cal-event:last-child { border-bottom: 0; }
.cal-event__head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.78rem; color: var(--text-muted);
  margin-bottom: 4px;
}
.cal-event__title {
  margin: 2px 0 4px; font-size: 0.96rem; font-weight: 700; color: var(--text);
}
.cal-event__body {
  margin: 0; font-size: 0.86rem; color: var(--text);
  line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}

@media (min-width: 640px) {
  .cal-cell { padding: 6px 8px; }
  .cal-day { font-size: 0.9rem; }
}

/* Dashboard announcement preview */
.ann-preview-list .ann-preview-item {
  display: flex; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
  text-align: left; cursor: pointer;
  background: transparent; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; font: inherit; color: var(--text);
}
.ann-preview-list .ann-preview-item:last-child { border-bottom: 0; }
.ann-preview-item__dot {
  flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); margin-top: 7px;
}
.ann-preview-item.is-read .ann-preview-item__dot { background: var(--text-muted); opacity: 0.4; }
.ann-preview-item__body { flex: 1; min-width: 0; }
.ann-preview-item__title {
  font-weight: 600; font-size: 0.92rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ann-preview-item__meta {
  font-size: 0.76rem; color: var(--text-muted); margin-top: 2px;
}


/* Payroll strip (dashboard) */
.payroll-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-top: 14px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  color: #064e3b;
}
html[data-theme="dark"] .payroll-strip {
  background: linear-gradient(135deg, rgba(5,150,105,0.18), rgba(16,185,129,0.10));
  border-color: rgba(16,185,129,0.35);
  color: #d1fae5;
}
.payroll-strip__icon { font-size: 1.5rem; flex: 0 0 auto; }
.payroll-strip__body { flex: 1; min-width: 0; }
.payroll-strip__title { font-size: 0.84rem; font-weight: 600; }
.payroll-strip__meta { font-size: 0.78rem; opacity: 0.85; margin-top: 2px; }
.payroll-strip__badge {
  flex: 0 0 auto;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 0.72rem; font-weight: 700;
  background: rgba(255,255,255,0.7); color: #065f46;
}
.payroll-strip__badge--info { background: var(--info-bg); color: var(--info-fg); }
.payroll-strip__badge--warn { background: #fef3c7; color: #92400e; }


/* DTR summary + status indicators */
.dtr-summary {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  padding: 10px; margin-bottom: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.dtr-summary__item { text-align: center; padding: 6px 4px; border-radius: 8px; }
.dtr-summary__num { font-size: 1.05rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.dtr-summary__label {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 700; margin-top: 2px;
}
.dtr-summary__item--success { background: var(--success-bg); }
.dtr-summary__item--success .dtr-summary__num { color: var(--success-fg); }
.dtr-summary__item--warn { background: #fef3c7; }
.dtr-summary__item--warn .dtr-summary__num { color: #92400e; }
.dtr-summary__item--info { background: var(--info-bg); }
.dtr-summary__item--info .dtr-summary__num { color: var(--info-fg); }
.dtr-summary__item--bad { background: var(--danger-bg); }
.dtr-summary__item--bad .dtr-summary__num { color: var(--danger-fg); }

@media (max-width: 480px) {
  .dtr-summary { grid-template-columns: repeat(3, 1fr); }
  .dtr-summary__item:nth-child(4),
  .dtr-summary__item:nth-child(5) { grid-column: span 1; }
}

.dtr-status {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; margin-left: 6px; vertical-align: middle;
}
.dtr-status--success { background: var(--success-bg); color: var(--success-fg); }
.dtr-status--warn    { background: #fef3c7; color: #92400e; }
.dtr-status--info    { background: var(--info-bg); color: var(--info-fg); }
.dtr-status--bad     { background: var(--danger-bg); color: var(--danger-fg); }

.dtr-card--warn { border-left: 3px solid #f59e0b; }
.dtr-card--info { border-left: 3px solid var(--info-fg); }
.dtr-card--bad  { border-left: 3px solid var(--danger-fg); }


/* Topbar bell + notifications */
.topbar__bell {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.topbar__bell:hover { background: var(--surface-soft); }
.topbar__bell svg { width: 18px; height: 18px; }
.topbar__bell-dot {
  position: absolute; top: -2px; right: -2px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--danger-fg); color: #fff;
  border-radius: var(--radius-pill); border: 2px solid var(--surface);
  font-size: 0.65rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}

.notif-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }

.notif-item {
  display: flex; gap: 12px; align-items: flex-start;
  width: 100%; padding: 12px 14px; margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left; cursor: pointer;
  font: inherit; color: var(--text);
  position: relative;
  transition: background var(--t-fast) var(--ease-out);
}
.notif-item:hover { background: var(--surface-soft); }
.notif-item.is-read { opacity: 0.7; }
.notif-item__icon {
  flex: 0 0 auto; width: 36px; height: 36px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; background: var(--surface-soft); color: var(--text);
}
.notif-item__icon--success { background: var(--success-bg); color: var(--success-fg); }
.notif-item__icon--bad     { background: var(--danger-bg);  color: var(--danger-fg); }
.notif-item__icon--info    { background: var(--info-bg);    color: var(--info-fg); }
.notif-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-item__title { font-weight: 700; font-size: 0.92rem; color: var(--text); }
.notif-item__text  { font-size: 0.84rem; color: var(--text-muted); white-space: pre-wrap; word-break: break-word; }
.notif-item__time  { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }
.notif-item__dot {
  position: absolute; top: 14px; right: 14px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}

/* Hide bell on the topbar in mobile if you want? Keep visible for now. */


/* Schedule page rows */
.sched-row {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.sched-row:last-child { border-bottom: 0; }
.sched-row__date {
  flex: 0 0 64px;
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}
.sched-row__dow { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.sched-row__day { font-weight: 700; font-size: 0.84rem; color: var(--text); }
.sched-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sched-row__time { font-weight: 600; }
.sched-row__meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.84rem; color: var(--text-muted); }
.sched-row__loc { color: var(--text-muted); }
.sched-row__notes { font-size: 0.82rem; color: var(--text-muted); }

/* Dashboard "Today's shift" */
.today-shift { margin-top: 10px; }
.today-shift__head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.today-shift__type { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.today-shift__time { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.today-shift__loc { font-size: 0.86rem; color: var(--text-muted); margin-top: 2px; }
.today-shift__foot { margin-top: 10px; display: flex; justify-content: flex-end; }


/* Schedule page rows */
.sched-row {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.sched-row:last-child { border-bottom: 0; }
.sched-row__date {
  flex: 0 0 64px;
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}
.sched-row__dow { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.sched-row__day { font-weight: 700; font-size: 0.84rem; color: var(--text); }
.sched-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sched-row__time { font-weight: 600; }
.sched-row__meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.84rem; color: var(--text-muted); }
.sched-row__loc { color: var(--text-muted); }
.sched-row__notes { font-size: 0.82rem; color: var(--text-muted); }

/* Dashboard "Today's shift" */
.today-shift { margin-top: 10px; }
.today-shift__head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.today-shift__type { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.today-shift__time { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.today-shift__loc { font-size: 0.86rem; color: var(--text-muted); margin-top: 2px; }
.today-shift__foot { margin-top: 10px; display: flex; justify-content: flex-end; }


/* =========================================================================
   DESIGN POLISH v3 � Premium pass
   - Inter advanced features + tighter type
   - Layered shadows + hover lift on cards
   - Page transitions
   - Glass topbar on scroll
   - Accent personalization
   - Progress rings
   - Command palette
   ========================================================================= */

/* Inter advanced features (tabular figures + open sans-serif glyphs) */
html { font-feature-settings: 'cv11', 'ss01', 'ss03'; }
body {
  line-height: 1.55;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.005em;
}
h1, h2, h3, .topbar__title, .card h2, .section-title {
  letter-spacing: -0.018em;
}
.stat-card__value, .today-shift__time, .dash-clock__time, .topbar__title {
  font-feature-settings: 'tnum', 'cv11';
}

/* Selection + scrollbar polish */
::selection { background: color-mix(in srgb, var(--primary) 28%, transparent); color: var(--text); }
* { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }
:root[data-theme="dark"] * { scrollbar-color: var(--gray-700) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--gray-400) 60%, transparent);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* Layered shadow tokens (--shadow-card, --shadow-card-hover, --shadow-pop)
   now live in theme.css alongside the rest of the shadow scale. */

/* Card hover lift */
.card {
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--t-med) var(--ease-out),
              transform var(--t-med) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
}
@media (hover: hover) {
  .stat-card:hover,
  .ann-card:hover,
  .notif-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
  }
}

/* Page transitions (mounted by router) */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-enter { animation: pageIn .22s var(--ease-out) both; }

/* Glass topbar when scrolled */
.topbar {
  transition: background var(--t-med) var(--ease-out),
              border-color var(--t-med) var(--ease-out),
              box-shadow var(--t-med) var(--ease-out);
}
.topbar.is-scrolled {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: color-mix(in srgb, var(--border) 60%, transparent);
  box-shadow: 0 6px 20px rgba(15, 23, 42, .04);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .page-enter, .skeleton, .topbar__bell-dot { animation: none !important; }
  .card, .btn, .stat-card, .notif-item { transition: none !important; }
  .stat-card:hover, .ann-card:hover, .notif-item:hover { transform: none !important; }
}

/* Accent personalization overrides (--primary family per data-accent)
   now live in theme.css. */

/* =========================================================================
   PROGRESS RING
   ========================================================================= */
.progress-ring {
  /* Shrinks gracefully on narrow screens; capped at 76px on larger */
  --ring-size: clamp(60px, 18vw, 76px);
  --ring-stroke: 6;
  --ring-track: color-mix(in srgb, var(--primary) 12%, transparent);
  --ring-color: var(--primary);
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  flex: 0 0 auto;
}
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring__track { fill: none; stroke: var(--ring-track); stroke-width: var(--ring-stroke); }
.progress-ring__bar {
  fill: none;
  stroke: var(--ring-color);
  stroke-width: var(--ring-stroke);
  stroke-linecap: round;
  transition: stroke-dashoffset .9s var(--ease-out);
}
.progress-ring__center {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.82rem; color: var(--text);
  font-feature-settings: 'tnum';
}
.progress-ring--success { --ring-color: var(--success); --ring-track: color-mix(in srgb, var(--success) 14%, transparent); }
.progress-ring--warning { --ring-color: var(--warning); --ring-track: color-mix(in srgb, var(--warning) 14%, transparent); }
.progress-ring--info    { --ring-color: var(--info);    --ring-track: color-mix(in srgb, var(--info) 14%, transparent); }

/* Stat-card variant with progress ring */
.stat-card--ring {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: clamp(8px, 3vw, 14px);
  text-align: left;
}
.stat-card--ring .stat-card__icon { display: none; }
.stat-card--ring .stat-card__body {
  flex: 1;
  min-width: 0;           /* critical: lets text truncate rather than overflow */
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

/* =========================================================================
   COMMAND PALETTE
   ========================================================================= */
.cmdk-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  z-index: 1100;
  display: grid; place-items: start center;
  padding: 12vh 16px 16px;
  animation: fade-in .16s var(--ease-out);
}
.cmdk-backdrop[hidden] { display: none !important; }
.cmdk {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: slide-up .2s var(--ease-out);
}
.cmdk__search {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cmdk__search svg { width: 18px; height: 18px; color: var(--text-muted); flex: 0 0 auto; }
.cmdk__input {
  flex: 1; border: 0; outline: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 0.95rem;
}
.cmdk__list {
  max-height: 50vh; overflow-y: auto; padding: 6px;
}
.cmdk__item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  background: transparent; border: 0; cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text); font: inherit; text-align: left;
}
.cmdk__item:hover, .cmdk__item.is-active { background: var(--surface-2); }
.cmdk__item svg { width: 16px; height: 16px; color: var(--text-muted); flex: 0 0 auto; }
.cmdk__item-label { flex: 1; min-width: 0; font-weight: 500; }
.cmdk__item-hint { font-size: 0.78rem; color: var(--text-muted); }
.cmdk__empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: .88rem; }
.cmdk__footer {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: .74rem; color: var(--text-muted);
}
.kbd {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .72rem; font-family: ui-monospace, 'SF Mono', monospace;
  color: var(--text-soft);
}

/* Topbar search button (desktop) */
.topbar__search {
  display: none;
}
@media (min-width: 768px) {
  .topbar__search {
    display: inline-flex;
    align-items: center; gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 6px 10px 6px 12px;
    color: var(--text-muted);
    font-size: .82rem;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
  }
  .topbar__search:hover { background: var(--surface); border-color: var(--border-strong); }
}

/* =========================================================================
   THEME PICKER MODAL
   ========================================================================= */
.theme-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-top: 8px;
}
.theme-tile {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font: inherit; color: var(--text);
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.theme-tile:hover { transform: translateY(-1px); }
.theme-tile.is-active { border-color: var(--primary); }
.theme-tile__preview {
  height: 36px; border-radius: 8px;
  border: 1px solid var(--border);
}
.theme-tile__preview--light { background: linear-gradient(180deg, #ffffff 0 50%, #f7f9fc 50% 100%); }
.theme-tile__preview--dark  { background: linear-gradient(180deg, #131c2c 0 50%, #0b1220 50% 100%); }
.theme-tile__label { font-weight: 600; font-size: .88rem; }

.accent-row {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 8px;
}
.accent-swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: transform var(--t-fast);
}
.accent-swatch:hover { transform: scale(1.08); }
.accent-swatch.is-active::after {
  content: '?';
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: .9rem;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.accent-swatch[data-accent="default"] { background: linear-gradient(135deg, #2f81d6, #1a5598); }
.accent-swatch[data-accent="purple"]  { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.accent-swatch[data-accent="green"]   { background: linear-gradient(135deg, #10b981, #047857); }
.accent-swatch[data-accent="orange"]  { background: linear-gradient(135deg, #f97316, #c2410c); }
.accent-swatch[data-accent="pink"]    { background: linear-gradient(135deg, #ec4899, #be185d); }
.accent-swatch[data-accent="teal"]    { background: linear-gradient(135deg, #14b8a6, #0f766e); }
