:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #667085;
  --line: #d7dee8;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --accent: #147a73;
  --accent-2: #d95f39;
  --good: #11845b;
  --warn: #b54708;
  --bad: #b42318;
  --shadow: 0 18px 50px rgba(24, 33, 47, 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;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--ink);
}

.sidebar {
  min-height: 100vh;
  padding: 24px;
  background: #101820;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 800;
}

.brand small, .eyebrow, small { color: var(--muted); }
.sidebar .brand small { color: #b9c5d4; display: block; margin-top: 2px; }

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: #d9e2ec;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
}

nav a.active, nav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

main { padding: 30px; min-width: 0; }

.topbar, .panel-head, .actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(28px, 4vw, 42px); }
h2 { font-size: 18px; }

button, .button, input, select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

button, .button {
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}

button:hover, .button:hover { border-color: var(--accent); }
.secondary { margin-top: auto; background: #fff; color: #101820; width: 100%; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0 18px;
}

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

.metrics article { padding: 18px; display: grid; gap: 6px; }
.metrics span { color: var(--muted); font-weight: 700; }
.metrics strong { font-size: 34px; }

.grid {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 18px;
  align-items: start;
}

.panel { padding: 18px; min-width: 0; }
.span-2 { grid-column: span 1; }

.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 13px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }

.photo-button {
  width: 42px;
  height: 42px;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  border-color: #c7d2df;
  background: #edf2f7;
}

.photo-button img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}

.success { background: #e7f6ef; color: var(--good); }
.warning { background: #fff2df; color: var(--warn); }
.danger { background: #ffebe8; color: var(--bad); }
.neutral { background: #edf2f7; color: #475467; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--accent); }
.switch input { width: 18px; height: 18px; }

.alerts { display: grid; gap: 12px; margin-top: 18px; }
.alerts div {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.alerts strong { font-size: 24px; color: var(--accent-2); }
.alerts span { color: var(--muted); font-weight: 700; }

#searchInput { width: min(260px, 100%); padding: 0 12px; }

.employee-list, .shift-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.employee, .shift {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.employee strong, .shift strong { display: block; }
.employee small, .shift small { display: block; margin-top: 4px; }
.shift-time { text-align: right; }

.timeline {
  display: grid;
  gap: 0;
  margin-top: 18px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 58px 24px 1fr;
  gap: 12px;
  min-height: 62px;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 69px;
  top: 24px;
  bottom: -16px;
  width: 2px;
  background: var(--line);
}

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

.timeline-item time {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  padding-top: 3px;
}

.timeline-item > span {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 50%;
  background: #8a94a6;
  box-shadow: 0 0 0 4px #edf2f7;
  z-index: 1;
}

.timeline-item.primary > span { background: var(--accent); box-shadow: 0 0 0 4px #dff4f1; }
.timeline-item.success > span { background: var(--good); box-shadow: 0 0 0 4px #e7f6ef; }
.timeline-item.warning > span { background: var(--warn); box-shadow: 0 0 0 4px #fff2df; }

.timeline-item strong { display: block; }
.timeline-item small { display: block; margin-top: 4px; }

.settings { display: grid; gap: 12px; margin-top: 16px; }
.settings label { display: grid; gap: 6px; color: var(--muted); font-weight: 800; font-size: 13px; }
.settings input, .settings select { padding: 0 10px; width: 100%; }
.settings .check { grid-template-columns: 18px 1fr; align-items: center; color: var(--ink); }
.settings .check input { width: 18px; height: 18px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #101820;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.modal.show { display: grid; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 32, 0.58);
}

.modal-panel {
  position: relative;
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(16, 24, 32, 0.3);
}

.modal-panel img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #edf2f7;
  border: 1px solid var(--line);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  z-index: 1;
}

.modal-info {
  padding: 20px 12px 8px 0;
}

.modal-info dl {
  display: grid;
  gap: 10px;
  margin: 22px 0 0;
}

.modal-info dl div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.modal-info dt {
  color: var(--muted);
  font-weight: 800;
}

.modal-info dd {
  margin: 0;
  font-weight: 700;
}

@media (max-width: 1000px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    min-height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  nav { display: flex; flex-wrap: wrap; }
  .secondary { width: auto; margin-top: 0; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  main { padding: 18px; }
  .topbar, .panel-head { align-items: flex-start; flex-direction: column; }
  .metrics { grid-template-columns: 1fr; }
  .actions { width: 100%; }
  .actions .button { flex: 1; }
  .employee, .shift { grid-template-columns: 1fr; }
  .shift-time { text-align: left; }
  .modal-panel { grid-template-columns: 1fr; }
  .modal-info { padding: 0; }
}
