/* ============================================================
   THE DRAFT ROOM — DESIGN SYSTEM
   Bright, playful, rounded look: warm off-white surfaces, teal
   accent, pill buttons, soft shadows, friendly rounded type.
   ============================================================ */

* { box-sizing: border-box; }
html, body { height: 100%; }

:root {
  /* ---- Light theme (default): pure black & white ---- */
  --bg: #ffffff;
  --bg2: #ffffff;
  --card: #ffffff;
  --card2: #f4f4f5;
  --text: #18181b;
  --text-muted: rgba(24, 24, 27, 0.6);
  --stroke: #e4e4e7;
  --border: #e4e4e7;

  --primary: #18181b;
  --primary-dark: #000000;
  --primary-light: #3f3f46;
  --primary-tint: rgba(24, 24, 27, 0.07);
  --primary-contrast: #ffffff;

  --success: #16a34a;
  --ok: #16a34a;
  --ok-light: rgba(22, 163, 74, 0.12);

  --warning: #b45309;
  --warning-light: rgba(180, 83, 9, 0.13);

  --danger: #dc2626;
  --danger2: #ef4444;
  --danger-light: rgba(220, 38, 38, 0.11);

  --info: #3f3f46;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.16);

  --r: 20px;
  --radius: 20px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --opacity-low: 0.08;
  --opacity-med: 0.16;

  --muted: rgba(24, 24, 27, 0.6);
  --btn: var(--card2);
  --btn2: var(--card2);
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 68px;

  --transition: all 0.16s ease;
  --focus: rgba(24, 24, 27, 0.18);

  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---- Dark theme: explicit opt-in class, set on <html> pre-paint by an
   inline script in base.html (avoids a flash of the wrong theme) and kept
   in sync on <body> by app.js's toggle button. Light is the default. ---- */
html.dark-theme,
body.dark-theme {
  --bg: #0a0a0a;
  --bg2: #0a0a0a;
  --card: #191919;
  --card2: #232323;
  --text: #f4f4f5;
  --text-muted: rgba(244, 244, 245, 0.62);
  --stroke: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.1);

  --primary: #f4f4f5;
  --primary-dark: #ffffff;
  --primary-light: #d4d4d8;
  --primary-tint: rgba(244, 244, 245, 0.13);
  --primary-contrast: #101010;

  --success: #4ade80;
  --ok: #4ade80;
  --ok-light: rgba(74, 222, 128, 0.15);

  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, 0.15);

  --danger: #f87171;
  --danger2: #fca5a5;
  --danger-light: rgba(248, 113, 113, 0.15);

  --info: #d4d4d8;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.36);
  --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);

  --muted: rgba(244, 244, 245, 0.62);
  --btn: var(--card2);
  --btn2: var(--card2);
  --focus: rgba(244, 244, 245, 0.22);
}

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  margin: 0;
}

/* Draft Room brand photo as a persistent app-wide backdrop, desaturated to
   match the black & white theme. Fixed + behind everything via ::before so
   it doesn't repaint/scroll oddly (background-attachment:fixed is flaky on
   iOS Safari). */
body.app-body { position: relative; background: transparent; }
body.app-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6)),
              url('/static/background.PNG') center/cover no-repeat;
}
html.dark-theme body.app-body::before,
body.dark-theme.app-body::before {
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.55), rgba(10, 10, 10, 0.55)),
              url('/static/background.PNG') center/cover no-repeat;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.92; }
img { max-width: 100%; display: block; }

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; color: var(--text); font-family: var(--font); }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; margin: 0; }
h5 { font-size: 13px; font-weight: 700; margin: 0; }
h6 { font-size: 12px; font-weight: 700; margin: 0; }

.muted { color: var(--text-muted); }
.smalltxt { font-size: 12.5px; }
.strong { font-weight: 800; }
.big { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.small { font-size: 0.85rem; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, 0.35); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128, 128, 128, 0.5); }

/* ============================================================
   TOP NAVBAR (replaces the old left sidebar layout entirely)
   ============================================================ */
.app-body { display: block; }

.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--stroke);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
}

.navbar-logo { height: 38px; width: 38px; object-fit: contain; border-radius: var(--radius-sm); }

.navbar-nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.navlink2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
  transition: var(--transition);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.navlink2 i:not(.navdd-caret) { color: var(--primary); font-size: 13px; }
.navlink2:hover { background: var(--card2); color: var(--text); }
.navlink2.active { background: var(--primary); color: var(--primary-contrast); }
.navlink2.active i { color: var(--primary-contrast); }

.navdd { position: relative; }
.navdd-caret { font-size: 9px !important; color: var(--text-muted) !important; margin-left: -2px; transition: transform 0.15s ease; }
.navdd.open .navdd-caret { transform: rotate(180deg); }

.navdd-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 1001;
}

.navdd.open .navdd-menu { display: block; }

.navdd-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}
.navdd-menu a:hover { background: var(--primary-tint); color: var(--primary); }
.navdd-menu a i { color: var(--primary); width: 16px; text-align: center; }

.navbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.navbar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-right: 4px;
  line-height: 1.25;
}
.navbar-user-name { font-weight: 700; color: var(--text); font-size: 13px; }
.navbar-user-role { font-size: 11px; color: var(--text-muted); }

.theme-toggle, .logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--card2);
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  padding: 0;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--primary); color: var(--primary-contrast); }
.logout-btn:hover { background: var(--danger); color: #fff; }

.mobile-menu-btn { display: none; }

/* Mobile slide-down menu */
.mobile-menu-panel {
  display: none;
  position: fixed;
  top: 0; right: 0;
  width: min(320px, 88vw);
  height: 100vh;
  background: var(--card);
  border-left: 1px solid var(--stroke);
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  padding: 20px 14px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.mobile-menu-panel.open { display: block; transform: translateX(0); }

.mm-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-pill);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 14.5px;
  margin-bottom: 2px;
}
.mm-link i { width: 20px; text-align: center; color: var(--primary); }
.mm-link:hover, .mm-link.active { background: var(--primary-tint); color: var(--primary); }
.mm-link.mm-logout i { color: var(--danger); }
.mm-link.mm-logout:hover { background: var(--danger-light); color: var(--danger); }

.mm-divider {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 14px 14px 6px;
  border-top: 1px solid var(--stroke);
  margin-top: 8px;
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 15, 0.45);
  z-index: 1150;
}
.mobile-menu-overlay.open { display: block; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 60px);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alerts { padding: 14px 28px 0; display: flex; flex-direction: column; gap: 10px; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
}

.alert-success { background: linear-gradient(var(--ok-light), var(--ok-light)), var(--card); color: var(--success); }
.alert-warning { background: linear-gradient(var(--warning-light), var(--warning-light)), var(--card); color: var(--warning); }
.alert-danger  { background: linear-gradient(var(--danger-light), var(--danger-light)), var(--card); color: var(--danger); }
.alert-info    { background: linear-gradient(rgba(23, 162, 199, 0.12), rgba(23, 162, 199, 0.12)), var(--card); color: var(--info); }

.alert-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* ============================================================
   PAGE CONTENT / CONTAINER
   ============================================================ */
.page-content { flex: 1; padding: 28px; overflow-y: auto; }

.container { width: min(1200px, 100%); margin: 0 auto; }
main, .page, .content { width: min(1200px, calc(100% - 0px)); margin: 0 auto; }

.footer {
  padding: 16px 28px;
  border-top: 1px solid var(--stroke);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================================
   CARD SYSTEM
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card.mini { padding: 14px 16px; }
.card.center { max-width: 460px; margin: 0 auto; }

.cardhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--stroke);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--stroke);
}

.card-header h2 { font-size: 17px; font-weight: 700; }
.card-body { margin-bottom: 18px; }
.card-footer {
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.actions, .cardhead .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline { display: flex; gap: 8px; align-items: center; }

@media (max-width: 760px) {
  .cardhead { flex-direction: column; align-items: stretch; }
  .cardhead .actions { justify-content: flex-start; }
}

/* ============================================================
   HERO BANNER (brand photo)
   ============================================================ */
.hero-banner {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #2a2118, #14100c) url('/static/background.PNG') center/cover no-repeat;
  box-shadow: var(--shadow-md);
}

.hero-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(20, 14, 8, 0.72) 0%, rgba(20, 14, 8, 0.5) 100%);
}

.hero-banner-inner {
  position: relative;
  z-index: 1;
  padding: 16px 22px;
  color: #fff;
}

.hero-banner-inner h1 { color: #fff; font-size: 20px; }
.hero-banner-inner p { color: rgba(255, 255, 255, 0.82); margin-top: 4px; font-size: 13.5px; font-weight: 600; }

@media (max-width: 640px) {
  .hero-banner-inner { padding: 14px 18px; }
  .hero-banner-inner h1 { font-size: 17px; }
}

/* ============================================================
   LOGIN SCREEN (standalone page, no app chrome)
   ============================================================ */
.login-body {
  display: block;
  min-height: 100vh;
  position: relative;
  background: transparent;
}

.login-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
    url('/static/background.PNG') center/cover no-repeat;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-panel {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 34px 32px;
  text-align: center;
}

.login-logo { width: 64px; height: 64px; object-fit: contain; margin: 0 auto 14px; border-radius: var(--radius-md); }
.login-panel h1 { font-size: 22px; margin-bottom: 4px; }
.login-panel .muted { display: block; margin-bottom: 20px; font-size: 13px; }
.login-panel .form { text-align: left; }

@media (max-width: 480px) {
  .login-panel { padding: 26px 22px; }
}

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid { display: grid; gap: 18px; }
.grid-2, .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3, .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

@media (max-width: 900px) {
  .grid-3, .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid2, .grid-3, .grid3, .grid-4 { grid-template-columns: 1fr; }
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; } .gap-4 { gap: 32px; }

/* ============================================================
   FORMS / INPUTS
   ============================================================ */
label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.form { display: flex; flex-direction: column; gap: 14px; }
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; }

.form-control,
.input,
.textarea,
textarea,
select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  background: var(--card2);
  border: 1.5px solid var(--stroke);
  border-radius: var(--radius-md);
  transition: var(--transition);
  font-family: inherit;
  outline: none;
}

.form-control:focus,
.input:focus,
.textarea:focus,
textarea:focus,
select:focus,
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus);
  background: var(--card);
}

.input:hover { border-color: var(--primary-light); }

.input:disabled, select:disabled, textarea:disabled {
  background: var(--card2);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

textarea, .textarea { resize: vertical; min-height: 96px; }

select, select.input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--text);
  opacity: 1;
}

select option { background: var(--card); color: var(--text); }

::placeholder { color: var(--text-muted); opacity: 0.8; }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
  box-shadow: 0 0 0 1000px var(--card2) inset;
}

/* ============================================================
   BUTTONS — pill-shaped, playful
   ============================================================ */
.btn,
button,
[role="button"],
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  background: var(--primary);
  color: var(--primary-contrast);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn:hover, button:hover, input[type="submit"]:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn:active, button:active { transform: translateY(0); }

.btn:disabled, button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Reset chrome-free buttons used purely as icon controls */
.navlink2, .mobile-menu-btn, .theme-toggle, .logout-btn, .alert-close {
  box-shadow: none;
}
.navlink2:hover, .mobile-menu-btn:hover { transform: none; }

.btn.primary, .btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn.primary:hover, .btn-primary:hover { background: var(--primary-dark); }

.btn.danger, .btn-danger { background: var(--danger); color: #fff; }
.btn.danger:hover, .btn-danger:hover { background: #d63e3e; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #129671; }

.btn-secondary { background: var(--card2); color: var(--text); }
.btn-secondary:hover { background: var(--stroke); transform: translateY(-1px); }

.btn-outline, .btn-outline-secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--stroke);
}
.btn-outline:hover, .btn-outline-secondary:hover { background: var(--card2); border-color: var(--primary-light); }

.btn.small, .btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn.full { width: 100%; justify-content: center; }
.btn.btn-sm { padding: 7px 13px; font-size: 12.5px; }

/* ============================================================
   TABLES — div/grid "row" system used across most pages
   ============================================================ */
.table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.row {
  display: grid;
  gap: 12px;
  padding: 13px 16px;
  align-items: center;
  border-top: 1px solid var(--stroke);
  background: var(--card);
  transition: var(--transition);
}

.row:first-child { border-top: none; }
.row:hover { background: var(--card2); }

.row.head {
  background: var(--card2);
  border-top: none;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
  color: var(--text-muted);
}

.row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }

.table-wrapper, .tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Real <table> markup (e.g. reconcile_history.html) */
table.table {
  display: table;
  width: 100%;
  border-collapse: collapse;
}
table.table thead { background: var(--card2); }
table.table th {
  padding: 11px 16px;
  text-align: left;
  font-weight: 800;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--stroke);
}
table.table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--stroke);
  color: var(--text);
}
table.table tbody tr:hover td { background: var(--card2); }
table.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BULK EDIT TABLES
   ============================================================ */
.bulk-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius-md); overflow: hidden; }
.bulk-table thead { background: var(--card2); }
.bulk-table th { padding: 12px 14px; text-align: left; font-weight: 800; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--stroke); white-space: nowrap; }
.bulk-table td { padding: 8px 14px; border-bottom: 1px solid var(--stroke); }
.bulk-table tbody tr:hover { background: var(--card2); }

.bulk-input {
  width: 100%;
  padding: 7px 11px;
  font-size: 13px;
  border: 1.5px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  transition: var(--transition);
}
.bulk-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.bulk-input.error { border-color: var(--danger); background: var(--danger-light); }
.bulk-input[type="number"] { text-align: right; }

/* ============================================================
   DROPDOWNS
   ============================================================ */
.dropdown { position: relative; width: 100%; display: inline-block; }

.dropdown-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--card2);
  border: 1.5px solid var(--stroke);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  color: var(--text);
}

.dropdown-toggle:hover, .dropdown.open .dropdown-toggle { border-color: var(--primary); }

.dropdown-toggle .caret {
  width: 0; height: 0; margin-left: 8px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-muted);
}

.dropdown-toggle .value { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.dropdown-toggle .placeholder, .dropdown-toggle [data-dd-value].placeholder { color: var(--text-muted); }

.dropdown-menu {
  position: absolute;
  z-index: 500;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.dropdown.open .dropdown-menu { display: block; }

.dropdown-search { padding: 8px; border-bottom: 1px solid var(--stroke); }
.dropdown-search input { width: 100%; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text);
  border-top: 1px solid var(--stroke);
}
.dropdown-item:first-child { border-top: none; }
.dropdown-item:hover, .dropdown-item.active { background: var(--primary-tint); color: var(--primary); }

/* ============================================================
   TILES
   ============================================================ */
.tile {
  display: block;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.tile:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tile:active { transform: translateY(0); }
.tile.disabled { opacity: 0.45; pointer-events: none; }
.tile-title { font-weight: 800; font-size: 15px; color: var(--text); }
.tile-sub { margin-top: 4px; color: var(--text-muted); font-size: 12.5px; }

/* ============================================================
   DASHBOARD STATS + QUICK ACTIONS
   ============================================================ */
.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 900px) { .dash-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .dash-stats { gap: 8px; } }

.dash-stat {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.dash-stat:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }

.dash-stat-warn { border-color: rgba(245, 165, 36, 0.4); }
.dash-stat-warn .dash-stat-icon { color: var(--warning); background: var(--warning-light); }
.dash-stat-warn .dash-stat-val { color: var(--warning); }

.dash-stat-danger { border-color: rgba(239, 75, 75, 0.4); }
.dash-stat-danger .dash-stat-icon { color: var(--danger); background: var(--danger-light); }
.dash-stat-danger .dash-stat-val { color: var(--danger); }

.dash-stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-pill);
  background: var(--primary-tint);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}

.dash-stat-val { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
.dash-stat-lbl { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; font-weight: 700; }

.quick-actions { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }

.quick-btn {
  flex: 1; min-width: 110px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-decoration: none; color: var(--text);
  transition: var(--transition);
  font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.quick-btn i { font-size: 19px; color: var(--primary); }
.quick-btn:hover { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); transform: translateY(-2px); }
.quick-btn:hover i { color: var(--primary-contrast); }

@media (max-width: 480px) {
  .quick-btn { min-width: 76px; padding: 10px 6px; font-size: 11.5px; }
  .quick-btn i { font-size: 16px; }
}

/* ============================================================
   EMPTY STATE / TOASTS
   ============================================================ */
.empty {
  padding: 24px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--stroke);
  color: var(--text-muted);
  background: var(--card2);
  text-align: center;
  font-weight: 600;
}

.toasts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.toast { padding: 10px 16px; border-radius: var(--radius-md); border-left: 4px solid var(--stroke); background: var(--card); box-shadow: var(--shadow-sm); font-weight: 600; }
.toast.success { border-left-color: var(--ok); background: linear-gradient(var(--ok-light), var(--ok-light)), var(--card); color: var(--success); }
.toast.error { border-left-color: var(--danger); background: linear-gradient(var(--danger-light), var(--danger-light)), var(--card); color: var(--danger); }
.toast.warning { border-left-color: var(--warning); background: linear-gradient(var(--warning-light), var(--warning-light)), var(--card); color: var(--warning); }

/* ============================================================
   SPLIT LAYOUT / SECONDARY SIDEBAR (page-local, not #sidebar)
   ============================================================ */
.split { display: grid; grid-template-columns: 260px 1fr; gap: 14px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.sidebar {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  padding: 14px;
}

.sidehead { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }

.sidelink { display: block; text-decoration: none; color: var(--text); padding: 9px 12px; border-radius: var(--radius-pill); border: 1px solid transparent; font-weight: 600; }
.sidelink:hover { background: var(--card2); }
.sidelink.active { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }

/* ============================================================
   BEER PAGES
   ============================================================ */
.beer-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .beer-grid { grid-template-columns: 1fr 1fr; } }

.sheet { width: 100%; overflow: auto; border-radius: var(--radius-md); border: 1px solid var(--stroke); background: var(--card); }
.sheet table { width: 100%; border-collapse: collapse; min-width: 900px; }
.sheet th, .sheet td { padding: 10px 12px; border-bottom: 1px solid var(--stroke); vertical-align: middle; white-space: nowrap; }
.sheet th { position: sticky; top: 0; background: var(--card2); z-index: 2; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; font-size: 11.5px; color: var(--text-muted); }
.sheet tr:hover td { background: var(--card2); }

.cell-input { width: 100%; border: 1.5px solid var(--stroke); background: var(--card2); color: var(--text); padding: 7px 10px; border-radius: var(--radius-sm); outline: none; }
.cell-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--stroke); background: var(--card2);
  font-size: 12px; font-weight: 700; color: var(--text);
}
.pill.low { border-color: rgba(245, 165, 36, 0.4); background: var(--warning-light); color: var(--warning); }
.pill.critical { border-color: rgba(239, 75, 75, 0.4); background: var(--danger-light); color: var(--danger); }

.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 10px; }

.tap-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .tap-split { grid-template-columns: 1fr; } }

.tap-window { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius-lg); overflow: hidden; }
.tap-window-head { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--stroke); }
.tap-window-head h2 { margin: 0; font-size: 1.05rem; }
.tap-window table { width: 100%; table-layout: fixed; }

.pct-edit { display: inline-flex; align-items: center; gap: 8px; }
.pct-edit input, .tap-window input[type="number"] { width: 90px; }

/* beer-page / beers-page shared card + column layout (kept theme-aware) */
.beer-page .beer-header, .beers-page .beers-header {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.beer-page .beer-title, .beers-page .beers-title { margin: 0; font-size: 1.4rem; font-weight: 800; }
.beer-page .beer-subtitle, .beers-page .beers-subtitle { opacity: 0.75; font-size: 0.9rem; color: var(--text-muted); }
.beer-page .beer-actions, .beers-page .beers-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.beer-page .beer-analytics { display: grid; grid-template-columns: repeat(4, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 1200px) { .beer-page .beer-analytics { grid-template-columns: repeat(2, minmax(200px, 1fr)); } }
@media (max-width: 680px) { .beer-page .beer-analytics { grid-template-columns: 1fr; } }

.beer-page .beer-card, .beers-page .beers-card {
  background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius-lg); overflow: hidden;
}
.beer-page .beer-card-head, .beers-page .beers-card-head {
  padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card2); border-bottom: 1px solid var(--stroke);
}
.beer-page .beer-card-head-tight, .beers-page .beers-card-head-tight { padding: 10px 13px; }
.beer-page .beer-card-title, .beers-page .beers-card-title { font-weight: 800; line-height: 1.1; }
.beer-page .beer-card-subtitle, .beers-page .beers-card-subtitle { opacity: 0.75; font-size: 0.85rem; margin-top: 2px; color: var(--text-muted); }
.beer-page .beer-card-body, .beers-page .beers-card-body { padding: 13px 15px; }
.beer-page .beer-pill, .beers-page .beers-pill { padding: 5px 12px; border-radius: var(--radius-pill); font-size: 0.8rem; background: var(--card2); border: 1px solid var(--stroke); font-weight: 700; }

.beer-page .beer-panels, .beers-page .beers-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
@media (max-width: 1200px) { .beer-page .beer-panels, .beers-page .beers-panels { grid-template-columns: 1fr; } }

.beer-page .beer-table-wrap, .beers-page .beers-table-wrap { overflow: auto; }
.beer-page .beer-table, .beers-page .beers-table { width: 100%; margin: 0; color: var(--text); border-collapse: collapse; }
.beer-page .beer-table thead th, .beers-page .beers-table thead th {
  background: var(--card2); color: var(--text); border-bottom: 1px solid var(--stroke); white-space: nowrap; padding: 10px 12px; text-align: left;
}
.beer-page .beer-table tbody td, .beers-page .beers-table tbody td {
  background: transparent; border-top: 1px solid var(--stroke); vertical-align: middle; padding: 8px 12px;
}
.beer-page .beer-table.table-hover tbody tr:hover td,
.beers-page .beers-table.table-hover tbody tr:hover td { background: var(--card2); }

.beer-page .col-tap, .beers-page .bcol-abv, .beers-page .bcol-cups { width: 90px; }
.beer-page .col-percent { width: 220px; }
.beer-page .col-kegs, .beers-page .bcol-keg { width: 110px; }
.beer-page .col-action { width: 140px; }
.beer-page .col-beer, .beers-page .bcol-beer, .beers-page .bcol-name, .beers-page .bcol-brewery { min-width: 240px; }
.beers-page .bcol-style { width: 160px; }
.beers-page .bcol-cost, .beers-page .bcol-price, .beers-page .bcol-back { width: 110px; }
.beers-page .bcol-actions { min-width: 200px; }

.beer-page .beer-percent { display: flex; align-items: center; gap: 10px; }
.beer-page .beer-percent-input { width: 100px; min-width: 100px; }
.beer-page .beer-progress { height: 6px; margin-top: 8px; background: var(--card2); border-radius: var(--radius-pill); overflow: hidden; }
.beer-page .beer-check { display: flex; align-items: center; gap: 10px; padding: 10px 0 2px 2px; }

.beers-page .beers-row-actions { margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; }

.bulk-savebar { position: fixed; left: 0; right: 0; bottom: 16px; z-index: 1055; padding: 0 16px; }
.bulk-savebar-inner {
  max-width: 1100px; margin: 0 auto; background: var(--card); border: 1px solid var(--stroke);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.bulk-savebar-title { font-weight: 800; line-height: 1.1; }
.bulk-savebar-sub { opacity: 0.75; font-size: 0.85rem; margin-top: 2px; color: var(--text-muted); }
.bulk-savebar-right { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   MODAL (generic reusable — most modals in this app are
   still built with inline position:fixed styles, which already
   read var(--card)/var(--stroke)/var(--text) and pick up the
   new theme automatically)
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(30, 20, 15, 0.5); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--stroke); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--stroke); display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   STATUS TEXT / BADGES (theme-aware)
   ============================================================ */
.text-status-active { color: var(--success); }
.text-status-inactive { color: var(--danger); }

.badge { padding: 4px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; }
.badge-status { padding: 3px 9px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; }
.badge-status-active   { background: var(--ok-light); color: var(--success); }
.badge-status-inactive { background: var(--danger-light); color: var(--danger); }
.badge-status-raw      { background: rgba(23, 162, 199, 0.14); color: var(--info); }
.badge-status-other    { background: rgba(168, 85, 247, 0.14); color: #a855f7; }

.avatar { width: 36px; height: 36px; border-radius: var(--radius-pill); }

/* Category icon badge — small colored circle, used anywhere a category name appears */
.cat-badge-sm {
  display:inline-flex; align-items:center; justify-content:center; flex-shrink:0;
  width:20px; height:20px; border-radius:50%; font-size:10px;
  background:var(--card2); color:var(--text-muted); border:1px solid var(--stroke);
}
.avatar-lg { width: 56px; height: 56px; border-radius: var(--radius-pill); }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--stroke);
  justify-content: space-around;
  align-items: center;
  height: 64px;
  z-index: 999;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom)) 0;
}

.mobile-bottom-nav a, .mobile-bottom-nav .nav-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; height: 56px; color: var(--text-muted); text-decoration: none;
  font-size: 10.5px; font-weight: 700; gap: 3px; transition: var(--transition); border-radius: var(--radius-md); margin: 0 4px;
}
.mobile-bottom-nav a i { font-size: 21px; }
.mobile-bottom-nav a:hover, .mobile-bottom-nav a.active { color: var(--primary); background: var(--primary-tint); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .navbar-nav { display: none; }
  .navbar-user { display: none; }
  .mobile-menu-btn {
    display: flex; align-items: center; justify-content: center;
    background: var(--card2); border: none; color: var(--text);
    width: 38px; height: 38px; border-radius: var(--radius-pill); font-size: 16px; cursor: pointer;
  }
  .mobile-menu-btn:hover { background: var(--primary-tint); color: var(--primary); }
}

@media (max-width: 768px) {
  main.main-content { padding-bottom: 76px; }

  .navbar-inner { padding: 10px 14px; gap: 10px; }
  .navbar-brand span { display: none; }

  .page-content { padding: 14px; padding-bottom: 28px; }
  .alerts { padding: 12px 14px 0; }

  .card { padding: 16px; border-radius: var(--radius-md); }

  .table, table.table { font-size: 12.5px; }
  table.table th, table.table td { padding: 8px 10px; }

  .grid-2, .grid2, .grid-3, .grid3, .grid-4 { grid-template-columns: 1fr; gap: 12px; }

  .bulk-table th, .bulk-table td { padding: 8px; font-size: 12px; }

  .mobile-bottom-nav { display: flex; }

  .btn { min-height: 46px; font-size: 15px; }
  .form-control, .input, textarea, select { min-height: 46px; font-size: 16px; }

  h1 { font-size: 21px; } h2 { font-size: 17px; } h3 { font-size: 14px; }

  .dropdown-menu { max-height: 260px; }
}

@media (max-width: 480px) {
  .page-content { padding: 12px; }
  .card { padding: 14px; }
  .card-footer { flex-direction: column; }
  .card-footer .btn { width: 100%; }
  .btn { min-height: 44px; padding: 10px 16px; }
  h1 { font-size: 19px; } h2 { font-size: 16px; }
}

@media (min-width: 769px) {
  .mobile-bottom-nav { display: none !important; }
  main.main-content { padding-bottom: 0; }
}

@media (any-hover: none) {
  .btn:hover, a:hover { transform: none; }
  .btn:active, a:active { opacity: 0.85; transform: scale(0.99); }
}
