/* App chrome only — forms/cards use daisyUI component classes. */
:root {
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #141414;
  color: #c8c8c8;
  padding: 1.25rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.brand-meta { min-width: 0; }
.brand-meta strong {
  display: block;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-meta span {
  display: block;
  font-size: 0.74rem;
  color: #7a7a7a;
  text-transform: capitalize;
  margin-top: 0.1rem;
}

.nav-group { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-label {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a7a7a;
  padding: 0.65rem 0.75rem 0.4rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  color: #c8c8c8;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-link:hover { background: #1f1f1f; color: #fff; }
.nav-link.active { background: #2a2a2a; color: #fff; }
.nav-link svg { width: 18px; height: 18px; opacity: 0.85; flex-shrink: 0; }
.nav-spacer { flex: 1; }
.nav-link.logout { color: #7a7a7a; }
.nav-link.logout:hover { color: #fff; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 35;
}
.sidebar-backdrop.show { display: block; }

.main { min-width: 0; display: flex; flex-direction: column; background: oklch(96% 0.005 250); }

.topbar {
  background: #fff;
  border-bottom: 1px solid #e6e8ec;
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #111318;
}
.topbar-title p {
  margin: 0.2rem 0 0;
  color: #6b7280;
  font-size: 0.86rem;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.content {
  padding: 1.85rem 1.85rem 3rem;
  max-width: 1180px;
  width: 100%;
}
.content.content-wide { max-width: 1320px; }

.grid-dash { display: grid; gap: 1.35rem; }
@media (min-width: 960px) {
  .grid-dash-2 { grid-template-columns: 1.3fr 0.95fr; align-items: start; }
}

.tpl-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.15rem;
}
.tpl-gallery-card {
  border: 1px solid #e6e8ec;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tpl-gallery-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}
.tpl-gallery-card.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.tpl-gallery-preview {
  background:
    linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 0.85rem;
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tpl-gallery-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  box-shadow: 0 8px 20px rgba(0,0,0,0.28);
}
.tpl-gallery-body {
  padding: 1rem 1.05rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
}
.tpl-gallery-body h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #111318;
}
.tpl-gallery-body p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #6b7280;
}

.timers-layout {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 960px) {
  .timers-layout {
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: start;
  }
}
.timer-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: min(70vh, 720px);
  overflow-y: auto;
}
.timer-list-item {
  border: 1px solid #e6e8ec;
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: #fafbfc;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.timer-list-item:hover { border-color: #bfdbfe; background: #fff; }
.timer-list-item.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.timer-list-item strong {
  display: block;
  font-size: 0.92rem;
  color: #111318;
}
.timer-list-item span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.hub-grid {
  display: grid;
  gap: 1.15rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.hub-card {
  border: 1px solid #e6e8ec;
  border-radius: 16px;
  background: #fff;
  padding: 1.25rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 150px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.hub-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}
.hub-card h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}
.hub-card p {
  margin: 0;
  font-size: 0.86rem;
  color: #6b7280;
  line-height: 1.45;
  flex: 1;
}
.tpl-swatches { display: flex; gap: 0.35rem; align-items: center; }
.tpl-swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
.layout-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}
.layout-pick label {
  border: 1px solid #e6e8ec;
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
  cursor: pointer;
  background: #fafbfc;
  display: block;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.layout-pick label:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
}
.layout-pick input { margin-right: 0.4rem; }
.layout-pick strong { display: block; font-size: 0.82rem; color: #111318; }
.layout-pick span { display: block; font-size: 0.72rem; color: #6b7280; margin-top: 0.15rem; }

.preview-stage-check {
  background-color: #f3f4f6;
  background-image:
    linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.preview-stage-check .preview-empty-msg { color: #6b7280; }
.preview-stage-check img { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18); }

.editor-shell {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}
@media (min-width: 1100px) {
  .editor-shell {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }
}
.editor-sidebar { max-width: 100%; }
.layout-pick-compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  max-height: 220px;
  overflow: auto;
}
.layout-pick-compact label {
  padding: 0.4rem 0.5rem;
}
.layout-pick-compact span { display: none; }
.hex-swatch {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 0.35rem;
  align-items: center;
}
.hex-swatch-color {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  background: #fff;
}
.unit-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}
.unit-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
  font-size: 0.78rem;
  background: #fff;
}
.style-carousel-track {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}
.style-carousel-dots {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 0.35rem;
}

.preview-stage {
  border: 1px solid #e6e8ec;
  border-radius: 16px;
  padding: 1.25rem;
  background:
    radial-gradient(ellipse 70% 80% at 50% 0%, rgba(37, 99, 235, 0.08), transparent),
    linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-stage img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.preview-stage .preview-empty-msg {
  color: rgba(255,255,255,0.55);
  font-size: 0.9rem;
  text-align: center;
  margin: 0;
}

.timer-card {
  border: 1px solid #e6e8ec;
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  background: #fff;
}
.timer-card-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.timer-card h3 {
  font-family: var(--font-accent);
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.timer-card .meta { font-size: 0.8rem; color: #6b7280; }
.timer-card .meta span { display: inline-block; margin-right: 0.7rem; }
.preview { margin-top: 0.9rem; }
.preview img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid #e6e8ec;
  background: #0f1720;
  display: block;
}
.embed {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.45;
  background: #f8f9fb;
  border: 1px solid #e6e8ec;
  border-radius: 10px;
  padding: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 0.85rem;
}
.embed.show { display: block; }

.actions-primary, .actions-secondary, .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.actions-primary, .row-actions { margin-top: 1rem; }
.actions-secondary { margin-top: 0.6rem; }

.audit-lines {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #6b7280;
  line-height: 1.55;
  max-height: 180px;
  overflow-y: auto;
}
.audit-lines div { padding: 0.3rem 0; border-bottom: 1px solid #e6e8ec; }

.preview-wrap {
  border: 1px solid #e6e8ec;
  border-radius: 12px;
  padding: 1rem;
  background: #f8f9fb;
  margin-bottom: 1rem;
}
.preview-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}

.bg-upload {
  border: 1px dashed #d5d8de;
  border-radius: 12px;
  padding: 1rem;
  background: #fafbfc;
  margin-top: 0.75rem;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.health-item {
  border: 1px solid #e6e8ec;
  border-radius: 12px;
  padding: 0.85rem;
  background: #fafbfc;
}
.health-item.ok strong { color: #16a34a; }
.health-item.bad strong { color: #dc2626; }

.events {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.45;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e6e8ec;
  border-radius: 12px;
  background: #fafbfc;
  padding: 0.65rem;
}
.events div { padding: 0.4rem 0.3rem; border-bottom: 1px solid #e6e8ec; }
.level-error { color: #dc2626; font-weight: 700; }
.level-warning { color: #b45309; font-weight: 700; }
.level-info { color: #2563eb; font-weight: 700; }

.token-box {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  word-break: break-all;
  background: #f8f9fb;
  border: 1px dashed #d5d8de;
  border-radius: 10px;
  padding: 0.85rem;
  margin: 0.6rem 0;
}

.toast-app {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: #111827;
  color: #fff;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  display: none;
  z-index: 50;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.toast-app.show { display: block; }

/* Utilities used from JS-rendered markup (Tailwind browser may not scan strings). */
.empty-panel {
  border: 1px dashed #d5d8de;
  border-radius: 14px;
  background: #f4f5f7;
  padding: 2.75rem 1.5rem;
  text-align: center;
}
.empty-panel p { margin: 0; }
.empty-panel .empty-title { font-weight: 650; font-size: 1rem; color: #111318; }
.empty-panel .empty-sub { margin-top: 0.5rem; font-size: 0.875rem; color: #6b7280; }

.billing-kpis {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: #6b7280;
  margin-top: 0.35rem;
}
.billing-kpis span strong { color: #111318; }

.mobile-nav-toggle { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, var(--sidebar-w));
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-nav-toggle { display: inline-flex; }
  .content { padding: 1.15rem 1rem 2rem; }
  .health-grid { grid-template-columns: 1fr 1fr; }
  .actions-primary .btn,
  .actions-secondary .btn,
  .row-actions .btn { width: 100%; }
}
@media (max-width: 620px) {
  .health-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0.85rem 1rem; }
}

/* Custom BitView-inspired daisyUI theme */
[data-theme="bitview"] {
  color-scheme: light;
  --color-base-100: #ffffff;
  --color-base-200: #f4f5f7;
  --color-base-300: #e6e8ec;
  --color-base-content: #111318;
  --color-primary: #2563eb;
  --color-primary-content: #ffffff;
  --color-secondary: #111827;
  --color-secondary-content: #ffffff;
  --color-accent: #0ea5e9;
  --color-accent-content: #ffffff;
  --color-neutral: #1f2937;
  --color-neutral-content: #f9fafb;
  --color-info: #3b82f6;
  --color-info-content: #ffffff;
  --color-success: #16a34a;
  --color-success-content: #ffffff;
  --color-warning: #d97706;
  --color-warning-content: #ffffff;
  --color-error: #dc2626;
  --color-error-content: #ffffff;
  --radius-selector: 0.75rem;
  --radius-field: 0.7rem;
  --radius-box: 0.9rem;
  --size-selector: 0.25rem;
  --size-field: 0.25rem;
  --border: 1px;
  --depth: 0.5;
  --noise: 0;
}
