/* Alsu Bakery - style.css */
:root {
  --bg: #fbf6ea; --card: #ffffff; --ink: #2a2a24; --muted: #6f6a5c; --line: #e9e0c9;
  --green: #1f4d3a; --green-2: #2d6a50; --gold: #c9a24b; --gold-soft: #f6ebcb; --cream: #fbf6ea;
  --danger: #b3392f; --warn: #c77d12; --ok: #2f7d4f; --info: #2b6a8f;
  --side: #17372a; --side-ink: #e8efe9; --input: #fffdf7; --shadow: 0 1px 2px rgba(60, 50, 20, .06), 0 6px 18px rgba(60, 50, 20, .06);
  --radius: 12px;
}
html[data-theme="dark"] {
  --bg: #0e1813; --card: #15231c; --ink: #ecefe9; --muted: #9db0a4; --line: #243a2e;
  --green: #3f9a73; --green-2: #4fb086; --gold: #d8b45e; --gold-soft: #2c2a17; --cream: #15231c;
  --danger: #e0685c; --warn: #e0a043; --ok: #55b985; --info: #64a8cf;
  --side: #0a130f; --side-ink: #dfe8e2; --input: #101c16; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; margin: 0; letter-spacing: .1px; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .right { text-align: right; } .center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--ok); } .neg { color: var(--danger); } .warn-t { color: var(--warn); }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }

/* layout */
.app { display: grid; grid-template-columns: 262px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; z-index: 40; }
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 16px; border-bottom: 1px solid rgba(201, 162, 75, .25); }
.brand img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #fff1; }
.brand strong { font: 700 19px Georgia, serif; color: var(--gold); display: block; line-height: 1.1; }
.brand small { color: #b9c9bf; font-size: 12px; }
#nav { padding: 10px 10px 4px; flex: 1; }
.nav-group { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: #94ab9e; margin: 14px 10px 6px; }
#nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--side-ink); text-decoration: none; margin-bottom: 2px; font-size: 14.5px; }
#nav a:hover { background: rgba(255, 255, 255, .07); }
#nav a.active { background: var(--gold); color: #1d2a22; font-weight: 600; }
#nav a .ico { width: 22px; text-align: center; font-size: 16px; }
#nav a .badge-n { margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.side-foot { padding: 12px 18px 16px; font-size: 12px; color: #b9c9bf; border-top: 1px solid rgba(255, 255, 255, .08); }
.status-line { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #7d8c83; flex: none; } .dot.ok { background: #52c486; } .dot.warn { background: #e8a93b; } .dot.bad { background: #e0685c; }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; gap: 10px; align-items: center; padding: 10px 22px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.side-backdrop { display: none; }
.gsearch { position: relative; flex: 1; max-width: 560px; }
.gsearch input { width: 100%; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.gs-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; z-index: 50; }
.gs-results a { display: flex; gap: 10px; padding: 9px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.gs-results a:hover, .gs-results a:focus { background: var(--gold-soft); }
.gs-results .tag { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); min-width: 78px; }
#main { padding: 24px 26px 60px; max-width: 1500px; width: 100%; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--green); background: var(--green); color: #fff; padding: 9px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; text-decoration: none; line-height: 1.2; }
html[data-theme="dark"] .btn { color: #0b1510; }
.btn:hover { filter: brightness(1.1); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #25301f; }
.btn.ghost { background: transparent; color: var(--green); } html[data-theme="dark"] .btn.ghost { color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.icon-btn { border: 1px solid var(--line); background: var(--card); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 18px; line-height: 1; }
.icon-btn:hover { background: var(--gold-soft); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card h2, .card h3 { margin-bottom: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat.green { border-left-color: var(--green); } .stat.red { border-left-color: var(--danger); }
.stat .lbl { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; }
.stat .val { font: 700 24px Georgia, serif; margin-top: 2px; word-break: break-word; }
.stat .sub { font-size: 12.5px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.sticky { position: sticky; top: 76px; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.fld input, .fld select, .fld textarea, .cell-in { width: 100%; padding: 9px 11px; border: 1px solid var(--line); background: var(--input); border-radius: 8px; }
.fld input:read-only { background: var(--gold-soft); }
.fld textarea { min-height: 80px; resize: vertical; }
.fld .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.fld.span-2 { grid-column: span 2; } .fld.full { grid-column: 1 / -1; }
.fld input:invalid, .cell-in:invalid { border-color: var(--danger); }
.cell-in { padding: 6px 8px; }
.checks { display: flex; gap: 8px; align-items: center; }
.checks input { width: auto; }
.callout { padding: 11px 14px; border-radius: 9px; background: var(--gold-soft); border: 1px solid var(--gold); font-size: 14px; }
.callout.bad { background: color-mix(in srgb, var(--danger) 12%, var(--card)); border-color: var(--danger); }
.callout.good { background: color-mix(in srgb, var(--ok) 12%, var(--card)); border-color: var(--ok); }
.callout.info { background: color-mix(in srgb, var(--info) 10%, var(--card)); border-color: var(--info); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 16px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.active { color: var(--green); border-bottom-color: var(--gold); } html[data-theme="dark"] .tabs button.active { color: var(--gold); }

/* tables */
.tbl-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.tbl-tools input[type=search] { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); min-width: 220px; }
.tbl-tools select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
table.tbl { width: 100%; border-collapse: collapse; min-width: 560px; }
.tbl th { background: var(--green); color: #fff; text-align: left; padding: 10px 12px; font-size: 13px; white-space: nowrap; position: sticky; top: 0; }
html[data-theme="dark"] .tbl th { background: #1d3a2d; color: var(--gold); }
.tbl th[data-sort] { cursor: pointer; user-select: none; } .tbl th[data-sort]:hover { filter: brightness(1.15); }
.tbl th.num { text-align: right; }
.tbl td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:nth-child(even) { background: color-mix(in srgb, var(--gold-soft) 45%, transparent); }
.tbl tbody tr:hover { background: var(--gold-soft); }
.tbl tfoot td { font-weight: 700; background: var(--gold-soft); border-top: 2px solid var(--gold); }
.tbl td.acts { white-space: nowrap; text-align: right; }
.tbl td.acts .btn { margin-left: 4px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 2px; font-size: 13px; color: var(--muted); }
.pager .btn { padding: 4px 10px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gold-soft); color: var(--ink); border: 1px solid var(--line); }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, var(--card)); color: var(--ok); border-color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, var(--card)); color: var(--warn); border-color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--danger) 16%, var(--card)); color: var(--danger); border-color: var(--danger); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 42px; } .empty h3 { color: var(--ink); margin: 6px 0; } .empty .btn { margin-top: 12px; }

/* modal, toast, loader */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 25, 20, .55); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; z-index: 100; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); border-top: 5px solid var(--gold); }
.modal.lg { max-width: 940px; } .modal.sm { max-width: 440px; } .modal.xl { max-width: 1060px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px 20px; } .modal-foot { padding: 12px 20px 16px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 300; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--green); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); border-left: 5px solid var(--gold); animation: pop .2s ease; }
html[data-theme="dark"] .toast { background: #1d3a2d; }
.toast.error { background: var(--danger); } .toast.warn { background: var(--warn); }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.loader { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 85%, transparent); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 400; gap: 12px; }
.loader.on { display: flex; }
.spin { width: 44px; height: 44px; border: 5px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* recipe editor & misc */
.bar { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--gold); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); } .kv:last-child { border-bottom: 0; }
.kv b { font-variant-numeric: tabular-nums; }
.kv.big { font-size: 17px; border-bottom: 2px solid var(--gold); }
.line-tbl td { padding: 6px 6px; } .line-tbl input, .line-tbl select { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; margin-top: 4px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.list-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }

/* print area (fixed colours, always light) */
#print-area { display: none; }
.doc { font: 13px/1.45 "Segoe UI", Arial, sans-serif; color: #222; background: #fff; }
.doc h1 { font-size: 22px; margin: 0 0 4px; color: #1f4d3a; } .doc h2 { font-size: 16px; color: #1f4d3a; border-bottom: 2px solid #c9a24b; padding-bottom: 3px; margin: 16px 0 6px; }
.doc table { width: 100%; border-collapse: collapse; margin: 6px 0; } .doc th { background: #1f4d3a; color: #fff; padding: 6px 8px; text-align: left; font-size: 12px; } .doc td { padding: 5px 8px; border-bottom: 1px solid #ddd; } .doc td.num, .doc th.num { text-align: right; }
.doc .head { display: flex; align-items: center; gap: 12px; border-bottom: 3px solid #c9a24b; padding-bottom: 8px; margin-bottom: 10px; } .doc .head img { width: 54px; height: 54px; border-radius: 50%; }
.doc .meta { color: #666; font-size: 12px; }

.inv { font: 13px/1.45 "Segoe UI", Arial, sans-serif; color: #26261f; background: #fff; max-width: 780px; margin: 0 auto; border: 1px solid #d9cfae; position: relative; overflow: hidden; }
.inv-top { background: #1f4d3a; color: #fff; padding: 22px 28px; display: flex; justify-content: space-between; gap: 18px; align-items: center; border-bottom: 5px solid #c9a24b; }
.inv-brand { display: flex; align-items: center; gap: 14px; } .inv-brand img { width: 66px; height: 66px; border-radius: 50%; background: #fff2; object-fit: cover; }
.inv-brand h1 { font: 700 26px Georgia, serif; color: #e6c46f; margin: 0; } .inv-brand div div { font-size: 12px; color: #cfe0d6; }
.inv-title { text-align: right; } .inv-title b { display: block; font: 700 24px Georgia, serif; letter-spacing: 3px; color: #e6c46f; } .inv-title span { font-size: 12.5px; color: #dbe8e0; }
.inv-body { padding: 20px 28px; }
.inv-info { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.inv-info .box { min-width: 200px; } .inv-info h4 { margin: 0 0 4px; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #8a7a3c; }
.inv table { width: 100%; border-collapse: collapse; } .inv thead th { background: #f6ebcb; color: #1f4d3a; text-align: left; padding: 8px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; border-top: 2px solid #c9a24b; border-bottom: 2px solid #c9a24b; }
.inv td { padding: 8px 10px; border-bottom: 1px solid #ece4cb; } .inv .r { text-align: right; } .inv tbody tr:nth-child(even) { background: #fcf9ef; }
.inv-sum { display: flex; justify-content: space-between; gap: 20px; margin-top: 14px; flex-wrap: wrap; }
.inv-sum .pay { flex: 1; min-width: 200px; font-size: 12.5px; } .inv-sum .tot { width: 290px; }
.inv-sum .tot div { display: flex; justify-content: space-between; padding: 4px 0; } .inv-sum .tot .grand { background: #1f4d3a; color: #e6c46f; padding: 9px 12px; border-radius: 6px; font: 700 17px Georgia, serif; margin-top: 4px; }
.inv-sum .tot .due { color: #a3302a; font-weight: 700; }
.stamp { position: absolute; left: 30px; bottom: 22px; transform: rotate(-8deg); border: 3px double; padding: 2px 14px; font: 800 20px Georgia, serif; letter-spacing: 3px; opacity: .3; pointer-events: none; }
.stamp.paid { color: #1f7a45; border-color: #1f7a45; } .stamp.part { color: #c77d12; border-color: #c77d12; } .stamp.due { color: #a3302a; border-color: #a3302a; }
.inv-foot { text-align: center; padding: 14px 28px 20px; border-top: 1px dashed #c9a24b; margin: 6px 28px 0; color: #5d5a46; }
.inv-foot b { font: 700 16px Georgia, serif; color: #1f4d3a; display: block; margin-bottom: 4px; }
.inv-sign { display: flex; justify-content: flex-end; padding: 0 28px 16px; } .inv-sign div { border-top: 1px solid #888; width: 200px; text-align: center; padding-top: 3px; font-size: 12px; color: #666; }

@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .sticky { position: static; } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-102%); transition: transform .22s; box-shadow: 8px 0 30px rgba(0, 0, 0, .35); }
  body.nav-open .sidebar { transform: none; }
  .side-backdrop { display: none; }
  body.nav-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 35; }
  .menu-btn { display: inline-block; }
  #main { padding: 16px 14px 60px; } .topbar { padding: 8px 12px; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .hide-xs { display: none; } .fld.span-2 { grid-column: auto; } h1 { font-size: 22px; } .grid-3 { grid-template-columns: 1fr; } .inv-top { flex-direction: column; align-items: flex-start; } .inv-title { text-align: left; }  }
@media print {
  html[data-theme="dark"] { --bg: #fff; --card: #fff; --ink: #222; --muted: #666; --line: #ddd; --green: #1f4d3a; --gold: #c9a24b; --gold-soft: #f6ebcb; --input: #fff; --danger: #b3392f; --ok: #2f7d4f; --warn: #c77d12; }
  html[data-theme="dark"] .tbl th { background: #1f4d3a; color: #fff; }
  .app, #modals, #toasts, #loader { display: none !important; }
  #print-area { display: block !important; }
  body { background: #fff; } @page { size: A4; margin: 10mm; }
  .inv { border: 0; max-width: none; } .stamp { opacity: .3; }
  .inv-top, .doc th, .inv thead th, .inv-sum .tot .grand { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .inv tbody tr:nth-child(even) { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
