:root {
  --leaf-950: #102c20;
  --leaf-900: #173d2c;
  --leaf-800: #21543b;
  --leaf-700: #2d6b48;
  --leaf-100: #dcebd9;
  --cream: #f7f1e5;
  --paper: #fffdf7;
  --ink: #183126;
  --muted: #6a766a;
  --line: #ddd5c4;
  --mango: #f59d22;
  --mango-dark: #bb6800;
  --mango-pale: #ffe3a7;
  --berry: #ba3d3d;
  --berry-pale: #f9dfda;
  --sky: #ddedeb;
  --shadow: 0 16px 38px rgba(32, 53, 36, .12);
  --radius: 4px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--cream); }
body { margin: 0; min-height: 100vh; background: var(--cream); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--mango); outline-offset: 2px; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .11; z-index: 20; background-image: radial-gradient(rgba(16,44,32,.65) .45px, transparent .55px); background-size: 5px 5px; mix-blend-mode: multiply; }
[hidden] { display: none !important; }

.eyebrow { margin: 0 0 7px; color: var(--mango-dark); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.muted { color: var(--muted); line-height: 1.55; }
.brand-mark { position: relative; display: grid; place-items: center; width: 76px; height: 76px; background: var(--mango); color: var(--leaf-950); font-family: Georgia, serif; font-size: 26px; font-weight: 900; letter-spacing: -.09em; transform: rotate(-5deg); clip-path: polygon(0 0, 88% 0, 100% 15%, 100% 100%, 12% 100%, 0 84%); }
.brand-mark i, .brand-mark b { position: absolute; display: block; background: var(--leaf-900); content: ""; }
.brand-mark i { width: 19px; height: 8px; border-radius: 100% 0; transform: rotate(-38deg); top: 10px; right: 11px; }
.brand-mark b { width: 2px; height: 18px; transform: rotate(28deg); top: 15px; right: 21px; }
.brand-mark.small { width: 37px; height: 37px; font-size: 14px; }
.brand-mark.small i { width: 10px; height: 4px; top: 5px; right: 5px; }
.brand-mark.small b { height: 9px; top: 7px; right: 11px; }

/* Login */
.login-shell { display: grid; grid-template-columns: minmax(360px, 1.06fr) minmax(420px, .94fr); min-height: 100vh; }
.login-brand { position: relative; overflow: hidden; padding: clamp(38px, 8vw, 110px); color: #fff8e9; background: var(--leaf-900); }
.login-brand::before { position: absolute; width: 82vh; height: 82vh; top: -27vh; right: -33vh; border: 1px solid rgba(255,250,235,.22); border-radius: 50%; content: ""; box-shadow: 0 0 0 55px rgba(255,250,235,.04), 0 0 0 112px rgba(255,250,235,.035); }
.login-brand::after { position: absolute; left: 0; bottom: 0; width: 100%; height: 160px; content: ""; background: repeating-linear-gradient(135deg, transparent 0 26px, rgba(245,157,34,.22) 27px 30px, transparent 31px 57px); }
.login-brand .brand-mark { margin-bottom: clamp(50px, 12vh, 130px); }
.login-brand .eyebrow { position: relative; color: var(--mango); z-index: 1; }
.login-brand h1 { position: relative; max-width: 600px; margin: 0; color: #fffaf0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(58px, 7vw, 112px); font-weight: 500; letter-spacing: -.075em; line-height: .8; z-index: 1; }
.login-brand h1 em { color: var(--mango); font-weight: 500; }
.brand-copy { position: relative; max-width: 350px; margin: 34px 0; color: #d4e2d0; font-size: 16px; line-height: 1.55; z-index: 1; }
.harvest-stamp { position: relative; display: grid; gap: 1px; width: max-content; padding: 13px 17px; color: var(--leaf-950); background: var(--mango); font-size: 9px; font-weight: 800; letter-spacing: .13em; text-align: center; transform: rotate(-3deg); z-index: 1; }
.harvest-stamp strong { font-family: Georgia, serif; font-size: 24px; line-height: .9; letter-spacing: -.06em; }
.login-panel { display: grid; place-items: center; padding: 32px; background: var(--cream); }
.login-card { width: min(100%, 392px); animation: rise .45s ease both; }
.login-card h2 { margin: 0; font-family: Georgia, serif; font-size: 44px; font-weight: 500; line-height: .95; letter-spacing: -.05em; }
.login-card .muted { margin: 17px 0 30px; }
.login-card form { display: grid; gap: 17px; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 800; letter-spacing: .03em; }
input, select, textarea { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--ink); background: var(--paper); border: 1px solid #cfc5b2; border-radius: var(--radius); }
textarea { min-height: 86px; resize: vertical; }
input::placeholder { color: #91958d; }
.form-error { margin: 0; padding: 10px; color: #7e1f25; background: var(--berry-pale); border-left: 3px solid var(--berry); font-size: 13px; line-height: 1.4; }
.login-note { margin-top: 24px; color: var(--muted); font-size: 11px; letter-spacing: .05em; }

/* Application shell */
.app-shell { display: grid; grid-template-columns: 234px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; color: #eaf3e5; background: var(--leaf-900); z-index: 5; }
.sidebar-top { padding: 24px 18px 16px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; color: #fffdf6; font-family: Georgia, serif; font-size: 19px; font-weight: 500; letter-spacing: -.04em; text-decoration: none; }
.sidebar-brand strong, .mobile-brand strong { color: var(--mango); font-weight: 500; }
.sidebar-caption { display: block; margin-top: 27px; color: #9bbda3; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.main-nav { display: grid; gap: 3px; padding: 4px 12px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 39px; padding: 8px 10px; color: #d1e1d3; background: transparent; border: 0; border-left: 2px solid transparent; border-radius: 0; font-size: 13px; font-weight: 650; text-align: left; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.075); }
.nav-item.active { color: var(--leaf-950); background: var(--mango); border-left-color: #fff1c7; }
.nav-symbol { display: inline-grid; width: 18px; place-items: center; font-size: 18px; line-height: 1; }
.nav-label { margin: 22px 10px 5px; color: #8bac95; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.sidebar-bottom { margin-top: auto; padding: 14px 12px 18px; border-top: 1px solid rgba(255,255,255,.13); }
.session-badge { overflow: hidden; padding: 0 10px 11px; color: #c9ddc9; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.logout { color: #eec1b9; }
.mobile-bar { display: none; }
.workspace { min-width: 0; background: var(--cream); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 104px; padding: 25px clamp(20px, 4vw, 58px) 17px; border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-family: Georgia, serif; font-size: 31px; font-weight: 500; letter-spacing: -.045em; line-height: 1; }
.connection-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.health-dot { width: 8px; height: 8px; background: #c78a29; border-radius: 50%; box-shadow: 0 0 0 3px rgba(199,138,41,.13); }
.health-dot.online { background: #3a9b5e; box-shadow: 0 0 0 3px rgba(58,155,94,.13); }
.health-dot.offline { background: var(--berry); box-shadow: 0 0 0 3px rgba(186,61,61,.13); }
.page-content { min-height: calc(100vh - 104px); padding: clamp(18px, 3.5vw, 42px) clamp(20px, 4vw, 58px) 54px; outline: none; }

/* Shared app components */
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-head h3 { margin: 0; font-family: Georgia, serif; font-size: 25px; font-weight: 500; letter-spacing: -.04em; }
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; gap: 9px; padding: 9px 14px; color: var(--ink); background: var(--paper); border: 1px solid #cbbfa7; border-radius: 3px; font-size: 12px; font-weight: 800; letter-spacing: .015em; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 0 rgba(24,49,38,.14); }
.btn-primary { color: #172a1d; background: var(--mango); border-color: var(--mango-dark); }
.btn-primary:hover:not(:disabled) { background: #ffac31; }
.btn-danger { color: #801d23; background: var(--berry-pale); border-color: #d79891; }
.btn-quiet { min-height: 32px; padding: 6px 9px; border-color: transparent; background: transparent; color: var(--leaf-800); }
.btn-wide { width: 100%; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 2px; font-size: 22px; line-height: 1; }
.icon-button:hover { background: var(--mango-pale); }
.toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.toolbar .search-field { flex: 1 1 235px; }
.toolbar label { min-width: 130px; }
.field-inline { display: grid; gap: 7px; min-width: 120px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.field-inline input, .field-inline select { min-height: 39px; }
.content-panel { background: rgba(255,253,247,.74); border: 1px solid var(--line); box-shadow: 7px 7px 0 rgba(41,73,49,.05); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-title h4 { margin: 0; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.panel-title span { color: var(--muted); font-size: 11px; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; background: var(--leaf-100); color: var(--leaf-800); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.status-chip.warning { color: #925511; background: var(--mango-pale); }
.status-chip.danger { color: #8e2829; background: var(--berry-pale); }
.status-chip.neutral { color: #567060; background: #e8ede4; }
.empty-state, .loading-state, .error-state { display: grid; place-items: center; min-height: 190px; padding: 28px; color: var(--muted); text-align: center; }
.empty-state strong, .error-state strong { color: var(--ink); font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.empty-state p, .error-state p { max-width: 320px; margin: 8px 0 0; font-size: 13px; line-height: 1.5; }
.error-state { background: #fff8f6; color: #8a3430; }
.loading-state::before { width: 25px; height: 25px; margin-bottom: 10px; border: 3px solid #d5dfd2; border-top-color: var(--leaf-700); border-radius: 50%; content: ""; animation: spin .7s linear infinite; }

/* POS */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 20px; align-items: start; }
.pos-shelf { min-width: 0; }
.pos-tools { display: flex; gap: 10px; margin-bottom: 14px; }
.pos-tools input { min-height: 45px; font-size: 14px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.fruit-tile { position: relative; display: grid; align-content: space-between; min-height: 134px; padding: 13px; overflow: hidden; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--tile, var(--leaf-700)); border-radius: 0; text-align: left; transition: transform .16s ease, box-shadow .16s ease; }
.fruit-tile::after { position: absolute; right: -16px; bottom: -18px; width: 72px; height: 72px; background: var(--tile-soft, var(--leaf-100)); border-radius: 50%; content: ""; }
.fruit-tile:hover:not(:disabled) { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--tile, var(--leaf-700)); }
.fruit-tile:disabled { color: #8a8f88; background: #f0ede5; }
.fruit-category { position: relative; z-index: 1; width: max-content; padding: 3px 5px; color: var(--tile, var(--leaf-700)); background: var(--tile-soft, var(--leaf-100)); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.fruit-name { position: relative; z-index: 1; margin: 15px 0 3px; font-family: Georgia, serif; font-size: 20px; font-weight: 500; letter-spacing: -.045em; }
.fruit-price { position: relative; z-index: 1; color: var(--leaf-800); font-size: 13px; font-weight: 850; }
.fruit-stock { position: relative; z-index: 1; margin-top: 2px; color: var(--muted); font-size: 10px; }
.cart-panel { position: sticky; top: 20px; min-height: 390px; }
.cart-label { display: flex; align-items: baseline; justify-content: space-between; padding: 15px 16px 10px; border-bottom: 1px solid var(--line); }
.cart-label h3 { margin: 0; font-family: Georgia, serif; font-size: 23px; font-weight: 500; letter-spacing: -.045em; }
.cart-label span { color: var(--muted); font-size: 11px; font-weight: 700; }
.cart-lines { max-height: calc(100vh - 420px); min-height: 160px; overflow: auto; }
.cart-empty { display: grid; place-items: center; min-height: 220px; padding: 25px; color: var(--muted); font-size: 13px; text-align: center; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; padding: 13px 16px; border-bottom: 1px dashed #d9d2c3; }
.cart-line-name { overflow: hidden; font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.cart-line-price { color: var(--muted); font-size: 11px; }
.cart-line-subtotal { align-self: center; font-size: 13px; font-weight: 850; }
.qty-control { display: flex; align-items: center; gap: 5px; }
.qty-control button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; color: var(--leaf-800); background: var(--leaf-100); border: 0; font-weight: 900; }
.qty-control button:hover { background: var(--mango); color: var(--leaf-950); }
.qty-control output { min-width: 25px; font-size: 12px; font-weight: 800; text-align: center; }
.remove-line { justify-self: end; width: max-content; min-height: 22px; padding: 1px 0; color: var(--berry); background: none; border: 0; font-size: 10px; font-weight: 800; text-decoration: underline; }
.cart-footer { padding: 15px 16px 16px; }
.total-row { display: flex; align-items: end; justify-content: space-between; margin-bottom: 13px; }
.total-row span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.total-row strong { color: var(--leaf-900); font-family: Georgia, serif; font-size: 29px; font-weight: 500; letter-spacing: -.05em; }

/* Dashboard */
.metric-strip { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); border: 1px solid var(--line); background: var(--paper); box-shadow: 8px 8px 0 rgba(41,73,49,.05); }
.metric { min-width: 0; padding: 19px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric:nth-child(1) { border-top: 4px solid var(--leaf-700); }
.metric:nth-child(2) { border-top: 4px solid var(--mango); }
.metric:nth-child(3) { border-top: 4px solid var(--berry); }
.metric span { display: block; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.metric strong { display: block; overflow: hidden; margin-top: 7px; font-family: Georgia, serif; font-size: clamp(22px, 2.3vw, 34px); font-weight: 500; letter-spacing: -.05em; text-overflow: ellipsis; white-space: nowrap; }
.metric small { display: block; min-height: 15px; margin-top: 4px; color: var(--muted); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: 1.22fr .78fr; gap: 18px; margin-top: 20px; }
.activity-list { margin: 0; padding: 0; list-style: none; }
.activity-list li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.activity-list .activity-empty { display: block; padding: 24px 16px; color: var(--muted); font-size: 12px; line-height: 1.55; text-align: center; }
.activity-mark { display: grid; place-items: center; width: 29px; height: 29px; color: var(--leaf-800); background: var(--leaf-100); font-size: 14px; }
.activity-list strong { display: block; font-size: 12px; }
.activity-list small { color: var(--muted); font-size: 10px; }
.activity-list .activity-value { font-size: 12px; font-weight: 850; white-space: nowrap; }
.stock-alerts { display: grid; gap: 7px; padding: 13px 16px 16px; }
.stock-alert { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; background: #fff9ec; border-left: 3px solid var(--mango); }
.stock-alert strong { font-size: 12px; }
.stock-alert span { color: #975b15; font-size: 11px; font-weight: 800; }

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; min-width: 600px; border-collapse: collapse; }
.data-table th { padding: 11px 14px; color: var(--muted); background: #f1ecdf; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 850; letter-spacing: .09em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.data-table tbody tr:hover { background: #fff9ea; }
.data-table .main-cell { font-weight: 800; }
.data-table .sub-cell { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.table-actions { display: flex; justify-content: flex-end; gap: 4px; }
.stock-number { font-weight: 850; }
.stock-number.low { color: #a75416; }
.stock-number.out { color: var(--berry); }

/* Modal, checkout, receipt */
.app-modal { width: min(760px, calc(100vw - 26px)); max-height: min(850px, calc(100vh - 26px)); padding: 0; color: var(--ink); background: var(--paper); border: 0; box-shadow: 0 24px 80px rgba(12,33,23,.35); }
.app-modal::backdrop { background: rgba(16,44,32,.62); backdrop-filter: blur(2px); }
.modal-head { position: sticky; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 19px 22px 15px; background: var(--paper); border-bottom: 1px solid var(--line); z-index: 2; }
.modal-head h2 { margin: 0; font-family: Georgia, serif; font-size: 25px; font-weight: 500; letter-spacing: -.04em; }
.modal-body { padding: 21px 22px 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .span-two { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.checkout-total { display: flex; align-items: end; justify-content: space-between; margin: 16px 0; padding: 14px; color: #fffdf6; background: var(--leaf-900); }
.checkout-total span { font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.checkout-total strong { color: var(--mango); font-family: Georgia, serif; font-size: 30px; font-weight: 500; letter-spacing: -.05em; }
.payment-list { display: grid; gap: 8px; }
.payment-line { display: grid; grid-template-columns: minmax(110px, .8fr) minmax(120px, .85fr) minmax(0, 1fr) 30px; align-items: end; gap: 8px; padding: 10px; background: #f4f0e5; border-left: 3px solid var(--mango); }
.payment-line label { min-width: 0; font-size: 9px; }
.payment-line input, .payment-line select { min-height: 37px; padding: 7px; font-size: 12px; }
.payment-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.payment-summary div { padding: 10px; background: var(--leaf-100); }
.payment-summary span { display: block; color: var(--leaf-800); font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.payment-summary strong { display: block; margin-top: 3px; font-size: 17px; }
.payment-summary .short { background: var(--berry-pale); }
.receipt { max-width: 480px; margin: 0 auto; padding: 6px; }
.receipt-top { padding: 18px; color: #fffdf5; background: var(--leaf-900); text-align: center; }
.receipt-top h3 { margin: 3px 0; color: var(--mango); font-family: Georgia, serif; font-size: 28px; font-weight: 500; letter-spacing: -.06em; }
.receipt-top p { margin: 0; color: #d4e1d1; font-size: 10px; }
.receipt-meta { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px dashed #bdb7a9; color: var(--muted); font-size: 11px; }
.receipt-lines { padding: 5px 0; }
.receipt-line { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 8px 0; font-size: 12px; }
.receipt-line small { display: block; color: var(--muted); font-size: 10px; }
.receipt-total { display: grid; gap: 5px; padding: 11px 0; border-top: 2px solid var(--leaf-900); }
.receipt-total div { display: flex; justify-content: space-between; font-size: 12px; }
.receipt-total .grand { margin-top: 5px; color: var(--leaf-900); font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.receipt-foot { padding: 14px 5px 3px; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; }

/* Roles */
.permission-matrix { display: grid; gap: 15px; }
.permission-module { border: 1px solid var(--line); }
.permission-module h4 { margin: 0; padding: 10px 12px; color: var(--leaf-900); background: var(--leaf-100); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.permission-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.check-option { display: flex; align-items: flex-start; gap: 8px; min-height: 49px; padding: 10px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 700; letter-spacing: 0; }
.check-option input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--leaf-700); }
.check-option small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }

/* Operational workspaces */
.check-inline { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 3px; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0; }
.check-inline input { width: 17px; min-height: 17px; margin: 0; accent-color: var(--leaf-700); }
.field-note { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
input[readonly] { color: var(--leaf-800); background: var(--leaf-100); border-color: #aec5af; cursor: default; }
.subsection-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 0 9px; padding-top: 12px; border-top: 1px solid var(--line); }
.subsection-head h4 { margin: 0; color: var(--leaf-900); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.purchase-items, .journal-lines { display: grid; gap: 8px; }
.purchase-line { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(82px, .55fr) minmax(104px, .72fr) minmax(118px, .8fr) 32px; align-items: end; gap: 8px; padding: 10px; background: #f5f0e5; border-left: 3px solid var(--mango); }
.purchase-line label, .journal-line label { min-width: 0; font-size: 9px; }
.purchase-line input, .purchase-line select, .journal-line input, .journal-line select { min-height: 36px; padding: 7px; font-size: 12px; }
.purchase-total-banner { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin: 16px 0 4px; padding: 13px 15px; color: #fffaf0; background: var(--leaf-900); }
.purchase-total-banner span { font-size: 10px; font-weight: 850; letter-spacing: .1em; }
.purchase-total-banner strong { color: var(--mango); font-family: Georgia, serif; font-size: 27px; font-weight: 500; letter-spacing: -.05em; white-space: nowrap; }
.payment-summary.compact { margin-top: 8px; }
.stock-signal { margin: 13px 0 0; padding: 10px 12px; color: var(--leaf-800); background: var(--leaf-100); border-left: 3px solid var(--leaf-700); font-size: 12px; font-weight: 700; }
.stock-signal.adjustment_out { color: #8e5811; background: #fff0ce; border-left-color: var(--mango-dark); }
.stock-signal.spoilage { color: #8e2829; background: var(--berry-pale); border-left-color: var(--berry); }
.expense-summary { display: grid; gap: 10px; margin-bottom: 20px; }
.finance-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
.category-totals { display: flex; flex-wrap: wrap; gap: 7px; }
.category-totals span { display: grid; gap: 2px; min-width: 128px; padding: 8px 10px; background: #fff9ec; border-left: 3px solid var(--mango); }
.category-totals small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.category-totals strong { font-size: 12px; }
.finance-layout { display: grid; grid-template-columns: minmax(220px, .45fr) minmax(0, 1.55fr); gap: 18px; align-items: start; }
.account-list { display: grid; max-height: 515px; overflow: auto; }
.account-row { display: grid; grid-template-columns: 49px 1fr; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.account-row small { grid-column: 2; color: var(--muted); font-size: 10px; font-weight: 500; }
.account-code { color: var(--leaf-800); font-size: 10px; font-weight: 850; }
.journal-line { display: grid; grid-template-columns: minmax(155px, 1fr) minmax(105px, .6fr) minmax(105px, .6fr) 32px; align-items: end; gap: 8px; padding: 10px; background: #f5f0e5; border-left: 3px solid var(--leaf-700); }
.journal-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.journal-totals div { padding: 10px; color: var(--leaf-900); background: var(--leaf-100); }
.journal-totals span { display: block; color: var(--leaf-800); font-size: 9px; font-weight: 850; letter-spacing: .09em; }
.journal-totals strong { display: block; margin-top: 3px; font-size: 16px; }
.journal-balance { margin: 9px 0 0; padding: 9px 11px; color: var(--leaf-800); background: var(--leaf-100); border-left: 3px solid var(--leaf-700); font-size: 12px; font-weight: 750; }
.journal-balance.warning { color: #8f5812; background: #fff0ce; border-left-color: var(--mango-dark); }
.journal-balance.balanced { color: var(--leaf-800); background: var(--leaf-100); }
.detail-list { display: grid; gap: 1px; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 4px; border-bottom: 1px dashed #cfc6b5; font-size: 12px; }
.detail-row span { min-width: 0; }
.detail-row strong { text-align: right; white-space: nowrap; }
.journal-detail { align-items: flex-start; }
.workspace-tabs { display: flex; gap: 1px; margin-bottom: 18px; overflow-x: auto; border-bottom: 2px solid var(--line); }
.tab-button { min-height: 39px; padding: 8px 14px; color: var(--muted); background: transparent; border: 0; border-bottom: 3px solid transparent; font-size: 12px; font-weight: 800; white-space: nowrap; }
.tab-button:hover { color: var(--leaf-800); background: #fff9ec; }
.tab-button.active { color: var(--leaf-900); border-bottom-color: var(--mango); background: #fff9ec; }
.report-metrics { grid-template-columns: repeat(4, minmax(0,1fr)); }
.reports-grid { grid-template-columns: 1.15fr .85fr; }
.toast-region { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(370px, calc(100vw - 36px)); z-index: 30; }
.toast { padding: 12px 14px; color: #fffdf7; background: var(--leaf-900); border-left: 4px solid var(--mango); box-shadow: var(--shadow); font-size: 13px; font-weight: 700; animation: toast-in .25s ease both; }
.toast.error { background: #7f292b; border-left-color: #ffb2a5; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1050px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr) 310px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(135px,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .finance-layout { grid-template-columns: 1fr; }
  .report-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 50px; width: min(272px, 86vw); height: calc(100vh - 50px); transform: translateX(-105%); box-shadow: 10px 0 30px rgba(8,27,17,.2); transition: transform .2s ease; }
  .app-shell.menu-open .sidebar { transform: translateX(0); }
  .mobile-bar { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; height: 50px; padding: 7px 12px; color: #fffdf7; background: var(--leaf-900); z-index: 8; }
  .mobile-bar .icon-button { width: 32px; height: 32px; color: #fff; border-color: rgba(255,255,255,.25); }
  .mobile-brand { font-family: Georgia, serif; font-size: 17px; }
  .topbar { min-height: 88px; padding: 19px 20px 14px; }
  .topbar h2 { font-size: 27px; }
  .connection-state { display: none; }
  .page-content { min-height: calc(100vh - 138px); padding: 20px 16px 38px; }
  .pos-layout { grid-template-columns: 1fr; }
  .cart-panel { position: static; min-height: 0; }
  .cart-lines { min-height: 0; max-height: none; }
  .cart-empty { min-height: 145px; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .finance-metrics, .report-metrics { grid-template-columns: 1fr; }
  .purchase-line { grid-template-columns: minmax(0,1fr) minmax(85px,.7fr) minmax(100px,.8fr) 32px; }
  .purchase-line label:nth-child(4) { grid-column: 1 / 4; }
  .journal-line { grid-template-columns: 1fr 1fr 32px; }
  .journal-line label:first-child { grid-column: 1 / 3; }
  .section-head { align-items: stretch; flex-direction: column; }
  .section-head .btn { align-self: flex-start; }
}
@media (max-width: 550px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 245px; padding: 27px 28px; }
  .login-brand .brand-mark { width: 47px; height: 47px; margin-bottom: 35px; font-size: 17px; }
  .login-brand .brand-mark i { width: 12px; height: 5px; top: 6px; right: 6px; }
  .login-brand .brand-mark b { height: 11px; top: 8px; right: 13px; }
  .login-brand h1 { font-size: 49px; }
  .login-brand .brand-copy, .harvest-stamp { display: none; }
  .login-panel { padding: 37px 25px; align-items: start; }
  .login-card h2 { font-size: 39px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .fruit-tile { min-height: 123px; }
  .fruit-name { font-size: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-two { grid-column: auto; }
  .payment-line { grid-template-columns: 1fr 1fr 30px; }
  .payment-line label:nth-child(3) { grid-column: 1 / 3; }
  .permission-options { grid-template-columns: 1fr; }
  .modal-head, .modal-body { padding-left: 15px; padding-right: 15px; }
  .purchase-total-banner strong { font-size: 23px; }
  .detail-row { align-items: flex-start; }
}
@media (max-width: 390px) {
  .product-grid { grid-template-columns: 1fr; }
  .fruit-tile { min-height: 112px; }
  .fruit-name { margin-top: 10px; }
}
@media print {
  body { background: #fff; }
  body * { visibility: hidden !important; }
  #app-modal, #app-modal *, .receipt, .receipt * { visibility: visible !important; }
  #app-modal { position: absolute; inset: 0; display: block; width: 100%; max-width: none; max-height: none; box-shadow: none; }
  .modal-head, .modal-body > :not(.receipt) { display: none !important; }
  .modal-body { padding: 0; }
  .receipt { padding: 0; }
  .receipt-top { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
