/* ═══════════════════════════════════════════════════════════════════
   DESIGN TOKENS  –  single source of truth for the whole project
   ═══════════════════════════════════════════════════════════════════ */
:root {
  /* Palette */
  --brand-black: #111;
  --brand-white: #fff;
  --brand-orange: #f79a3b;
  --brand-blue: #69add2;
  --ink: #2b2a28;
  --muted: #7a766e;

  /* Module accent — overridden per page (e.g. :root { --module-color: #c86b2a; }) */
  --module-color: var(--brand-orange);

  /* Surfaces */
  --paper: #fff7e9;
  --paper-edge: #ebe6da;
  --table-head: #F2E9DA;
  --table-line: #E5DAC7;
  --ok: #e9ffe9;
  --warn: #ffe5e5;
  --disabled: #F7EEE1;

  /* Status — traffic-light palette (for operational status badges) */
  --status-pending-bg:    #fef9c3;
  --status-pending-color: #854d0e;
  --status-pending-border:#fde68a;
  --status-success-bg:    #dcfce7;
  --status-success-color: #166534;
  --status-success-border:#86efac;
  --status-danger-bg:     #fee2e2;
  --status-danger-color:  #991b1b;
  --status-danger-border: #fca5a5;
  --status-info-bg:       #dbeafe;
  --status-info-color:    #1e40af;
  --status-info-border:   #93c5fd;
  --status-warn-bg:       #fff7e8;
  --status-warn-color:    #92400e;
  --status-warn-border:   #fde1ae;

  /* Shape */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 8px 18px rgba(0,0,0,.06);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.3);
}

/* ═══════════════════════════════════════════════════════════════════
   GLOBAL
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0,0,0,.03) 1px, transparent 1px),
    linear-gradient(0deg,  rgba(0,0,0,.02) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0,0,0,.025), rgba(0,0,0,0)) no-repeat,
    #faf7f2;
  background-size: 16px 16px, 18px 18px, 100% 100%, auto;
  background-repeat: repeat, repeat, no-repeat, no-repeat;
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  width: 180px;
  background-color: #000;
  color: white;
  padding: 2rem 1rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  z-index: 9998;
  transition: left 0.3s ease;
}

.sidebar h1 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 2rem;
}

.sidebar a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 0 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
}

.sidebar a:hover,
.sidebar a.active {
  background-color: var(--brand-orange);
  color: black;
}

.sidebar a.disabled {
  background-color: transparent;
  color: #777;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.6;
}

.sidebar i { margin-right: 0.5rem; }
.sidebar svg { margin-right: 0.5rem; height: 16px; }

.sidebar-link-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-badge {
  margin-left: auto;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--status-danger-bg);
  color: var(--status-danger-color);
  border: 1px solid var(--status-danger-border);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.sidebar a.active .sidebar-badge,
.sidebar a:hover .sidebar-badge {
  background: #000;
  color: #fff;
  border-color: #000;
}

.sidebar .bottom {
  margin-top: auto;
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════════
   USER MENU
   ═══════════════════════════════════════════════════════════════════ */

.user-menu {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.notification-menu {
  position: relative;
  flex-shrink: 0;
}

.header-menu-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.notification-menu-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.2rem;
  padding: 0.35rem;
  gap: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
  line-height: 1;
}

.notification-menu-btn:hover { color: var(--brand-orange); }

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--status-danger-bg);
  color: var(--status-danger-color);
  border: 1px solid var(--status-danger-border);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  width: min(360px, 90vw);
  z-index: 1000;
  max-height: 75vh;
  overflow-y: auto;
}

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

.notification-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid var(--paper-edge);
}

.notification-item {
  display: block;
  padding: 0.8rem 1rem;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--paper-edge);
  transition: background 0.15s;
}

.notification-item:hover { background: var(--paper-edge); }

.notification-item-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}

.notification-item-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.task-audience {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

.notification-empty,
.notification-more {
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.user-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.4rem;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
  line-height: 1;
}

.user-menu-btn:hover { color: var(--brand-orange); }

.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  min-width: 200px;
  z-index: 1000;
}

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

.user-menu-name {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  border-bottom: 1px solid var(--paper-edge);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.user-menu-item:hover {
  background: var(--paper-edge);
  color: var(--brand-orange);
}

.user-menu-divider {
  border-top: 1px solid var(--paper-edge);
  margin: 0.25rem 0;
}

.user-menu-lang {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.user-menu-lang select {
  flex: 1;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background-color: var(--paper);
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════════════════════════════ */

main {
  flex: 1;
  overflow-y: auto;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  padding: 0;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════
   MESSAGES
   ═══════════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: min(360px, calc(100vw - 2.5rem));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-left-width: 4px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.13);
  pointer-events: all;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: toast-in 0.32s cubic-bezier(0.34,1.56,0.64,1) both;
}

.toast--hiding {
  animation: toast-out 0.38s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(calc(100% + 1.5rem)); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0);               max-height: 120px; }
  to   { opacity: 0; transform: translateX(calc(100% + 1.5rem)); max-height: 0; padding-top: 0; padding-bottom: 0; margin-bottom: 0; }
}

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.toast-body {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.45;
  color: inherit;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  font-size: 0.8rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.toast-close:hover { opacity: 1; }

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.25;
  width: 100%;
  animation: toast-progress 5s linear forwards;
  transform-origin: left;
}

@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* Variants */
.toast.success {
  border-left-color: #4caf50;
  color: #1a5c1e;
  background: #f0fdf4;
}

.toast.error {
  border-left-color: #ef4444;
  color: #7f1d1d;
  background: #fef2f2;
}

.toast.warning {
  border-left-color: #f59e0b;
  color: #78350f;
  background: #fffbeb;
}

.toast.info,
.toast.debug {
  border-left-color: var(--brand-blue);
  color: #1e3a5f;
  background: #eff6ff;
}

.toast:not(.success):not(.error):not(.warning):not(.info):not(.debug) {
  border-left-color: var(--brand-orange);
  color: #3a2a1a;
  background: var(--paper);
}

/* ═══════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════ */

table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--table-line);
  text-align: left;
}

table tr.no-border th,
table tr.no-border td { border-bottom: none !important; }

table th {
  background-color: var(--table-head);
  font-weight: 600;
  color: #3c362f;
}

td.active { border: 3px dashed var(--brand-orange); }

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════ */

.btn-primary {
  background: var(--module-color);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: filter 0.15s;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  justify-content: center;
}

.btn-primary:hover { filter: brightness(1.08); color: white; }

.btn-primary:disabled {
  background: #d1d5db;
  border-color: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
  filter: none;
}

/* Explicit orange button (unaffected by --module-color) */
.btn-orange {
  background: var(--brand-orange);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: filter 0.15s;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  text-align: center;
}

.btn-orange:hover { filter: brightness(1.05); }

.btn-orange:disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
  filter: none;
  opacity: 0.7;
}

.btn-secondary {
  background: var(--paper);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 600;
  transition: background 0.15s;
  border: 1px solid var(--paper-edge);
  cursor: pointer;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.btn-secondary:hover { background: var(--paper-edge); color: var(--ink); }

.btn-secondary.active { border: 2px solid var(--brand-orange); }

.btn-green, .btn-red {
  padding: 0.2rem 0.4rem;
  border-radius: 9999px;
  font-weight: bold;
  transition: filter 0.15s;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .2rem;
}

.btn-green { background: #4CAF50; color: white; }
.btn-green:hover { filter: brightness(.9); }
.btn-green:disabled { background: #ccc; color: #666; cursor: not-allowed; }

.btn-red { background: #f44336; color: white; }
.btn-red:hover { filter: brightness(.9); }
.btn-red:disabled { background: #ccc; color: #666; cursor: not-allowed; }

.btn-link {
  color: var(--ink);
  background-color: transparent;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: all 0.15s ease;
  font-size: 0.9rem;
}

.btn-link:hover {
  background-color: var(--paper-edge);
  color: var(--ink);
}

/* ── Header-style dropdown/nav button (used across many pages) ── */
.hdr-btn {
  display: flex; align-items: center; gap: .4rem;
  padding: .35rem .75rem;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  font-size: .82rem; font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s;
}
.hdr-btn:hover { background: var(--paper-edge); color: var(--ink); }
.hdr-btn i { color: var(--brand-orange); }

/* ═══════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════ */

.card {
  max-width: 700px;
  margin: auto;
  background: var(--paper);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--paper-edge);
}

/* Fluid card — full width, no max-width */
.card-fluid {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.centered-container {
  max-width: 800px;
  margin: auto;
}

/* ═══════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════ */



.form {
  position: relative;
  max-width: 100%;
  background: var(--paper);
  background: color-mix(in srgb, var(--module-color) 6%, var(--paper));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.form.centred {
  margin-top: 10px;
  margin-left: auto;
  margin-right: auto;
  max-width: 500px;
}

@media (max-width: 500px) {
  .form.centred {
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: auto;
    border-radius: 0;
  }
}

.form h1 {
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.2rem;
  margin-top: 1rem;
}

.form label, label.field-label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  color: #544c41;
  margin-bottom: .25rem;
}

.form input:not([type="checkbox"]),
.filter-bar input:not([type="checkbox"]),
.form select,
.filter-bar select,
.form textarea {
  width: 100%;
  padding: 0.6rem;
  font-size: 1rem;
  box-sizing: border-box;
  border: 1.5px solid var(--paper-edge);
  border-radius: var(--radius-sm);
  background-color: white;
  color: var(--ink);
  font-family: inherit;
}

.form select,
.filter-bar select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2210%22%20height%3D%225%22%20viewBox%3D%220%200%2010%205%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M0%200l5%205%205-5z%22%20fill%3D%22%23544c41%22/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.6em;
}

.form input:focus,
.filter-bar input:focus,
.form select:focus,
.filter-bar select:focus,
.form textarea:focus {
  border-color: var(--module-color);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--module-color) 20%, transparent);
}

.form .form-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════════════════════════════════ */

.filter-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: .5rem 1rem;
  align-items: end;
  width: 100%;
}

@media (min-width: 720px) {
  .filter-bar {
    grid-template-columns: auto auto auto 1fr auto;
    width: auto;
  }
}

.filter-group { display: grid; gap: .25rem; }

.filter-label {
  font-size: .8rem;
  color: var(--muted);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   STATUS BADGES  –  traffic-light palette
   ═══════════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; border: 1px solid transparent;
  white-space: nowrap; text-decoration: none;
}

.badge--pending {
  background: var(--status-pending-bg);
  color: var(--status-pending-color);
  border-color: var(--status-pending-border);
}
.badge--confirmed,
.badge--success,
.badge--approved {
  background: var(--status-success-bg);
  color: var(--status-success-color);
  border-color: var(--status-success-border);
}
.badge--cancelled,
.badge--rejected,
.badge--danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-color);
  border-color: var(--status-danger-border);
}
.badge--info {
  background: var(--status-info-bg);
  color: var(--status-info-color);
  border-color: var(--status-info-border);
}
.badge--warn {
  background: var(--status-warn-bg);
  color: var(--status-warn-color);
  border-color: var(--status-warn-border);
}

/* Table row tinting to match status badges */
tr.row-pending td  { background: color-mix(in srgb, var(--status-pending-bg) 60%, white); }
tr.row-confirmed td,
tr.row-success td  { background: color-mix(in srgb, var(--status-success-bg) 60%, white); }
tr.row-cancelled td,
tr.row-rejected td { background: color-mix(in srgb, var(--status-danger-bg) 60%, white); }
tr.row-info td     { background: color-mix(in srgb, var(--status-info-bg) 60%, white); }
tr.row-warn td     { background: color-mix(in srgb, var(--status-warn-bg) 60%, white); }

/* ═══════════════════════════════════════════════════════════════════
   MODALS  –  shared across warehouse, dashboard, etc.
   ═══════════════════════════════════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  animation: modal-fade .18s ease;
}
.modal-overlay.open { display: block; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal-panel {
  display: none;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, 95vw);
  max-height: 85vh;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  overflow: hidden;
  flex-direction: column;
  animation: modal-up .2s ease;
}
.modal-panel.open { display: flex; }

@keyframes modal-up {
  from { transform: translate(-50%, calc(-50% + 16px)); opacity: 0; }
  to   { transform: translate(-50%, -50%); opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--paper-edge);
  flex-shrink: 0;
}

.modal-title {
  font-weight: 900;
  font-size: 1.15rem;
  flex: 1;
  color: var(--ink);
}

.modal-close {
  background: none; border: none;
  font-size: 1.3rem; cursor: pointer;
  color: var(--muted); padding: .2rem .4rem; border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--ink); background: var(--paper-edge); }

.modal-body {
  flex: 1; overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: 1rem;
}

/* Modal sections (batch/barrel detail) */
.msec { border-radius: 10px; padding: .65rem .85rem; border: 1px solid; }
.msec-title {
  font-weight: 800; font-size: .88rem;
  display: flex; align-items: center; gap: .35rem;
  margin-bottom: .45rem;
}
.msec--pending   { background: #f5f5f5; border-color: #ddd; }
.msec--pending .msec-title { color: #888; }
.msec--milling   { background: #fefdf4; border-color: #f0d070; }
.msec--milling .msec-title { color: #6a5000; }
.msec--mashing   { background: #edf6fb; border-color: #6ea8c8; }
.msec--mashing .msec-title { color: #1a4d6a; }
.msec--fermentation { background: #edf9ea; border-color: #78b869; }
.msec--fermentation .msec-title { color: #1a4a10; }
.msec--first-distillation { background: #fdf6ec; border-color: #e09848; }
.msec--first-distillation .msec-title { color: #6b3c08; }
.msec--distillation { background: #fdf0e8; border-color: #c86b2a; }
.msec--distillation .msec-title { color: #5a2508; }
.msec--barrel    { background: #f5f0e8; border-color: #c9a96e; }
.msec--barrel .msec-title { color: #6b3a10; }

.mrow { font-size: .84rem; margin-bottom: .2rem; color: var(--ink); }
.mrow span { font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════
   SECTION HEADING
   ═══════════════════════════════════════════════════════════════════ */

.section-heading {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 800; font-size: 1rem; color: var(--ink);
  margin: 1.5rem 0 .6rem; padding-bottom: .3rem;
  border-bottom: 2px solid color-mix(in srgb, var(--module-color) 40%, transparent);
}
.section-heading i { color: var(--module-color); }

/* ═══════════════════════════════════════════════════════════════════
   SIDE NAV  (stock item sidebar, etc.)
   ═══════════════════════════════════════════════════════════════════ */

.side-nav { list-style: none; padding: 0; margin: 0; }

.side-nav li a {
  display: block;
  padding: .5rem .75rem;
  text-decoration: none;
  color: var(--ink);
  transition: background .15s, color .15s;
}
.side-nav li a:hover { background: var(--paper-edge); color: var(--ink); }
.side-nav li a.active {
  font-weight: 700;
  border-left: 3px solid var(--brand-orange);
  background: color-mix(in srgb, var(--brand-orange) 8%, var(--paper));
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════ */

.text-muted  { color: var(--muted); }
.text-small  { font-size: .85rem; color: var(--muted); }
.hidden      { display: none; }

.clickable-row { cursor: pointer; transition: background .12s; }
.clickable-row:hover td { background: color-mix(in srgb, var(--brand-orange) 5%, var(--paper)); }

.table-group-header {
  background: var(--table-head);
  font-weight: 700;
  font-size: .95rem;
  color: var(--ink);
  padding: .6rem .75rem;
}

/* Hide on mobile, show on desktop */
.mobile-hide { display: table-cell; }

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR MENU CATEGORIES
   ═══════════════════════════════════════════════════════════════════ */

.menu-category {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #aaa;
  margin: 1rem 0 0.5rem 0;
  letter-spacing: 0.05em;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.sidebar-menu-group {
  position: relative;
}

.sidebar-menu-trigger {
  width: 100%;
  color: white;
  background: transparent;
  border: 0;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 0 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.sidebar-menu-trigger:hover,
.sidebar-menu-group:focus-within > .sidebar-menu-trigger,
.sidebar-menu-group.active > .sidebar-menu-trigger {
  background-color: var(--brand-orange);
  color: black;
}

.sidebar-menu-trigger svg,
.sidebar-menu-trigger i:not(.sidebar-menu-chevron) {
  flex: 0 0 auto;
}

.sidebar-menu-chevron {
  margin-left: auto;
  margin-right: 0;
  font-size: 0.72rem;
  transition: transform 0.2s ease;
}

.sidebar-menu-group:hover .sidebar-menu-chevron,
.sidebar-menu-group:focus-within .sidebar-menu-chevron,
.sidebar-menu-group.open .sidebar-menu-chevron {
  transform: rotate(90deg);
}

.sidebar-submenu {
  display: none;
  flex-direction: column;
  margin-top: 0.35rem;
  margin-left: 0.35rem;
  width: calc(100% - 0.35rem);
  gap: 0.25rem;
  padding: 0.3rem;
  background: #141414;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 26px rgba(0,0,0,0.32);
  z-index: 10000;
}

.sidebar-menu-group:hover > .sidebar-submenu,
.sidebar-menu-group:focus-within > .sidebar-submenu,
.sidebar-menu-group.open > .sidebar-submenu {
  display: flex;
}

.sidebar-submenu a {
  padding: 0.45rem 0.45rem;
  font-size: 0.84rem;
  line-height: 1.2;
  white-space: normal;
}

.sidebar-submenu i,
.sidebar-submenu svg {
  width: 16px;
  flex: 0 0 16px;
}

/* ═══════════════════════════════════════════════════════════════════
   LAYOUT HELPERS
   ═══════════════════════════════════════════════════════════════════ */

.row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.row.centered { justify-content: center; }

/* ═══════════════════════════════════════════════════════════════════
   COUNTER
   ═══════════════════════════════════════════════════════════════════ */

.counter-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

.counter-button {
  padding: 0.5rem 1rem;
  font-size: 1.5rem !important;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-sm);
  background-color: var(--paper);
  color: var(--ink);
  touch-action: manipulation;
}

.counter-value {
  font-size: 1.5rem !important;
  width: 3rem;
  text-align: center;
  max-width: 100px;
  padding: 0.5rem 1rem !important;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius-sm);
  background-color: var(--paper);
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════════════════════
   HEADER BAR + BREADCRUMB
   ═══════════════════════════════════════════════════════════════════ */

.header-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .5rem 1rem;
  background: var(--paper);
  border-bottom: 1px solid var(--paper-edge);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: #333;
  color: #e0e0e0;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 8px rgba(0,0,0,0.1);
  width: 30px;
  height: 30px;
  text-decoration: none;
}

.header-button:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.3); }

.header-title {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.header-title svg { height: 16px; }

.home-button {
  background: var(--brand-orange);
  color: white;
  width: 30px;
  height: 30px;
}

.back-button {
  background: #333;
  color: #e0e0e0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  font-size: 0.78rem;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover { color: var(--brand-orange); }

.breadcrumb .sep {
  color: var(--paper-edge);
  font-size: 0.7rem;
  user-select: none;
}

.breadcrumb .current {
  color: var(--ink);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════
   BURGER (mobile sidebar toggle)
   ═══════════════════════════════════════════════════════════════════ */

.burger {
  display: none;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 0 8px rgba(0,0,0,0.3);
  padding: 0.5rem;
  font-size: 2rem;
  border: none;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 9999;
  cursor: pointer;
  border-top-right-radius: 5px;
  height: 55px;
  width: 55px;
  transition: left 0.3s ease;
}

.sidebar.open ~ .burger { left: 180px; }

/* ═══════════════════════════════════════════════════════════════════
   BIG BUTTON (home page tiles)
   ═══════════════════════════════════════════════════════════════════ */

.big-button {
  width: 170px;
  height: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  font-size: 1.8rem;
  text-align: center;
}

.big-button svg { height: 28.8px; }

@media (max-width: 600px) {
  .big-button { width: 120px; height: 120px; font-size: 1.5rem; }
}

@media (max-width: 400px) {
  .big-button { width: 100px; height: 100px; font-size: 1.2rem; }
}

/* ═══════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════ */

.footer { margin-top: 2rem; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

/* Desktop */
@media (min-width: 1201px) {
  .sidebar { left: 0; }
  main { margin-left: 180px; width: calc(100% - 180px); }
}

/* Mobile */
@media (max-width: 1200px) {
  .burger { display: block; }
  .sidebar { left: -200px; }
  .sidebar.open { left: 0; }
  main { margin-left: 0; padding: 0; width: 100%; }
  .sidebar-submenu { box-shadow: none; }
  .sidebar-menu-group:hover > .sidebar-submenu,
  .sidebar-menu-group:focus-within > .sidebar-submenu {
    display: none;
  }
  .sidebar-menu-group.open > .sidebar-submenu {
    display: flex;
  }
  .sidebar-menu-group:hover .sidebar-menu-chevron,
  .sidebar-menu-group:focus-within .sidebar-menu-chevron {
    transform: none;
  }
  .sidebar-menu-group.open .sidebar-menu-chevron {
    transform: rotate(90deg);
  }
}

@media (max-width: 768px) {
  .notification-menu-dropdown {
    position: fixed;
    top: var(--tasks-mobile-top, 64px);
    right: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    height: calc(100vh - var(--tasks-mobile-top, 64px));
    height: calc(100dvh - var(--tasks-mobile-top, 64px));
    max-height: none;
    border-radius: 0;
    overscroll-behavior-y: contain;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow-wrap: anywhere;
  }

  .mobile-hide { display: none !important; }

  .filter-bar {
    grid-template-columns: 1fr;
    width: 100%;
  }
}
