:root {
  --orange: rgb(255, 118, 30);
  --blue: rgb(70, 110, 235);
  --text: rgb(36, 38, 46);
  --muted: rgb(102, 106, 118);
  --line: rgb(228, 231, 237);
  --bg: #eef0f4;
  --card: #ffffff;
  --danger: #ee0a24;
  --ok: #07c160;
  --side: #151821;
  --radius: 10px;
  --font: Arial, Avenir, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

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

.layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}

.side {
  background: var(--side);
  border-right: 0;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
  position: relative;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--orange);
}
.brand strong { display: block; font-size: 16px; color: #fff; }
.brand span { color: #8b90a3; font-size: 12px; }

.nav a {
  display: block;
  color: #c8cddb;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.nav a:hover, .nav a.active {
  background: rgba(255, 118, 30, 0.16);
  color: #ffb07a;
}

.main { padding: 22px 24px 48px; min-width: 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.topbar h1 { margin: 0; font-size: 22px; font-weight: 700; }
.who { color: var(--muted); font-size: 13px; }

.btn {
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.grid { display: grid; gap: 12px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.card.accent { border-color: #ffd7b8; background: linear-gradient(180deg, #fff, #fff8f2); }
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.stat { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; color: var(--muted); }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  background: var(--line);
}
.pill.captured { background: #e8f0fe; color: var(--blue); }
.pill.dev { background: #fff3e8; color: var(--orange); }
.pill.ok { background: #e8f8ef; color: var(--ok); }
.pill.warn { background: #fff3e8; color: var(--orange); }
.pill.bad { background: #fde8ea; color: var(--danger); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.toolbar input, .toolbar select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: top;
}
table.data th { color: var(--muted); font-weight: 600; background: #fafafa; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fffaf5; }

.empty, .error, .loading {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.error { color: var(--danger); border-color: #f5c2c7; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #151821;
}
.login {
  width: min(420px, 92vw);
  padding: 28px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
.login h1 { margin: 0 0 6px; }
.login label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.login input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.pass-toggle:hover { color: var(--text); }
.pass-toggle .eye-off { display: none; }
.pass-toggle.is-open .eye-on { display: none; }
.pass-toggle.is-open .eye-off { display: block; }
.card label { display: block; margin: 10px 0 4px; font-size: 13px; }
.card input, .card select, .card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 14px;
}
.card textarea.wide { min-height: 160px; resize: vertical; font-family: inherit; line-height: 1.45; }
.banner-preview { display: block; width: min(100%, 560px); max-height: 180px; object-fit: cover; border-radius: 8px; margin: 8px 0 12px; background: #151821; }
.contact-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.contact-row:last-child { border-bottom: 0; }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 12px; font-size: 14px; }
.kv div:nth-child(odd) { color: var(--muted); }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }

.callout {
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff6ee;
  border: 1px solid #ffd7b8;
  font-size: 13px;
  margin-bottom: 14px;
}
.callout.danger { background: #fff5f5; border-color: #f5c2c7; }

.nav-group {
  margin: 14px 12px 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7b8194;
}
.lede { color: var(--muted); margin: 0 0 14px; max-width: 720px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.okbox {
  padding: 12px 14px;
  background: #e8f8ef;
  border: 1px solid #b7ebc6;
  color: #046c38;
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.quick .btn { text-decoration: none; display: inline-block; }
.mission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 12px 0 24px;
}
.mission-card, .pick {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.pick { cursor: pointer; }
.pick input { margin-top: 6px; }
.thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #f2f3f5;
  flex: 0 0 72px;
}
.thumb-empty {
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
}
.img-row { display: flex; gap: 12px; align-items: center; }
.mission-pick { display: grid; gap: 8px; margin-bottom: 12px; }
.linkish {
  background: none;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
h2 { font-size: 16px; margin: 22px 0 10px; }
.section-title { font-size: 15px; margin: 18px 0 8px; }
.task-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fafafa;
}
.warn-text { color: #b42318; font-size: 13px; }
.ok-text { color: #067647; font-size: 13px; }

.menu-btn,
.side-close,
.side-overlay { display: none; }

@media (max-width: 980px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
  .layout { grid-template-columns: 1fr; }
  .side {
    display: none;
    position: fixed;
    z-index: 30;
    left: 0;
    top: 0;
    height: 100vh;
    width: min(280px, 86vw);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.35);
  }
  .side.open { display: block; }
  .menu-btn { display: inline-block; pointer-events: auto; }
  .side-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 36px;
    pointer-events: auto;
  }
  .side-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(15, 18, 28, 0.55);
    border: 0;
    padding: 0;
    cursor: pointer;
    pointer-events: none;
  }
  .side-overlay.open {
    display: block;
    pointer-events: auto;
  }
  body.k4-menu-open { overflow: hidden; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
