:root {
  --teal: #0B5D50;
  --teal-dark: #073D35;
  --teal-ink: #0B3B34;
  --lime: #D4E84A;
  --mint: #EEF7F3;
  --mint-line: #C7DDD5;
  --muted: #3E5D57;
  --card: #FFFFFF;
  --orange: #C2410C;
  --orange-bg: #FDEDE4;
  --amber-bg: #FBF4D5;
  --amber-ink: #6B5300;
  --ok-bg: #E2F3EC;
  --ok-ink: #0B5D50;
  --gray-bg: #EDF1F0;
  --gray-ink: #4A5653;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 59, 52, .06), 0 4px 16px rgba(11, 59, 52, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--mint);
  color: var(--teal-ink);
  font-size: 16px;
  line-height: 1.45;
}
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 48px; text-align: center; color: var(--muted); }

/* Header */
.top {
  background: var(--teal);
  color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.top-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.brand:hover { color: #fff; }
.brand .k { color: var(--lime); }
.brand .d { color: #9FD2C6; font-weight: 500; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a {
  color: #DDF0EA; text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: var(--lime); color: var(--teal-dark); }
.nav .pill { background: var(--orange); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 7px; font-weight: 700; }
.nav a.on .pill { background: var(--teal-dark); }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.who a { color: #DDF0EA; }
.who .role { background: rgba(255,255,255,.12); padding: 3px 8px; border-radius: 999px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 30px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 20px; margin: 0 0 12px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0 0 20px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head .sub { margin: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
.stat:hover { color: inherit; outline: 2px solid var(--mint-line); }
.stat .n { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 14px; }
.stat.warn .n { color: var(--orange); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--teal); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--teal-dark); color: #fff; }
.btn.lime { background: var(--lime); color: var(--teal-dark); }
.btn.lime:hover { background: #C3D83A; color: var(--teal-dark); }
.btn.ghost { background: transparent; color: var(--teal); border-color: var(--mint-line); }
.btn.ghost:hover { background: var(--mint); color: var(--teal-dark); }
.btn.danger { background: transparent; color: var(--orange); border-color: #F1C9B5; }
.btn.danger:hover { background: var(--orange-bg); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: progress; }

/* Forms */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=search], input[type=number], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--mint-line); background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--lime); outline-offset: 1px;
}
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { flex: 1 1 160px; }
.filters input[type=search] { flex: 2 1 240px; }
.err { background: var(--orange-bg); color: #8A2D08; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.note { background: var(--amber-bg); color: var(--amber-ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--mint-line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #E5EFEB; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .muted, .muted { color: var(--muted); font-size: 14px; }
td.act { text-align: right; white-space: nowrap; }
.tag { font-weight: 700; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok-ink); }
.b-out { background: #E3ECFA; color: #1E3F78; }
.b-warn { background: var(--amber-bg); color: var(--amber-ink); }
.b-danger { background: var(--orange-bg); color: #8A2D08; }
.b-gray { background: var(--gray-bg); color: var(--gray-ink); }

/* My items */
.mine { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.mine .card { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.mine .t { font-weight: 700; font-size: 18px; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 420px; }
.auth-logo { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 18px; font-weight: 700; font-size: 30px; letter-spacing: -0.03em; color: var(--teal); }
.auth-logo .k { color: #6E7F1A; }
.auth-logo .d { color: var(--muted); font-weight: 500; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--mint); padding: 4px; border-radius: 12px; }
.tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--teal-ink); box-shadow: var(--shadow); }

/* Dialog */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--teal-ink); }
dialog::backdrop { background: rgba(7, 61, 53, .45); }
.dlg { padding: 24px; }
.dlg h2 { margin-bottom: 16px; }
.dlg .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: var(--teal-dark); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; max-width: calc(100vw - 32px); }
#toast div.bad { background: #8A2D08; }

dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.info dt { color: var(--muted); font-size: 14px; }
dl.info dd { margin: 0; }

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .who .name { display: none; }
  td, th { padding: 8px 6px; }
}
