:root {
  --bg: #f8fafc;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --border: #cbd5e1;
  --text: #1e293b;
  --muted: #64748b;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-soft: 0 2px 4px -1px rgb(0 0 0 / 0.06);
  --radius-lg: 12px;
  --radius-md: 12px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  width: min(1380px, calc(100% - 24px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
}

.topbar-row,
.brand,
.topbar-actions,
.hero-actions,
.section-title-row,
.filter-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-row {
  justify-content: space-between;
  padding: 16px 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), #60a5fa);
  color: white;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.brand-title,
h1,
h2,
h3,
.stat-card strong {
  font-family: "Inter", sans-serif;
  letter-spacing: -0.02em;
}

.brand-title,
.brand-subtitle,
.muted,
.compact,
.eyebrow {
  margin: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.button {
  border: 0;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.button:hover,
.mini-button:hover,
.side-nav a:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: white;
  background: var(--brand);
  box-shadow: var(--shadow-soft);
}

.button-secondary {
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.danger-button {
  color: white;
  background: var(--danger);
  box-shadow: var(--shadow-soft);
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 0 30px;
}

.sidebar,
.workspace,
.stats-grid,
.workspace-grid,
.stack-form,
.list-stack {
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero-panel h1 {
  margin: 10px 0 10px;
  font-size: clamp(28px, 2.8vw, 40px);
  line-height: 1.1;
  font-weight: 600;
}

.hero-panel {
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
}

.side-nav {
  padding: 12px;
  gap: 8px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.side-nav a:hover {
  background: #eff6ff;
  color: var(--brand);
}

.hero-metrics {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.hero-metrics article {
  padding: 14px 16px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #dbeafe;
  box-shadow: var(--shadow-soft);
}

.hero-metrics strong,
.summary-box h3 {
  display: block;
  margin-bottom: 6px;
}

.hero-metrics span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.eyebrow,
.pill,
.badge {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.eyebrow {
  background: #dbeafe;
  color: var(--brand);
  border: 1px solid #bfdbfe;
}

.pill {
  background: #eff6ff;
  color: var(--brand);
  border: 1px solid #dbeafe;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.compact {
  font-size: 14px;
}

.section-title-row {
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.section-title-row h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 600;
}

.stack-form label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea {
  resize: vertical;
}

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

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

.stat-card {
  padding: 22px;
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-soft);
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
}

.stat-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #eff6ff;
  font-size: 18px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  font-weight: 600;
}

.tone-students {
  border-top: 3px solid var(--brand);
}

.tone-batches {
  border-top: 3px solid #7c3aed;
}

.tone-collected {
  border-top: 3px solid var(--success);
}

.tone-due {
  border-top: 3px solid var(--warning);
}

.stat-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.workspace-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feature-panel {
  min-height: 100%;
}

.filter-row input {
  flex: 1 1 auto;
}

.list-stack.empty-state,
.summary-view.empty-state {
  min-height: 140px;
  display: grid;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  color: var(--muted);
  background: #f8fafc;
  padding: 20px;
  text-align: center;
}

.card {
  background: var(--panel-strong);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow-soft);
}

.card-head,
.card-actions,
.summary-grid,
.summary-top,
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.card-title {
  margin: 0;
  font-weight: 700;
}

.card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.mini-button {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 500;
}

.badge.Paid {
  background: rgba(5, 150, 105, 0.1);
  color: var(--success);
}

.badge.Pending {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

.badge.Partial {
  background: rgba(37, 99, 235, 0.12);
  color: var(--brand);
}

.summary-view {
  background: var(--panel-strong);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-soft);
}

.summary-grid {
  flex-wrap: wrap;
}

.summary-box {
  flex: 1 1 220px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid #dbeafe;
}

.summary-box h3 {
  margin: 0 0 10px;
}

.summary-row {
  padding: 6px 0;
}

@media (max-width: 1180px) {
  .app-shell,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(1380px, calc(100% - 16px));
  }

  .topbar-row,
  .topbar-actions,
  .hero-actions,
  .section-title-row,
  .filter-row,
  .card-head,
  .card-actions,
  .summary-grid,
  .summary-top,
  .summary-row {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
