:root {
  --a-bg: #f3f6fb;
  --a-card: #ffffff;
  --a-sidebar: #090b0f;
  --a-border: #e2e8f0;
  --a-text: #0a0d12;
  --a-muted: #64748b;
  --a-accent: #0057b8;
  --a-accent-hover: #003f8a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--a-bg);
  color: var(--a-text);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #0d1117;
  padding: 1.5rem;
}

.login-card {
  width: min(440px, 100%);
  background: #ffffff;
  border-radius: 16px;
  padding: 2.25rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.login-logo { margin-bottom: 1.25rem; }
.login-logo img { height: 32px; display: block; }
.login-card h1 { margin: 0 0 0.4rem; font-size: 1.45rem; }
.login-footer { margin-top: 1.25rem; font-size: 0.88rem; color: var(--a-muted); text-align: center; }
.login-footer a:hover { color: var(--a-accent); }

/* Layout Shell */
.admin-shell {
  display: grid;
  grid-template-columns: 265px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--a-sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__brand {
  background: #ffffff;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar__brand img { height: 24px; max-width: 100%; }

.sidebar__group {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  padding: 0.85rem 0.75rem 0.35rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.62rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #cbd5e1;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar__link.is-active {
  background: var(--a-accent);
  color: #ffffff;
  font-weight: 600;
}

.sidebar__badge {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.84rem;
}

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

.topbar-admin {
  background: #ffffff;
  border-bottom: 1px solid var(--a-border);
  padding: 0.9rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-admin h2 {
  margin: 0;
  font-size: 1.2rem;
}

.topbar-admin__right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.88rem;
}

.role-pill {
  background: #e2e8f0;
  color: #334155;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.content-wrap {
  padding: 1.75rem;
  max-width: 1360px;
  width: 100%;
}

/* Cards & Grids */
.card {
  background: var(--a-card);
  border: 1px solid var(--a-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.08rem;
}

.muted {
  color: var(--a-muted);
  font-size: 0.88rem;
  margin-top: 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: #ffffff;
  border: 1px solid var(--a-border);
  border-radius: 12px;
  padding: 1.25rem;
}

.stat-box strong {
  display: block;
  font-size: 1.85rem;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.stat-box span {
  font-size: 0.85rem;
  color: var(--a-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

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

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

/* Forms */
.stack-form { display: flex; flex-direction: column; gap: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.32rem; margin-bottom: 0.75rem; }
.field label { font-size: 0.82rem; font-weight: 600; color: #334155; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.78rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #ffffff;
  color: var(--a-text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--a-accent);
}

.color-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.color-input-wrap input[type="color"] {
  width: 46px;
  height: 38px;
  padding: 2px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.image-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.35rem 0;
}

.check-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--a-accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.05rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.btn--sm { padding: 0.42rem 0.75rem; font-size: 0.8rem; }
.btn--full { width: 100%; }
.btn--primary { background: var(--a-accent); color: #ffffff; }
.btn--primary:hover { background: var(--a-accent-hover); }
.btn--secondary { background: #ffffff; border-color: #cbd5e1; color: var(--a-text); }
.btn--secondary:hover { border-color: #64748b; }
.btn--danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.btn--danger:hover { background: #fecaca; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.75rem 0.7rem; border-bottom: 1px solid var(--a-border); text-align: left; vertical-align: middle; }
th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--a-muted); background: #f8fafc; }

.thumb-mini {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--a-border);
  background: #fff;
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.status-pill--ok { background: #dcfce7; color: #166534; }
.status-pill--off { background: #f1f5f9; color: #475569; }
.status-pill--warn { background: #fef3c7; color: #92400e; }

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}
.alert--success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert--error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}

.media-card {
  border: 1px solid var(--a-border);
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.media-card__img {
  height: 135px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-bottom: 1px solid var(--a-border);
}

.media-card__img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.media-card__body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
}

/* Live Appearance Preview & Range Sliders */
.slider-box {
  background: #f8fafc;
  border: 1px solid var(--a-border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.slider-box__title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--a-text);
}

.range-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.range-field__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.range-val {
  background: #e2e8f0;
  color: #0a0d12;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--a-accent);
  cursor: pointer;
}

.live-preview-box {
  border: 1px solid var(--a-border);
  border-radius: 12px;
  padding: 1.5rem;
  background: #f8fafc;
}

.preview-card-sample {
  background: #ffffff;
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  max-width: 380px;
}

/* Media Picker Modal */
.picker-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.7);
}
.picker-modal[hidden] { display: none; }

.picker-modal__dialog {
  background: #ffffff;
  border-radius: 14px;
  width: min(880px, 100%);
  max-height: 85vh;
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.picker-modal__head {
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--a-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.picker-modal__body {
  padding: 1.25rem;
  overflow-y: auto;
}

.picker-item {
  border: 1.5px solid var(--a-border);
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  text-align: center;
  background: #fff;
}
.picker-item:hover { border-color: var(--a-accent); }
.picker-item img { height: 95px; width: 100%; object-fit: contain; margin-bottom: 0.35rem; }
.picker-item span { display: block; font-size: 0.75rem; word-break: break-all; color: var(--a-muted); }

@media (max-width: 960px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .stats-row, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
