:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142426;
  background: #edf2f0;
  font-synthesis: none;
}

.settings-menu { position: relative; }
.settings-dropdown { position: absolute; top: calc(100% + 8px); right: 0; min-width: 180px; padding: 6px; z-index: 30; border: 1px solid #c8d3d0; border-radius: 10px; background: white; box-shadow: 0 12px 30px #062c3033; }
.settings-dropdown button { display: block; width: 100%; padding: 12px; text-align: left; border: 0; border-radius: 6px; background: white; color: #142426; }
.settings-dropdown button:hover { background: #edf2f0; }
.settings-panel { max-width: 760px; margin: auto; }
.users-panel .lots-table { min-width: 850px; }
.users-panel .lots-table th { padding: 16px 18px; }
.new-user-form { max-width: 680px; padding-bottom: 32px; }
.user-access-button { padding: 8px 14px; color: #0a5c58; background: white; border: 1px solid #9ab5b0; border-radius: 8px; }
.user-access-button:disabled { opacity: .5; cursor: default; }

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #edf2f0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 16% 0%, rgba(213, 170, 87, .26), transparent 29rem),
    linear-gradient(135deg, #052c30 0%, #0c4848 48%, #0b3337 100%);
}
.login-card {
  width: min(100%, 430px);
  padding: 44px;
  border-radius: 24px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 24px 80px rgba(0,0,0,.32);
}
.brand { display: flex; gap: 13px; align-items: center; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #062c30; background: #d5aa57; font-size: 26px; }
.brand p { margin: 0; color: #587072; font-size: .89rem; font-weight: 650; letter-spacing: .02em; }
.brand h1 { margin: 2px 0 0; color: #062c30; font-size: 1.47rem; letter-spacing: -.03em; }
.login-card h2 { margin: 42px 0 7px; font-size: 1.55rem; letter-spacing: -.035em; }
.login-card > p { margin: 0 0 26px; color: #5a696a; line-height: 1.5; }
.field { display: grid; gap: 8px; margin-top: 18px; color: #233638; font-size: .92rem; font-weight: 700; }
.field input, .filter-search, select { border: 1px solid #c8d3d0; border-radius: 10px; background: #fff; color: #142426; min-height: 46px; padding: 0 13px; outline: none; }
.field input:focus, .filter-search:focus, select:focus { border-color: #17746e; box-shadow: 0 0 0 3px rgba(23,116,110,.16); }
.primary { width: 100%; min-height: 48px; margin-top: 28px; border: 0; border-radius: 11px; color: white; background: #0a5c58; font-weight: 750; }
.primary:hover { background: #074a48; }
.primary:disabled { cursor: wait; opacity: .68; }
.form-error { margin: 18px 0 0; color: #b52d2d; font-size: .9rem; line-height: 1.4; }

.app-shell { min-height: 100vh; }
.topbar { min-height: 76px; padding: 0 42px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: white; background: #062c30; }
.topbar .brand h1 { color: white; }
.topbar .brand p { color: #bbd0ce; }
.topbar .brand-mark { width: 37px; height: 37px; border-radius: 11px; font-size: 21px; }
.account { display: flex; align-items: center; gap: 14px; }
.account-email { color: #c6d6d4; font-size: .9rem; }
.quiet { border: 1px solid rgba(255,255,255,.4); border-radius: 9px; background: transparent; color: white; min-height: 36px; padding: 0 12px; font-size: .9rem; }
.quiet:hover { background: rgba(255,255,255,.12); }
.workspace { width: min(1460px, calc(100% - 48px)); margin: 0 auto; padding: 36px 0 58px; }
.page-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: #24716c; font-size: .78rem; letter-spacing: .1em; font-weight: 800; text-transform: uppercase; }
.page-heading h2 { margin: 0; color: #102d30; font-size: clamp(1.7rem, 3vw, 2.45rem); letter-spacing: -.045em; }
.page-heading p { max-width: 540px; margin: 7px 0 0; color: #5a6a6c; line-height: 1.5; }
.result-count { color: #51676a; font-size: .94rem; font-weight: 650; white-space: nowrap; }
.heading-actions { display: flex; align-items: center; gap: 15px; }
.receive-button { min-height: 42px; border: 0; border-radius: 10px; padding: 0 15px; color: white; background: #0a5c58; font-weight: 800; white-space: nowrap; }
.receive-button:hover { background: #074a48; }
.controls { padding: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border: 1px solid #d7e0de; border-radius: 15px 15px 0 0; background: #f9fbfa; }
.filter-search { flex: 1 1 360px; min-height: 44px; }
.toggle { display: flex; align-items: center; gap: 9px; color: #24383a; font-size: .9rem; font-weight: 700; user-select: none; }
.toggle input { width: 17px; height: 17px; accent-color: #0a6d66; }
.sort { display: flex; align-items: center; gap: 9px; color: #526668; font-size: .86rem; font-weight: 700; }
.sort select { min-height: 40px; }
.lots-table-wrap { overflow-x: auto; border: 1px solid #d7e0de; border-top: 0; border-radius: 0 0 15px 15px; background: white; }
.lots-table { width: 100%; min-width: 960px; border-collapse: collapse; }
.lots-table th { padding: 0; color: #5a6e70; background: #f4f7f6; border-bottom: 1px solid #dce5e2; font-size: .73rem; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.column-sort { width: 100%; min-height: 46px; display: flex; align-items: center; gap: 7px; padding: 13px 16px; border: 0; color: inherit; background: transparent; font: inherit; text-align: left; text-transform: inherit; letter-spacing: inherit; }
.column-sort:hover { color: #0b615c; background: #eaf1ef; }
.column-sort:focus-visible { outline: 3px solid rgba(23,116,110,.36); outline-offset: -3px; }
.sort-direction { color: #0b615c; font-size: .92rem; letter-spacing: 0; }
.lots-table td { padding: 16px; border-bottom: 1px solid #e6edeb; vertical-align: middle; color: #263839; }
.lots-table tr:last-child td { border-bottom: 0; }
.product-name { color: #132e31; font-weight: 800; }
.muted { color: #64787a; }
.lot-code { color: #345054; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; }
.amount { color: #0c4947; font-size: 1.18rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.amount-sub { margin-top: 3px; color: #697d7f; font-size: .79rem; }
.empty, .loading { padding: 64px 24px; color: #587072; text-align: center; }
.error-panel { margin: 0 0 20px; padding: 14px 16px; border: 1px solid #e5b3b3; border-radius: 12px; background: #fff6f6; color: #8f2424; line-height: 1.45; }
.retry { margin-left: 8px; border: 0; color: #075b57; background: transparent; font-weight: 800; text-decoration: underline; }
.quiet.dark { color: #0a5c58; border-color: #aabfbc; }
.quiet.dark:hover { background: #e8f0ee; }

.receive-panel { max-width: 940px; margin: 0 auto; padding: 30px; border: 1px solid #d7e0de; border-radius: 18px; background: #fff; box-shadow: 0 10px 35px rgba(7, 43, 45, .06); }
.receive-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid #e4ecea; }
.receive-header h2 { margin: 0; color: #102d30; font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -.04em; }
.receive-header p:not(.eyebrow) { margin: 7px 0 0; color: #5a6a6c; line-height: 1.5; }
.product-search { width: 100%; min-height: 50px; margin: 24px 0 13px; padding: 0 15px; border: 1px solid #c8d3d0; border-radius: 10px; font: inherit; outline: none; }
.product-search:focus { border-color: #17746e; box-shadow: 0 0 0 3px rgba(23,116,110,.16); }
.product-results { display: grid; gap: 8px; }
.product-result { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; padding: 16px 17px; border: 1px solid #d7e2df; border-radius: 11px; color: #143234; background: #fbfdfc; text-align: left; }
.product-result:hover { border-color: #0a6d66; background: #f0f7f5; }
.product-result span { color: #627779; font-size: .9rem; }
.receive-form { display: grid; gap: 21px; margin-top: 25px; }
.receive-form fieldset { display: grid; gap: 13px; margin: 0; padding: 20px; border: 1px solid #dce5e2; border-radius: 13px; }
.receive-form legend { padding: 0 6px; color: #174d4d; font-size: .95rem; font-weight: 850; }
.receive-form .field { margin: 0; }
.receive-form .field input, .receive-form .field select, .receive-form .field textarea { width: 100%; border: 1px solid #c8d3d0; border-radius: 10px; background: #fff; color: #142426; min-height: 46px; padding: 10px 13px; outline: none; }
.receive-form .field textarea { min-height: 104px; resize: vertical; }
.receive-form .field input:focus, .receive-form .field select:focus, .receive-form .field textarea:focus { border-color: #17746e; box-shadow: 0 0 0 3px rgba(23,116,110,.16); }
.read-only-field { display: grid; gap: 6px; padding: 13px; border-radius: 10px; background: #eef5f3; color: #5b7273; font-size: .88rem; }
.read-only-field strong { color: #16383a; font-size: 1rem; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.answer-field { display: grid; gap: 8px; color: #233638; font-size: .92rem; font-weight: 700; }
.answer-options { display: flex; gap: 10px; }
.answer { min-width: 110px; min-height: 42px; border: 1px solid #b8c9c6; border-radius: 9px; color: #264143; background: #fff; font-weight: 750; }
.answer:hover { background: #eef6f4; }
.answer.selected { border-color: #0a5c58; color: #fff; background: #0a5c58; }
.field-help, .file-count { margin: 0; color: #64787a; font-size: .85rem; line-height: 1.45; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 3px; }
.form-actions .primary { width: auto; min-width: 124px; margin: 0; padding: 0 18px; }
.notice { margin: 0; padding: 12px 14px; border: 1px solid #d7c376; border-radius: 10px; color: #6d5700; background: #fff9db; line-height: 1.45; }

@media (max-width: 720px) {
  .login-card { padding: 32px 25px; }
  .topbar { min-height: 68px; padding: 0 20px; }
  .account-email { display: none; }
  .workspace { width: min(100% - 28px, 1460px); padding-top: 25px; }
  .page-heading { align-items: start; flex-direction: column; margin-bottom: 19px; }
  .heading-actions { width: 100%; justify-content: space-between; }
  .result-count { white-space: normal; }
  .controls { gap: 12px; }
  .sort { width: 100%; justify-content: space-between; }
  .sort select { width: min(72vw, 260px); }
  .receive-panel { padding: 22px 17px; }
  .receive-header { align-items: stretch; flex-direction: column; }
  .product-result { align-items: start; flex-direction: column; gap: 5px; }
  .field-grid { grid-template-columns: 1fr; }
  .form-actions { justify-content: stretch; flex-direction: column-reverse; }
  .form-actions button { width: 100%; }
}
