:root {
  --blue-900: #0f2447;
  --blue-700: #174ea6;
  --blue-100: #e8f0ff;
  --yellow: #f5c542;
  --green: #16a34a;
  --orange: #f97316;
  --red: #dc2626;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-600: #475569;
  --slate-900: #0f172a;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--slate-100);
  color: var(--slate-900);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--blue-900);
  color: var(--white);
  padding: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: var(--blue-900);
  font-weight: 800;
}

.brand span {
  display: block;
  color: #b6c6e3;
  font-size: 12px;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: #dbeafe;
  text-decoration: none;
  padding: 13px 14px;
  border-radius: 12px;
  font-weight: 600;
}

nav a.active,
nav a:hover {
  background: rgba(255,255,255,0.12);
}

.content {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--blue-700);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 12px;
  margin: 0 0 6px 0;
}

h1, h2, p { margin-top: 0; }

.primary-button,
.panel button,
.action-grid button {
  border: 0;
  border-radius: 12px;
  background: var(--blue-700);
  color: white;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.card, .panel {
  background: var(--white);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .08);
}

.card span {
  display: block;
  color: var(--slate-600);
  font-weight: 700;
}

.card strong {
  display: block;
  font-size: 34px;
  margin: 10px 0;
}

.card p { color: var(--slate-600); margin-bottom: 0; }

.status-red { border-top: 6px solid var(--red); }
.status-orange { border-top: 6px solid var(--orange); }
.status-green { border-top: 6px solid var(--green); }
.status-blue { border-top: 6px solid var(--blue-700); }

.two-column {
  display: grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header button {
  background: var(--blue-100);
  color: var(--blue-700);
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  background: var(--slate-50);
  margin-bottom: 10px;
}

.list-item span {
  display: block;
  color: var(--slate-600);
  margin-top: 4px;
}

.list-item.danger { border-left: 5px solid var(--red); }
.list-item.warning { border-left: 5px solid var(--orange); }
.list-item.ok { border-left: 5px solid var(--green); }

.ai-box {
  display: flex;
  gap: 14px;
  background: var(--blue-100);
  padding: 18px;
  border-radius: 18px;
  margin-bottom: 16px;
}

.ai-box span { font-size: 34px; }
.ai-box p { color: var(--slate-600); margin-bottom: 0; }

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

.action-grid button {
  background: var(--slate-100);
  color: var(--slate-900);
  text-align: left;
}

.view { display: none; }
.active-view { display: block; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--slate-200);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--slate-600);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 12px;
}

.form-section {
  margin-top: 18px;
}

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

.customer-form label {
  display: grid;
  gap: 6px;
  color: var(--slate-600);
  font-weight: 700;
  font-size: 13px;
}

.customer-form input,
.customer-form textarea {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  color: var(--slate-900);
  background: var(--white);
}

.full-width {
  grid-column: 1 / -1;
}

.muted {
  color: var(--slate-600);
  line-height: 1.5;
}

.info-list {
  display: grid;
  gap: 10px;
}

.info-list div {
  background: var(--slate-50);
  border-radius: 14px;
  padding: 14px;
}

.info-list span {
  display: block;
  color: var(--slate-600);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.placeholder-panel {
  min-height: 220px;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .content { padding: 16px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .stats-grid { grid-template-columns: 1fr; }
  nav { grid-template-columns: 1fr; }
  .customer-form { grid-template-columns: 1fr; }
}
