* { box-sizing: border-box; }
:root {
  --navy-950: #0a1929;
  --navy-900: #0f2847;
  --navy-800: #1a3a5c;
  --navy-700: #234870;
  --navy-600: #2e5a84;
  --navy-500: #3c6e9a;
  --navy-300: #8aadca;
  --navy-100: #dae7f1;
  --navy-50: #f0f5f9;
  --brass: #c9a050;
  --brass-light: #e4bf70;
  --brass-dark: #9a7a3a;
  --coral: #e86a4a;
  --coral-dark: #c24a32;
  --paper: #faf7f0;
  --paper-warm: #f5ead5;
  --cream: #fdfbf6;
  --text: #0f2847;
  --text-soft: #5a7590;
  --border: #c8d6e0;
  --green: #2d7d5f;
  --green-light: #4caf82;
  --red: #c62828;
  --red-light: #ef5350;
}
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
}
body {
  background:
    /* depth lines - nautical chart */
    repeating-linear-gradient(
      45deg,
      transparent 0px,
      transparent 100px,
      rgba(30, 60, 100, 0.02) 100px,
      rgba(30, 60, 100, 0.02) 101px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent 0px,
      transparent 140px,
      rgba(30, 60, 100, 0.02) 140px,
      rgba(30, 60, 100, 0.02) 141px
    ),
    radial-gradient(ellipse at top, #f2ebd8 0%, #e8dfc4 30%, #d4c89f 100%);
  background-attachment: fixed;
  min-height: 100vh;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'><g fill='none' stroke='%23234870' stroke-width='0.6' opacity='0.06'><circle cx='150' cy='150' r='30'/><circle cx='150' cy='150' r='60'/><circle cx='150' cy='150' r='90'/><circle cx='150' cy='150' r='120'/><path d='M150 30 L150 270 M30 150 L270 150 M66 66 L234 234 M234 66 L66 234'/><path d='M150 40 L158 150 L150 60 L142 150 Z' fill='%23234870' opacity='0.4'/></g></svg>");
  background-size: 600px 600px;
  background-position: center;
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}
.hidden { display: none !important; }

/* ==================== LOGIN ==================== */
.login-screen {
  position: fixed; inset: 0; z-index: 2000;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.08) 0%, transparent 50%),
    linear-gradient(180deg, var(--navy-950) 0%, var(--navy-800) 60%, var(--navy-700) 100%);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.login-screen::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 180px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 180'><path d='M0,90 Q300,130 600,90 T1200,90 L1200,180 L0,180 Z' fill='%23ffffff' opacity='0.05'/><path d='M0,110 Q300,70 600,110 T1200,110 L1200,180 L0,180 Z' fill='%23ffffff' opacity='0.08'/><path d='M0,140 Q300,100 600,140 T1200,140 L1200,180 L0,180 Z' fill='%23ffffff' opacity='0.12'/></svg>") no-repeat center bottom;
  background-size: cover;
}
.login-screen::after {
  content: ''; position: absolute;
  top: 50%; left: 50%; width: 600px; height: 600px;
  transform: translate(-50%, -60%);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><g fill='none' stroke='%23c9a050' stroke-width='0.8' opacity='0.12'><circle cx='100' cy='100' r='30'/><circle cx='100' cy='100' r='55'/><circle cx='100' cy='100' r='80'/><path d='M100 20 L100 180 M20 100 L180 100 M40 40 L160 160 M160 40 L40 160'/><path d='M100 30 L106 100 L100 50 L94 100 Z' fill='%23c9a050' opacity='0.25'/></g></svg>");
  background-size: contain;
  pointer-events: none;
}
.login-card {
  background: rgba(250, 247, 240, 0.98);
  padding: 44px 40px; border-radius: 14px;
  width: 400px; max-width: 92%; text-align: center;
  box-shadow: 0 30px 80px rgba(0, 20, 40, 0.5),
              0 0 0 1px rgba(201, 160, 80, 0.3);
  position: relative; z-index: 1;
  backdrop-filter: blur(12px);
  border-top: 3px solid var(--brass);
}
.login-card .anchor-logo {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 8px 20px rgba(10, 30, 60, 0.35),
              inset 0 2px 4px rgba(255,255,255,0.2);
  color: var(--brass-light); font-size: 32px;
  border: 3px solid var(--brass);
}
.login-card h2 {
  margin: 0 0 6px; font-size: 28px;
  font-family: 'Playfair Display', serif;
  color: var(--navy-900); letter-spacing: -0.5px; font-weight: 700;
}
.login-card .sub {
  margin: 0 0 24px; color: var(--text-soft); font-size: 13px;
  font-style: italic; letter-spacing: 0.3px;
}
.login-card input {
  width: 100%; padding: 15px; font-size: 24px; text-align: center;
  border: 2px solid var(--border); border-radius: 10px;
  letter-spacing: 10px; margin-bottom: 14px;
  background: var(--cream);
  transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace; font-weight: 500;
  color: var(--navy-900);
}
.login-card input:focus {
  outline: none; border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(201, 160, 80, 0.2);
  background: #fff;
}
.login-card .error { color: var(--red); font-size: 13px; margin-bottom: 10px; }
.login-card button {
  width: 100%; padding: 14px; font-size: 15px; font-weight: 600;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  color: var(--brass-light); border: none; border-radius: 10px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(10, 30, 60, 0.25);
  transition: all 0.15s; letter-spacing: 0.5px;
  font-family: 'Inter', sans-serif;
  border: 1px solid rgba(201, 160, 80, 0.5);
}
.login-card button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(10, 30, 60, 0.35);
  color: #fff;
}
.login-card .hint { font-size: 11px; color: #99a; margin-top: 16px; font-style: italic; }

/* ==================== TOP BAR ==================== */
.topbar {
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.97) 0%, rgba(250, 247, 240, 0.95) 100%);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 16px rgba(10, 30, 60, 0.08);
  border-bottom: 1px solid rgba(201, 160, 80, 0.3);
  position: relative; z-index: 10;
}
.topbar-inner {
  padding: 12px 24px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  max-width: 1600px; margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  color: var(--brass-light); display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(10, 30, 60, 0.25);
  border: 2px solid var(--brass);
}
.logo h1 {
  margin: 0; font-size: 20px; font-weight: 700;
  color: var(--navy-900);
  font-family: 'Playfair Display', serif; letter-spacing: -0.3px;
}
.top-tabs { display: flex; gap: 2px; }
.top-tabs .tab {
  background: transparent; border: none;
  padding: 10px 18px; cursor: pointer; font-size: 14px;
  color: var(--text-soft); border-radius: 8px;
  font-weight: 500; transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.top-tabs .tab:hover { background: var(--navy-50); color: var(--navy-800); }
.top-tabs .tab.active {
  background: var(--navy-800); color: var(--brass-light); font-weight: 600;
  box-shadow: 0 2px 8px rgba(10, 30, 60, 0.2);
}
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.search {
  padding: 9px 14px; border: 1px solid var(--border); border-radius: 20px;
  font-size: 13px; min-width: 240px; background: var(--cream);
  transition: all 0.15s; font-family: inherit;
}
.search:focus {
  outline: none; border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(201, 160, 80, 0.15);
}
.wave-divider {
  height: 4px; width: 100%;
  background: linear-gradient(90deg, transparent 0%, var(--brass) 30%, var(--brass-light) 50%, var(--brass) 70%, transparent 100%);
  opacity: 0.5;
}

/* ==================== BUTTONS ==================== */
.btn-primary {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  color: var(--brass-light); border: 1px solid rgba(201, 160, 80, 0.4);
  padding: 9px 18px; border-radius: 8px; cursor: pointer; font-size: 13px;
  font-weight: 600; box-shadow: 0 2px 8px rgba(10, 30, 60, 0.2);
  transition: all 0.15s; font-family: inherit;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10, 30, 60, 0.3); color: #fff;
}
.btn-brass {
  background: linear-gradient(135deg, var(--brass-dark), var(--brass));
  color: #fff; border: none;
  padding: 9px 18px; border-radius: 8px; cursor: pointer; font-size: 13px;
  font-weight: 600; box-shadow: 0 2px 8px rgba(154, 122, 58, 0.25);
  transition: all 0.15s;
}
.btn-brass:hover { transform: translateY(-1px); }
.btn-green {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: #fff; border: none;
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
  font-weight: 600; box-shadow: 0 2px 6px rgba(45, 125, 95, 0.25);
}
.btn-green:hover { transform: translateY(-1px); }
.btn-ghost {
  background: rgba(255,255,255,0.6); border: 1px solid var(--border);
  padding: 8px 15px; border-radius: 8px; cursor: pointer; font-size: 13px;
  color: var(--text); font-weight: 500;
}
.btn-ghost:hover { background: #fff; border-color: var(--navy-300); }
.btn-tiny {
  background: transparent; border: none; cursor: pointer;
  padding: 3px 7px; font-size: 12px; color: #a0b0b5; border-radius: 4px;
}
.btn-tiny:hover { color: var(--red); background: rgba(198, 40, 40, 0.1); }

/* ==================== VIEW ==================== */
.view { padding: 22px 24px 90px; max-width: 1600px; margin: 0 auto; position: relative; z-index: 1; }
.toolbar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.summary { color: var(--text-soft); font-size: 13px; margin-left: auto; font-style: italic; }

.insert-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 20px;
  background: var(--cream); border: 1px solid var(--border);
  cursor: pointer; user-select: none;
  font-size: 12px; color: var(--text-soft);
  transition: all 0.15s;
}
.insert-toggle:hover { border-color: var(--navy-300); }
.insert-toggle.on {
  background: rgba(201, 160, 80, 0.15); border-color: var(--brass);
  color: var(--brass-dark); font-weight: 600;
}
.insert-toggle .switch {
  width: 34px; height: 18px; border-radius: 10px;
  background: #bbb; position: relative; transition: background 0.15s;
}
.insert-toggle .switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transition: left 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.insert-toggle.on .switch { background: var(--brass); }
.insert-toggle.on .switch::after { left: 18px; }

/* ==================== CATEGORY BLOCK ==================== */
.category-block {
  background: var(--paper); border-radius: 12px; margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(10, 30, 60, 0.08),
              0 0 0 1px rgba(10, 30, 60, 0.04);
  overflow: hidden; position: relative;
}
.category-block::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brass-dark), var(--brass), var(--brass-dark));
}
.category-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px;
  background: linear-gradient(180deg, #fdfaf0 0%, var(--paper) 100%);
  border-bottom: 1px solid rgba(201, 160, 80, 0.2);
}
.category-header .toggle {
  background: none; border: none; font-size: 12px; cursor: pointer;
  color: var(--navy-700); padding: 5px 8px; border-radius: 5px;
  transition: background 0.15s;
}
.category-header .toggle:hover { background: var(--navy-50); }
.category-header .cat-name {
  font-size: 17px; font-weight: 600; border: none; background: transparent;
  color: var(--navy-900); flex: 1; padding: 4px 6px; border-radius: 4px;
  font-family: 'Playfair Display', serif; letter-spacing: -0.2px;
}
.category-header .cat-name:focus {
  outline: 1px solid var(--brass); background: #fff;
  font-family: 'Inter', sans-serif; font-size: 15px;
}
.category-header .count {
  font-size: 11px; color: var(--navy-800);
  background: rgba(201, 160, 80, 0.15); border: 1px solid rgba(201, 160, 80, 0.3);
  padding: 3px 10px; border-radius: 12px; font-weight: 600;
}
.category-block.collapsed table,
.category-block.collapsed .cat-footer { display: none; }

/* ==================== TABLE ==================== */
table.sheet { width: 100%; border-collapse: collapse; background: var(--paper); }
table.sheet th {
  background: #faf2dc; font-weight: 600; text-align: left;
  padding: 0; font-size: 11px; color: var(--navy-700);
  border-bottom: 2px solid rgba(201, 160, 80, 0.4);
  letter-spacing: 0.5px; position: relative;
  cursor: move;
}
table.sheet th.dragging { opacity: 0.5; }
table.sheet th.drag-over { background: rgba(201, 160, 80, 0.3); }
table.sheet th input.th-label {
  width: 100%; background: transparent; border: none; padding: 10px 12px;
  font-weight: 700; font-size: 11px; color: var(--navy-800);
  text-transform: uppercase; letter-spacing: 0.6px;
  font-family: inherit; border-radius: 4px;
  cursor: text;
}
table.sheet th input.th-label:hover { background: rgba(201, 160, 80, 0.1); }
table.sheet th input.th-label:focus {
  outline: 1px solid var(--brass); background: #fff;
}
table.sheet th.col-actions-head {
  padding: 10px 12px; font-size: 11px; text-transform: uppercase;
  text-align: right; cursor: default;
}
table.sheet td { padding: 0; border-bottom: 1px solid rgba(201, 160, 80, 0.15); }
table.sheet td input {
  width: 100%; padding: 11px 12px; border: none; background: transparent;
  font-size: 13px; font-family: inherit; color: var(--text);
}
table.sheet td input:focus {
  outline: 2px solid var(--brass); background: #fff;
  position: relative; z-index: 1; border-radius: 2px;
}
table.sheet td.col-price input,
table.sheet td.col-stock input,
table.sheet td.col-size input { text-align: center; }
table.sheet .col-actions { width: 130px; text-align: center; padding-right: 10px; }
table.sheet tr:hover td { background: rgba(255, 250, 235, 0.5); }
table.sheet tr.highlight td { background: #fff4c7 !important; transition: background 0.4s; }

table.sheet th.col-name, table.sheet td.col-name { min-width: 180px; }
table.sheet th.col-size, table.sheet td.col-size { width: 80px; }
table.sheet th.col-color, table.sheet td.col-color { width: 100px; }
table.sheet th.col-price, table.sheet td.col-price { width: 90px; }
table.sheet th.col-stock, table.sheet td.col-stock { width: 80px; }
table.sheet th.col-notes, table.sheet td.col-notes { min-width: 160px; }

/* cart controls */
.row-cart {
  display: flex; gap: 4px; align-items: center; justify-content: flex-end;
  padding: 4px 0;
}
.row-cart input {
  width: 52px !important; padding: 6px !important; text-align: center;
  border: 1px solid var(--border) !important; border-radius: 5px;
  font-size: 12px; font-weight: 500;
}
.row-cart input:focus { border-color: var(--green) !important; outline: none !important; }
.row-cart input.has-qty {
  background: #d4f1d4 !important; border-color: var(--green) !important;
  color: #1a5c1a; font-weight: 700;
}
.btn-cart-add {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: #fff; border: none; border-radius: 5px;
  width: 30px; height: 30px; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.btn-cart-add:hover { transform: scale(1.08); }
.btn-cart-add.flying { animation: flyToCart 0.5s ease-out forwards; }
@keyframes flyToCart {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* insert zone */
.insert-zone {
  height: 0; position: relative; cursor: pointer; overflow: hidden;
  transition: background 0.1s, height 0.1s;
}
body.insert-mode .insert-zone { height: 6px; }
.insert-zone td {
  padding: 0 !important; border: none !important; background: transparent !important;
}
.insert-zone::before {
  content: '+ insert row'; display: none;
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--navy-700); color: var(--brass-light); padding: 3px 14px;
  border-radius: 12px; font-size: 11px; white-space: nowrap;
  z-index: 5; font-weight: 500;
}
body.insert-mode .insert-zone:hover { background: rgba(201, 160, 80, 0.2); height: 22px; }
body.insert-mode .insert-zone:hover::before { display: block; }

.cat-footer {
  padding: 10px 16px; background: rgba(201, 160, 80, 0.05);
  border-top: 1px solid rgba(201, 160, 80, 0.15);
}
.cat-footer .btn-add {
  background: transparent; border: 1px dashed var(--navy-300);
  color: var(--navy-700);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 12px;
  font-weight: 500; transition: all 0.15s;
}
.cat-footer .btn-add:hover {
  background: var(--cream); border-color: var(--brass); border-style: solid;
  color: var(--brass-dark);
}

/* ==================== CART FAB ==================== */
.cart-fab {
  position: fixed; bottom: 24px; right: 24px;
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: #fff; border: none; border-radius: 28px;
  padding: 14px 22px; font-size: 14px; font-weight: 600;
  cursor: pointer; z-index: 100;
  box-shadow: 0 6px 20px rgba(45, 125, 95, 0.45);
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s;
  font-family: inherit;
}
.cart-fab:hover { transform: translateY(-2px); }
.cart-fab .count {
  background: rgba(255,255,255,0.25); padding: 2px 10px;
  border-radius: 12px; font-size: 12px; font-weight: 700;
}
.cart-fab.empty {
  background: linear-gradient(135deg, var(--red), var(--red-light));
  box-shadow: 0 6px 20px rgba(198, 40, 40, 0.35);
}
.cart-fab.pulse { animation: pulseCart 0.4s; }
@keyframes pulseCart {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ==================== CART DRAWER ==================== */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(10, 30, 60, 0.45);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 95vw; background: var(--paper);
  z-index: 201; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.3, 0.7, 0.3, 1);
  box-shadow: -8px 0 30px rgba(10, 30, 60, 0.2);
}
.cart-drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 18px 22px; border-bottom: 1px solid rgba(201, 160, 80, 0.25);
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg, #fdfaf0, var(--paper));
  position: relative;
}
.drawer-head::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brass-dark), var(--brass), var(--brass-dark));
}
.drawer-head h3 {
  margin: 0; color: var(--navy-900); font-size: 18px;
  font-family: 'Playfair Display', serif;
}
.drawer-close {
  background: none; border: none; font-size: 26px; cursor: pointer;
  color: var(--text-soft); padding: 0 6px;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.cart-empty {
  text-align: center; padding: 60px 20px; color: var(--text-soft);
}
.cart-empty .icon { font-size: 48px; display: block; margin-bottom: 12px; opacity: 0.4; }
.cart-item {
  padding: 12px 0; border-bottom: 1px solid rgba(201, 160, 80, 0.15);
  display: flex; gap: 10px; align-items: center;
}
.cart-item:last-child { border-bottom: none; }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .name { font-weight: 600; color: var(--navy-900); font-size: 13px; }
.cart-item .details { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.cart-item .qty-ctrl { display: flex; align-items: center; gap: 4px; }
.cart-item .qty-ctrl button {
  width: 26px; height: 26px; border-radius: 5px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-weight: 600; color: var(--navy-700);
}
.cart-item .qty-ctrl button:hover { background: var(--navy-50); }
.cart-item .qty-ctrl input {
  width: 46px; padding: 4px; text-align: center;
  border: 1px solid var(--border); border-radius: 4px; font-size: 13px;
}
.cart-item .remove {
  background: none; border: none; color: var(--red); cursor: pointer;
  padding: 4px 8px; font-size: 14px; border-radius: 4px;
}
.cart-item .remove:hover { background: rgba(198, 40, 40, 0.1); }
.drawer-foot {
  padding: 14px 18px; border-top: 1px solid rgba(201, 160, 80, 0.25);
  background: rgba(255, 250, 235, 0.5);
}
.drawer-foot .totals {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--text-soft); margin-bottom: 10px;
}
.drawer-foot .totals strong { color: var(--navy-900); }
.drawer-foot .actions { display: flex; gap: 8px; }
.drawer-foot .actions button { flex: 1; padding: 10px; font-size: 13px; }

/* ==================== DAILY WORK ==================== */
.daily-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  max-width: 1600px;
}
.daily-toolbar .today-date {
  margin-left: auto; font-size: 12px; color: var(--navy-800);
  background: rgba(201, 160, 80, 0.15); border: 1px solid rgba(201, 160, 80, 0.3);
  padding: 6px 14px; border-radius: 14px; font-weight: 500;
}
.task-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px; max-width: 1600px;
}
.daily-panel {
  background: var(--paper); border-radius: 12px; padding: 16px;
  box-shadow: 0 4px 16px rgba(10, 30, 60, 0.08), 0 0 0 1px rgba(10, 30, 60, 0.04);
  position: relative; overflow: hidden;
}
.daily-panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brass-dark), var(--brass), var(--brass-dark));
}
.daily-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid rgba(201, 160, 80, 0.2);
}
.daily-header .box-name {
  margin: 0; font-size: 16px; color: var(--navy-900); font-weight: 600;
  border: none; background: transparent; flex: 1;
  padding: 4px 6px; border-radius: 4px;
  font-family: 'Playfair Display', serif; letter-spacing: -0.1px;
}
.daily-header .box-name:focus {
  outline: 1px solid var(--brass); background: var(--cream);
  font-family: 'Inter', sans-serif;
}
.daily-header .task-count {
  font-size: 11px; color: var(--navy-800);
  background: rgba(201, 160, 80, 0.15); border: 1px solid rgba(201, 160, 80, 0.3);
  padding: 3px 9px; border-radius: 10px; font-weight: 600;
}
.daily-header .box-delete {
  background: none; border: none; cursor: pointer; color: #a0b0b5;
  padding: 4px 8px; border-radius: 4px; font-size: 14px;
}
.daily-header .box-delete:hover { color: var(--red); background: rgba(198, 40, 40, 0.1); }
.task-input-row { display: flex; gap: 6px; margin-bottom: 14px; }
.task-input-row input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; background: var(--cream); font-family: inherit;
}
.task-input-row input:focus {
  outline: none; border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(201, 160, 80, 0.1);
}
.task-input-row button { padding: 8px 14px; font-size: 13px; }
.task-list { list-style: none; padding: 0; margin: 0; }
.task-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; margin-bottom: 3px;
  border: 1px solid transparent; transition: background 0.15s;
}
.task-item:hover { background: var(--cream); border-color: rgba(201, 160, 80, 0.2); }
.task-item .check {
  width: 20px; height: 20px; border-radius: 6px; cursor: pointer;
  border: 2px solid var(--navy-300); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.task-item .check.done {
  background: var(--brass); border-color: var(--brass); color: #fff;
}
.task-item .check.done::before { content: '✓'; font-size: 13px; font-weight: 700; }
.task-item .text {
  flex: 1; border: none; background: transparent; padding: 4px 6px;
  font-size: 14px; color: var(--text); font-family: inherit;
  border-radius: 4px; min-width: 0;
}
.task-item .text:focus { outline: 1px solid var(--brass); background: #fff; }
.task-item.done .text { text-decoration: line-through; color: var(--text-soft); }
.task-item .delete {
  opacity: 0; transition: opacity 0.15s;
  background: none; border: none; cursor: pointer; color: var(--red);
  padding: 4px 8px; border-radius: 4px;
}
.task-item:hover .delete { opacity: 0.7; }
.task-item .delete:hover { opacity: 1; background: rgba(198, 40, 40, 0.1); }
.daily-empty {
  text-align: center; padding: 30px 16px; color: var(--text-soft);
  background: var(--cream); border-radius: 8px; font-size: 13px;
}
.daily-empty .icon { font-size: 40px; opacity: 0.4; display: block; margin-bottom: 10px; }

/* ==================== AI CALCULATOR ==================== */
.calc-container {
  max-width: 900px; margin: 0 auto;
}
.calc-panel {
  background: var(--paper); border-radius: 12px; padding: 22px;
  box-shadow: 0 4px 16px rgba(10, 30, 60, 0.08), 0 0 0 1px rgba(10, 30, 60, 0.04);
  position: relative; overflow: hidden; margin-bottom: 16px;
}
.calc-panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brass-dark), var(--brass), var(--brass-dark));
}
.calc-panel h2 {
  margin: 0 0 6px; font-family: 'Playfair Display', serif;
  color: var(--navy-900); font-size: 20px;
}
.calc-panel .sub {
  margin: 0 0 16px; color: var(--text-soft); font-size: 13px; font-style: italic;
}
.calc-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.calc-io label {
  display: block; font-size: 12px; color: var(--navy-700); font-weight: 600;
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.calc-io textarea {
  width: 100%; min-height: 220px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.6;
  background: var(--cream); resize: vertical;
  color: var(--text);
}
.calc-io textarea:focus {
  outline: none; border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(201, 160, 80, 0.15);
  background: #fff;
}
.calc-io textarea.output {
  background: #fdfbf2; border-color: rgba(201, 160, 80, 0.3);
  color: var(--navy-900); font-weight: 500;
}
.calc-actions {
  display: flex; gap: 10px; margin-top: 14px; align-items: center; flex-wrap: wrap;
}
.calc-actions .status { font-size: 12px; color: var(--text-soft); margin-left: auto; }
.calc-settings {
  background: #fdfbf2; border: 1px solid rgba(201, 160, 80, 0.25);
  border-radius: 8px; padding: 14px; font-size: 12px;
}
.calc-settings summary {
  cursor: pointer; font-weight: 600; color: var(--navy-800);
  padding: 4px 0; user-select: none;
}
.calc-settings .settings-body { margin-top: 10px; display: grid; gap: 10px; }
.calc-settings label { font-size: 12px; color: var(--navy-700); font-weight: 500; }
.calc-settings input, .calc-settings select {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 12px;
  background: #fff;
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 30, 60, 0.5);
  z-index: 500; display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  overflow-y: auto;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal-card {
  background: var(--paper); border-radius: 12px; width: 100%;
  max-width: 560px; box-shadow: 0 20px 60px rgba(10, 30, 60, 0.3);
  overflow: hidden; position: relative;
}
.modal-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brass-dark), var(--brass), var(--brass-dark));
}
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid rgba(201, 160, 80, 0.2);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h3 { margin: 0; font-family: 'Playfair Display', serif; color: var(--navy-900); font-size: 18px; }
.modal-body { padding: 16px 22px; max-height: 60vh; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid rgba(201, 160, 80, 0.2);
  display: flex; gap: 8px; justify-content: flex-end; background: rgba(255, 250, 235, 0.4);
}
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li {
  padding: 9px 12px; border-radius: 6px; margin-bottom: 2px;
  display: flex; align-items: center; gap: 10px;
}
.check-list li:hover { background: var(--cream); }
.check-list input[type=checkbox] {
  width: 18px; height: 18px; cursor: pointer; accent-color: var(--brass);
}
.check-list label { cursor: pointer; flex: 1; font-size: 14px; }
.check-list .muted { color: var(--text-soft); font-size: 11px; }

/* ==================== TOAST ==================== */
.save-indicator {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy-800); color: var(--brass-light);
  padding: 9px 22px; border-radius: 22px;
  font-size: 12px; opacity: 0; pointer-events: none;
  transition: opacity 0.3s; z-index: 1500; font-weight: 500;
  box-shadow: 0 6px 16px rgba(10, 30, 60, 0.3);
  border: 1px solid rgba(201, 160, 80, 0.4);
}
.save-indicator.show { opacity: 1; }
.save-indicator.success { background: var(--green); color: #fff; border-color: rgba(255,255,255,0.3); }
.save-indicator.error { background: var(--red); color: #fff; border-color: rgba(255,255,255,0.3); }



tr.filtered-out { display: none; }

/* ==================== PRINT STYLES ==================== */
.print-area { display: none; }
@media print {
  @page { size: A4; margin: 12mm 10mm; }
  body { background: #fff !important; font-size: 10pt; }
  body::before { display: none !important; }
  .topbar, .view, .cart-fab, .cart-drawer, .drawer-backdrop,
  .modal-backdrop, .preview-banner, .save-indicator { display: none !important; }
  .print-area { display: block !important; }
  .print-area h1 {
    font-family: 'Playfair Display', serif; font-size: 18pt;
    margin: 0 0 4pt; color: #000;
  }
  .print-area .print-meta {
    font-size: 9pt; color: #555; margin-bottom: 12pt;
    border-bottom: 1px solid #999; padding-bottom: 6pt;
  }
  .print-area .print-cat {
    margin-top: 10pt; page-break-inside: avoid;
  }
  .print-area .print-cat h2 {
    font-family: 'Playfair Display', serif; font-size: 13pt;
    margin: 0 0 4pt; padding: 4pt 0; border-bottom: 2px solid #000;
  }
  .print-area table {
    width: 100%; border-collapse: collapse; font-size: 10pt;
  }
  .print-area th, .print-area td {
    border: 1px solid #888; padding: 4pt 6pt; text-align: left;
  }
  .print-area th { background: #eee; font-weight: 700; }
  .print-area td.stock-cell { width: 70pt; height: 20pt; }
  .print-area .row-num { width: 28pt; text-align: center; color: #666; }
  .print-area .page-break { page-break-after: always; }
}

@media (max-width: 700px) {
  .topbar-inner { padding: 10px 14px; gap: 10px; }
  .logo h1 { font-size: 16px; }
  .search { min-width: 140px; font-size: 12px; }
  table.sheet th.col-notes, table.sheet td.col-notes { display: none; }
  .view { padding: 12px; }
  .cart-drawer { width: 100%; }
  .calc-grid { grid-template-columns: 1fr; }
}

/* ==================== SETTINGS ==================== */
.settings-section {
  margin-bottom: 18px; padding-bottom: 16px;
  border-bottom: 1px solid rgba(201, 160, 80, 0.15);
}
.settings-section:last-of-type { border-bottom: none; }
.set-label {
  display: block; font-size: 12px; color: var(--navy-700);
  font-weight: 600; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.set-hint {
  font-size: 11px; color: var(--text-soft); margin: 6px 0 0;
}
.set-hint a { color: var(--brass-dark); }
.key-row { display: flex; gap: 6px; }
.key-row input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; background: var(--cream);
  font-family: 'JetBrains Mono', monospace;
}
.key-row input:focus {
  outline: none; border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(201, 160, 80, 0.15);
}
.key-row button { padding: 6px 12px; font-size: 12px; }
#setAiProvider {
  padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; background: var(--cream);
  font-family: inherit; width: 100%;
}
.key-status {
  font-size: 11px; margin-top: 6px; color: var(--green); font-weight: 500;
}
.key-status.missing { color: var(--text-soft); font-style: italic; }
