:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe3ee;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --blue: #2563eb;
  --amber: #b45309;
  --green: #15803d;
  --danger: #b91c1c;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.public-shell,
.app-shell {
  min-height: 100vh;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand span,
.avatar {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.avatar.large {
  width: 72px;
  height: 72px;
  font-size: 24px;
}

.public-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(18px, 5vw, 64px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 2;
}

.hero {
  display: grid;
  gap: 32px;
  padding: clamp(40px, 8vw, 96px) clamp(18px, 5vw, 72px);
  align-items: center;
}

.hero h1 {
  font-size: clamp(48px, 8vw, 92px);
  line-height: 0.92;
  margin: 10px 0 18px;
  letter-spacing: 0;
}

.hero p {
  color: var(--muted);
  max-width: 620px;
  font-size: 18px;
  line-height: 1.7;
}

.hero-actions,
.section-actions,
.form-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.hero-panel {
  display: grid;
  gap: 14px;
  background: #0f172a;
  color: #fff;
  padding: clamp(18px, 4vw, 28px);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 750;
  min-height: 42px;
}

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

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

.secondary-btn {
  background: #e6f4f1;
  color: var(--brand-dark);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
}

.danger-btn {
  background: #fee2e2;
  color: var(--danger);
}

.compact {
  padding: 8px 12px;
  min-height: 34px;
  font-size: 13px;
}

.full {
  width: 100%;
}

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

.auth-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  display: grid;
  gap: 12px;
  width: min(100%, 440px);
  padding: 24px;
}

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

textarea {
  min-height: 110px;
  resize: vertical;
}

label {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.app-shell {
  display: grid;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.mobile-menu-overlay,
.menu-toggle {
  display: none;
}

.sidebar nav {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: flex-start;
}

.sidebar nav button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  white-space: nowrap;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
}

.sidebar nav button span {
  display: inline-block;
  width: 20px;
  text-align: center;
}

.sidebar nav button strong {
  font: inherit;
}

.sidebar nav button.active {
  color: var(--brand-dark);
  background: #e6f4f1;
}

.workspace {
  padding: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar small,
.stat-card small,
table small,
.report-tile span,
.timeline span,
.timeline small {
  display: block;
  color: var(--muted);
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin: 8px 0 18px;
}

.section-header h2,
.panel h3,
.profile-card h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
}

.grid,
.stats-grid,
.employee-grid {
  display: grid;
  gap: 14px;
}

.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.panel {
  padding: 18px;
  overflow: hidden;
}

.period-banner {
  margin: -4px 0 16px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  line-height: 1.5;
}

.range-card {
  display: grid;
  gap: 10px;
}

.range-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.range-pill {
  display: grid;
  gap: 3px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  color: var(--muted);
  text-align: left;
}

.range-pill strong {
  color: var(--ink);
  font-size: 14px;
}

.range-pill small,
.range-modal-header small {
  color: var(--muted);
  line-height: 1.4;
}

.range-pill.active {
  border-color: var(--brand);
  background: #e6f4f1;
  box-shadow: inset 0 0 0 1px var(--brand);
}

.range-pill.active strong {
  color: var(--brand-dark);
}

.range-pill.active small {
  color: #0f766e;
}

.range-pill:hover {
  border-color: var(--brand);
  background: #ffffff;
}

.range-pill.active:hover {
  background: #dff1ee;
}

.range-pill:focus-visible {
  outline: 3px solid rgba(20, 184, 166, 0.25);
  outline-offset: 2px;
}

.range-pill.active::after {
  content: "Dipakai";
  justify-self: start;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.range-custom {
  display: none;
  grid-template-columns: 170px 170px auto;
  gap: 10px;
  align-items: center;
}

.range-custom.show {
  display: grid;
}

.modal-backdrop {
  display: none;
}

.modal-backdrop.open {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 23, 42, 0.42);
}

.range-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 31;
  width: min(94vw, 620px);
  transform: translate(-50%, -50%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.24);
  padding: 20px;
}

.range-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.range-modal-header h3 {
  margin: 0;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 112px;
}

.hero-panel .stat-card {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.hero-panel .stat-card span,
.hero-panel .stat-card small {
  color: #cbd5e1;
}

.stat-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 30px;
  letter-spacing: 0;
}

.stat-card.green strong,
.money {
  color: var(--green);
}

.stat-card.amber strong {
  color: var(--amber);
}

.stat-card.blue strong {
  color: var(--blue);
}

.stat-card.danger strong {
  color: var(--danger);
}

.today-times,
.metric-list,
.detail-grid {
  display: grid;
  gap: 10px;
}

.today-times {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.today-times div,
.metric-list span,
.map-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.today-times div {
  display: grid;
  gap: 6px;
  align-content: center;
  min-width: 0;
}

.today-times strong {
  overflow-wrap: anywhere;
}

.today-times span,
.detail-grid span {
  color: var(--muted);
  font-size: 12px;
}

.detail-grid {
  grid-template-columns: minmax(120px, 0.8fr) 1.2fr;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 850;
}

.badge-approved,
.badge-active,
.badge-hadir {
  color: #166534;
  background: #dcfce7;
}

.badge-pending {
  color: #92400e;
  background: #fef3c7;
}

.badge-rejected,
.badge-inactive {
  color: #991b1b;
  background: #fee2e2;
}

.badge-flagged {
  color: #1d4ed8;
  background: #dbeafe;
}

.badge-izin,
.badge-sakit,
.badge-cuti {
  color: #6d28d9;
  background: #ede9fe;
}

.badge-libur {
  color: #475569;
  background: #e2e8f0;
}

.badge-alpha {
  color: #991b1b;
  background: #fee2e2;
}

.badge-scheduled,
.badge-today_pending {
  color: #475569;
  background: #e2e8f0;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: #eef2f7;
}

.mini-chart {
  display: flex;
  align-items: end;
  gap: 12px;
  min-height: 170px;
  padding-top: 22px;
}

.bar-item {
  display: grid;
  gap: 8px;
  justify-items: center;
  flex: 1;
}

.bar-item span {
  width: 100%;
  max-width: 42px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #14b8a6, #2563eb);
}

.bar-item small {
  color: var(--muted);
}

.clock-form,
.settings-form,
.employee-form {
  display: grid;
  gap: 12px;
}

.manual-fields {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.auto-attendance-card {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(135deg, #eefaf7, #ffffff);
}

.auto-attendance-card span,
.auto-attendance-card small {
  color: var(--muted);
}

.auto-attendance-card strong {
  font-size: 22px;
}

.stacked-panels {
  display: grid;
  gap: 14px;
}

.manual-fields strong {
  color: var(--ink);
}

.manual-fields small,
.helper-text {
  color: var(--muted);
  line-height: 1.5;
}

.camera-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.camera-preview {
  display: none;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #0f172a;
}

.camera-preview.active {
  display: block;
}

.employee-form {
  margin-bottom: 14px;
}

.preview-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.proof-photo,
.photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #eef2f7;
  border: 1px dashed #b6c2d2;
  text-align: center;
  padding: 18px;
}

.filters {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(100%, 460px);
  overflow-y: auto;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(15, 23, 42, 0.18);
  padding: 24px;
  z-index: 10;
}

.drawer-close {
  float: right;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: #eef2f7;
  font-size: 24px;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.edit-attendance-panel {
  margin-bottom: 14px;
}

.map-card {
  margin-top: 14px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px dashed #b6c2d2;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

.compact-empty {
  min-height: 170px;
}

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

.employee-card,
.report-tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.employee-card {
  display: grid;
  gap: 10px;
}

.employee-card h3,
.employee-card p {
  margin: 0;
}

.employee-card p,
.employee-card span {
  color: var(--muted);
}

.approval-row,
.request-row,
.timeline div {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.approval-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.row-actions {
  min-width: 260px;
}

.review-note {
  display: block;
  margin-top: 5px;
  color: #b45309;
  font-weight: 750;
}

.admin-attendance-table table {
  min-width: 980px;
}

.report-tile {
  display: grid;
  gap: 8px;
  min-height: 120px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check input {
  width: auto;
}

.profile-card {
  max-width: 680px;
}

@media (max-width: 560px) {
  body {
    padding-bottom: 0;
  }

  .app-shell {
    display: block;
  }

  .mobile-menu-overlay.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 18;
    background: rgba(15, 23, 42, 0.42);
  }

  .menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 22px;
    padding: 0;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(82vw, 320px);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 18px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 20px 0 48px rgba(15, 23, 42, 0.18);
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar nav {
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 8px;
    overflow: visible;
    flex: 0;
  }

  .sidebar nav button {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    white-space: normal;
  }

  .sidebar nav button span {
    display: inline-grid;
    place-items: center;
    width: 24px;
    font-size: 18px;
    line-height: 1;
  }

  .sidebar nav button strong {
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar > .ghost-btn {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 15px;
    border-radius: 8px;
    background: #f1f5f9;
  }

  .workspace {
    padding: 16px;
  }

  .public-nav {
    align-items: flex-start;
    gap: 12px;
  }

  .public-nav > div:last-child,
  .topbar,
  .section-header {
    align-items: stretch;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .topbar .primary-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .brand strong {
    white-space: nowrap;
  }

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

  .today-times {
    grid-template-columns: 1fr;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }

  .clock-form {
    gap: 14px;
  }

  .manual-fields {
    padding: 12px;
  }

  .manual-fields strong {
    display: block;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .range-card,
  .range-custom {
    grid-template-columns: 1fr;
  }

  .range-pills {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-actions .primary-btn,
  .form-actions .secondary-btn,
  .form-actions .ghost-btn {
    width: 100%;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .danger-btn {
    min-height: 46px;
  }

  .proof-photo,
  .photo-placeholder,
  .camera-preview {
    aspect-ratio: 3 / 4;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
  }

  td {
    display: grid;
    grid-template-columns: 100px 1fr;
    border: 0;
    padding: 8px;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: 1.05fr 0.95fr;
  }

  .app-shell {
    grid-template-columns: 260px 1fr;
  }

  .sidebar {
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding: 18px;
  }

  .sidebar nav {
    flex-direction: column;
    margin-top: 18px;
    align-items: stretch;
  }

  .workspace {
    padding: 28px;
  }

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

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

  .stats-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: 1.4fr 1fr 1fr;
  }

  .settings-form,
  .employee-form {
    grid-template-columns: 220px 1fr;
    align-items: center;
  }

  .settings-form button,
  .employee-form button {
    grid-column: 2;
    width: max-content;
  }
}

/* Final visual overrides: keep this after responsive rules. */
:root {
  --brand-soft: #e7f5f2;
  --soft-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.auth-card,
.panel,
.topbar,
.employee-card,
.report-tile {
  border-radius: 14px;
  box-shadow: var(--soft-shadow);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.primary-btn {
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

.primary-btn:hover,
.secondary-btn:hover,
.stat-card.clickable:hover {
  transform: translateY(-1px);
}

.secondary-btn,
.sidebar nav button.active {
  background: var(--brand-soft);
}

.sidebar {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.sidebar nav button {
  border-radius: 10px;
}

.topbar {
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px;
}

.section-actions {
  justify-content: flex-end;
}

.period-banner {
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
}

.range-modal {
  border-radius: 18px;
}

.range-pill,
.today-times div,
.metric-list span,
.map-card,
.manual-fields,
.camera-box {
  border-radius: 12px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: var(--soft-shadow);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand);
}

.stat-card.green::before {
  background: var(--green);
}

.stat-card.amber::before {
  background: var(--amber);
}

.stat-card.blue::before {
  background: var(--blue);
}

.stat-card.danger::before {
  background: var(--danger);
}

.stat-card.clickable {
  cursor: pointer;
}

.stat-card.clickable:hover {
  border-color: rgba(15, 118, 110, 0.3);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

.badge {
  gap: 6px;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.icon-btn:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.featured-camera {
  border-color: rgba(15, 118, 110, 0.24);
  background: linear-gradient(135deg, #eefaf7, #ffffff);
}

.featured-camera > div:first-child {
  display: grid;
  gap: 4px;
}

.manual-fields {
  min-width: 0;
  overflow: hidden;
}

.manual-fields input {
  min-width: 0;
}

.proof-photo,
.photo-placeholder,
.camera-preview {
  border-radius: 14px;
}

@media (max-width: 560px) {
  .workspace {
    padding: 14px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    margin: -6px 0 18px;
  }

  .section-header {
    display: grid;
    gap: 14px;
    align-items: stretch;
  }

  .section-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .section-actions:empty {
    display: none;
  }

  .range-pills,
  .range-custom {
    grid-template-columns: 1fr;
  }

  .range-modal {
    width: min(92vw, 420px);
    max-height: 86vh;
    overflow-y: auto;
    padding: 16px;
  }

  tr {
    border-radius: 14px;
  }

  td:last-child {
    grid-template-columns: 1fr;
  }

  td:last-child::before {
    display: none;
  }

  td .icon-btn {
    width: 100%;
  }

  .row-actions {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .row-actions .icon-btn,
  .row-actions .secondary-btn,
  .row-actions .danger-btn,
  .row-actions .ghost-btn {
    width: 100%;
  }

  .recap-filter-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .note-ellipsis {
    max-width: 100%;
  }
}

.dashboard-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin: 4px 0 20px;
}

.dashboard-topline h2 {
  margin: 0;
}

.dashboard-topline span,
.card-heading span {
  color: var(--muted);
}

.employee-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  border-radius: 18px;
  padding: clamp(22px, 4vw, 34px);
  color: #fff;
  background:
    radial-gradient(circle at 96% 16%, rgba(255, 255, 255, 0.13) 0 100px, transparent 102px),
    linear-gradient(135deg, #2563eb, #1e40af);
  box-shadow: 0 24px 54px rgba(37, 99, 235, 0.2);
}

.employee-hero h1,
.employee-hero p {
  margin: 0;
}

.employee-hero h1 {
  font-size: clamp(22px, 3vw, 30px);
}

.employee-hero p,
.employee-hero small {
  color: rgba(255, 255, 255, 0.82);
}

.hero-clock {
  display: block;
  margin: 22px 0 2px;
  font-size: clamp(42px, 8vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

.hero-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 150px));
  gap: 10px;
  margin-top: 22px;
}

.hero-status-grid div {
  display: grid;
  gap: 3px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.13);
}

.hero-status-grid span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
}

.hero-status-grid strong {
  font-size: 18px;
}

.hero-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.hero-action {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 850;
}

.hero-action.primary {
  background: #fff;
  color: #1d4ed8;
}

.hero-action.done {
  opacity: 0.75;
}

.holiday-badge {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  margin-top: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 850;
}

.employee-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0 18px;
}

.dashboard-metric {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--soft-shadow);
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.dashboard-metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

.dashboard-metric strong {
  font-size: 28px;
  line-height: 1;
}

.dashboard-metric span,
.dashboard-metric small {
  color: var(--muted);
}

.dashboard-metric.green {
  border-top-color: #10b981;
}

.dashboard-metric.amber {
  border-top-color: #f59e0b;
}

.dashboard-metric.blue {
  border-top-color: #2563eb;
}

.dashboard-metric.purple {
  border-top-color: #8b5cf6;
}

.metric-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 900;
}

.dashboard-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.95fr);
  gap: 18px;
  margin-bottom: 18px;
}

.card-heading,
.history-header,
.history-row,
.log-row {
  display: grid;
  align-items: center;
}

.card-heading {
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 16px;
}

.card-heading h3 {
  margin: 0;
}

.history-header,
.history-row {
  grid-template-columns: 1fr 0.8fr 0.8fr 1fr;
  gap: 10px;
}

.history-header {
  padding: 0 14px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.history-row {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.history-row:hover {
  background: #f8fafc;
}

.recap-table tbody tr[data-action="detail"] {
  cursor: pointer;
}

.recap-table tbody tr[data-action="detail"]:hover {
  background: #f8fafc;
}

.muted-row {
  background: #f8fafc;
  color: var(--muted);
}

.comparison-table table,
.recap-table table {
  min-width: 760px;
}

.recap-table table {
  min-width: 920px;
}

.recap-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

.recap-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.recap-table td {
  vertical-align: middle;
}

.muted-dash {
  color: #94a3b8;
}

.note-ellipsis {
  display: inline-block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.recap-filter-bar {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1.2fr) repeat(3, max-content);
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}

.recap-filter-info {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.cell-link {
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  padding: 0;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.side-detail-grid {
  margin-bottom: 14px;
}

.history-row:disabled {
  cursor: default;
  opacity: 1;
}

.timeline-modern {
  display: grid;
  gap: 0;
  padding-left: 8px;
}

.timeline-modern div {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 4px 10px;
  padding: 0 0 20px;
}

.timeline-modern div::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.timeline-modern div:last-child::before {
  display: none;
}

.timeline-modern div > span {
  grid-row: 1 / 3;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 999px;
  background: #cbd5e1;
}

.timeline-modern .done > span {
  background: #10b981;
}

.timeline-modern .active > span {
  background: #2563eb;
}

.timeline-modern small {
  color: var(--muted);
  font-weight: 750;
}

.timeline-modern strong {
  font-weight: 650;
}

.detail-log,
.pay-breakdown,
.calendar-list {
  display: grid;
  gap: 10px;
}

.log-row,
.pay-breakdown,
.calendar-list div {
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.pay-breakdown {
  grid-template-columns: 1fr auto;
}

.weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weekday-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}

.weekday-picker input {
  width: auto;
}

.policy-picker {
  display: grid;
  gap: 8px;
}

.policy-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.policy-option input {
  width: auto;
  margin-top: 3px;
}

.policy-option span {
  display: grid;
  gap: 3px;
}

.policy-option small {
  color: var(--muted);
  line-height: 1.35;
}

.gps-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
}

.gps-valid {
  color: #166534;
  background: #dcfce7;
}

.gps-unavailable {
  color: #92400e;
  background: #fef3c7;
}

.gps-suspicious {
  color: #991b1b;
  background: #fee2e2;
}

.calendar-admin,
.calendar-form {
  display: grid;
  gap: 12px;
}

.calendar-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-month div {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.calendar-month .work {
  border-color: rgba(16, 185, 129, 0.3);
  background: #ecfdf5;
}

.calendar-month .off {
  color: var(--muted);
  background: #f1f5f9;
}

@media (max-width: 760px) {
  .dashboard-topline {
    display: grid;
  }

  .hero-status-grid,
  .employee-stat-grid,
  .dashboard-split {
    grid-template-columns: 1fr;
  }

  .history-header {
    display: none;
  }

  .history-row {
    grid-template-columns: 1fr 1fr;
  }

  .hero-actions-row,
  .hero-action {
    width: 100%;
  }
}
