:root {
  --ink: #111827;
  --muted: #5b6472;
  --line: rgba(17, 24, 39, 0.12);
  --panel: rgba(255, 255, 255, 0.88);
  --green: #166534;
  --red: #9f1239;
  --amber: #92400e;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background: linear-gradient(135deg, #f0fdf4, #eff6ff);
}

.admin-shell {
  width: min(1220px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.2rem 0 2rem;
}

.admin-header,
.login-panel,
.admin-view,
.metric-card,
.status-line {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.1);
}

.admin-header,
.login-panel,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.admin-header,
.login-panel {
  padding: 1rem;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 0.45rem;
  color: #14532d;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: 3.5rem;
  line-height: 0.9;
  letter-spacing: 0;
}

h2,
h3,
p {
  margin: 0;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.login-panel {
  margin-top: 1rem;
}

.login-panel strong {
  display: block;
  margin-bottom: 0.35rem;
}

.dark-button,
.light-button,
.tab-button,
.light-link,
.edit-button,
.delete-button {
  min-height: 2.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 0.95rem;
  border-radius: 0.45rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.dark-button {
  border: 0;
  color: white;
  background: #111827;
}

.light-button,
.light-link,
.edit-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.delete-button {
  color: var(--red);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(159, 18, 57, 0.28);
}

.metric-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.metric-card {
  padding: 1rem;
}

.metric-card span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.tabs {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}

.tab-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
}

.tab-button.is-active {
  color: white;
  background: #111827;
}

.status-line {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  font-weight: 800;
}

.status-line.is-ready {
  color: var(--green);
}

.status-line.is-warning {
  color: var(--amber);
}

.status-line.is-error {
  color: var(--red);
}

.admin-view {
  margin-top: 1rem;
  padding: 1rem;
}

.section-head {
  margin-bottom: 1rem;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

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

.analysis-card,
.chart-card {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.72);
}

.analysis-card {
  padding: 1rem;
}

.analysis-card span {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.analysis-card strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.chart-card {
  margin-top: 1rem;
  padding: 1rem;
}

.chart-card h3 {
  margin: 0 0 0.25rem;
}

.pie-layout {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.2rem;
  align-items: center;
}

.sales-pie {
  width: 15rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.08);
  box-shadow: inset 0 0 0 1px var(--line);
}

.sales-legend {
  display: grid;
  gap: 0.55rem;
}

.legend-row {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 800;
}

.legend-dot {
  width: 0.8rem;
  aspect-ratio: 1;
  border-radius: 50%;
}

.member-form {
  display: grid;
  grid-template-columns: 1.3fr 0.6fr 1.3fr 0.7fr auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.cash-form,
.pricing-form,
.range-panel {
  display: grid;
  grid-template-columns: 0.8fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.66);
}

.pricing-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.range-panel {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.range-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 0.75rem;
  align-items: end;
}

.range-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

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

label {
  display: grid;
  gap: 0.35rem;
}

label span {
  color: rgba(17, 24, 39, 0.72);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 2.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.inline-money-input {
  min-width: 8.5rem;
  max-width: 10rem;
  min-height: 2.35rem;
  padding: 0.55rem 0.65rem;
}

.check-field {
  min-height: 2.7rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.check-field input {
  width: 1.05rem;
  min-height: 1.05rem;
  accent-color: #111827;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.68);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  text-align: left;
  vertical-align: middle;
}

th {
  background: rgba(17, 24, 39, 0.07);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
  font-weight: 700;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.is-on {
  color: var(--green);
  background: rgba(34, 197, 94, 0.15);
}

.badge.is-off {
  color: var(--red);
  background: rgba(244, 63, 94, 0.14);
}

.money-positive {
  color: var(--green);
}

.money-negative {
  color: var(--red);
}

.empty-row {
  color: var(--muted);
}

.split-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 1rem;
}

@media (max-width: 980px) {
  .metric-grid,
  .tabs,
  .dashboard-grid,
  .split-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-form,
  .cash-form,
  .pricing-form,
  .range-form,
  .range-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .admin-shell {
    width: min(100% - 1rem, 1220px);
  }

  .admin-header,
  .login-panel,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 2.8rem;
  }

  .metric-grid,
  .tabs,
  .dashboard-grid,
  .split-grid,
  .member-form,
  .cash-form,
  .pricing-form,
  .range-form,
  .range-summary,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .head-actions {
    justify-content: stretch;
  }

  .head-actions > * {
    width: 100%;
  }

  .range-actions,
  .range-actions > * {
    width: 100%;
  }

  .pie-layout {
    grid-template-columns: 1fr;
  }

  .sales-pie {
    width: min(100%, 16rem);
    justify-self: center;
  }

  table {
    min-width: 680px;
  }
}

/* Shared Promo 26 visual language */
.admin-header,
.login-panel,
.admin-view,
.metric-card,
.status-line,
.analysis-card,
.chart-card,
.cash-form,
.pricing-form,
.range-panel,
.table-wrap {
  border-radius: 1.25rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.dark-button,
.light-button,
.tab-button,
.light-link,
.edit-button,
.delete-button,
input,
select {
  border-radius: 0.85rem;
}

.dark-button,
.light-button,
.light-link {
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.dark-button:hover,
.light-button:hover,
.light-link:hover {
  transform: translateY(-1px);
}

html[data-color-theme="dark"] {
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.09);
  --panel: rgba(20, 29, 47, 0.76);
  --green: #4ade80;
  --red: #fb7185;
  --amber: #fbbf24;
}

html[data-color-theme="dark"] body {
  background:
    radial-gradient(circle at 14% 12%, rgba(249, 115, 22, 0.1), transparent 30%),
    radial-gradient(circle at 86% 14%, rgba(16, 185, 129, 0.09), transparent 30%),
    linear-gradient(180deg, #0b0f19, #121824);
}

html[data-color-theme="dark"] .admin-header,
html[data-color-theme="dark"] .login-panel,
html[data-color-theme="dark"] .admin-view,
html[data-color-theme="dark"] .metric-card,
html[data-color-theme="dark"] .status-line {
  background: var(--panel);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.32);
}

html[data-color-theme="dark"] h1 {
  background: linear-gradient(135deg, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html[data-color-theme="dark"] .eyebrow {
  color: #4ade80;
}

html[data-color-theme="dark"] .dark-button,
html[data-color-theme="dark"] .tab-button.is-active {
  color: #fff;
  background: linear-gradient(135deg, #334155, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-color-theme="dark"] .light-button,
html[data-color-theme="dark"] .light-link,
html[data-color-theme="dark"] .edit-button,
html[data-color-theme="dark"] .tab-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--line);
}

html[data-color-theme="dark"] .delete-button {
  color: var(--red);
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(251, 113, 133, 0.28);
}

html[data-color-theme="dark"] .analysis-card,
html[data-color-theme="dark"] .chart-card,
html[data-color-theme="dark"] .cash-form,
html[data-color-theme="dark"] .pricing-form,
html[data-color-theme="dark"] .range-panel,
html[data-color-theme="dark"] .table-wrap {
  background: rgba(10, 15, 30, 0.38);
  border-color: var(--line);
}

html[data-color-theme="dark"] label span {
  color: var(--muted);
}

html[data-color-theme="dark"] input,
html[data-color-theme="dark"] select {
  color: var(--ink);
  background: rgba(2, 6, 23, 0.5);
  border-color: var(--line);
}

html[data-color-theme="dark"] input:focus,
html[data-color-theme="dark"] select:focus {
  outline: 2px solid rgba(249, 115, 22, 0.24);
  border-color: rgba(249, 115, 22, 0.4);
}

html[data-color-theme="dark"] th {
  background: rgba(255, 255, 255, 0.055);
}

html[data-color-theme="dark"] th,
html[data-color-theme="dark"] td {
  border-bottom-color: rgba(255, 255, 255, 0.065);
}

html[data-color-theme="dark"] .sales-pie {
  background: rgba(255, 255, 255, 0.07);
}

html[data-color-theme="dark"] .badge.is-on {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
}

html[data-color-theme="dark"] .badge.is-off {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.12);
}
