:root {
  --bg: #efeae2;
  --surface: #fffdf9;
  --ink: #17212b;
  --muted: #667085;
  --line: #e2d9cc;
  --brand: #0c5f52;
  --brand-dark: #094940;
  --brand-2: #b45309;
  --ok: #157347;
  --danger: #b42318;
  --warn: #b54708;
  --shadow: 0 12px 36px rgba(23, 33, 43, 0.08);
  --radius: 16px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(12, 95, 82, 0.12), transparent 32%),
    radial-gradient(circle at 88% 0%, rgba(180, 83, 9, 0.10), transparent 28%),
    linear-gradient(180deg, #f6f1e8 0%, var(--bg) 100%);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0f221e 0%, #12231f 100%);
  color: #f5f1ea;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand {
  font-family: var(--display);
  font-size: 1.55rem;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.brand-sub { color: #aeb8b4; font-size: 0.85rem; margin-bottom: 28px; }
.nav a {
  display: block;
  color: #e8efec;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  text-decoration: none;
  transition: background .15s ease;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,0.09); }
.nav .section { color: #91a29c; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 18px 8px 8px; }
.main { padding: 28px; max-width: 1400px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.topbar h1 {
  font-family: var(--display);
  font-size: 1.85rem;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat {
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fff, #f4f8f6);
  border: 1px solid var(--line);
}
.stat strong { display: block; font-size: 1.7rem; margin-top: 6px; font-family: var(--display); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 11px;
  padding: 10px 16px;
  background: var(--brand);
  color: white !important;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  font: inherit;
  line-height: 1.2;
  transition: filter .15s ease, transform .15s ease;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.secondary { background: #2b3642; }
.btn.ghost { background: #fff; color: var(--ink) !important; border: 1px solid var(--line); }
.btn.warn { background: var(--brand-2); }
.btn.danger { background: var(--danger); }

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  background: #fff;
  font: inherit;
  margin-bottom: 12px;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(12, 95, 82, 0.25);
  border-color: var(--brand);
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 160px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 8px 0 14px; }
.checks label { display: flex; gap: 8px; align-items: center; color: var(--ink); margin: 0; font-weight: 500; }
.checks input { width: auto; margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 0.92rem; }
th { color: var(--muted); font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }

.flash-wrap { margin-bottom: 16px; }
.flash {
  padding: 12px 14px;
  border-radius: 11px;
  margin-bottom: 8px;
  background: #eef6f3;
  border: 1px solid #cfe4dc;
}
.flash.danger { background: #fef3f2; border-color: #fecdca; color: var(--danger); }
.flash.warning { background: #fffaeb; border-color: #fedf89; color: var(--warn); }
.flash.success { background: #ecfdf3; border-color: #abefc6; color: var(--ok); }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(12, 95, 82, 0.16), transparent 35%),
    radial-gradient(circle at 80% 10%, rgba(180, 83, 9, 0.14), transparent 30%),
    linear-gradient(160deg, #0f221e 0%, #1a2e29 45%, #efeae2 45%, #f7f2ea 100%);
}
.login-card {
  width: min(440px, 100%);
  background: rgba(255, 253, 249, 0.96);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  padding: 32px 28px;
  backdrop-filter: blur(8px);
}
.login-card h1 {
  font-family: var(--display);
  margin: 0 0 8px;
  font-size: 2rem;
  letter-spacing: -0.03em;
}
.login-card .btn { width: 100%; margin-top: 6px; padding: 12px 16px; }
.muted { color: var(--muted); }

.module-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.module-tile {
  display: block;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: var(--shadow);
}
.module-tile:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(23,33,43,0.1); text-decoration: none; }
.module-tile span { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

.tat-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.tat-table { min-width: 1200px; }
.tat-table th, .tat-table td { white-space: nowrap; }
.tat-table .sticky-col {
  position: sticky;
  left: 0;
  background: #fffdf9;
  z-index: 2;
  min-width: 180px;
}
.tat-table thead th { position: sticky; top: 0; background: #f4eee4; z-index: 3; }
.tat-table thead th.sticky-col { z-index: 4; }
.day-cell { min-width: 120px; }
.day-cell input {
  margin: 0 0 4px;
  padding: 6px 8px;
  font-size: 0.8rem;
}
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f2ef;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
}
.badge.warn { background: #fff4e5; color: var(--warn); }
.badge.danger { background: #fee4e2; color: var(--danger); }

code {
  background: #f3eee6;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85em;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}
