:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef2ed;
  --ink: #16201d;
  --muted: #6b756f;
  --line: #dfe5df;
  --primary: #176b5b;
  --primary-ink: #ffffff;
  --danger: #b83232;
  --danger-soft: #fee2e2;
  --amber: #b7791f;
  --shadow: 0 18px 50px rgba(20, 32, 29, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(23, 107, 91, .12), transparent 42%),
    linear-gradient(315deg, rgba(183, 121, 31, .12), transparent 38%),
    var(--bg);
}

.login-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 32px;
  align-items: center;
}

.login-panel h1 { font-size: 46px; line-height: 1.02; margin: 8px 0 16px; max-width: 640px; }
.form-card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.form-card { padding: 24px; display: grid; gap: 16px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: #111c19;
  color: #eef7f3;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; }
.brand span {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 8px; background: var(--primary); font-weight: 800;
}
.sidebar nav { display: grid; gap: 8px; }
.sidebar a:not(.brand) { padding: 11px 12px; border-radius: 8px; color: #c7d7d2; }
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,.1); color: white; }

.content { padding: 26px; max-width: 1480px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 28px; }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); font-size: 12px; font-weight: 800; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; color: var(--muted); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.summary-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.summary-grid span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.summary-grid strong { font-size: 28px; line-height: 1; }

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { padding: 18px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 16px; }
.panel h2 { margin: 0; font-size: 21px; }

.stack { display: grid; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23,107,91,.12); }

.btn {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  border-radius: 8px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
}
.btn:hover { filter: brightness(.98); transform: translateY(-1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn.small { padding: 8px 10px; min-height: 34px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 54px; }

.tabs, .filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.tabs a {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}
.tabs a.active { background: var(--primary); color: white; border-color: var(--primary); }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.filters input, .filters select { width: auto; min-width: 160px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px 10px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.pill { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; background: var(--surface-soft); font-size: 12px; font-weight: 800; }
.pill.live { background: #dcfce7; color: #166534; }
.actions summary { cursor: pointer; font-weight: 800; color: var(--primary); }
.actions form { margin-top: 10px; min-width: 240px; }

.worker-row, .request-row, .inline-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.request-row { grid-template-columns: 1.3fr 1fr auto auto; }
.inline-form { grid-template-columns: 1.3fr repeat(5, minmax(110px, 1fr)) auto; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }

.metric-line { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 12px 0; }
.metric-line.total { font-size: 22px; color: var(--primary); }
.flash {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}
.flash.success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.flash.error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

@media (max-width: 900px) {
  .login-panel, .app-shell, .grid.two, .summary-grid { grid-template-columns: 1fr; }
  .login-panel h1 { font-size: 34px; }
  .sidebar {
    position: static;
    height: auto;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px;
  }
  .sidebar nav { display: flex; overflow-x: auto; }
  .content { padding: 16px; }
  .topbar h1 { font-size: 23px; }
  .worker-row, .request-row, .inline-form { grid-template-columns: 1fr; }
  .filters input, .filters select, .filters button { width: 100%; }
}

@media (max-width: 520px) {
  .row { grid-template-columns: 1fr; }
  .summary-grid strong { font-size: 24px; }
  .panel { padding: 14px; }
}
