:root {
  --teal-900: #0b3b3c;
  --teal-800: #0d4a4b;
  --teal-700: #0f6466;
  --teal-500: #14b8a6;
  --teal-100: #d7f2ef;
  --teal-050: #f1faf9;
  --ink:      #12211f;
  --body:     #55666a;
  --muted:    #8a9a9a;
  --line:     #e6eeec;
  --bg:       #f5f8f7;
  --white:    #ffffff;
  --wa:       #25d366;
  --amber:    #f59e0b;
  --red:      #e5484d;
  --green:    #12a150;
  --radius:   14px;
  --shadow:   0 1px 2px rgba(11,59,60,.04), 0 14px 40px -18px rgba(11,59,60,.22);
  --shadow-sm:0 1px 3px rgba(11,59,60,.08);
  --sidebar:  260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--body);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; font-weight: 700; letter-spacing: -.02em; }
a { color: var(--teal-700); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================ Layout ============================ */
.admin { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--teal-900);
  color: #a9cbc9;
  padding: 26px 18px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 26px; }
.sidebar__mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: var(--teal-500); color: #fff;
  border-radius: 11px; font-weight: 800; font-size: 1.2rem;
}
.sidebar__brand b { color: #fff; font-size: 1.02rem; letter-spacing: -.02em; display: block; }
.sidebar__brand span { font-size: .74rem; color: #6fa3a1; text-transform: uppercase; letter-spacing: .12em; }

.sidebar__nav { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.sidebar__nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: #a9cbc9; font-weight: 500; font-size: .93rem;
  transition: background .15s ease, color .15s ease;
}
.sidebar__nav a .ic { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar__nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar__nav a.active { background: var(--teal-500); color: #fff; box-shadow: 0 8px 20px -8px rgba(20,184,166,.7); }

.sidebar__foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar__foot a { color: #7fb0ae; font-size: .88rem; padding: 9px 14px; display: flex; align-items: center; gap: 10px; border-radius: 9px; }
.sidebar__foot a:hover { background: rgba(255,255,255,.06); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 18px 34px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 1.4rem; }
.topbar .sub { font-size: .88rem; color: var(--muted); margin-top: 2px; }
.topbar__user { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--body); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--teal-100); color: var(--teal-700);
  display: grid; place-items: center; font-weight: 700;
}

.content { padding: 30px 34px 60px; flex: 1; }
.content--narrow { max-width: 860px; }

/* ============================ Flash ============================ */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: 11px;
  font-weight: 600; font-size: .92rem; margin-bottom: 24px;
  border: 1px solid transparent;
}
.flash--success { background: #e7f7ee; color: #0a7038; border-color: #bfe8d0; }
.flash--error   { background: #fdeaea; color: #b42318; border-color: #f6cccc; }

/* ============================ Cards / grid ============================ */
.grid { display: grid; gap: 20px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.panel__head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel__head h2 { font-size: 1.1rem; }
.panel__body { padding: 24px; }

/* Stat tiles */
.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  display: flex; align-items: center; gap: 16px;
}
.stat__icon {
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  border-radius: 13px; font-size: 1.5rem;
  background: var(--teal-050);
}
.stat__num { font-size: 1.8rem; font-weight: 800; color: var(--ink); letter-spacing: -.03em; line-height: 1; }
.stat__label { font-size: .84rem; color: var(--muted); margin-top: 4px; }

/* ============================ Buttons ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border: 1px solid transparent; border-radius: 10px;
  background: var(--teal-500); color: #fff;
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--teal-700); transform: translateY(-1px); box-shadow: 0 10px 22px -12px rgba(15,100,102,.8); }
.btn--sm { padding: 8px 14px; font-size: .84rem; border-radius: 9px; }
.btn--ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--teal-050); border-color: var(--teal-500); color: var(--teal-700); box-shadow: none; }
.btn--danger { background: var(--white); color: var(--red); border-color: #f3c9ca; }
.btn--danger:hover { background: var(--red); color: #fff; border-color: var(--red); box-shadow: none; }
.btn--block { width: 100%; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================ Forms ============================ */
.field { margin-bottom: 20px; }
.field > label { display: block; font-weight: 600; font-size: .86rem; color: var(--ink); margin-bottom: 7px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px;
  font: inherit; font-size: .93rem; color: var(--ink);
  background: var(--white); border: 1.5px solid var(--line); border-radius: 10px;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-100);
}
.field textarea { resize: vertical; min-height: 90px; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field--row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px 4px; margin-bottom: 24px; }
legend { font-weight: 700; color: var(--ink); font-size: .92rem; padding: 0 8px; }

.form-actions { display: flex; gap: 12px; align-items: center; padding-top: 4px; }

/* ============================ Tables ============================ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th {
  text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--teal-050);
}
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafcfb; }
.cell-strong { font-weight: 600; color: var(--ink); }
.cell-muted { color: var(--muted); font-size: .86rem; }

/* Row item with emoji/photo */
.rowitem { display: flex; align-items: center; gap: 12px; }
.rowitem .emoji { width: 40px; height: 40px; border-radius: 10px; background: var(--teal-050); display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.rowitem .thumb { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--teal-100); flex: none; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.badge--new { background: #fef3c7; color: #92660b; }
.badge--done { background: #e7f7ee; color: #0a7038; }

/* Empty state */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-size: 2.6rem; margin-bottom: 12px; }

/* Action icons in table */
.actions { display: flex; gap: 8px; justify-content: flex-end; }

.inline-form { display: inline; }

/* Warning strip (e.g. default password) */
.notice {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fff8eb; border: 1px solid #f6e0a8;
  color: #7a5b09; padding: 14px 18px; border-radius: 12px; margin-bottom: 24px; font-size: .9rem;
}
.notice b { color: #5c4406; }

.help-text { color: var(--muted); font-size: .9rem; margin-top: -8px; margin-bottom: 20px; }

/* ============================ Login ============================ */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--teal-100), var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); padding: 38px 34px;
}
.login-card .sidebar__mark { margin: 0 auto 18px; width: 52px; height: 52px; font-size: 1.5rem; }
.login-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 28px; }

/* ============================ Responsive ============================ */
@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: 6px 4px; padding: 12px;
  }
  .sidebar__brand { padding: 0 8px 0 4px; }
  .sidebar__nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .sidebar__nav a { padding: 8px 12px; }
  .sidebar__nav a .label { display: none; }
  .sidebar__nav a .ic { font-size: 1.15rem; }
  .sidebar__foot { margin: 0; padding: 0; border: 0; }
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .cards-3, .cards-2 { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .field--row, .field--row3 { grid-template-columns: 1fr; }
}
