:root {
  --sidebar-bg: #13151f;
  --sidebar-hover: #1e2133;
  --sidebar-active: #252a3d;
  --sidebar-text: rgba(255,255,255,0.52);
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #d4a244;
  --sidebar-width: 224px;

  --bg: #0d0f18;
  --surface-1: #141720;
  --surface-2: #1a1d2e;
  --surface-3: #1f2236;
  --border: rgba(255,255,255,0.07);
  --border-input: rgba(255,255,255,0.12);

  --text: #edf0f7;
  --text-dim: #8b90a7;
  --text-label: #c5c8d8;

  --accent: #d4a244;
  --accent-dim: rgba(212,162,68,0.12);
  --danger: #e05c5c;
  --success: #4caf7d;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body.admin-body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ── Layout ── */
.admin-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}
.admin-sidebar::-webkit-scrollbar { width: 3px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }

.admin-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border);
}
.admin-sidebar-logo img { height: 30px; width: auto; flex-shrink: 0; border-radius: 6px; }
.admin-sidebar-logo-text { font-size: 0.9rem; font-weight: 700; color: #fff; line-height: 1.2; }
.admin-sidebar-logo-sub { font-size: 0.67rem; color: var(--sidebar-text); }

.admin-nav { padding: 12px 10px; flex: 1; }

.admin-nav-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.22);
  padding: 14px 8px 5px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.admin-nav-item:hover { background: var(--sidebar-hover); color: rgba(255,255,255,0.85); }
.admin-nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.admin-nav-item.active .nav-icon { opacity: 1; color: var(--sidebar-accent); }
.nav-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.5; }

.admin-nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.admin-sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
.admin-sidebar-user { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); }
.admin-sidebar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #b8842a);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-sidebar-username {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Main ── */
.admin-main { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ── */
.admin-topbar {
  position: sticky;
  top: 0;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 50;
}
.admin-topbar-title { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.admin-topbar-actions { display: flex; align-items: center; gap: 10px; }
.admin-topbar-actions a {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--border-input);
  border-radius: 20px;
  transition: all 0.15s;
  background: var(--surface-2);
}
.admin-topbar-actions a:hover { border-color: var(--accent); color: var(--accent); }

/* ── Alert ── */
.admin-alert { padding: 16px 28px 0; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.83rem; font-weight: 500; }
.alert-success { background: rgba(76,175,125,0.1); color: var(--success); border: 1px solid rgba(76,175,125,0.25); }
.alert-error   { background: rgba(224,92,92,0.1);  color: var(--danger);  border: 1px solid rgba(224,92,92,0.25); }

/* ── Content ── */
.admin-content { padding: 28px; max-width: 880px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-panel > h2 { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.tab-panel > p.muted, .tab-panel > .muted:first-of-type {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 24px;
  display: block;
}

/* ── Chrome Settings-style form ── */
.stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 760px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stack-wide { max-width: 920px; }

/* Each field row */
.stack > label,
.stack > .field-row-2,
.stack > .image-field {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  gap: 8px;
}

.stack > label:last-of-type { border-bottom: none; }

.stack > h3 {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  padding: 12px 20px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  margin: 0;
}

.stack > p, .stack > .muted {
  padding: 10px 20px;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.stack > button[type="submit"] {
  margin: 16px 20px;
  width: auto;
  align-self: flex-start;
}

.stack > div { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.stack > div:last-child { border-bottom: none; }

/* Two column layout inside stack */
.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}

h3 {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 20px 0 10px;
}

/* ── Labels & Inputs ── */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-label);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select {
  background: var(--surface-2);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.87rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b90a7' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input[type="color"] {
  width: 48px; height: 38px;
  padding: 3px; cursor: pointer;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

textarea { resize: vertical; line-height: 1.55; }

/* Google-style checkbox toggle */
input[type="checkbox"] {
  width: 36px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
  border: none;
  padding: 0;
}
input[type="checkbox"]::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
input[type="checkbox"]:checked {
  background: var(--accent);
}
input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

.muted { color: var(--text-dim); font-size: 0.78rem; font-weight: 400; }
.wrap { max-width: 880px; }

/* ── Image field ── */
.image-field {
  background: var(--surface-2);
  border: 1px dashed var(--border-input);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.image-field .preview {
  max-width: 140px;
  max-height: 80px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-3);
  padding: 6px;
}
.upload-status { font-size: 0.74rem; color: var(--text-dim); }

/* ── Buttons — Google style ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 22px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--accent);
  color: #1a1200;
  border-color: var(--accent);
}
.btn-primary:hover { background: #c4922e; box-shadow: 0 1px 6px rgba(212,162,68,0.4); }
.btn-ghost {
  background: transparent;
  border-color: var(--border-input);
  color: var(--text-dim);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-sm { padding: 5px 14px; font-size: 0.75rem; border-radius: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Repeat rows ── */
.repeat-list { display: flex; flex-direction: column; gap: 10px; }

.repeat-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.repeat-row-wide {
  grid-template-columns: 1fr;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.repeat-row-wide .remove-row { align-self: flex-start; }

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-label);
  display: block;
  margin-bottom: 3px;
}

/* ── Stat trio ── */
.stat-trio { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }

/* ── Case row ── */
.case-row-form {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
}

/* ── Messages ── */
.messages-list { display: flex; flex-direction: column; gap: 12px; }
.message-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.message-card.message-unread { border-left: 3px solid var(--accent); }
.message-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.message-contact { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 8px; }
.message-contact a { color: var(--accent); text-decoration: none; }
.message-interests { font-size: 0.8rem; color: var(--accent); margin-bottom: 8px; }
.message-body { font-size: 0.88rem; line-height: 1.65; margin-bottom: 14px; }
.message-actions { display: flex; gap: 8px; }
.message-actions form { display: inline; }

/* ── Blog editor ── */
.editor-field { display: flex; flex-direction: column; }
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-input);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.editor-toolbar .btn-sm { font-size: 0.72rem; }
.editor-status { font-size: 0.72rem; color: var(--text-dim); margin-left: 4px; }
.editor-field textarea { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

/* ── Login ── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 42px;
  width: 100%;
  max-width: 390px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.login-card h1 { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }

/* ── Responsive ── */
@media (max-width: 860px) {
  .admin-sidebar { position: static; width: 100%; height: auto; }
  .admin-main { margin-left: 0; }
  .admin-topbar { position: static; }
  .field-row-2 { grid-template-columns: 1fr; }
}
