:root {
  --bg-main: #f4f6fb;
  --bg-card: rgba(255, 255, 255, 0.84);
  --bg-card-strong: #ffffff;
  --line-soft: rgba(15, 23, 42, 0.1);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --brand-1: #f59e0b;
  --brand-2: #f97316;
  --brand-3: #0f172a;
  --ok: #16a34a;
  --warn: #ea580c;
  --danger: #dc2626;
  --shadow-soft: 0 20px 40px -30px rgba(15, 23, 42, 0.6);
  --shadow-card: 0 24px 48px -36px rgba(15, 23, 42, 0.35);
  --radius-xl: 22px;
  /* Tenant theme — overridden via JS per tenant */
  --app-primary: #f59e0b;
  --app-secondary: #f97316;
  --app-primary-rgb: 245, 158, 11;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 15% 10%, rgba(249, 115, 22, 0.24), transparent 42%),
    radial-gradient(circle at 85% 0%, rgba(245, 158, 11, 0.18), transparent 44%),
    linear-gradient(135deg, #f6f4ef, #eff4ff 60%, #f8fbff);
  padding: 18px;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.mobile-frame {
  width: 100%;
  min-height: calc(100vh - 36px);
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 34px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}

.screen-wrap {
  padding: 28px;
}

.brand-block {
  text-align: center;
  padding: 22px 0 14px;
}

.logo-mark {
  margin: 0 auto 14px;
  width: 76px;
  height: 76px;
  border-radius: 25px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--app-primary, #f59e0b), var(--app-secondary, #f97316));
  box-shadow: 0 16px 28px -16px rgba(var(--app-primary-rgb, 249, 115, 22), 0.75);
}

.brand-block h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  letter-spacing: -0.02em;
}

.brand-block p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text-main);
  background: #fff;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--app-primary, rgba(249, 115, 22, 0.7));
  box-shadow: 0 0 0 4px rgba(var(--app-primary-rgb, 249, 115, 22), 0.18);
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--app-primary, #f59e0b), var(--app-secondary, #f97316));
  box-shadow: 0 18px 26px -18px rgba(var(--app-primary-rgb, 234, 88, 12), 0.8);
}

.btn-primary:hover {
  box-shadow: 0 18px 30px -14px rgba(var(--app-primary-rgb, 234, 88, 12), 0.85);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand-3);
  border: 1px solid var(--line-soft);
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-small {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 11px;
}

.hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.stack {
  display: grid;
  gap: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.title-wrap h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.95rem);
  letter-spacing: -0.02em;
}

.title-wrap p {
  margin: 5px 0 0;
  color: var(--text-muted);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  place-items: center;
}

.tab-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.tab-btn {
  border: 1px solid transparent;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-muted);
  padding: 10px 8px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

/* Old tab-btn active (pill style) — only for non-bottom-nav tabs */
.tab-btn.active:not(.tab-btn-bottom) {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(145deg, var(--app-primary, #f59e0b), var(--app-secondary, #f97316));
}

/* Bottom-nav tab active state */
.tab-btn-bottom.active {
  color: var(--app-primary, #f59e0b) !important;
  background: transparent !important;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  background: var(--bg-card-strong);
  border-radius: 17px;
  border: 1px solid var(--line-soft);
  padding: 15px;
}

.stat-card .label {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.stat-card .value {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
}

.cards {
  display: grid;
  gap: 12px;
}

.content-card {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
}

.content-card h4 {
  margin: 0;
  font-size: 1rem;
}

.meta {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.section-title {
  margin: 0 0 12px;
  font-size: 1rem;
}

.badge {
  font-size: 0.76rem;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(var(--app-primary-rgb, 249, 115, 22), 0.25);
  color: var(--app-primary, #b45309);
  background: rgba(var(--app-primary-rgb, 249, 115, 22), 0.08);
}

.empty {
  text-align: center;
  padding: 22px;
  border-radius: 14px;
  border: 1px dashed rgba(100, 116, 139, 0.5);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.5);
}

.split {
  display: grid;
  gap: 14px;
  grid-template-columns: 1.2fr 1fr;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #0f172a;
  color: #fff;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  box-shadow: 0 18px 30px -20px rgba(15, 23, 42, 0.9);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.splash-screen {
  min-height: calc(100vh - 36px);
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(160deg, #0f172a, #1e293b 62%, #334155);
  color: #fff;
}

.splash-screen .logo-mark {
  width: 96px;
  height: 96px;
}

.splash-screen p {
  margin: 8px 0 0;
  color: rgba(226, 232, 240, 0.75);
}

.config-warning {
  margin-bottom: 14px;
  border: 1px solid rgba(234, 88, 12, 0.3);
  background: #fff7ed;
  color: #9a3412;
  border-radius: 14px;
  padding: 12px 14px;
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.list-table th,
.list-table td {
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  padding: 10px 6px;
  vertical-align: top;
}

.list-table th {
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.footer-note {
  color: var(--text-muted);
  font-size: 0.84rem;
}

@media (max-width: 920px) {
  .split {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .tab-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mobile-frame {
    border-radius: 24px;
    min-height: calc(100vh - 20px);
  }

  body {
    padding: 10px;
  }
}
