:root {
  --bg: #0e1412;
  --bg-2: #151d1a;
  --panel: #1b2622;
  --line: #2a3b35;
  --text: #e8efe9;
  --muted: #8aa196;
  --accent: #c8f54a;
  --accent-2: #7dffb3;
  --danger: #ff6b6b;
  --warn: #ffc857;
  --ok: #5ee2a0;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 18px;
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(200, 245, 74, 0.08), transparent 50%),
    radial-gradient(700px 380px at 100% 0%, rgba(125, 255, 179, 0.06), transparent 46%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; }

.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side {
  background: linear-gradient(180deg, #14201c, #101816);
  border-right: 1px solid var(--line);
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 34px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent); color: #111;
  display: grid; place-items: center; font-weight: 800;
}
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav a {
  display: block; padding: 11px 12px; border-radius: 12px;
  color: var(--muted); margin-bottom: 6px;
}
.nav a.active, .nav a:hover { background: #22312c; color: var(--text); }
.side-foot { position: absolute; bottom: 24px; left: 20px; right: 20px; color: var(--muted); font-size: 12px; }

.main {
  padding: 28px 32px 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 0;
}
h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.03em; }
.sub { color: var(--muted); margin: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px; background: #22312c;
  border: 1px solid var(--line); font-size: 13px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(94, 226, 160, 0.15); }
.dot.off { background: var(--danger); }

.grid { display: grid; gap: 20px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 0; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -0.04em; }
.stat-label { color: var(--muted); margin-top: 4px; font-size: 13px; }

.split { grid-template-columns: 1.4fr 1fr; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid #24332e; }
tr:hover td { background: rgba(255,255,255,0.02); }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.pill {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  background: #24332e; font-size: 12px;
}

.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; max-width: 100%; }
.stack { display: grid; gap: 10px; width: 100%; max-width: 100%; }
.stack > * { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
input, select {
  background: #101816; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; min-width: 0;
}
button, .btn {
  background: var(--accent); color: #111; border: 0; border-radius: 12px;
  padding: 10px 14px; font-weight: 700; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: #3a1d1d; color: #ffb4b4; }
.flash {
  background: #2b3a18; border: 1px solid #4d6a22; color: #e7f7b6;
  padding: 12px 14px; border-radius: 12px; margin-bottom: 16px;
}

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card { width: min(420px, 100%); }
.login-card h1 { margin-bottom: 8px; }
.login-card form { display: grid; gap: 10px; margin-top: 18px; }
.login-card input, .login-card button { width: 100%; }

.hint {
  background: #121a17; border: 1px dashed var(--line);
  padding: 14px; border-radius: 14px; color: var(--muted); font-size: 14px; line-height: 1.5;
}
code { color: var(--accent-2); }

.cal th, .cal td { text-align: center; padding: 6px 4px; font-size: 11px; min-width: 28px; }
.cal td:first-child { text-align: left; min-width: 160px; }
.cell.ok { background: #173226; color: var(--ok); }
.cell.late { background: #3a2a12; color: var(--warn); }
.cell.absent { background: #3a1d1d; color: #ffb4b4; }
.cell.off { color: #4b5c56; }
.cell.future { color: #2e3d38; }

.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.month-head { text-align: center; color: var(--muted); font-size: 12px; padding: 4px; }
.day { background: #121a17; border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 118px; }
.day.empty { background: transparent; border: none; min-height: 0; }
.day.ok { border-color: #2e6b4a; }
.day.late { border-color: var(--warn); }
.day.early { border-color: #d8a15a; }
.day.off { opacity: .7; }
.day.sel { outline: 2px solid var(--accent); }
button.day { width: 100%; text-align: left; color: inherit; cursor: pointer; font: inherit; }
.day-num { font-weight: 800; }
.day-meta { color: var(--muted); font-size: 11px; }
.day-form { display: grid; gap: 4px; margin-top: 6px; }
.day-form input[type="time"] { width: 100%; min-height: 32px; font-size: 12px; }
.day-form button { min-height: 32px; padding: 4px 8px; }

button, .btn { min-height: 44px; }
input, select { min-height: 42px; font-size: 16px; }
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--accent);
}
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #121a17;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 14px;
}
.grid { gap: 20px; }
.card { margin-bottom: 0; }
.month { margin-top: 8px; }

.mobile-bar { display: none; }
.nav-mask { display: none; }
.hide-desk { display: none; }
.plist { display: grid; gap: 12px; }
.pitem {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.pitem-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.meta-line { margin-top: 6px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions form { margin: 0; }
.tag { display:inline-block; padding:4px 10px; border-radius:999px; font-size:12px; font-weight:700; white-space:nowrap; }
.tag.in { background:#173226; color:var(--ok); }
.tag.late { background:#3a2a12; color:var(--warn); }
.tag.wait { background:#1b2420; color:var(--muted); }
.tag.absent { background:#3a1d1d; color:#ffb4b4; }
.tag.early { background:#3a2a12; color:var(--warn); }
.tag.soft { background:#2a2a18; color:#d6c98a; }
.tag.done { background:#173226; color:var(--muted); }
.day.soft { border-color:#8a7d4a; }
.cell.soft { background:#2a2a18; color:#d6c98a; }

@media (max-width: 1100px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .shell { display: flex; flex-direction: column; }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 30;
    background: #14201c;
    border-bottom: 1px solid var(--line);
  }
  .mobile-bar strong {
    flex: 1;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .menu-btn {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px;
    min-height: 42px;
    padding: 0 !important;
    flex: 0 0 42px;
    background: #22312c;
    color: var(--text);
  }
  .hide-phone { display: none !important; }
  .hide-desk { display: grid; }
  .side {
    position: fixed !important;
    left: 0; top: 0;
    height: 100% !important;
    width: min(300px, 86vw);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .side.open { transform: none; }
  .nav-mask.show {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35;
  }
  .side-foot { position: static; margin-top: 24px; }
  .stats, .split { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: stretch; width: 100%; }
  .form-row, .stack { flex-direction: column; width: 100%; }
  .form-row > *:not(.menu-btn),
  .stack > *,
  .card form input,
  .card form select,
  .card form button,
  .card form .btn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .main { padding: 12px; overflow-x: hidden; }
  .month { gap: 6px; }
  .day { min-height: 72px; padding: 6px; }
}

@media (max-width: 640px) {
  h1 { font-size: 22px; }
  .stat-value { font-size: 26px; }
}

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 560px; }
@media (min-width: 1101px) {
  .hide-desk { display: none !important; }
}
