:root {
  color-scheme: light; --ink: #17263c; --muted: #516785; --blue: #2459d2; --blue-dark: #1647bd;
  --blue-soft: #e9f0ff; --line: #d9e2ee; --soft: #f2f6fb; --paper: #fff; --danger: #a23440;
  font: 16px/1.45 "Segoe UI", system-ui, sans-serif; background: var(--paper); color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }
h1,h2,h3,p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.65rem, 3vw, 2.1rem); line-height: 1.16; letter-spacing: -.025em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
a { color: var(--blue-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.wrap { width: min(1510px, calc(100% - 72px)); margin-inline: auto; }
.top { position: sticky; top: 0; z-index: 3; background: #f8fafe; border-bottom: 1px solid var(--line); }
.top .wrap { min-height: 64px; display: flex; align-items: center; gap: 42px; }
.brand, .links, .account { display: inline-flex; align-items: center; gap: 10px; }
.brand { color: var(--ink); font-weight: 760; font-size: 1.1rem; white-space: nowrap; text-decoration: none; }
.brand img { width: 36px; height: 36px; }
.links a { color: var(--muted); padding: 9px 15px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.links a[aria-current="page"] { background: var(--blue-soft); color: var(--blue-dark); }
.account { margin-left: auto; min-width: 0; }
.account button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--blue-soft); color: var(--blue-dark); font-weight: 750; padding: 0; }
.account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .88rem; }
.button { display: inline-flex; gap: 7px; align-items: center; justify-content: center; min-height: 43px; padding: 7px 15px; border: 1px solid #cad9f0; background: #fff; color: var(--blue-dark); border-radius: 8px; font-weight: 670; text-decoration: none; text-align: center; white-space: nowrap; }
.button:hover:not(:disabled) { border-color: var(--blue); background: #f4f7fe; }
.button.primary { background: var(--blue); border-color: var(--blue); color: white; }
.button.primary:hover:not(:disabled) { background: var(--blue-dark); }
button:disabled, fieldset:disabled { cursor: default; opacity: .6; }
.linkButton { border: 0; background: none; color: var(--blue-dark); padding: 0; font-weight: 650; text-align: left; }
.linkButton:hover { text-decoration: underline; }
.closeButton { border: 0; background: var(--soft); border-radius: 8px; min-width: 38px; height: 38px; color: var(--muted); font-size: 1.25rem; }
input:not([type="checkbox"]), select { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 42px; padding: 8px 11px; width: 100%; min-width: 0; }
input[type="checkbox"] { margin: 0; width: 17px; height: 17px; accent-color: var(--blue); }
label { display: grid; gap: 5px; font-weight: 650; font-size: .88rem; }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 500; min-height: 31px; }
.fieldGrid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: grid; gap: 14px; }
.muted { color: var(--muted); }
.statusBlock, .empty { padding: 35px 16px; color: var(--muted); text-align: center; }
.empty { display: grid; gap: 7px; justify-items: center; border: 1px dashed var(--line); border-radius: 10px; margin-block: 15px; }
.empty strong { color: var(--ink); }
.statusBlock { padding-top: 12vh; }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: #eef3fa; }
.authCard { width: min(100%, 422px); padding: 31px; background: white; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 12px 36px #193a7310; }
.authCard .brand { margin-bottom: 24px; }
.authCard h1 { margin-bottom: 14px; }
.formError { color: var(--danger); font-size: .88rem; overflow-wrap: anywhere; }
.heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 24px; }
.inventory { padding-block: 27px 102px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 18px; }
.filters select { width: auto; min-width: 168px; max-width: 100%; }
.counts { display: grid; font-size: .88rem; color: var(--muted); text-align: right; }
.counts strong { color: var(--blue-dark); }
#counts { display: none; }
.desktopTable { width: 100%; border-collapse: collapse; table-layout: fixed; }
.desktopTable th { padding: 12px 15px; background: var(--soft); color: #344963; font-size: .86rem; text-align: left; }
.desktopTable th:first-child { border-radius: 8px 0 0 8px; }
.desktopTable th:last-child { border-radius: 0 8px 8px 0; }
.desktopTable td { padding: 12px 15px; border-bottom: 1px solid #e5eaf2; color: #344963; vertical-align: middle; overflow-wrap: anywhere; }
.desktopTable tbody tr:hover { background: #f8fafe; }
.mainColumn { width: 35%; } .categoryColumn { width: 15%; } .totalColumn { width: 14%; }
.sort { color: inherit; font: inherit; font-weight: 700; border: 0; background: none; padding: 0; cursor: pointer; }
.productLink { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); }
.productLink strong { display: block; font-weight: 740; }
.productLink:hover strong { color: var(--blue-dark); }
.caption { color: var(--muted); font-size: .82rem; }
.thumb { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 9px; background: #e9eff8; display: grid; place-items: center; color: #536d92; overflow: hidden; }
.thumb.wine { background: #f4eaf1; color: #673452; }
.thumb svg { width: 25px; height: 25px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.chip { border-radius: 6px; padding: 3px 8px; background: #edf2f9; color: #3d5572; font-size: .78rem; overflow-wrap: anywhere; }
.badge { display: inline-block; justify-self: start; text-align: center; min-width: 26px; background: #e7effc; color: var(--blue-dark); border-radius: 6px; padding: 2px 6px; font-weight: 700; font-size: .8rem; }
.positions { display: grid; gap: 4px; font-size: .84rem; }
.position { display: flex; align-items: baseline; gap: 8px; }
.totalStrong { color: var(--ink); font-weight: 760; font-size: 1.14rem; }
.mobileCards { display: none; }
.footer { position: fixed; z-index: 3; inset: auto 0 0; border-top: 1px solid var(--line); background: #fff; padding-block: 11px calc(11px + env(safe-area-inset-bottom)); }
.footer .wrap { display: flex; justify-content: flex-end; align-items: center; gap: 9px; }
.search { display: flex; flex: 1; align-items: center; max-width: 560px; margin-right: auto; border: 1px solid var(--line); border-radius: 8px; background: #f4f7fc; color: var(--muted); padding-left: 12px; min-width: 0; }
.search input { border: 0; background: transparent; }
.detailHead { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 64px; z-index: 2; }
.detailHead .wrap { padding-block: 11px 15px; }
.detailLine { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.detailLine .thumb { width: 65px; height: 65px; }
.detailLine .thumb svg { width: 36px; height: 36px; }
.detailIdentity { min-width: 0; }
.detailIdentity .caption { margin-top: 5px; }
.detailTotal, .mobileTotal { color: var(--ink); background: #eff4ff; padding: 10px 15px; border-radius: 10px; }
.detailTotal { margin-left: auto; min-width: 150px; }
.detailTotal strong, .mobileTotal strong { font-size: 1.26rem; }
.mobileTotal { display: none; }
.details { padding-block: 19px 100px; }
.tableTitle { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.vintageColumn { width: 24%; }
.quantityColumn { width: 16%; }
.detailRows { display: grid; gap: 11px; }
.detailGroup { border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; }
.detailGroup header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e5eaf2; padding-bottom: 7px; }
.detailGroup .position { justify-content: space-between; margin-top: 7px; }
.locations, .admin { padding-block: 26px 65px; }
.locationsGrid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 15px; display: grid; gap: 11px; align-content: start; }
.panelHeader { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lineItem { display: flex; justify-content: space-between; gap: 7px; align-items: center; border-bottom: 1px solid #e5eaf2; padding: 8px 0; }
.lineItem:last-child { border: 0; }
.lineItem > * { min-width: 0; overflow-wrap: anywhere; }
.adminGrid { display: grid; grid-template-columns: minmax(230px, 29%) minmax(0, 1fr); gap: 24px; }
.member { width: 100%; text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 8px; color: var(--ink); }
.member.selected, .member:hover { background: var(--soft); }
.permissions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px 17px; }
.formActions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.formActions > :first-child { margin-right: auto; }
.dialogTitle { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialogTitle h2 { font-size: 1.26rem; }
dialog { width: min(580px, calc(100% - 24px)); max-height: 91dvh; border: 1px solid var(--line); border-radius: 13px; padding: 18px; color: var(--ink); box-shadow: 0 16px 58px #1123443a; }
dialog::backdrop { background: #1b2c4964; }
dialog form { display: grid; gap: 13px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.historyList { display: grid; gap: 10px; }
.historyList article { border-bottom: 1px solid var(--line); padding-bottom: 7px; }
.notice { position: fixed; z-index: 4; bottom: 77px; right: 18px; max-width: min(460px, calc(100% - 36px)); background: #17263c; color: white; padding: 11px 15px; border-radius: 9px; box-shadow: 0 8px 26px #18274425; }
@media(max-width: 760px) {
  .wrap { width: calc(100% - 28px); }
  .top .wrap { min-height: 59px; gap: 9px; }
  .brand { font-size: .96rem; gap: 6px; }
  .brand img { width: 28px; height: 28px; }
  .brandName, .account span { display: none; }
  .links { gap: 1px; }
  .links a { padding: 7px 8px; font-size: .83rem; }
  .account button { width: 29px; height: 29px; font-size: .73rem; }
  .heading { margin-bottom: 13px; }
  .inventory { padding-block: 17px 91px; }
  .filters { margin-bottom: 13px; gap: 5px; }
  .filters select { flex: 1 1 34%; min-width: 0; font-size: .8rem; }
  .counts { text-align: left; margin-bottom: 10px; }
  .desktopCounts { display: none; }
  #counts { display: grid; }
  .desktopTable { display: none; }
  .mobileCards { display: grid; }
  .cardLink { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 9px; color: var(--ink); text-decoration: none; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .cardLink:first-child { border-top: 1px solid var(--line); }
  .cardLink .thumb { width: 41px; height: 41px; }
  .cardLink .positions { margin-top: 5px; }
  .cardLink .position { justify-content: space-between; }
  .cardLink .position .badge { order: 1; }
  .footer .button { min-height: 43px; font-size: .84rem; padding-inline: 9px; }
  .search { padding-left: 7px; }
  .search input { padding-inline: 5px; font-size: .9rem; }
  .detailHead { top: 59px; }
  .detailLine .thumb { width: 48px; height: 48px; }
  .detailLine .thumb svg { width: 27px; height: 27px; }
  .detailLine h1 { font-size: 1.23rem; }
  .detailTotal { display: none; }
  .mobileTotal { display: block; margin-bottom: 14px; }
  .tableTitle { align-items: center; }
  .tableTitle .button { font-size: .83rem; min-height: 38px; padding-inline: 8px; }
  .locationsGrid, .adminGrid, .permissions { grid-template-columns: 1fr; }
  .locations, .admin { padding-top: 17px; }
  .authCard { padding: 22px; }
}
