:root {
  color-scheme: light;
  --paper: #f6f2e9;
  --paper-deep: #ebe4d6;
  --ink: #292e24;
  --ink-soft: #667064;
  --green: #596c42;
  --green-deep: #405035;
  --green-pale: #e7ecdc;
  --gold: #d7a94e;
  --line: #e8e4d9;
  --white: #fffefa;
  --shadow: 0 16px 42px rgba(58, 52, 39, 0.075);
  font-family: "Aptos", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 86% 0%, rgba(218, 198, 155, .23), transparent 34rem),
    var(--paper);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(89, 108, 66, .35); outline-offset: 3px; }
[hidden] { display: none !important; }

.page-wrap { width: min(100% - 40px, 1010px); margin: 0 auto; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(94, 97, 77, .12); }
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 13px; }
.brand-copy { display: grid; line-height: 1.08; letter-spacing: -.025em; }
.brand-copy strong { font-family: Georgia, "Times New Roman", serif; font-size: 19px; font-weight: 700; }
.brand-copy span { margin-top: 4px; color: var(--ink-soft); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.family-label { display: flex; gap: 8px; align-items: center; margin: 0; color: #78806f; font-size: 12px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #8c9a67; box-shadow: 0 0 0 3px rgba(140, 154, 103, .14); }

main { min-height: calc(100vh - 146px); padding: 48px 0 38px; }
.loading-panel { display: grid; place-items: center; min-height: 300px; color: var(--ink-soft); font-size: 14px; }
.loading-mark { width: 34px; height: 34px; border: 3px solid var(--paper-deep); border-top-color: var(--green); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

h1, h2, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
h1 { margin-bottom: 0; font-size: clamp(29px, 4vw, 39px); font-weight: 500; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 23px; font-weight: 500; line-height: 1.15; }
.eyebrow { margin-bottom: 10px; color: var(--green); font-size: 10px; font-weight: 750; letter-spacing: .15em; line-height: 1.25; text-transform: uppercase; }
.intro { margin: 14px 0 27px; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }

.login-card { width: min(100%, 430px); margin: 6vh auto 0; padding: 39px 40px 32px; border: 1px solid rgba(106, 105, 85, .12); border-radius: 22px; background: rgba(255, 254, 250, .88); box-shadow: var(--shadow); }
.login-card h1 { font-size: 34px; }
.login-form { display: grid; gap: 10px; }
.login-form label, .quantity-label, .threshold-form > label { color: #656b5f; font-size: 12px; font-weight: 700; }
input[type="password"], input[type="number"] { min-width: 0; border: 1px solid #deded1; border-radius: 11px; background: #fffefa; color: var(--ink); }
.login-form input { width: 100%; height: 48px; padding: 0 13px; margin-bottom: 5px; }
.form-message { margin: 2px 0 0; color: #a33e32; font-size: 13px; line-height: 1.45; }
.fine-print { margin: 22px 0 0; color: #878b80; font-size: 11px; line-height: 1.55; }

.welcome-row { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 27px; }
.quiet-button { padding: 9px 0; border: 0; background: transparent; color: #74796e; font-size: 12px; font-weight: 650; text-decoration: underline; text-decoration-color: #c3c4b8; text-underline-offset: 4px; }
.quiet-button:hover { color: var(--green-deep); text-decoration-color: currentColor; }
.dashboard-grid { display: grid; grid-template-columns: 1.04fr .96fr; gap: 16px; }
.stock-card, .action-card, .threshold-card, .notification-card { border: 1px solid rgba(95, 98, 79, .1); border-radius: 19px; box-shadow: var(--shadow); }
.stock-card { position: relative; overflow: hidden; min-height: 265px; padding: 24px 27px 19px; background: var(--green); color: #fffef7; }
.stock-card::after { position: absolute; right: -78px; bottom: -132px; width: 300px; height: 300px; border: 1px solid rgba(255, 255, 255, .09); border-radius: 50%; content: ""; }
.stock-card-top, .section-heading, .history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.stock-label { margin: 0; color: rgba(255, 255, 248, .77); font-size: 12px; font-weight: 650; letter-spacing: .04em; }
.bread-stamp { display: grid; width: 35px; height: 35px; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; color: #f1d496; font-size: 18px; }
.stock-count-line { display: flex; align-items: baseline; gap: 10px; margin-top: 9px; }
.stock-count { font-family: Georgia, "Times New Roman", serif; font-size: clamp(84px, 12vw, 118px); font-weight: 500; letter-spacing: -.075em; line-height: .96; font-variant-numeric: tabular-nums; }
.stock-count.negative { color: #ffce9c; }
.stock-unit { color: rgba(255,255,248,.79); font-size: 14px; }
.stock-status { position: relative; z-index: 1; min-height: 20px; margin: 15px 0 18px; color: #eff3e8; font-size: 13px; }
.stock-status.is-low { color: #ffdfa3; font-weight: 650; }
.stock-rule { display: flex; gap: 5px; align-items: center; height: 3px; }
.stock-rule span { width: 25px; height: 2px; border-radius: 9px; background: rgba(245, 220, 166, .7); }
.stock-rule span:last-child { width: 7px; background: rgba(245, 220, 166, .3); }
.updated-at { position: relative; z-index: 1; margin: 10px 0 0; color: rgba(255,255,248,.56); font-size: 10px; }

.action-card, .threshold-card, .notification-card { background: var(--white); }
.action-card { min-height: 265px; padding: 24px 25px 20px; }
.section-heading { align-items: center; }
.step-icon, .bell-icon { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 11px; background: var(--green-pale); color: var(--green); font-size: 20px; }
.quantity-label { display: block; margin: 21px 0 7px; }
.quantity-row { display: flex; height: 43px; align-items: stretch; gap: 7px; }
.step-button { display: grid; width: 45px; flex: 0 0 45px; place-items: center; border: 1px solid #ddded3; border-radius: 10px; background: #fff; font-size: 23px; font-weight: 450; line-height: 1; transition: background .15s, transform .15s; }
.step-button:hover { transform: translateY(-1px); }
.step-minus { color: #7d6553; }
.step-minus:hover { background: #f8f0e9; }
.step-plus { border-color: #dbe1cf; background: #edf1e6; color: var(--green-deep); }
.step-plus:hover { background: #e1e9d5; }
.quantity-row input { width: 70px; flex: 1; padding: 0 10px; text-align: center; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; appearance: textfield; }
.quantity-row input::-webkit-outer-spin-button, .quantity-row input::-webkit-inner-spin-button, .threshold-input-row input::-webkit-outer-spin-button, .threshold-input-row input::-webkit-inner-spin-button { margin: 0; appearance: none; }
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.button { min-height: 42px; display: inline-flex; justify-content: center; align-items: center; gap: 9px; padding: 0 14px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 700; transition: transform .16s, background .16s, border-color .16s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-primary { background: var(--green); color: #fffef9; }
.button-primary:hover:not(:disabled) { background: var(--green-deep); }
.button-light { border-color: #e4e3d9; background: #fffefa; color: #525a4c; }
.button-light:hover:not(:disabled) { border-color: #cfd7c2; background: #f7f8f2; }
.button-dark { background: #333a2e; color: #fffefa; }
.button-dark:hover:not(:disabled) { background: #22291f; }
.button-wide { width: 100%; min-height: 47px; }
.undo-button { display: flex; align-items: center; gap: 7px; margin-top: 13px; padding: 2px 0; border: 0; background: transparent; color: var(--green); font-size: 11px; font-weight: 650; }
.undo-button:disabled { cursor: default; color: #a4a89d; }
.undo-button span { font-size: 16px; }

.threshold-card, .notification-card { min-height: 171px; padding: 21px 25px; }
.section-copy { margin: 12px 0 0; color: #747a6f; font-size: 12px; line-height: 1.55; }
.threshold-form { margin-top: 15px; }
.threshold-form > label { display: block; margin-bottom: 7px; }
.threshold-input-row { display: flex; align-items: center; gap: 8px; }
.threshold-input-row input { width: 72px; height: 38px; padding: 0 8px; text-align: center; font-weight: 700; appearance: textfield; }
.threshold-input-row > span { flex: 1; color: #747a6f; font-size: 12px; }
.threshold-input-row .button { min-height: 38px; padding: 0 12px; }
.notification-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; background: #f0eee3; }
.notification-card .section-copy { max-width: 250px; margin-top: 8px; }
.notification-button { flex: 0 0 auto; min-height: 39px; font-size: 11px; }

.history-section { margin-top: 34px; }
.history-heading { align-items: end; padding-bottom: 14px; border-bottom: 1px solid rgba(93, 98, 79, .16); }
.history-caption { padding-bottom: 3px; color: #95988e; font-size: 10px; }
.history-list { display: grid; margin: 0; padding: 0; list-style: none; }
.history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 2px; border-bottom: 1px solid rgba(93, 98, 79, .11); }
.history-main { display: flex; min-width: 0; gap: 11px; align-items: center; }
.history-mark { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border-radius: 50%; background: #e7eddf; color: var(--green); font-size: 15px; font-weight: 700; }
.history-mark.is-negative { background: #f4e9dc; color: #9c6842; }
.history-mark.is-undo { background: #ece9dc; color: #80734c; }
.history-description { min-width: 0; }
.history-description strong { display: block; overflow: hidden; color: #444b3e; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.history-description time { display: block; margin-top: 4px; color: #96998f; font-size: 10px; }
.history-delta { color: #526444; font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-delta.is-negative { color: #9c6842; }
.history-empty { padding: 16px 2px; color: #81867b; font-size: 13px; }

.privacy-note { display: flex; align-items: flex-start; gap: 11px; margin-top: 27px; padding: 14px 16px; border: 1px solid #e8e5da; border-radius: 13px; background: rgba(255,254,250,.56); }
.privacy-lock { color: #808974; font-size: 20px; line-height: 1; }
.privacy-note p { margin: 0; color: #80857a; font-size: 11px; line-height: 1.55; }
.account-actions { display: flex; justify-content: end; padding-top: 7px; }
.toast { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 5; max-width: min(390px, calc(100vw - 40px)); padding: 13px 17px; border-radius: 12px; background: #30382a; box-shadow: 0 10px 30px rgba(0,0,0,.2); color: #fffef8; font-size: 13px; line-height: 1.45; }
.toast.is-error { background: #963f33; }
.footer { min-height: 58px; display: flex; justify-content: center; align-items: center; gap: 8px; color: #96988e; font-size: 10px; text-align: center; }

@media (max-width: 700px) {
  .page-wrap { width: min(100% - 30px, 520px); }
  .topbar { min-height: 72px; }
  main { min-height: calc(100vh - 124px); padding: 31px 0 29px; }
  .welcome-row { align-items: center; margin-bottom: 20px; }
  .welcome-row h1 { max-width: 300px; font-size: 29px; }
  .quiet-button { font-size: 11px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
  .stock-card { min-height: 235px; padding: 21px 23px 17px; }
  .stock-count { font-size: clamp(82px, 25vw, 108px); }
  .action-card { min-height: unset; padding: 21px 22px 17px; }
  .quantity-label { margin-top: 18px; }
  .threshold-card, .notification-card { min-height: unset; padding: 20px 22px; }
  .notification-card { align-items: flex-start; flex-direction: column; gap: 14px; }
  .notification-card .section-copy { max-width: none; }
  .notification-button { width: 100%; min-height: 43px; }
  .history-section { margin-top: 29px; }
  .history-caption { max-width: 100px; text-align: right; line-height: 1.4; }
  .footer { flex-wrap: wrap; gap: 5px 8px; padding: 13px 0; font-size: 9px; }
}

@media (max-width: 390px) {
  .family-label { font-size: 10px; }
  .brand-copy strong { font-size: 17px; }
  .welcome-row { align-items: end; }
  .welcome-row h1 { font-size: 25px; }
  .login-card { padding: 31px 25px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
