:root {
  color-scheme: light;
  --ink: #07111f;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff;
  --page: #f7fbff;
  --blue: #0866f5;
  --blue-strong: #0051d4;
  --blue-pale: #eef7ff;
  --green: #168553;
  --red: #b42318;
  --shadow: 0 18px 44px rgba(15, 65, 120, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 274px minmax(0, 1fr);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, var(--page) 100%);
  color: var(--ink);
}

button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }

.login {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff 0%, var(--page) 100%);
}

.login[hidden] { display: none; }

.login-panel, .panel, .brand, .filter-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
}

.login-panel img { width: 220px; max-width: 100%; }

.login-panel label, .filter-panel label, .tenant-switcher {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.login-panel input, .filter-panel input, .filter-panel select, .tenant-switcher select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  padding: 9px 11px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.sidebar {
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 24px 18px;
}

.brand {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
  padding: 14px;
}

.brand img { width: min(210px, 100%); }
.brand small, .eyebrow, .meta { color: var(--muted); font-size: 12px; }

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

.nav-item {
  position: relative;
  min-height: 42px;
  width: 100%;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0 12px 0 34px;
  font-weight: 750;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #cbd5e1;
  transform: translateY(-50%);
}

.nav-item.active {
  background: var(--blue-pale);
  color: var(--blue-strong);
}

.nav-item.active::before {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(8, 102, 245, 0.16);
}

.main {
  min-width: 0;
  padding: 30px 34px 44px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h1, .section-head h2, .detail-panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 { font-size: 30px; }
.eyebrow { margin: 0 0 5px; font-weight: 800; text-transform: uppercase; }

.top-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.user-chip {
  display: grid;
  gap: 3px;
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
}

.user-chip strong { color: var(--ink); font-size: 13px; }

.primary-action, .secondary-action {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-action {
  background: var(--blue);
  color: #ffffff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card {
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 15px;
  box-shadow: var(--shadow);
}

.summary-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 26px;
}

.summary-card p { margin: 0; color: var(--muted); font-size: 13px; }

.filter-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(6, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.panel { padding: 16px; }

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.badge {
  display: inline-grid;
  min-width: 42px;
  min-height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-pale);
  color: var(--blue-strong);
  font-weight: 850;
}

.object-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th, td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbff;
  color: var(--muted);
  font-size: 12px;
}

tr { cursor: pointer; }
tr:hover, tr.active { background: var(--blue-pale); }
td strong { display: block; }

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.status.confirmed, .status.completed, .status.active { background: #eaf7ef; color: var(--green); }
.status.cancelled, .status.no-show { background: #fff1f0; color: var(--red); }

.detail-grid {
  display: grid;
  gap: 9px;
}

.detail-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
  font-size: 13px;
}

.detail-row span:first-child {
  color: var(--muted);
  font-weight: 750;
}

.related-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.related-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
  font-size: 13px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

@media (max-width: 1120px) {
  body { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .workspace, .topbar { grid-template-columns: 1fr; }
  .filter-panel, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-actions { flex-wrap: wrap; }
}

@media (max-width: 720px) {
  .main, .sidebar { padding: 18px; }
  .nav, .filter-panel, .summary-grid { grid-template-columns: 1fr; }
}
