:root {
  color-scheme: light;
  --navy: #061d36;
  --navy-2: #09294b;
  --blue: #0b7cff;
  --cyan: #13b7d9;
  --green: #78c83d;
  --bg: #f4f9ff;
  --panel: #ffffff;
  --border: #dfe8f4;
  --text: #0c1b2f;
  --muted: #5e6b7c;
  --primary: #0b7cff;
  --primary-dark: #0062de;
  --ok: #167a3a;
  --warn: #9a6500;
  --bad: #b42318;
  --shadow: 0 18px 48px rgba(8, 44, 82, .08);
  --shadow-strong: 0 26px 70px rgba(5, 26, 51, .14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 84% 0%, rgba(19, 183, 217, .18), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 260px, #eef6ff 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.topbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

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

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(11, 124, 255, .24);
}

.brand strong {
  display: block;
  font-size: 20px;
  letter-spacing: -.02em;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 22px;
  min-width: 0;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 21px;
  letter-spacing: -.025em;
}

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

.check {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #fbfdff;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 13px;
}

.badge.ok {
  color: #fff;
  background: var(--ok);
}

.badge.bad {
  color: #fff;
  background: var(--bad);
}

.badge.warn {
  color: #fff;
  background: var(--warn);
}

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

.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.topnav a {
  color: var(--navy);
}

.topnav a:hover {
  color: var(--blue);
}

label {
  display: grid;
  gap: 6px;
  color: #1a2d43;
  font-weight: 800;
}

input,
select,
button,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(11, 124, 255, .18);
  border-color: var(--blue);
}

button {
  cursor: pointer;
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), var(--primary-dark));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(11, 124, 255, .22);
  transition: .18s transform, .18s box-shadow, .18s filter;
}

button:hover {
  filter: brightness(.96);
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(11, 124, 255, .26);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

pre {
  max-width: 100%;
  overflow: auto;
  background: var(--navy);
  color: #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

summary {
  cursor: pointer;
  font-weight: 700;
  margin: 14px 0 8px;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.compact-form {
  gap: 8px;
}

.compact-form input,
.compact-form button {
  min-height: 38px;
}

.notice {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 18px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}

.notice.success {
  color: #0b5f2a;
  background: #eff9f3;
  border-color: #b6e3c5;
}

.notice.error {
  color: #8a1f17;
  background: #fff0ef;
  border-color: #f0b8b2;
}

.meta-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

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

.meta-list div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.meta-list span {
  color: var(--muted);
  font-size: 13px;
}

.meta-list strong,
.path-cell {
  overflow-wrap: anywhere;
}

.tenant-panel {
  margin-top: 18px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.compact-table {
  margin-top: 16px;
}

.price-total {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  background: linear-gradient(135deg, #f4f9ff, #ffffff);
  margin-bottom: 14px;
}

.price-total span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.price-total strong {
  color: var(--navy);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
}

.compact-total {
  max-width: 340px;
}

.option-box {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin: 0;
  display: grid;
  gap: 8px;
}

.option-box legend {
  padding: 0 6px;
  color: #1a2d43;
  font-weight: 900;
}

.checkbox-line {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 8px;
  font-weight: 700;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th {
  background: #f4f9ff;
  color: #1a2d43;
  font-weight: 900;
}

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

tbody tr:hover {
  background: #fbfdff;
}

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

.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  background: #eaf4ff;
  color: var(--navy-2);
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 900;
}

.button-danger {
  min-height: 34px;
  border-color: #c43d32;
  background: #fff;
  color: #a1261d;
  box-shadow: none;
}

.button-danger:hover {
  background: #fff0ef;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 10px;
  padding: 7px 12px;
  margin-bottom: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--primary-dark));
  box-shadow: 0 10px 22px rgba(11, 124, 255, .18);
}

.button-link:hover {
  color: #fff;
  filter: brightness(.96);
}

.inline-form {
  display: inline;
  margin: 0;
}

.button-linklike {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--navy);
  box-shadow: none;
  font-weight: 800;
}

.button-linklike:hover {
  color: var(--blue);
  transform: none;
  box-shadow: none;
  filter: none;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 15%, rgba(19, 183, 217, .22), transparent 32%),
    linear-gradient(135deg, #031326, #06213d 62%, #061d36);
}

.auth-card {
  width: min(100%, 460px);
  box-shadow: var(--shadow-strong);
}

.auth-brand {
  margin-bottom: 18px;
}

.customer-login-card {
  margin: 0 auto;
}

.tenant-config-grid {
  display: block;
  margin-top: 18px;
}

.admin-tabs {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(244, 249, 255, .95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.admin-tabs .admin-tab {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  background: #fff;
  color: var(--navy);
  border-color: var(--border);
  box-shadow: none;
  white-space: nowrap;
}

.admin-tabs .admin-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--primary-dark));
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(11, 124, 255, .18);
}

.tenant-tab-panel {
  display: none;
}

.tenant-tab-panel.active {
  display: block;
}

.tenant-tab-panel[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .shell {
    padding: 12px;
  }

  .topbar,
  .grid,
  .dashboard-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topnav {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

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