@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --green: #17382d;
  --sage: #e8eee7;
  --cream: #f6f3eb;
  --ink: #202d26;
  --muted: #58635a;
  --line: #dadbd0;
  --rust: #a63d2f;
  --orange: #f7e6d5;
  --white: #fffdf8;
  --serif: 'Instrument Serif', Georgia, serif;
  --rail: 242px;
  --gutter: clamp(20px, 3.1vw, 55px);
  --radius: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 14px/1.5 'DM Sans', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--rust); }
button { cursor: pointer; border: 1px solid transparent; border-radius: 5px; padding: 10px 15px; font-weight: 600; color: var(--green); }
button:hover { filter: brightness(.95); }
button:disabled { opacity: .56; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
button.primary, a.primary { background: var(--green); color: white; }
.outline { background: var(--white); border: 1px solid #bfc6bb; color: var(--green); }
.small { padding: 8px 12px; font-size: 13px; }
.link { padding: 4px 0; background: transparent; color: var(--green); font-size: 13px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.skip-link { position: fixed; z-index: 30; top: 12px; left: 12px; padding: 10px 15px; background: white; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--rail); background: var(--green); color: #fbf3e4; display: flex; flex-direction: column; padding: 30px 18px 21px; z-index: 5; overflow-y: auto; }
.sidebar :focus-visible { outline-color: #f2c6a5; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 23px; font: 31px/.92 var(--serif); }
.brand-icon { display: grid; place-items: center; flex: 0 0 45px; color: #f4c3a5; }
.brand-icon svg { max-width: 100%; }
.workspace { border-top: 1px solid #ffffff33; padding: 17px 10px 8px; }
.workspace small { color: #d8dfd2; }
small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; font-weight: 400; }
nav { display: flex; flex-direction: column; gap: 3px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 5px; color: #e9eddf; font-weight: 500; font-size: 13px; }
nav a:hover { background: #ffffff12; }
nav a.active { background: #f3e9d5; color: var(--green); font-weight: 700; }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 20px; flex-shrink: 0; }
.nav-icon svg { width: 18px; height: 18px; }
nav .count { margin-left: auto; font-size: 12px; }
.sidebar-bottom { margin-top: auto; padding: 24px 10px 0; font-size: 12px; }
.local-dot { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.local-dot::before { content: ''; width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: #e9b693; }
.sidebar-bottom p { margin: 4px 0 9px; color: #d8dfd2; }
.sidebar-bottom .link { color: inherit; }
.profile { display: flex; gap: 9px; align-items: center; border-top: 1px solid #ffffff33; margin-top: 14px; padding-top: 15px; overflow-wrap: anywhere; }
.profile small { color: #d8dfd2; }
.avatar { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: inline-grid; place-items: center; background: #ece6d6; color: #644a28; font-size: 12px; font-weight: 700; }
.app { margin-left: var(--rail); }
.topbar { min-height: 67px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px var(--gutter); background: var(--white); }
.breadcrumb { font-size: 13px; font-weight: 600; color: var(--green); }
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
main { max-width: 1540px; min-height: 62vh; margin: auto; padding: 29px var(--gutter) 42px; }
main:focus { outline: none; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 15px; margin-bottom: 23px; }
.eyebrow { font-size: 11px; letter-spacing: .13em; text-transform: uppercase; font-weight: 700; color: var(--rust); margin: 0 0 8px; }
.page-heading h1 { font: 400 clamp(39px, 4vw, 58px)/.99 var(--serif); margin: 0; }
.page-heading p { color: var(--muted); margin: 10px 0 0; max-width: 60ch; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.actions:empty { display: none; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; min-width: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; gap: 10px; }
.panel-header h2, .section-title { font: 400 30px/1.04 var(--serif); margin: 0; }
.panel-header p { color: var(--muted); margin: 5px 0 0; }
.table-wrap { overflow-x: auto; }
.table-wrap:focus-visible { outline-offset: -2px; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; }
th { font-size: 11px; letter-spacing: .035em; font-weight: 700; color: var(--muted); background: #f2f3eb; padding: 11px 16px; border-block: 1px solid var(--line); }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
td .name { display: flex; align-items: center; gap: 9px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 4px; padding: 4px 8px; background: var(--sage); color: var(--green); }
.tag.amber { background: #f8ecd7; color: #714711; }
.tag.blue { background: #e9eff4; color: #24516a; }
.tag.gray { background: #eeeee7; color: #505c52; }
footer { display: flex; justify-content: space-between; gap: 10px; padding: 0 var(--gutter) 20px; color: var(--muted); font-size: 12px; }
.toolbar, .filters { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.filters { margin-bottom: 15px; }
.filters input, .toolbar input { flex: 1; min-width: min(220px, 100%); }
input, select, textarea { background: var(--white); border: 1px solid #bfc6bb; border-radius: 5px; padding: 10px 12px; color: var(--ink); max-width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }
.catalogue { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 15px; }
.product { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.product-photo { height: 162px; background: #ede9dc; display: grid; place-items: center; padding: 17px; }
.product-photo img { height: 100%; max-height: 128px; max-width: 90%; object-fit: contain; mix-blend-mode: multiply; }
.product-info { display: flex; flex-direction: column; align-items: start; flex: 1; padding: 16px; }
.product h3 { font-size: 15px; line-height: 1.35; font-weight: 700; margin: 0 0 9px; }
.product p { color: var(--muted); font-size: 13px; margin: 8px 0 15px; }
.product-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; width: 100%; }
.product-bottom b { font-size: 17px; }
.cart-bar { position: sticky; z-index: 4; bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 15px; background: var(--green); color: white; padding: 12px 15px; border-radius: var(--radius); box-shadow: 0 8px 30px #16392c40; }
.cart-bar button { background: var(--cream); }
.batch { padding: 18px 20px; border-top: 1px solid var(--line); }
.batch h3 { margin: 0; font-size: 15px; }
.batch-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.batch p { color: var(--muted); }
.batch-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(55px, .23fr) minmax(68px, .27fr); gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 13px; align-items: center; overflow-wrap: anywhere; }
.batch-line input { width: 70px; padding: 6px; }
.muted { color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 10px; width: 670px; max-width: calc(100vw - 24px); max-height: 90dvh; padding: 0; color: var(--ink); background: var(--white); box-shadow: 0 25px 100px #12291a55; }
dialog::backdrop { background: #15292090; }
.modal-head, .modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; }
.modal-head { border-bottom: 1px solid var(--line); }
.modal-head h2 { font: 400 33px/1 var(--serif); margin: 0; }
.close { background: var(--sage); border-radius: 50%; padding: 0; width: 40px; height: 40px; flex-shrink: 0; font-size: 24px; }
.modal-body { padding: 19px 20px; }
.modal-body p { color: var(--muted); }
.modal-footer { justify-content: end; flex-wrap: wrap; border-top: 1px solid var(--line); background: #f1f3eb; }
.form-grid, .info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: block; font-size: 13px; margin-bottom: 11px; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 5px; }
.line-edit { display: grid; grid-template-columns: minmax(0, 1fr) 70px 40px; gap: 8px; align-items: center; margin: 10px 0; }
.line-edit input { width: 100%; padding: 7px; }
.line-edit button { padding: 7px; background: #f7e9e4; color: var(--rust); }
.add-line { display: flex; gap: 8px; margin: 15px 0; }
.add-line select { flex: 1; min-width: 0; }
.total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 15px; margin: 16px 0; font-size: 16px; font-weight: 700; }
.history, .info-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.history { margin-top: 16px; }
.info-card h2 { font: 400 28px var(--serif); margin: 0 0 7px; }
.info-card p { margin-block: 6px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--green); color: white; border-radius: 6px; padding: 12px 16px; width: max-content; max-width: calc(100vw - 30px); opacity: 0; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; }
.print-only { display: none; }

@media (max-width: 1090px) { :root { --rail: 200px; } .brand { font-size: 27px; } }
@media (max-width: 770px) {
  .sidebar { position: static; width: 100%; padding: 14px var(--gutter); }
  .brand { padding: 0; font-size: 29px; width: fit-content; }
  .brand br { display: none; }
  .brand br::after { content: ' '; }
  .workspace { border-top: 0; padding: 8px 0 2px; }
  .sidebar-bottom { display: flex; align-items: center; justify-content: space-between; gap: 5px 12px; padding: 8px 0 0; flex-wrap: wrap; }
  .sidebar-bottom p { display: none; }
  .sidebar-bottom .profile { margin: 0; border: 0; padding: 0; }
  nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); }
  nav a { min-height: 42px; font-size: 12px; padding: 7px; }
  .app { margin: 0; }
  .topbar { min-height: 0; padding-block: 9px; }
  main { padding-top: 20px; }
  .page-heading { flex-direction: column; align-items: start; }
}
@media (max-width: 540px) {
  .form-grid, .info-grid { grid-template-columns: 1fr; }
  .panel-header, .batch, .toolbar { padding-inline: 13px; }
  .panel-header h2 { font-size: 26px; }
  td, th { padding-inline: 10px; }
}
@media print {
  body { background: white; color: black; }
  .sidebar, .app, dialog, #toast { display: none !important; }
  .print-only { display: block; padding: 25px; font: 12px Arial, sans-serif; color: black; }
  .print-only h1 { font: 28px Georgia, serif; }
  .print-only td, .print-only th { border: 1px solid #ccc; padding: 8px; }
}
