:root {
  color-scheme: light;
  --ink: #191817;
  --muted: #6e6961;
  --line: #e5ded2;
  --paper: #fffaf1;
  --panel: #ffffff;
  --brand: #c9912f;
  --brand-dark: #825514;
  --good: #0f7b57;
  --danger: #b42318;
  --soft: #f5efe4;
  --shadow: 0 18px 50px rgba(32, 25, 18, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(201, 145, 47, 0.12), transparent 35%),
    linear-gradient(180deg, #fffdf8 0%, var(--paper) 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(201, 145, 47, 0.13), transparent 34%),
    linear-gradient(180deg, #080807 0%, #11100f 100%);
}

.login-panel {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid rgba(201, 145, 47, 0.35);
  border-radius: 8px;
  background: rgba(16, 15, 14, 0.92);
  color: #fff8ec;
  box-shadow: var(--shadow);
}

.login-logo {
  display: block;
  width: 150px;
  height: 150px;
  object-fit: cover;
  object-position: center;
  margin: 0 auto 18px;
  border: 1px solid rgba(201, 145, 47, 0.5);
  border-radius: 22px;
  background: #080706;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.32);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 24px;
  text-align: center;
  font-size: clamp(2rem, 7vw, 3rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 2rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
}

.form-stack,
.modal-panel {
  display: grid;
  gap: 16px;
}

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

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

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(201, 145, 47, 0.18);
}

.login-panel input {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.button,
.icon-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 850;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(180deg, #d9a64a, var(--brand));
  color: #1b1305;
  box-shadow: 0 10px 20px rgba(130, 85, 20, 0.22);
}

.button-ghost {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff3de;
}

.button-muted {
  background: var(--soft);
  color: var(--ink);
}

.button-danger {
  background: #fce8e6;
  color: var(--danger);
}

.button-good {
  background: #e3f5ee;
  color: var(--good);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #ffb4aa;
  font-size: 0.9rem;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #11100f;
  color: #fff8ec;
}

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

.brand img {
  width: 64px;
  height: 64px;
  border: 1px solid rgba(201, 145, 47, 0.45);
  border-radius: 14px;
  object-fit: cover;
  object-position: center;
  background: #080706;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1.08rem;
}

.brand span {
  color: #ccbda5;
  font-size: 0.85rem;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.sidebar-actions .button {
  width: 100%;
}

.nav-tab {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #e7dac4;
  text-align: left;
  font-weight: 800;
}

.nav-tab.active {
  border-color: rgba(201, 145, 47, 0.42);
  background: rgba(201, 145, 47, 0.14);
  color: #fff7e8;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar,
.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-bar p {
  margin-bottom: 0;
  color: var(--muted);
}

.compact {
  margin-top: 24px;
  margin-bottom: 12px;
}

.summary-grid,
.report-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

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

.summary-card,
.employee-card,
.table-card,
.modal-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(32, 25, 18, 0.07);
}

.summary-card {
  padding: 16px;
}

.summary-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.summary-card strong {
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.employee-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.employee-card.is-running {
  border-color: #8bd2a8;
  background: linear-gradient(180deg, #f0fff6 0%, #ffffff 62%);
  box-shadow: 0 14px 34px rgba(15, 123, 87, 0.18);
}

.employee-card.is-running .employee-head {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(15, 123, 87, 0.14);
}

.employee-head {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.avatar,
.avatar-placeholder {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: 8px;
  object-fit: cover;
  background: #211b14;
  color: #ffd98c;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.3rem;
}

.employee-name {
  min-width: 0;
}

.employee-name strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.employee-name span,
.meta,
.mini-muted {
  color: var(--muted);
  font-size: 0.86rem;
}

.shift-status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

.employee-card.is-running .shift-status {
  border: 1px solid #a7e8bf;
  background: #dcfce7;
}

.live-duration {
  font-variant-numeric: tabular-nums;
  font-size: 1.45rem;
  font-weight: 900;
}

.employee-card.is-running .live-duration {
  color: #095c3d;
  font-size: 1.58rem;
}

.employee-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.employee-actions.single-action {
  grid-template-columns: 1fr;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  max-width: 520px;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
}

.table-card {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: #fbf5ea;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

tr:last-child td {
  border-bottom: 0;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) repeat(2, minmax(150px, 0.8fr)) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.compact-filters {
  grid-template-columns: minmax(180px, 260px) auto;
  justify-content: start;
}

.preset-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid #d7b36b;
  border-radius: 8px;
  background: linear-gradient(135deg, #17120b 0%, #2b2011 100%);
  color: #fff8ec;
  box-shadow: 0 18px 42px rgba(32, 25, 18, 0.14);
}

.dashboard-hero h3 {
  margin-bottom: 6px;
  font-size: 1.45rem;
}

.dashboard-hero .mini-muted {
  margin-bottom: 0;
  color: #dccbad;
}

.dashboard-hero > strong {
  color: #f5c86e;
  font-size: clamp(1.7rem, 5vw, 3rem);
  font-variant-numeric: tabular-nums;
}

.ranking-list {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.ranking-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(32, 25, 18, 0.06);
}

.ranking-card.leader {
  border-color: #d7b36b;
  background: #fff8e8;
}

.ranking-card strong,
.ranking-card span {
  display: block;
}

.ranking-card span,
.ranking-score span {
  color: var(--muted);
  font-size: 0.86rem;
}

.rank-badge {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #21170a;
  color: #f5c86e;
  font-weight: 900;
}

.ranking-score {
  text-align: right;
}

.ranking-score strong {
  font-size: 1.18rem;
  font-variant-numeric: tabular-nums;
}

.report-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.mini-list {
  display: grid;
  gap: 10px;
}

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

.mini-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.modal {
  width: min(520px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.52);
}

.modal-panel {
  padding: 22px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.icon-button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  background: var(--soft);
  color: var(--ink);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 8px;
  background: #11100f;
  color: #fff8ec;
  box-shadow: var(--shadow);
  z-index: 5;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e3f5ee;
  color: var(--good);
  font-size: 0.78rem;
  font-weight: 850;
}

.status-pill.running {
  background: #c7f7d8;
  color: #095c3d;
}

.status-pill.running::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #12a365;
  box-shadow: 0 0 0 4px rgba(18, 163, 101, 0.14);
}

.status-pill.off {
  background: #f3eee6;
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-tab {
    text-align: center;
  }

  .button-ghost {
    width: auto;
  }

  .summary-grid,
  .report-totals,
  .report-columns {
    grid-template-columns: 1fr 1fr;
  }

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

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

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .section-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .report-totals,
  .report-columns,
  .filters {
    grid-template-columns: 1fr;
  }

  .dashboard-hero,
  .ranking-card {
    grid-template-columns: 1fr;
  }

  .dashboard-hero > strong,
  .ranking-score {
    text-align: left;
  }

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

  .table-card {
    overflow-x: auto;
  }

  table {
    min-width: 720px;
  }
}
