/* Theme adjustments for dark mode in tweaks.css */
html[data-mode="dark"] .twk-panel {
  background: rgba(37, 32, 26, 0.92);
  color: var(--ink-1);
  border-color: rgba(255,255,255,0.1);
}

html[data-mode="dark"] .twk-card {
  background: rgba(60, 50, 40, 0.4);
  border-color: var(--rule);
}
html[data-mode="dark"] .twk-card:hover { background: rgba(60, 50, 40, 0.6); }
html[data-mode="dark"] .twk-card.on {
  background: var(--primary);
  color: var(--primary-soft);
  border-color: var(--primary);
}

html[data-mode="dark"] .twk-seg {
  background: rgba(60, 50, 40, 0.4);
  border-color: var(--rule);
}
html[data-mode="dark"] .twk-seg button { color: var(--ink-2); }
html[data-mode="dark"] .twk-seg button.on {
  background: var(--primary);
  color: var(--primary-soft);
  border-color: var(--primary);
}

/* Firebase connection indicator */
.fb-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  border: 1px solid transparent;
  transition: all 0.4s;
  cursor: default;
  white-space: nowrap;
}
.fb-status[data-online="true"] {
  background: var(--green-soft);
  color: var(--green);
  border-color: transparent;
}
.fb-status[data-online="false"] {
  background: var(--slate-soft);
  color: var(--ink-4);
  border-color: var(--rule);
}
.fb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}
.fb-status[data-online="true"] .fb-dot {
  animation: fb-pulse 2s ease-in-out infinite;
}
@keyframes fb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.75); }
}

/* Tweaks panel UI */
.twk-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2147483646;
  width: 320px;
  max-height: calc(100vh - 36px);
  display: none;
  flex-direction: column;
  background: rgba(253, 251, 247, 0.92);
  color: var(--ink-1);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 18px 50px rgba(60,45,25,0.20);
  font-family: var(--font-sans);
  font-size: 12px;
  overflow: hidden;
}

.twk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, rgba(255,255,255,0.5), transparent);
}

.twk-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--ink-1);
}

.twk-close {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}
.twk-close:hover { color: var(--ink-1); }

.twk-body {
  overflow-y: auto;
  padding: 14px;
}

.twk-sec { margin-bottom: 16px; }
.twk-sec:last-child { margin-bottom: 0; }

.twk-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.twk-sub {
  font-size: 11px;
  color: var(--ink-3);
  margin: 2px 0 9px;
  line-height: 1.35;
}

.twk-grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.twk-card {
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 9px 7px 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
  font-family: inherit;
}

.twk-card:hover { background: #fff; }

.twk-card.on {
  background: var(--ink-1);
  color: #f3e9d6;
  border-color: var(--ink-1);
  box-shadow: 0 4px 12px rgba(60,45,25,0.18);
}

.twk-swatch {
  display: flex;
  height: 18px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 7px;
  border: 1px solid rgba(0,0,0,0.06);
}
.twk-swatch span { flex: 1; }

.sw-heritage span:nth-child(1) { background: #f6f3ed; }
.sw-heritage span:nth-child(2) { background: #b08544; }
.sw-heritage span:nth-child(3) { background: #2a251e; }

.sw-modernist span:nth-child(1) { background: #f4f1ec; }
.sw-modernist span:nth-child(2) { background: #c83a2c; }
.sw-modernist span:nth-child(3) { background: #0a0908; }

.sw-bauhaus span:nth-child(1) { background: #f9f5e9; }
.sw-bauhaus span:nth-child(2) { background: #e63946; }
.sw-bauhaus span:nth-child(3) { background: #1d4ed8; }

.twk-cn {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.twk-cd {
  font-size: 9.5px;
  margin-top: 2px;
  opacity: 0.7;
  line-height: 1.25;
}

.twk-card.on .twk-cd { opacity: 0.85; color: #d8cfbe; }

.twk-seg {
  display: flex;
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.twk-seg button {
  flex: 1;
  background: transparent;
  border: none;
  padding: 7px 8px;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.12s;
}

.twk-seg button:hover { color: var(--ink-1); }

.twk-seg button.on {
  background: var(--ink-1);
  color: #f3e9d6;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(60,45,25,0.20);
}

/* ───────────────────────────────── AESTHETIC: HERITAGE (default — already in style.css) */

/* ───────────────────────────────── AESTHETIC: MODERNIST */
html[data-aesthetic="modernist"] {
  --bg: #f4f1ec;
  --paper: #ffffff;
  --paper-2: #f7f4ee;
  --card: #ffffff;
  --ink-1: #0a0908;
  --ink-2: #1f1d1a;
  --ink-3: #5a554d;
  --ink-4: #8a847b;
  --rule: #d8d3ca;
  --rule-2: #b8b1a4;
  --gold: #c83a2c;
  --gold-ink: #a32b1f;
  --gold-soft: #fbe5e1;
  --blue: #1f3a5f;
  --blue-ink: #15294a;
  --blue-soft: #e0e5ec;
  --green: #1f5f3a;
  --green-soft: #d8ead9;
  --red: #c83a2c;
  --red-soft: #fbe5e1;
  --slate-soft: #e6e1d8;
  --font-display: var(--font-sans);
}
html[data-aesthetic="modernist"] body {
  font-feature-settings: normal;
}
html[data-aesthetic="modernist"] .page-head h2,
html[data-aesthetic="modernist"] .stl,
html[data-aesthetic="modernist"] .brand-name,
html[data-aesthetic="modernist"] .sc-v,
html[data-aesthetic="modernist"] .rno {
  font-family: var(--font-sans);
  letter-spacing: -0.025em;
  font-weight: 700;
}
html[data-aesthetic="modernist"] .page-head h2 { font-size: 30px; }
html[data-aesthetic="modernist"] .sidebar {
  background: #0a0908;
  color: #d8d3ca;
}
html[data-aesthetic="modernist"] .brand-logo {
  background: var(--gold);
  color: #fff;
  border-radius: 0;
}
html[data-aesthetic="modernist"] .card,
html[data-aesthetic="modernist"] .sc {
  border-radius: 2px;
  border: 1px solid var(--ink-1);
  box-shadow: 4px 4px 0 var(--ink-1);
}
html[data-aesthetic="modernist"] .sc::before { background: var(--gold); width: 4px; }
html[data-aesthetic="modernist"] .btn { border-radius: 2px; }
html[data-aesthetic="modernist"] .rc { border-radius: 2px; }
html[data-aesthetic="modernist"] .invoice-doc::before {
  background: var(--gold);
  height: 6px;
}
html[data-aesthetic="modernist"] .nav-i.active {
  border-left-color: var(--gold);
  background: rgba(200,58,44,0.14);
}
html[data-aesthetic="modernist"] .nav-ic { color: var(--gold); }
html[data-aesthetic="modernist"] .tab.active {
  border-bottom-color: var(--gold);
  color: var(--gold-ink);
}
html[data-aesthetic="modernist"] .afill {
  background: var(--gold);
}
html[data-aesthetic="modernist"] .tb-av {
  background: var(--gold);
  color: #fff;
  border-radius: 2px;
}
html[data-aesthetic="modernist"] .badge {
  border-radius: 2px;
}

/* ───────────────────────────────── AESTHETIC: BAUHAUS */
html[data-aesthetic="bauhaus"] {
  --bg: #f9f5e9;
  --paper: #ffffff;
  --paper-2: #fbf8ec;
  --card: #ffffff;
  --ink-1: #1d1d1b;
  --ink-2: #2d2d29;
  --ink-3: #5a564f;
  --ink-4: #8a857c;
  --rule: #1d1d1b;
  --rule-2: #1d1d1b;
  --gold: #fbbf24;
  --gold-ink: #b8860b;
  --gold-soft: #fef3c7;
  --blue: #1d4ed8;
  --blue-ink: #1e3a8a;
  --blue-soft: #dbeafe;
  --green: #15803d;
  --green-soft: #dcfce7;
  --red: #e63946;
  --red-soft: #fee2e2;
  --slate-soft: #f3f0e3;
  --font-display: var(--font-sans);
}
html[data-aesthetic="bauhaus"] .card,
html[data-aesthetic="bauhaus"] .sc {
  border: 2px solid var(--ink-1);
  border-radius: 0;
  box-shadow: none;
}
html[data-aesthetic="bauhaus"] .card { border-radius: 0; }
html[data-aesthetic="bauhaus"] .sc {
  border-radius: 0;
}
html[data-aesthetic="bauhaus"] .sc::before { background: var(--blue); width: 6px; }
html[data-aesthetic="bauhaus"] .sc:nth-child(2)::before { background: var(--gold); }
html[data-aesthetic="bauhaus"] .sc:nth-child(3)::before { background: var(--red); }
html[data-aesthetic="bauhaus"] .sc:nth-child(4)::before { background: var(--ink-1); }
html[data-aesthetic="bauhaus"] .brand-logo {
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  font-family: var(--font-sans);
  font-weight: 800;
}
html[data-aesthetic="bauhaus"] .sidebar {
  background: var(--ink-1);
  border-right: none;
}
html[data-aesthetic="bauhaus"] .nav-i.active {
  background: var(--gold);
  color: var(--ink-1);
  border-left: 4px solid var(--red);
  font-weight: 700;
}
html[data-aesthetic="bauhaus"] .nav-i.active .nav-ic { color: var(--ink-1); }
html[data-aesthetic="bauhaus"] .btn { border-radius: 0; border-width: 2px; font-weight: 600; }
html[data-aesthetic="bauhaus"] .btn-p { background: var(--blue); border-color: var(--blue); color: #fff; }
html[data-aesthetic="bauhaus"] .btn-s { background: var(--green); border-color: var(--green); }
html[data-aesthetic="bauhaus"] .btn-d { background: var(--red); border-color: var(--red); }
html[data-aesthetic="bauhaus"] .rc { border-radius: 0; border-width: 2px; }
html[data-aesthetic="bauhaus"] .s-av { background: var(--blue); color: #fff; border-color: var(--ink-1); }
html[data-aesthetic="bauhaus"] .s-paid, html[data-aesthetic="bauhaus"] .s-oc.s-paid { background: var(--green); color: #fff; border-color: var(--ink-1); }
html[data-aesthetic="bauhaus"] .s-oc { background: var(--red); color: #fff; border-color: var(--ink-1); }
html[data-aesthetic="bauhaus"] .s-rs { background: var(--gold); color: var(--ink-1); border-color: var(--ink-1); }
html[data-aesthetic="bauhaus"] .s-mn { background: #fff; color: var(--ink-1); border-color: var(--ink-1); }
html[data-aesthetic="bauhaus"] .badge { border-radius: 0; border-width: 2px; font-weight: 700; }
html[data-aesthetic="bauhaus"] .tb-av { background: var(--red); color: #fff; border-radius: 50%; }
html[data-aesthetic="bauhaus"] input,
html[data-aesthetic="bauhaus"] select,
html[data-aesthetic="bauhaus"] textarea {
  border-radius: 0;
  border: 2px solid var(--ink-1);
}
html[data-aesthetic="bauhaus"] input:focus,
html[data-aesthetic="bauhaus"] select:focus {
  border-color: var(--blue);
  box-shadow: 4px 4px 0 var(--blue);
}
html[data-aesthetic="bauhaus"] .invoice-doc::before {
  background: linear-gradient(90deg, var(--red) 0%, var(--red) 33%, var(--gold) 33%, var(--gold) 66%, var(--blue) 66%);
  height: 8px;
}
html[data-aesthetic="bauhaus"] .afill { background: var(--blue); }
html[data-aesthetic="bauhaus"] .tab.active { border-bottom-color: var(--red); color: var(--red); border-bottom-width: 3px; }

/* ───────────────────────────────── DENSITY: OPERATIONAL */
html[data-density="operational"] {
  font-size: 12.5px;
}
html[data-density="operational"] .main { padding: 14px 18px 24px; }
html[data-density="operational"] .topbar { height: 44px; padding: 0 18px; }
html[data-density="operational"] .card { padding: 12px 14px; margin-bottom: 8px; border-radius: 4px; }
html[data-density="operational"] .sc { padding: 9px 12px; }
html[data-density="operational"] .sc-v { font-size: 22px; margin-top: 3px; }
html[data-density="operational"] .sc-lbl { font-size: 9.5px; }
html[data-density="operational"] .sc-s { font-size: 10.5px; margin-top: 3px; }
html[data-density="operational"] .page-head { margin-bottom: 10px; padding-bottom: 8px; }
html[data-density="operational"] .page-head h2 { font-size: 19px; }
html[data-density="operational"] .page-sub { font-size: 11.5px; }
html[data-density="operational"] .stl { font-size: 13.5px; }
html[data-density="operational"] th { padding: 6px 6px; font-size: 9.5px; }
html[data-density="operational"] td { padding: 6px 6px; font-size: 11.5px; }
html[data-density="operational"] .g2,
html[data-density="operational"] .g3,
html[data-density="operational"] .g4 { gap: 8px; margin-bottom: 8px; }
html[data-density="operational"] .room-g {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 5px;
}
html[data-density="operational"] .rc { padding: 7px 5px; }
html[data-density="operational"] .rno { font-size: 17px; }
html[data-density="operational"] .rtg { font-size: 9px; margin-top: 3px; }
html[data-density="operational"] .btn { padding: 5px 10px; font-size: 11.5px; }
html[data-density="operational"] .btn-xs { padding: 3px 6px; font-size: 10px; }
html[data-density="operational"] .fg { margin-bottom: 6px; }
html[data-density="operational"] .fg label { font-size: 10px; margin-bottom: 2px; }
html[data-density="operational"] input,
html[data-density="operational"] select,
html[data-density="operational"] textarea { padding: 5px 8px; font-size: 12px; }
html[data-density="operational"] .nav-i { padding: 6px 18px; font-size: 12px; }
html[data-density="operational"] .nav-sec { padding: 9px 18px 4px; }
html[data-density="operational"] .brand { padding: 14px 18px 12px; }

/* ───────────────────────────────── NUMERALS: MECHANICAL */
html[data-numerals="mechanical"] .sc-v,
html[data-numerals="mechanical"] .rno,
html[data-numerals="mechanical"] .right,
html[data-numerals="mechanical"] .tnum {
  font-family: var(--font-mono);
  font-feature-settings: "tnum", "zero";
  letter-spacing: -0.01em;
}
html[data-numerals="mechanical"] .sc-v { font-weight: 500; font-size: 24px; }
html[data-numerals="mechanical"] .rno { font-weight: 500; font-size: 19px; }
