@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700;1,9..40,400&family=Fraunces:opsz,wght@9..144,500;9..144,700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&family=Literata:opsz,wght@7..72,500;7..72,700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=Space+Grotesk:wght@500;700&display=swap");

:root {
  --bg: #f3ead8;
  --surface: #ffffff;
  --surface2: #efe6d4;
  --text: #1a1a1a;
  --muted: #8a8174;
  --border: #d9d0bf;
  --accent: #8b2e2e;
  --accent-text: #ffffff;
  --radius: 10px;
  --radius-lg: 14px;
  --font-display: "IBM Plex Mono", ui-monospace, monospace;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 10px 30px rgba(40, 20, 10, 0.06);
}

html[data-theme="Receipt"][data-mode="Light"] {
  --bg: #f3ead8; --surface: #fff; --surface2: #efe6d4; --text: #1a1512; --muted: #8a8174; --border: #d4cbb8;
  --font-display: "IBM Plex Mono", monospace; --font-body: "Source Serif 4", serif; --radius: 10px; --radius-lg: 14px;
}
html[data-theme="Receipt"][data-mode="Dark"] {
  --bg: #1c1b19; --surface: #2a2825; --surface2: #35322e; --text: #f3ead8; --muted: #a89f90; --border: #4a453c;
  --accent-text: #1c1b19; --font-display: "IBM Plex Mono", monospace; --font-body: "Source Serif 4", serif;
}
html[data-theme="Espresso"][data-mode="Light"] {
  --bg: #f6efe4; --surface: #fff8ee; --surface2: #efe0c8; --text: #2a1c12; --muted: #8a7058; --border: #e2d2b8;
  --font-display: "Fraunces", serif; --font-body: "Source Serif 4", serif; --radius: 12px; --radius-lg: 18px;
}
html[data-theme="Espresso"][data-mode="Dark"] {
  --bg: #1c140e; --surface: #2a1f16; --surface2: #3a2b1e; --text: #f4e6d0; --muted: #c4a078; --border: #4a3828;
  --accent-text: #1c140e; --font-display: "Fraunces", serif; --font-body: "Source Serif 4", serif; --radius: 12px; --radius-lg: 18px;
}
html[data-theme="MinimalMono"][data-mode="Light"] {
  --bg: #f7f7f5; --surface: #ffffff; --surface2: #eeeeea; --text: #111; --muted: #6b6b66; --border: #d8d8d2;
  --font-display: "IBM Plex Sans", sans-serif; --font-body: "IBM Plex Sans", sans-serif; --font-mono: "IBM Plex Mono", monospace;
  --radius: 2px; --radius-lg: 4px;
}
html[data-theme="MinimalMono"][data-mode="Dark"] {
  --bg: #0b0b0b; --surface: #161616; --surface2: #222; --text: #f4f4f4; --muted: #9a9a96; --border: #333;
  --font-display: "IBM Plex Sans", sans-serif; --font-body: "IBM Plex Sans", sans-serif; --radius: 2px; --radius-lg: 4px;
}
html[data-theme="Botanical"][data-mode="Light"] {
  --bg: #e7eee6; --surface: #f7faf6; --surface2: #dce6da; --text: #1e2a1c; --muted: #6d7a6a; --border: #c9d4c6;
  --font-display: "Literata", serif; --font-body: "Source Serif 4", serif; --radius: 22px; --radius-lg: 28px;
}
html[data-theme="Botanical"][data-mode="Dark"] {
  --bg: #142016; --surface: #1d2c20; --surface2: #243628; --text: #e7eee6; --muted: #9bb09a; --border: #314836;
  --accent-text: #142016; --font-display: "Literata", serif; --font-body: "Source Serif 4", serif; --radius: 22px; --radius-lg: 28px;
}
html[data-theme="NeonBrew"][data-mode="Light"] {
  --bg: #f4eef8; --surface: #ffffff; --surface2: #eee4f6; --text: #1b1024; --muted: #7a6b86; --border: #e0d4ea;
  --font-display: "Space Grotesk", sans-serif; --font-body: "DM Sans", sans-serif; --radius: 18px; --radius-lg: 24px;
}
html[data-theme="NeonBrew"][data-mode="Dark"] {
  --bg: #160c22; --surface: #241534; --surface2: #2e1b42; --text: #f6eefe; --muted: #b9a7c9; --border: #3d2756;
  --accent-text: #160c22; --font-display: "Space Grotesk", sans-serif; --font-body: "DM Sans", sans-serif; --radius: 18px; --radius-lg: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.45;
}
h1, h2, h3, .brand-name, .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}
html[data-theme="MinimalMono"] .brand-name,
html[data-theme="MinimalMono"] .kicker,
html[data-theme="Receipt"] .brand-name,
html[data-theme="Receipt"] .kicker { text-transform: uppercase; letter-spacing: 0.08em; }

a { color: inherit; }
.muted { color: var(--muted); }
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
label, .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 6px;
}

.brand-bar { padding: 22px 22px 0; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-name { font-size: 15px; }
.logo, .logo-fallback {
  width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none;
}
html[data-theme="NeonBrew"] .logo-fallback,
html[data-theme="Botanical"] .logo-fallback,
html[data-theme="Espresso"] .logo-fallback { border-radius: 999px; }
.logo-fallback {
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text);
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
}
.shell { max-width: 420px; margin: 18px auto 40px; padding: 0 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.card.center { text-align: center; }
.card h1 { margin: 8px 0 10px; font-size: 28px; }
.rule { border: 0; border-top: 1px dashed var(--border); margin: 18px 0; }
html[data-theme="MinimalMono"] .rule { border-top-style: solid; }
.icon { width: 28px; height: 28px; margin: 0 auto 8px; color: var(--text); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="time"],
input[type="url"], select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 12px 12px;
  font-family: var(--font-body);
  font-size: 16px;
}
.btn, button.btn {
  display: block; width: 100%;
  background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: var(--radius);
  padding: 14px 16px; margin-top: 18px;
  font-family: var(--font-body); font-size: 18px; font-weight: 700;
  cursor: pointer; text-align: center; text-decoration: none;
}
html[data-theme="NeonBrew"] .btn { border-radius: 999px; }
.btn.secondary, button.secondary {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.pill {
  display: inline-block;
  background: var(--surface2);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.pill.accent { background: var(--accent); color: var(--accent-text); }
.footer-note { text-align: center; color: var(--muted); font-size: 14px; padding: 0 18px 28px; }
.qr { width: 220px; height: 220px; margin: 12px auto; display: block; background: #fff; padding: 8px; border-radius: 8px; }
.balance-num { font-family: var(--font-display); font-size: 64px; line-height: 1; margin: 6px 0; }
.error-box {
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px; margin: 14px 0;
}
.flash { padding: 10px 12px; border-radius: var(--radius); margin-bottom: 12px; }
.flash.ok { background: var(--surface2); }
.flash.bad { background: var(--surface2); border: 1px dashed var(--border); }

body.backoffice { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 18px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sidebar nav a, .sidebar .signout button {
  display: block; text-decoration: none; border: 0; background: none;
  padding: 10px 12px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 15px; color: var(--text); text-align: left; cursor: pointer; width: 100%;
}
.sidebar nav a.active { background: var(--accent); color: var(--accent-text); }
.sidebar .signout { border-top: 1px dashed var(--border); padding-top: 12px; }
.office-main { padding: 28px 36px 60px; }
.office-main h1 { font-size: 34px; margin: 6px 0 18px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.kpi .num { font-family: var(--font-display); font-size: 36px; }
.kpi .lbl { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
table.data th { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pair { display: flex; gap: 10px; align-items: center; }
.swatches { display: flex; gap: 8px; margin: 8px 0 16px; }
.swatch { width: 28px; height: 28px; border-radius: 999px; border: 2px solid var(--border); cursor: pointer; }
.theme-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.theme-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; display: block; }
.theme-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-card input { margin-bottom: 8px; }
.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hours-grid { display: grid; grid-template-columns: 120px 1fr 1fr 80px; gap: 8px; align-items: center; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.btn.inline { width: auto; display: inline-block; padding: 10px 16px; margin: 0; }

@media (max-width: 900px) {
  body.backoffice { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .kpi-row, .theme-cards, .qr-grid, .split { grid-template-columns: 1fr; }
  .office-main { padding: 18px; }
}
