:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --ink: #10201d;
  --muted: #64748b;
  --line: #dbe3ea;
  --green: #0f8a5f;
  --green-dark: #08724d;
  --red: #dc2626;
  --orange: #f59e0b;
  --blue: #2563eb;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--green-dark); text-decoration: none; font-weight: 700; }

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}

.auth-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 18px;
  align-items: stretch;
}

.auth-brand, .auth-form, .status-card, .profile-card, .summary-grid article, .live-card, .location-item, .user-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-brand {
  padding: 36px;
  display: flex;
  gap: 18px;
  align-items: center;
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #0f766e;
  color: white;
  font-weight: 900;
}

.auth-brand h1, .topbar h1, .section-heading h2, .profile-card h2 {
  margin: 0;
}

.auth-brand p, .auth-form p, .section-heading p, .profile-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.auth-form {
  padding: 30px;
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 750;
}

input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

textarea { resize: vertical; }

.primary-btn, .button-row button, .tabs button, .location-strip button, .photo-input span {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 800;
}

.primary-btn {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.primary-btn:hover { background: var(--green-dark); }

.form-message {
  margin: 0;
  border-radius: 8px;
  padding: 12px;
  font-weight: 750;
}

.form-message.error, .outside { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.form-message.success, .inside { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0 16px;
  background: rgba(246, 248, 251, 0.94);
  backdrop-filter: blur(12px);
}

.brand-lockup, .account-nav, .button-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-nav {
  justify-content: flex-end;
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.offline-banner {
  margin-bottom: 14px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  padding: 12px;
  font-weight: 800;
}

.mobile-clock-panel {
  display: grid;
  grid-template-columns: minmax(320px, 480px) 1fr;
  gap: 16px;
  align-items: stretch;
}

.status-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.status-card h2 {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
}

.status-card > p {
  margin: 0;
  color: var(--muted);
}

.shift-timer {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 12vw, 4.5rem);
  line-height: 1;
  font-weight: 900;
}

.clock-button {
  width: 100%;
  min-height: 86px;
  border: 0;
  border-radius: 8px;
  color: white;
  font-size: clamp(1.35rem, 6vw, 2rem);
  font-weight: 950;
  box-shadow: 0 18px 40px rgba(15, 138, 95, 0.24);
}

.clock-button.clock-in { background: var(--green); }
.clock-button.clock-out { background: var(--red); box-shadow: 0 18px 40px rgba(220, 38, 38, 0.22); }
.clock-button:disabled { opacity: 0.62; cursor: wait; }

.photo-input input { position: absolute; opacity: 0; pointer-events: none; }
.photo-input span {
  display: inline-grid;
  width: max-content;
  place-items: center;
}

.location-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
}

.mini-map, .admin-map {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    #eefaf7;
  background-size: 24px 24px;
  position: relative;
}

.map-pin {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--blue);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.28);
}

.map-pin.warning { background: var(--orange); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.summary-grid article {
  min-height: 108px;
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.summary-grid span, .live-card span, .timesheet-row span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.summary-grid strong {
  font-size: 1.55rem;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 0;
}

.tabs button {
  white-space: nowrap;
  background: #fff;
}

.tabs button.active {
  border-color: var(--green);
  background: #e7f8f2;
  color: var(--green-dark);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.timesheet-list, .live-grid, .location-list, .audit-list, .user-list {
  display: grid;
  gap: 10px;
}

.timesheet-row, .live-card, .location-item, .audit-item, .user-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.timesheet-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.timesheet-row strong, .live-card strong { display: block; margin-bottom: 3px; }

.user-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.user-item span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 3px;
}

.muted-item {
  opacity: 0.62;
}

.live-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.live-card {
  display: grid;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
}

.filter-bar, .location-form, .user-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.location-form { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.user-form { grid-template-columns: repeat(4, minmax(150px, 1fr)); }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.report-table th, .report-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #334155;
  font-size: 0.82rem;
}

.profile-card {
  padding: 20px;
  max-width: 620px;
}

.profile-card dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
}

.profile-card dt { color: var(--muted); font-weight: 800; }
.profile-card dd { margin: 0; }

dialog {
  width: min(520px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(15, 23, 42, 0.36); }
dialog form { padding: 20px; display: grid; gap: 12px; }

@media (max-width: 840px) {
  .auth-shell, .mobile-clock-panel { grid-template-columns: 1fr; }
  .auth-brand { padding: 26px; }
  .topbar, .section-heading { align-items: flex-start; flex-direction: column; }
  .account-nav { width: 100%; justify-content: space-between; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar, .location-form, .user-form { grid-template-columns: 1fr; }
  .user-item { grid-template-columns: 1fr; }
  .clock-button { min-height: 96px; }
}

@media (max-width: 480px) {
  .app-shell { padding: 12px; }
  .brand-mark { width: 46px; height: 46px; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .summary-grid article { min-height: 92px; padding: 13px; }
  .summary-grid strong { font-size: 1.15rem; }
  .location-strip { align-items: stretch; flex-direction: column; }
  .tabs button { flex: 1 0 auto; }
}

@media print {
  .topbar, .mobile-clock-panel, .tabs, .filter-bar, .button-row, .report-table button { display: none !important; }
  body { background: #fff; }
  .tab-panel { display: block; }
  .table-wrap { border: 0; overflow: visible; }
  .report-table { min-width: 0; font-size: 10px; }
}
