/* =========================================================================
   Noosa Kitchen — Modern Culinary Atelier Design System
   Refined hospitality operational platform for Pawoon & Odoo integration
   ========================================================================= */

0,9..144,600;0,9..144,700;1,9..144,400&family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Canvas & Surfaces */
  --bg: #F7F5F0;
  --panel: #FFFFFF;
  --panel-border: #E8E3DC;
  --panel-border-subtle: #F2EFEA;
  --input-bg: #FCFBF9;
  --header-bg: #FFFFFF;

  /* Typography Colors */
  --text: #1C1917;
  --text-dim: #78716C;
  --text-muted: #A8A29E;

  /* Brand Accents — Spiced Terracotta & Artisan Warmth */
  --accent: #C25E34;
  --accent-hover: #A84E29;
  --accent-surface: #FDF4ED;
  --accent-border: #F6D6C7;

  /* Status Colors */
  --ok: #2D6A4F;
  --ok-surface: rgba(45, 106, 79, 0.10);
  --warn: #D97706;
  --warn-surface: rgba(217, 119, 6, 0.10);
  --err: #BE123C;
  --err-surface: rgba(190, 18, 60, 0.08);

  /* Geometry & Shadows */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(28, 25, 23, 0.06), 0 2px 6px -1px rgba(28, 25, 23, 0.03);
  --shadow-lg: 0 12px 32px -4px rgba(28, 25, 23, 0.12);

  /* Font Stacks */
  --font-display: 'Fraunces', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', Menlo, Consolas, monospace;

  /* Layout Width */
  --max-width: 1220px;
}

/* =========================================================================
   Base Resets & Global Styles
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================================================
   Typography & Hierarchy
   ========================================================================= */

h1, .h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 6px;
}

h2, .h2 {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.display-heading {
  font-family: var(--font-display);
}

.subtitle {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 24px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* =========================================================================
   Topbar Navigation
   ========================================================================= */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--panel-border);
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.03);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .brand {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.topbar .brand::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(194, 94, 52, 0.5);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.topbar nav a:hover,
.topbar nav a.active {
  color: var(--accent);
  background: var(--accent-surface);
  font-weight: 600;
}

/* =========================================================================
   Main Container & Cards
   ========================================================================= */

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin-bottom: 0;
}

/* =========================================================================
   Grids & Form Controls
   ========================================================================= */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  margin-top: 14px;
}

label:first-child {
  margin-top: 0;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-surface);
  background: #FFFFFF;
}

.field-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.45;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.checkbox-row input {
  width: auto;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.checkbox-row label {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #FFFFFF;
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 5px rgba(194, 94, 52, 0.2);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn svg,
.station-icon svg {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  flex: 0 0 16px;
  display: inline-block;
}

.btn-station {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: var(--radius-pill);
}

.btn:hover {
  background: var(--accent-hover);
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(194, 94, 52, 0.25);
  filter: none;
}

.btn:active {
  transform: translateY(0);
}

.btn.secondary {
  background: #FFFFFF;
  border: 1px solid var(--panel-border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn.secondary:hover {
  background: #FAF8F5;
  border-color: #D6D0C5;
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(28, 25, 23, 0.05);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* =========================================================================
   Tables
   ========================================================================= */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
}

.table-scroll::-webkit-scrollbar {
  height: 6px;
}

.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 3px;
}

/* Fallback containment for panels that hold bare tables */
.panel:has(> table),
.panel:has(> form > table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  background: #FCFBF9;
  border-bottom: 1px solid var(--panel-border);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--panel-border-subtle);
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(194, 94, 52, 0.025);
}

td.num, .mono-cell {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

a.row-link, button.row-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease;
}

a.row-link:hover, button.row-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* =========================================================================
   Stat Cards & KPIs
   ========================================================================= */

.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  border-color: #D6D0C5;
  box-shadow: var(--shadow-md);
}

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--text-dim);
}

.stat-trend.up { color: var(--ok); }
.stat-trend.down { color: var(--err); }

/* =========================================================================
   Badges, Status & Alerts
   ========================================================================= */

.badge, .status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.status.success, .badge.in-stock {
  background: var(--ok-surface);
  color: var(--ok);
}

.status.running, .badge.low-stock {
  background: var(--warn-surface);
  color: var(--warn);
}

.status.failed, .badge.out-stock {
  background: var(--err-surface);
  color: var(--err);
}

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
}

.flash.error {
  background: var(--err-surface);
  color: var(--err);
  border: 1px solid rgba(190, 18, 60, 0.22);
}

.flash.success {
  background: var(--ok-surface);
  color: var(--ok);
  border: 1px solid rgba(45, 106, 79, 0.22);
}

.flash.info {
  background: var(--accent-surface);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.banner-warn {
  background: var(--warn-surface);
  border: 1px solid rgba(217, 119, 6, 0.25);
  color: #92400E;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 32px 16px;
  text-align: center;
}

/* =========================================================================
   Tabs
   ========================================================================= */

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 20px;
  padding-bottom: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(28, 25, 23, 0.05);
}

.tab-btn.active {
  background: var(--accent);
  color: #FFFFFF;
}

/* =========================================================================
   Modal Dialog
   ========================================================================= */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--panel);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--panel-border);
  position: relative;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.chart-panel canvas {
  max-height: 260px;
}

.login-wrap {
  max-width: 360px;
  margin: 10vh auto;
  padding: 0 20px;
}

/* =========================================================================
   Comprehensive Responsive Overhaul
   ========================================================================= */

/* Desktop to Medium Laptop */
@media (max-width: 1024px) {
  .wrap {
    padding: 24px 20px 60px;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Tablet Viewport */
@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 18px;
  }

  .topbar .brand {
    font-size: 15px;
  }

  /* Horizontal touch swipeable navigation */
  .topbar nav {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .topbar nav::-webkit-scrollbar {
    display: none;
  }

  .topbar nav a {
    padding: 7px 12px;
    font-size: 12px;
    background: #FAF8F5;
    border: 1px solid var(--panel-border-subtle);
  }

  .topbar nav a.active {
    background: var(--accent-surface);
    border-color: var(--accent-border);
  }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .panel {
    padding: 18px;
  }

  /* Tabs horizontal scroll on tablet/mobile */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: 8px;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex-shrink: 0;
  }
}

/* Mobile Devices (<= 640px) */
@media (max-width: 640px) {
  .wrap {
    padding: 16px 14px 60px;
  }

  h1, .h1 {
    font-size: 20px;
  }

  h2, .h2 {
    font-size: 11px;
  }

  .subtitle {
    font-size: 12px;
    margin-bottom: 18px;
  }

  .panel {
    padding: 16px 14px;
    border-radius: var(--radius-sm);
  }

  /* 16px input font prevents iOS auto-zoom */
  input[type="text"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
    padding: 11px 12px;
  }

  /* Touch-friendly buttons */
  .btn {
    width: 100%;
    min-height: 44px;
    padding: 11px 16px;
    font-size: 14px;
  }

  /* Prevent button blowup in inline bars, headers, tabs and checklist cards */
  .panel-header .btn,
  .checklist-stations .btn,
  .btn-pill,
  .note-section .btn,
  .btn-inline {
    width: auto !important;
    min-height: 36px;
    padding: 6px 12px;
  }

  .checklist-stations {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .checklist-stations .btn {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    font-size: 11.5px !important;
    padding: 6px 12px !important;
    border-radius: var(--radius-pill) !important;
  }
  .checklist-stations .btn svg {
    width: 14px !important;
    height: 14px !important;
    flex: 0 0 14px !important;
    margin-right: 4px;
  }

  .shift-switcher {
    flex-direction: row !important;
    gap: 8px !important;
  }
  .shift-switcher .btn {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Checklist task cards & notes on mobile */
  .task-card {
    padding: 14px 14px !important;
  }
  .task-card .task-title {
    font-size: 13.5px !important;
    line-height: 1.35;
  }
  .note-input-container > div {
    flex-wrap: wrap;
    gap: 8px !important;
  }
  .note-input-container input[type="text"] {
    width: 100% !important;
    flex: 1 1 100% !important;
  }
  .note-input-container .btn {
    flex: 1;
    min-height: 38px !important;
  }

  /* Mobile tables */
  table {
    font-size: 12px;
  }

  th, td {
    padding: 9px 10px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-card .stat-value {
    font-size: 20px;
  }

  /* Mobile Modal dialog fits screen */
  .modal-backdrop {
    padding: 12px;
    align-items: flex-end;
  }

  .modal {
    padding: 20px 16px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    max-height: 90vh;
  }
}
