:root {
  color-scheme: light;
  --pink: #ffcad4;
  --pink-deep: #db9eaa;
  --rose: #a76875;
  --ink: #302626;
  --muted: #78696a;
  --paper: #fffdfc;
  --line: #eee5e4;
  --green: #34744a;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Trebuchet MS", Arial, sans-serif;
  font-family: var(--sans);
}
* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: #f8f5f4; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.login-view { display: grid; min-height: 100svh; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 10%, #ffe3e8, var(--pink) 50%, #f3b8c3 100%); }
.login-card { width: min(100%, 430px); padding: 36px clamp(22px, 6vw, 46px) 30px; border: 1px solid rgba(255,255,255,.85); border-radius: 26px; background: rgba(255,253,252,.94); box-shadow: 0 24px 64px rgba(102,57,67,.16); text-align: center; }
.login-logo { display: block; width: 108px; height: 108px; margin: 0 auto 17px; border: 3px solid #fff; border-radius: 50%; object-fit: cover; box-shadow: 0 6px 20px rgba(98,58,66,.12); }
.eyebrow { margin: 0 0 8px; color: var(--rose); font-size: .68rem; font-weight: 700; letter-spacing: .15em; }
.login-card h1, .page-heading h1 { margin: 0; font-family: var(--serif); font-size: clamp(1.8rem, 6vw, 2.3rem); font-weight: 500; }
.login-intro { margin: 12px auto 25px; color: var(--muted); font-size: .93rem; line-height: 1.55; }
.login-form { display: grid; gap: 9px; text-align: left; }
.login-form label, .field { color: #55494a; font-size: .8rem; font-weight: 700; }
.login-form input, .field input, .field textarea, .search-box input { width: 100%; min-width: 0; border: 1px solid #ded5d4; border-radius: 11px; outline: none; background: #fff; color: var(--ink); }
.login-form input { height: 48px; margin-bottom: 8px; padding: 0 13px; }
.login-form input:focus, .field input:focus, .field textarea:focus, .search-box:focus-within { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(167,104,117,.12); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 0 16px; border: 1px solid transparent; border-radius: 11px; font-size: .83rem; font-weight: 700; text-decoration: none; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .icon-button:focus-visible, .text-button:focus-visible { outline: 3px solid rgba(167,104,117,.38); outline-offset: 2px; }
.button-primary { background: var(--ink); color: #fff; box-shadow: 0 5px 13px rgba(48,38,38,.14); }
.button-primary:hover { background: #493b3b; }
.login-submit { width: 100%; min-height: 48px; margin-top: 9px; }
.text-button { justify-self: center; padding: 8px; border: 0; background: transparent; color: var(--rose); font-size: .8rem; font-weight: 700; }
.message { min-height: 1.1em; margin: 10px 0 0; color: #9b3f46; font-size: .8rem; line-height: 1.45; }
.privacy-note { display: block; margin-top: 20px; color: #847677; font-size: .71rem; }
.privacy-note span { color: var(--rose); }

.dashboard-view { min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 82px; padding: 12px max(22px, calc((100vw - 1180px)/2)); border-bottom: 1px solid var(--line); background: rgba(255,253,252,.94); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand img { width: 52px; height: 52px; border: 2px solid #fff; border-radius: 50%; object-fit: cover; box-shadow: 0 3px 10px rgba(98,58,66,.11); }
.brand span { display: grid; gap: 3px; }
.brand strong { font-family: var(--serif); font-size: 1.05rem; font-weight: 500; }
.brand small { color: var(--muted); font-size: .72rem; }
.account-area { display: flex; align-items: center; gap: 14px; }
.user-email { max-width: 260px; overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.button-quiet { min-height: 38px; padding-inline: 12px; border-color: var(--line); background: #fff; color: #5f5152; }
.button-outline { border-color: #ded2d2; background: #fff; color: #514647; }
.workspace { width: min(100% - 44px, 1120px); margin: 0 auto; padding: 35px 0 22px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading .eyebrow { margin-bottom: 6px; }
.page-heading h1 { font-size: clamp(2rem, 5vw, 2.7rem); }
.subheading { margin: 7px 0 0; color: var(--muted); font-size: .9rem; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { display: grid; gap: 5px; min-height: 123px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 4px 12px rgba(56,38,39,.035); }
.stat-label { color: #665859; font-size: .78rem; font-weight: 700; }
.stat-card strong { font-family: var(--serif); font-size: 1.8rem; font-weight: 500; line-height: 1.05; }
.stat-caption { color: #8a7b7c; font-size: .72rem; }
.catalog-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); box-shadow: 0 4px 14px rgba(56,38,39,.035); }
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 19px 20px; border-bottom: 1px solid var(--line); }
.catalog-toolbar h2 { margin: 0; font-family: var(--serif); font-size: 1.25rem; font-weight: 500; }
.muted { color: var(--muted); }
.catalog-toolbar p { margin: 5px 0 0; font-size: .75rem; }
.search-box { display: flex; align-items: center; gap: 8px; width: min(310px, 45%); height: 42px; padding: 0 11px; border: 1px solid #e2d9d8; border-radius: 10px; background: #fff; color: #968687; }
.search-box span { font-size: 1.35rem; line-height: 1; }
.search-box input { height: 38px; padding: 0; border: 0; box-shadow: none !important; font-size: .82rem; }
.connection-message { padding: 0 20px; color: #9b3f46; font-size: .82rem; }
.connection-message:not(:empty) { padding-top: 13px; }
.product-list { display: grid; }
.product-row { display: grid; grid-template-columns: 56px minmax(150px, 1fr) minmax(420px, 2.25fr) minmax(88px, .55fr) auto; grid-template-areas: "pic main facts stock actions"; align-items: center; gap: 14px; min-height: 86px; padding: 12px 17px; border-bottom: 1px solid #f0e9e8; }
.product-row:last-child { border-bottom: 0; }
.product-image, .product-placeholder { grid-area: pic; width: 54px; height: 54px; border-radius: 12px; background: #f8e8e8; object-fit: cover; }
.product-placeholder { display: grid; place-items: center; color: #a96f7b; font-family: var(--serif); font-size: 1.5rem; }
.product-main { grid-area: main; min-width: 0; }
.product-main strong { display: block; overflow: hidden; font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.product-main small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: .73rem; text-overflow: ellipsis; white-space: nowrap; }
.product-main .location-summary { color: #936a72; font-size: .66rem; }
.product-facts { grid-area: facts; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; min-width: 0; }
.product-meta { display: grid; gap: 4px; min-width: 0; color: #6c5f60; font-size: .69rem; }
.product-meta b { overflow: hidden; color: #463b3c; font-size: .82rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.stock-pill { grid-area: stock; justify-self: start; padding: 6px 9px; border-radius: 999px; background: #edf5ee; color: #3d744a; font-size: .69rem; font-weight: 700; white-space: nowrap; }
.stock-pill.low { background: #fff3dd; color: #8a6320; }
.stock-pill.out { background: #f9e5e5; color: #a34448; }
.row-actions { grid-area: actions; display: flex; gap: 5px; }
.icon-button { display: inline-grid; width: 36px; height: 36px; place-items: center; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #77696a; font-size: 1.05rem; }
.icon-button:hover { border-color: var(--line); background: #fff7f6; color: var(--ink); }
.icon-button.danger:hover { background: #fff0f0; color: #a34448; }
.empty-state { display: grid; justify-items: center; gap: 9px; padding: 45px 20px; color: var(--muted); text-align: center; }
.empty-state .empty-icon { color: #bd8790; font-family: var(--serif); font-size: 2rem; }
.empty-state strong { color: var(--ink); font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.empty-state span:last-child { max-width: 390px; font-size: .81rem; line-height: 1.5; }
.dashboard-footer { display: flex; justify-content: center; gap: 9px; padding: 23px 0 0; color: #8b7b7c; font-size: .68rem; }

.dialog { width: min(100% - 24px, 620px); max-height: min(92svh, 780px); padding: 0; overflow: auto; border: 1px solid #eadfdf; border-radius: 19px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 90px rgba(30,20,21,.28); }
.dialog::backdrop { background: rgba(39,29,30,.48); backdrop-filter: blur(3px); }
.dialog-small { max-width: 470px; }
.dialog-card { padding: 23px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-heading .eyebrow { margin-bottom: 5px; }
.dialog-heading h2 { margin: 0; font-family: var(--serif); font-size: 1.55rem; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field input, .field textarea { min-height: 43px; padding: 10px 12px; font-size: .85rem; font-weight: 400; resize: vertical; }
.field textarea { min-height: 78px; }
.field input::placeholder { color: #b0a3a3; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; margin-top: 12px; }
.path-help { margin: -3px 0 18px; font-size: .83rem; line-height: 1.55; }
.path-help code { padding: 2px 5px; border-radius: 5px; background: #f7ecec; color: #744f58; }

@media (max-width: 760px) {
  .topbar { min-height: 72px; padding-inline: 16px; }
  .brand img { width: 45px; height: 45px; }
  .brand strong { font-size: .96rem; }
  .user-email { display: none; }
  .workspace { width: min(100% - 28px, 600px); padding-top: 25px; }
  .page-heading { align-items: start; flex-direction: column; gap: 16px; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .stats-grid { gap: 8px; }
  .stat-card { min-height: 106px; padding: 13px 12px; }
  .stat-label { font-size: .69rem; line-height: 1.3; }
  .stat-card strong { font-size: 1.55rem; }
  .stat-caption { font-size: .64rem; line-height: 1.35; }
  .catalog-toolbar { align-items: stretch; flex-direction: column; padding: 16px; }
  .search-box { width: 100%; }
  .connection-message { padding-inline: 16px; }
  .product-row { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "pic main stock" "pic facts actions"; gap: 10px; padding: 13px 14px; }
  .product-image, .product-placeholder { width: 46px; height: 46px; }
  .product-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .product-meta { gap: 3px; font-size: .62rem; }
  .product-meta b { font-size: .7rem; }
  .stock-pill { align-self: start; }
  .row-actions { justify-self: end; align-self: end; }
  .icon-button { width: 32px; height: 32px; }
}
@media (max-width: 420px) {
  .login-view { padding: 15px; }
  .login-card { padding: 29px 21px 24px; }
  .topbar { gap: 8px; padding-inline: 12px; }
  .brand { gap: 8px; }
  .brand img { width: 40px; height: 40px; }
  .brand strong { font-size: .88rem; }
  .brand small { font-size: .66rem; }
  .button-quiet { min-height: 35px; padding-inline: 9px; font-size: .73rem; }
  .workspace { width: min(100% - 22px, 600px); }
  .heading-actions { gap: 7px; }
  .heading-actions .button { padding-inline: 10px; font-size: .75rem; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-card { padding: 12px 9px; }
  .stat-label { font-size: .64rem; }
  .stat-caption { font-size: .59rem; }
  .product-row { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 8px; padding-inline: 10px; }
  .product-image, .product-placeholder { width: 40px; height: 40px; }
  .product-main strong { font-size: .8rem; }
  .product-main small { font-size: .67rem; }
  .product-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .product-meta { font-size: .6rem; }
  .product-meta b { font-size: .68rem; }
  .stock-pill { padding: 5px 7px; font-size: .61rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
