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

/* ── Theme tokens ─────────────────────────────────────────── */
:root {
  --bg:             #f0f2f5;
  --surface:        #ffffff;
  --text:           #1a1a2e;
  --text-muted:     #555;
  --border:         #e8e8e8;
  --primary:        #0078d4;
  --primary-hover:  #005fa3;
  --primary-light:  #e6f0fb;
  --nav-bg:         #0078d4;
  --nav-text:       #ffffff;
  --input-border:   #ccc;
  --code-bg:        #f0f0f0;
  --row-self:       #fffbe6;
  --tag-admin-bg:   #e6f0fb;
  --tag-admin-text: #0078d4;
  --success-bg:     #e6f4ea;
  --success-text:   #2e7d32;
  --success-border: #a8d5ab;
  --error-bg:       #fdecea;
  --error-text:     #c62828;
  --error-border:   #f5b4b4;
  --shadow:         rgba(0,0,0,.08);
  --transition:     background-color .2s, color .2s, border-color .2s;
}

html.dark {
  --bg:             #0f1117;
  --surface:        #1e2130;
  --text:           #e2e8f0;
  --text-muted:     #94a3b8;
  --border:         #2d3748;
  --primary:        #4da6ff;
  --primary-hover:  #2d8fef;
  --primary-light:  #162032;
  --nav-bg:         #161b27;
  --nav-text:       #e2e8f0;
  --input-border:   #4a5568;
  --code-bg:        #2d3748;
  --row-self:       #2a2a17;
  --tag-admin-bg:   #162032;
  --tag-admin-text: #4da6ff;
  --success-bg:     #1a3327;
  --success-text:   #68d391;
  --success-border: #276749;
  --error-bg:       #3b1a1a;
  --error-text:     #fc8181;
  --error-border:   #742a2a;
  --shadow:         rgba(0,0,0,.3);
}

/* ── Base ─────────────────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: var(--transition);
}

/* ── Nav ──────────────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  background: var(--nav-bg);
  color: var(--nav-text);
  transition: var(--transition);
}
.brand { font-size: 1.2rem; font-weight: 700; letter-spacing: .5px; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a {
  color: var(--nav-text);
  text-decoration: none;
  opacity: .9;
  font-size: .95rem;
}
.nav-links a:hover { opacity: 1; text-decoration: underline; }

/* ── Theme switcher ───────────────────────────────────────── */
.theme-switcher {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 3px;
}
.theme-btn {
  background: transparent;
  border: none;
  color: var(--nav-text);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: .95rem;
  line-height: 1;
  opacity: .65;
  transition: background .15s, opacity .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-btn:hover  { opacity: 1; background: rgba(255,255,255,.2); }
.theme-btn.active { opacity: 1; background: rgba(255,255,255,.3); }

/* ── Main layout ──────────────────────────────────────────── */
main {
  max-width: 680px;
  margin: 2.5rem auto;
  padding: 0 1rem;
}
.center { text-align: center; }

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: 10px;
  padding: 2rem 2.5rem;
  box-shadow: 0 2px 8px var(--shadow);
  transition: var(--transition);
}
.card h1 { font-size: 1.6rem; margin-bottom: 1.5rem; color: var(--primary); }

/* ── Info table ───────────────────────────────────────────── */
.info-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.info-table th, .info-table td {
  padding: .6rem .8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.info-table th { width: 35%; color: var(--text-muted); font-weight: 600; }
.info-table em { color: var(--text-muted); font-style: italic; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .55rem 1.4rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .95rem;
  text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--primary-hover); }
.btn.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn.secondary:hover { background: var(--primary-light); }

/* ── Form ─────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: .75rem; max-width: 340px; }
.form label { font-weight: 600; font-size: .9rem; }
.form input[type="text"],
.form input[type="email"],
.form input[type="tel"] {
  padding: .5rem .75rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 1rem;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  transition: var(--transition);
}
.form input:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: .65rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.alert.success { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.alert.error   { background: var(--error-bg);   color: var(--error-text);   border: 1px solid var(--error-border); }

/* ── Admin panel ──────────────────────────────────────────── */
.admin-wrap { max-width: 900px; margin: 0 auto; }

.admin-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-header h1 { font-size: 1.6rem; color: var(--primary); margin: 0; }

.badge {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
  padding: .2rem .7rem;
  font-size: .8rem;
  font-weight: 600;
}

.table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
  font-size: .9rem;
  transition: var(--transition);
}
.admin-table thead { background: var(--primary); color: #fff; }
.admin-table th, .admin-table td {
  padding: .65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table tbody tr:hover { background: var(--primary-light); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.row-self { background: var(--row-self) !important; }

.actions { display: flex; gap: .5rem; align-items: center; }
.inline-form { display: inline; }

.btn.sm { padding: .3rem .8rem; font-size: .82rem; }
.btn.danger { background: #c62828; }
.btn.danger:hover { background: #a31f1f; }

.tag { display: inline-block; border-radius: 4px; padding: .1rem .5rem; font-size: .78rem; font-weight: 600; }
.tag.admin { background: var(--tag-admin-bg); color: var(--tag-admin-text); }

.form.wide { max-width: 480px; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; }
.checkbox-row label { font-weight: 600; font-size: .9rem; margin: 0; }

.meta { font-size: .8rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.meta code {
  background: var(--code-bg);
  padding: .1rem .4rem;
  border-radius: 4px;
  font-size: .78rem;
}
