:root {
  color-scheme: light;
  --ink: #332c28;
  --muted: #8d837d;
  --line: #ece7e2;
  --paper: #fff;
  --canvas: #f8f6f3;
  --accent: #9a765c;
  --accent-dark: #76563f;
  --soft: #f2ece6;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 64px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 48px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--ink); color: #fff; font-family: Georgia, serif; font-size: 24px; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 20px; letter-spacing: -.02em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.account-actions, .print-actions { display: flex; align-items: center; gap: 9px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 650; text-decoration: none; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .65; }
.button-primary { background: var(--ink); color: #fff; }
.button-primary:hover:not(:disabled) { background: #4a3e37; }
.button-outline { border-color: #ddd5ce; background: transparent; color: var(--ink); }
.button-outline:hover { background: #fff; }
.button-quiet { background: transparent; color: #62574f; }
.button-quiet:hover { background: #efeae5; }
.button-wide { width: 100%; }
.button-qr { min-height: 33px; border-color: #e7ddd3; background: #fbf8f5; color: var(--accent-dark); font-size: 12px; }
.button-edit { min-height: 33px; padding: 0 12px; background: transparent; color: #70665f; font-size: 12px; }

.login-layout { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: clamp(42px, 9vw, 118px); max-width: 930px; margin: 105px auto 60px; }
.welcome-copy { max-width: 490px; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .17em; }
.welcome-copy h1, .dashboard-heading h1 { margin: 14px 0 16px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 5vw, 52px); font-weight: 500; letter-spacing: -.04em; line-height: 1.08; }
.welcome-copy > p, .dashboard-heading > div > p { max-width: 510px; margin: 0; color: #7e746e; font-size: 15px; line-height: 1.75; }
.feature-note { display: flex; align-items: center; gap: 10px; margin-top: 28px; color: #6f655e; font-size: 12px; line-height: 1.5; }
.feature-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #a58365; box-shadow: 0 0 0 5px #a583651c; }
.panel { border: 1px solid var(--line); border-radius: 15px; background: var(--paper); box-shadow: 0 6px 24px #37271908; }
.login-card { padding: 30px; }
.login-card h2, .dialog-heading h2 { margin: 10px 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 500; }
.muted, .login-card > p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-card > .muted { margin: 0 0 26px; }
label { display: block; color: #514842; font-size: 12px; font-weight: 650; }
.login-card label, .product-dialog label { margin-bottom: 8px; }
input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #e4ded8; border-radius: 8px; outline: none; background: #fff; color: var(--ink); font-size: 14px; }
input:focus { border-color: #ad8b70; box-shadow: 0 0 0 3px #ad8b7019; }
.login-card .button { margin-top: 17px; }
.form-error { min-height: 18px; margin: 10px 0 0; color: #a33b35; font-size: 12px; line-height: 1.45; }

.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 61px 0 28px; }
.dashboard-heading h1 { margin: 8px 0 10px; font-size: clamp(31px, 4vw, 42px); }
.dashboard-heading > div > p { font-size: 13px; }
.dashboard-heading > .button { margin-bottom: 2px; min-height: 44px; }
.dashboard-heading > .button span { font-size: 18px; font-weight: 400; }
.stats-row { display: grid; grid-template-columns: minmax(190px, 250px) 1fr; gap: 14px; margin-bottom: 22px; }
.stat-card { display: flex; flex-direction: column; min-height: 117px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.stat-card > span { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .13em; }
.stat-card > strong { margin-top: 9px; font-size: 25px; font-weight: 650; letter-spacing: -.03em; }
.stat-card > small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.stat-card-note { background: #f3eee9; border-color: #f3eee9; }
.stat-card-note > strong { font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 500; }
.products-panel { overflow: hidden; }
.list-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 21px 22px 18px; }
.list-tools { display: flex; align-items: center; gap: 6px; }
.import-button, .template-button { min-height: 36px; padding: 0 10px; white-space: nowrap; font-size: 11px; }
.import-button { cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.list-toolbar h2 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.list-toolbar .muted { margin: 0; font-size: 11px; }
.search-box { position: relative; display: block; width: min(260px, 45%); }
.search-box > span { position: absolute; top: 8px; left: 12px; color: #a19891; font-size: 22px; line-height: 1; }
.search-box input { height: 37px; padding-left: 37px; border-color: #ede8e3; background: #fcfbfa; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #fbfaf9; }
th { height: 37px; padding: 0 20px; color: #9a918a; font-size: 9px; font-weight: 750; letter-spacing: .1em; }
td { height: 65px; padding: 10px 20px; border-top: 1px solid #f1eeeb; font-size: 13px; }
.product-name-cell { max-width: 380px; font-weight: 600; overflow-wrap: anywhere; }
.price-cell { color: #554940; font-weight: 650; white-space: nowrap; }
.actions-heading, .actions-cell { text-align: right; }
.actions-cell { white-space: nowrap; }
.status-message { margin: 0 22px 12px; padding: 11px 13px; border: 1px solid #dfece1; border-radius: 8px; background: #f1f8f2; color: #3c7048; font-size: 12px; }
.status-message[data-error="true"] { border-color: #eedbd8; background: #fbf2f0; color: #9d453e; }
.empty-state { padding: 47px 16px; text-align: center; }
.empty-state > strong { display: block; margin-top: 10px; font-size: 14px; }
.empty-state > p { margin: 7px 0 17px; color: var(--muted); font-size: 12px; }
.empty-icon { display: inline-grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: var(--soft); color: var(--accent-dark); font-size: 23px; }
.empty-state .button { min-height: 36px; font-size: 12px; }
.footnote { margin: 13px 2px 0; color: #988e87; font-size: 11px; }

.product-dialog, .qr-dialog { width: min(100% - 32px, 440px); padding: 25px; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 20px 70px #30241b2b; color: var(--ink); }
.product-dialog::backdrop, .qr-dialog::backdrop { background: #211a16a1; backdrop-filter: blur(2px); }
.product-dialog form { display: grid; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.dialog-heading h2 { margin-bottom: 0; }
.icon-button { display: grid; width: 33px; height: 33px; place-items: center; border: 0; border-radius: 8px; background: #f4f1ee; color: #73675f; cursor: pointer; font-size: 23px; line-height: 1; }
.product-dialog label:not(:first-of-type) { margin-top: 18px; }
.price-input { position: relative; }
.price-input > span { position: absolute; top: 12px; left: 13px; color: #84796f; font-size: 14px; }
.price-input input { padding-left: 34px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 11px; }
.dialog-actions .button { min-width: 105px; }
.qr-dialog { text-align: center; }
.qr-dialog .dialog-heading { text-align: left; margin-bottom: 12px; }
.qr-dialog .dialog-heading h2 { max-width: 320px; overflow-wrap: anywhere; font-size: 20px; }
.qr-preview { display: grid; min-height: 258px; place-items: center; padding: 15px; border: 1px solid #f0ece8; border-radius: 11px; background: #fff; }
.qr-preview img { width: min(100%, 290px); image-rendering: pixelated; }
.qr-preview > span { color: var(--muted); font-size: 12px; }
.qr-help { margin: 13px 0 17px; font-size: 11px; }

.print-body { background: #fff; }
.print-shell { width: min(1100px, calc(100% - 36px)); margin: 0 auto; padding: 24px 0; }
.print-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.print-toolbar h1 { margin: 6px 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 500; }
.print-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.print-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.print-item { display: flex; min-width: 0; min-height: 188px; flex-direction: column; align-items: center; justify-content: center; padding: 10px 7px; border: 1px solid #eee9e4; border-radius: 8px; text-align: center; break-inside: avoid; }
.print-item canvas { width: 118px !important; height: 118px !important; }
.print-brand { margin: 0 0 4px !important; color: #332c28 !important; font-size: 9px !important; font-weight: 800; letter-spacing: .12em; }
.print-product-brand { margin: 0 0 4px !important; color: #916c4f !important; font-size: 9px !important; font-weight: 650; }
.print-item strong { max-width: 100%; margin-top: 4px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.print-item span { margin-top: 3px; color: #70563f; font-size: 11px; font-weight: 700; }

@media (max-width: 760px) {
  .shell { width: min(100% - 32px, 580px); padding-top: 18px; }
  .account-actions { gap: 2px; }
  .account-actions .button { min-height: 35px; padding: 0 8px; font-size: 10px; }
  .login-layout { grid-template-columns: 1fr; gap: 28px; margin: 62px auto 30px; }
  .welcome-copy h1 { max-width: 440px; font-size: 39px; }
  .welcome-copy > p { font-size: 13px; }
  .feature-note { margin-top: 18px; }
  .login-card { padding: 24px; }
  .dashboard-heading { align-items: flex-start; margin-top: 45px; }
  .dashboard-heading > .button { flex: 0 0 auto; min-height: 39px; padding: 0 11px; font-size: 11px; }
  .dashboard-heading > div > p { max-width: 430px; line-height: 1.6; }
  .list-toolbar { align-items: flex-start; padding: 18px 15px 15px; }
  th { padding: 0 12px; }
  td { padding: 9px 12px; }
  .print-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .brand { gap: 8px; }
  .brand-mark { width: 36px; height: 36px; font-size: 20px; }
  .brand strong { font-size: 17px; }
  .brand small { font-size: 8px; }
  .account-actions { max-width: 200px; flex-wrap: wrap; justify-content: flex-end; }
  .account-actions .button-quiet:first-child { display: none; }
  .dashboard-heading { gap: 12px; }
  .dashboard-heading h1 { font-size: 29px; }
  .dashboard-heading > .button { max-width: 125px; white-space: nowrap; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 102px; padding: 13px; }
  .stat-card > strong { font-size: 22px; }
  .stat-card-note > strong { font-size: 16px; }
  .stat-card > small { font-size: 10px; line-height: 1.4; }
  .list-toolbar { flex-direction: column; gap: 13px; }
  .list-tools { width: 100%; flex-wrap: wrap; }
  .search-box { width: 100%; }
  th { font-size: 8px; }
  td { font-size: 11px; }
  .button-qr, .button-edit { min-height: 30px; padding: 0 8px; font-size: 10px; }
  .print-toolbar { align-items: flex-start; flex-direction: column; }
  .print-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  @page { size: A4; margin: 8mm; }
  body.print-body, .print-shell { width: auto; margin: 0; padding: 0; }
  .print-toolbar { display: none; }
  .print-grid { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .print-item { min-height: 39mm; padding: 2mm; border-color: #ddd; border-radius: 0; }
  .print-item canvas { width: 29mm !important; height: 29mm !important; }
  .print-item strong { margin-top: 1mm; font-size: 7pt; }
  .print-item span { margin-top: 1mm; font-size: 8pt; }
}
