:root {
  --ink: #1d2623;
  --muted: #68736f;
  --line: #dce4df;
  --paper: #f4f7f5;
  --green: #0e684f;
  --green-dark: #0a4939;
  --green-soft: #e7f2ed;
  --gold: #e4b85c;
  --danger: #b64b43;
  --danger-soft: #fff1ef;
  --white: #fff;
  --shadow: 0 14px 36px rgba(20, 52, 41, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(14, 104, 79, .2); outline-offset: 2px; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.auth-screen { position: fixed; z-index: 200; inset: 0; display: grid; place-items: center; min-height: 100dvh; overflow: auto; padding: 24px; background: radial-gradient(circle at 72% 18%, rgba(70,156,128,.45), transparent 28%), linear-gradient(145deg, #0c382e, #0e684f 62%, #092f27); }
.login-card { width: min(430px, 100%); overflow: hidden; border: 1px solid rgba(255,255,255,.26); border-radius: 26px; background: rgba(255,255,255,.97); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.login-brand { display: flex; align-items: center; gap: 12px; padding: 24px 27px 18px; border-bottom: 1px solid var(--line); }
.login-brand > span { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: var(--green); color: #fff; font-size: 18px; font-weight: 850; }
.login-brand div { display: grid; gap: 2px; }
.login-brand small { color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.login-brand strong { font-size: 19px; }
.auth-checking { min-height: 250px; display: grid; place-items: center; align-content: center; gap: 14px; color: var(--green); font-size: 13px; }
.cloud-spinner { width: 34px; height: 34px; border: 3px solid #dcece5; border-top-color: var(--green); border-radius: 50%; animation: cloud-spin .8s linear infinite; }
@keyframes cloud-spin { to { transform: rotate(360deg); } }
.login-card form { padding: 25px 27px 27px; }
.login-card h1 { margin: 7px 0 7px; font-size: 30px; letter-spacing: -.04em; }
.login-card form > p:not(.eyebrow):not(.login-error) { margin: 0 0 21px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-card label { display: grid; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 11px; font-weight: 750; }
.login-card input { width: 100%; min-height: 48px; border: 1px solid #cbd7d1; border-radius: 12px; background: #fafcfb; padding: 0 13px; color: var(--ink); font-size: 16px; }
.login-error { min-height: 19px; margin: 9px 0 0; color: var(--danger); font-size: 11px; }
.login-safe-note { display: block; margin-top: 13px; color: #7e8984; font-size: 9px; text-align: center; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; z-index: 20; top: 0; height: 72px; display: flex; align-items: center; gap: 12px; padding: 0 4vw; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; background: var(--green); color: #fff; font-weight: 850; letter-spacing: -.04em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.brand-copy { display: grid; min-width: 96px; }
.brand-copy small { color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.brand-copy strong { font-size: 18px; }
.topnav { display: flex; align-self: stretch; gap: 5px; margin-left: 4vw; }
.mobile-bottom-nav { display: none; }
.nav-button { position: relative; border: 0; background: transparent; padding: 0 15px; color: var(--muted); font-weight: 700; }
.nav-button.active { color: var(--green); }
.nav-button.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--green); }
.nav-button span { display: inline-grid; min-width: 19px; height: 19px; place-items: center; margin-left: 3px; padding: 0 5px; border-radius: 999px; background: #edf1ef; color: var(--green); font-size: 10px; }
.source-pill { margin-left: auto; max-width: 300px; overflow: hidden; padding: 8px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { position: relative; display: flex; align-items: center; gap: 9px; margin-left: auto; }
.topbar-actions .source-pill { margin-left: 0; }
.account-button { min-height: 44px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 6px 10px; color: var(--ink); text-align: left; }
.account-button > span:last-child { display: grid; gap: 1px; }
.account-button small { color: var(--muted); font-size: 8px; font-weight: 650; }
.account-button strong { max-width: 82px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sync-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #2aaa78; box-shadow: 0 0 0 3px #e4f6ee; }
.account-button.syncing .sync-dot { background: #d69a2f; box-shadow: 0 0 0 3px #fff3d8; animation: sync-pulse 1s ease infinite; }
.account-button.offline .sync-dot { background: #b64b43; box-shadow: 0 0 0 3px #ffe9e6; }
@keyframes sync-pulse { 50% { opacity: .4; } }
.account-menu { position: absolute; z-index: 50; top: calc(100% + 7px); right: 0; width: 145px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 5px; box-shadow: 0 15px 36px rgba(19,53,41,.17); }
.account-menu button { width: 100%; border: 0; border-radius: 8px; background: transparent; padding: 10px; color: var(--ink); font-size: 11px; text-align: left; }
.account-menu button:hover { background: var(--green-soft); color: var(--green); }

.view { display: none; }
.view.active { display: block; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 32px; padding: 32px 4vw 30px; background: radial-gradient(circle at 78% 16%, #2a8066 0, transparent 28%), linear-gradient(125deg, #123f34, #0b5d48); color: #fff; }
.hero h1, .records-hero h1 { margin: 7px 0 8px; font-size: clamp(27px, 3vw, 42px); line-height: 1.12; letter-spacing: -.04em; }
.hero p:not(.eyebrow) { margin: 0; color: #cce1d8; font-size: 14px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow.gold { color: var(--gold); }
.hero-stat { min-width: 132px; padding: 16px 19px; border: 1px solid rgba(255,255,255,.18); border-radius: 16px; background: rgba(255,255,255,.06); }
.hero-stat strong { display: block; font-size: 32px; }
.hero-stat span { color: #cce1d8; font-size: 12px; }

.workspace { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; padding: 19px 4vw 42px; }
.panel { border: 1px solid var(--line); border-radius: 19px; background: var(--white); box-shadow: var(--shadow); }
.search-panel { position: sticky; top: 91px; align-self: start; max-height: calc(100vh - 110px); display: flex; flex-direction: column; overflow: hidden; padding: 15px; }
.search-box { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 12px; border: 1px solid #cbd7d1; border-radius: 13px; background: #fafcfb; }
.search-icon { color: var(--green); font-size: 25px; line-height: 1; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box kbd { border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 3px 5px; color: #87908c; font-size: 10px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 11px; }
.filters label { position: relative; min-width: 0; }
.filters label > span { display: block; margin: 0 0 5px 2px; color: var(--muted); font-size: 10px; font-weight: 700; }
.filters input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 9px; color: var(--ink); font-size: 12px; }
.filter-suggestions { position: absolute; z-index: 15; top: calc(100% + 5px); left: 0; right: 0; display: none; max-height: 250px; overflow: auto; border: 1px solid #cdd9d3; border-radius: 11px; background: #fff; padding: 5px; box-shadow: 0 15px 35px rgba(19,53,41,.16); }
.filter-suggestions.open { display: grid; gap: 3px; }
.filter-suggestion { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 0; border-radius: 8px; background: transparent; padding: 8px 9px; color: var(--ink); font-size: 11px; text-align: left; }
.filter-suggestion:hover, .filter-suggestion:focus { background: var(--green-soft); color: var(--green); }
.filter-suggestion small { color: var(--muted); font-size: 9px; }
.filter-empty { padding: 12px 8px; color: var(--muted); font-size: 10px; text-align: center; }
.filter-meta { display: flex; justify-content: space-between; align-items: center; padding: 13px 3px 9px; color: var(--muted); font-size: 12px; }
.text-button { border: 0; background: transparent; color: var(--green); font-size: 11px; font-weight: 700; }
.difficulty-hint { margin: 0 3px 8px; border-radius: 8px; background: #fff8e8; padding: 7px 8px; color: #7b6338; font-size: 9px; line-height: 1.45; }
.product-list { display: grid; gap: 7px; overflow: auto; overscroll-behavior: contain; padding-right: 3px; }
.product-row { width: 100%; display: grid; grid-template-columns: 69px minmax(0,1fr); gap: 11px; min-height: 88px; border: 1px solid transparent; border-radius: 13px; background: transparent; padding: 8px; text-align: left; }
.product-row:hover { background: #f7faf8; }
.product-row.selected { border-color: #91baa9; background: var(--green-soft); }
.thumb, .thumb-placeholder { width: 69px; height: 69px; border-radius: 9px; background: #f0f2f1; object-fit: cover; }
.thumb-placeholder { display: grid; place-items: center; color: #9ca6a1; font-size: 10px; }
.product-row-copy { min-width: 0; align-self: center; }
.product-row strong { display: -webkit-box; overflow: hidden; color: var(--ink); font-size: 13px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-row small { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.mini-tags { display: flex; gap: 5px; margin-top: 6px; }
.mini-tags em { border-radius: 5px; background: #fff; padding: 3px 6px; color: var(--green); font-size: 9px; font-style: normal; }
.score-line { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.score-badge { width: fit-content; border-radius: 999px; padding: 3px 7px; font-size: 9px; font-weight: 800; }
.score-badge.level-1 { background: #e9f5ef; color: #287157; }
.score-badge.level-2 { background: #eef3d7; color: #657719; }
.score-badge.level-3 { background: #fff1c9; color: #8a5d14; }
.score-badge.level-4 { background: #ffe3dc; color: #ad4037; }
.score-badge.level-missing { background: #f0f2f1; color: #747d79; }
.score-line small { margin: 0; color: var(--muted); font-size: 9px; }
.load-more { margin-top: 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 9px; color: var(--green); font-size: 12px; font-weight: 700; }
.empty-list { padding: 38px 14px; color: var(--muted); text-align: center; }
.empty-list strong { display: block; margin-bottom: 5px; color: var(--ink); }

.detail-panel { min-width: 0; padding: 21px; }
.mobile-back-button, .mobile-visual-tabs, .mobile-action-bar { display: none; }
.detail-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.detail-heading h2 { margin: 5px 0 8px; font-size: clamp(22px, 2.5vw, 31px); letter-spacing: -.035em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { border-radius: 6px; background: #f0f3f1; padding: 5px 8px; color: #53605b; font-size: 10px; }
.tags .auto-tag { background: #fff4d8; color: #855b12; }
.tags .points-tag { background: #fff1c9; color: #825711; font-weight: 800; }
.primary-button, .secondary-button { border-radius: 10px; padding: 10px 14px; font-weight: 750; }
.primary-button { border: 0; background: var(--green); color: #fff; box-shadow: 0 7px 18px rgba(14,104,79,.16); }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { border: 1px solid #cbd6d1; background: #fff; color: var(--green); }
.visual-grid { display: grid; grid-template-columns: minmax(250px, .77fr) minmax(390px, 1.23fr); gap: 13px; margin-top: 19px; }
.visual-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #f7f9f8; }
.card-label { min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); background: #fff; font-size: 12px; font-weight: 750; }
.card-label small { color: var(--muted); font-size: 10px; font-weight: 500; }
.card-link { border: 0; background: transparent; color: var(--green); font-size: 10px; font-weight: 750; }
.product-photo { position: relative; height: 400px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg,#fff,#f2f4f3); }
.product-photo img { width: 100%; height: 100%; object-fit: contain; }
.product-photo button { position: absolute; inset: 0; border: 0; background: transparent; }
.standard-preview { height: 400px; overflow: auto; background: #d9ddda; }
.standard-preview img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.no-image { height: 100%; display: grid; place-items: center; padding: 20px; color: #8a9490; text-align: center; }
.no-image span { display: block; font-size: 30px; margin-bottom: 6px; }
.details-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; padding: 12px; border-radius: 13px; background: #f2f6f4; }
.detail-item { min-width: 0; padding: 7px 8px; border-right: 1px solid var(--line); }
.detail-item:last-child { border-right: 0; }
.detail-item span { display: block; color: var(--muted); font-size: 9px; }
.detail-item strong { display: block; overflow: hidden; margin-top: 5px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.flow-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; border: 1px solid #d8e4de; border-radius: 12px; background: #f7fbf9; }
.flow-banner p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.detail-empty { min-height: 560px; display: grid; place-items: center; text-align: center; color: var(--muted); }

.records-hero { display: flex; justify-content: space-between; align-items: end; gap: 25px; padding: 35px 4vw 28px; background: #fff; border-bottom: 1px solid var(--line); }
.records-hero h1 { font-size: clamp(27px, 3vw, 38px); }
.records-hero p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; }
.records-toolbar { display: flex; align-items: center; gap: 10px; margin: 18px 4vw 0; padding: 12px; }
.records-toolbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.records-toolbar input { height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; color: var(--ink); }
.summary-cards { display: grid; grid-template-columns: repeat(5,1fr); gap: 11px; margin: 12px 4vw; }
.summary-cards article { display: grid; grid-template-columns: 1fr auto; align-items: end; min-height: 97px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.summary-cards span { grid-column: 1/-1; color: var(--muted); font-size: 11px; }
.summary-cards strong { margin-top: 7px; font-size: 30px; }
.summary-cards small { padding-bottom: 5px; color: var(--muted); }
.summary-cards .danger strong { color: var(--danger); }
.summary-cards .success strong { color: var(--green); }
.summary-cards .points { border-color: #e5cd9a; background: #fffaf0; }
.summary-cards .points strong { color: #9b691a; }
.points-calendar-panel { margin: 12px 4vw; padding: 18px; }
.ledger-calendar-panel { margin-bottom: 40px; }
.ledger-hero { background: linear-gradient(135deg, #fff, #f7fbf9); }
.calendar-heading label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; font-weight: 700; }
.calendar-heading input { height: 40px; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 0 10px; color: var(--ink); }
.calendar-layout { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(260px,.55fr); gap: 16px; }
.calendar-weekdays, .points-calendar { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.calendar-weekdays { margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 700; text-align: center; }
.calendar-day { min-height: 78px; display: grid; align-content: space-between; justify-items: start; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; padding: 8px; color: var(--ink); text-align: left; }
.calendar-day > span { font-size: 11px; font-weight: 750; }
.calendar-day strong { color: #8b9490; font-size: 13px; }
.calendar-day small { color: var(--muted); font-size: 9px; }
.calendar-day.has-records { border-color: #b9d3c7; background: var(--green-soft); }
.calendar-day.has-records strong { color: var(--green); }
.calendar-day.today > span { width: 23px; height: 23px; display: grid; place-items: center; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--green); color: #fff; }
.calendar-day.selected { outline: 2px solid var(--gold); outline-offset: 1px; }
.calendar-blank { min-height: 78px; }
.range-ledger { display: flex; flex-direction: column; gap: 12px; border: 1px solid #ead8ab; border-radius: 14px; background: #fffcf3; padding: 16px; }
.month-total, .range-total { display: grid; grid-template-columns: 1fr auto; align-items: end; border-radius: 11px; padding: 13px; }
.month-total { background: #fff1c9; }
.range-total { background: #fff; border: 1px solid #ead8ab; }
.month-total span, .range-total span { grid-column: 1/-1; color: #76551d; font-size: 10px; font-weight: 800; }
.month-total strong, .range-total strong { margin-top: 4px; color: #8a5d14; font-size: 32px; }
.month-total small, .range-total small { padding-bottom: 5px; color: #8a5d14; }
.range-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.range-controls label { color: var(--muted); font-size: 10px; font-weight: 700; }
.range-controls input { width: 100%; height: 40px; margin-top: 5px; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 0 8px; color: var(--ink); }
.range-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.range-ledger > p { margin: 0; color: #7d725b; font-size: 9px; line-height: 1.55; }
.records-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.65fr); gap: 13px; padding: 0 4vw 40px; }
.records-list-panel, .report-panel { padding: 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-heading h2 { margin: 4px 0 0; font-size: 20px; }
.section-heading > span { color: var(--muted); font-size: 11px; }
.record-item { display: grid; grid-template-columns: minmax(170px,1fr) repeat(4,76px) auto; gap: 8px; align-items: center; padding: 11px 5px; border-top: 1px solid #edf0ee; }
.record-item:first-child { border-top: 0; }
.record-name strong { display: block; font-size: 12px; }
.record-name small { color: var(--muted); font-size: 10px; }
.record-number { padding: 8px; border-radius: 8px; background: #f4f7f5; text-align: right; }
.record-number span { display: block; color: var(--muted); font-size: 9px; }
.record-number strong { font-size: 15px; }
.record-actions { display: grid; gap: 5px; }
.edit-record, .delete-record { min-width: 50px; height: 30px; border-radius: 8px; font-size: 10px; font-weight: 700; }
.edit-record { border: 1px solid #bad1c6; background: var(--green-soft); color: var(--green); }
.delete-record { border: 0; background: transparent; color: #8d9692; }
.delete-record:hover { background: var(--danger-soft); color: var(--danger); }
.note-line { grid-column: 1/-1; margin: -3px 0 2px; color: #6a7470; font-size: 10px; }
.report-panel { position: sticky; top: 91px; align-self: start; }
.report-panel textarea { width: 100%; min-height: 245px; resize: vertical; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; padding: 13px; color: var(--ink); line-height: 1.75; }
.private-ledger-heading { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin: 20px 0 8px; padding-top: 17px; border-top: 1px solid var(--line); }
.private-ledger-heading div { display: grid; gap: 3px; }
.private-ledger-heading span { width: fit-content; border-radius: 999px; background: #fff1c9; padding: 3px 7px; color: #8a5d14; font-size: 9px; font-weight: 800; }
.private-ledger-heading strong { font-size: 15px; }
.private-ledger-heading small { color: var(--muted); font-size: 9px; }
.report-panel textarea.points-ledger { min-height: 195px; border-color: #ead6aa; background: #fffcf5; }
.wide { width: 100%; margin-top: 9px; }
.save-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.empty-records { padding: 46px 10px; color: var(--muted); text-align: center; }

dialog { padding: 0; border: 0; }
dialog::backdrop { background: rgba(10,26,21,.62); backdrop-filter: blur(4px); }
.record-dialog { width: min(650px, calc(100% - 28px)); border-radius: 19px; box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.record-dialog form { padding: 21px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.dialog-heading h2 { margin: 5px 0 2px; font-size: 22px; }
.dialog-heading small { color: var(--muted); }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 9px; background: #f0f3f1; color: var(--muted); font-size: 23px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 19px; }
.form-grid label { color: var(--muted); font-size: 11px; font-weight: 700; }
.form-grid input, .form-grid textarea { width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; color: var(--ink); }
.full-width { grid-column: 1/-1; }
.received-preview, .points-preview { display: grid; grid-template-columns: 1fr auto; align-items: end; border-radius: 11px; padding: 11px; }
.received-preview { background: var(--green-soft); }
.points-preview { background: #fff1c9; }
.received-preview span, .points-preview span { grid-column: 1/-1; font-size: 10px; font-weight: 700; }
.received-preview strong, .points-preview strong { margin-top: 4px; font-size: 26px; }
.received-preview small, .points-preview small { padding-bottom: 4px; }
.received-preview span, .received-preview strong, .received-preview small { color: var(--green); }
.points-preview span, .points-preview strong, .points-preview small { color: #8a5d14; }
.form-error { min-height: 18px; margin: 7px 0 0; color: var(--danger); font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.care-dialog { width: min(420px, calc(100% - 30px)); overflow: hidden; border: 1px solid #ead8ab; border-radius: 24px; background: #fffdf7; box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.care-card { padding: 27px 25px 23px; text-align: center; background: radial-gradient(circle at 50% 0, #fff1c9, transparent 48%), #fffdf8; }
.care-spark { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 50%; background: var(--green); color: #fff; font-size: 30px; font-weight: 800; box-shadow: 0 9px 24px rgba(14,104,79,.18); }
.care-dialog h2 { margin: 7px 0 8px; font-size: 24px; letter-spacing: -.03em; }
.care-dialog #care-message { margin: 0; color: #4f5d57; font-size: 14px; line-height: 1.75; }
.care-dialog #care-meta { display: block; min-height: 18px; margin-top: 11px; color: #94702d; font-size: 11px; font-weight: 700; }
.care-dialog .primary-button { min-height: 46px; margin-top: 17px; }

.image-dialog { width: min(96vw, 1400px); height: 94vh; max-width: none; max-height: none; overflow: hidden; border-radius: 16px; background: #202622; }
.image-dialog-bar { height: 58px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 13px 0 17px; background: #fff; }
.image-dialog-bar strong { display: block; font-size: 13px; }
.image-dialog-bar small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.image-dialog-bar .gesture-help { color: var(--green); }
.zoom-controls { display: flex; align-items: center; gap: 7px; }
.zoom-controls button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--green); font-size: 19px; }
.zoom-controls span { min-width: 48px; text-align: center; font-size: 11px; }
.zoom-controls .close-image { margin-left: 5px; background: #eef2f0; color: var(--ink); }
.image-stage { position: relative; height: calc(94vh - 58px); overflow: hidden; overscroll-behavior: contain; touch-action: none; background: radial-gradient(circle at 50% 45%, #35413b, #1b211e 72%); cursor: grab; user-select: none; -webkit-user-select: none; }
.image-stage.dragging { cursor: grabbing; }
.image-stage img { --zoom: 1; --pan-x: 0px; --pan-y: 0px; position: absolute; left: 50%; top: 50%; width: auto; height: auto; max-width: calc(100% - 24px); max-height: calc(100% - 24px); object-fit: contain; transform: translate3d(calc(-50% + var(--pan-x)), calc(-50% + var(--pan-y)), 0) scale(var(--zoom)); transform-origin: center center; will-change: transform; pointer-events: none; -webkit-user-drag: none; }
.image-stage img.animated { transition: transform .22s cubic-bezier(.2,.8,.2,1); }

.password-dialog { width: min(470px, calc(100% - 28px)); border-radius: 20px; background: #fff; box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.password-dialog form { padding: 22px; }
.password-dialog form > label { display: grid; gap: 6px; margin-top: 13px; color: var(--muted); font-size: 11px; font-weight: 700; }
.password-dialog input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; color: var(--ink); font-size: 16px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 20px); visibility: hidden; opacity: 0; border-radius: 10px; background: #17241f; padding: 11px 15px; color: #fff; font-size: 12px; box-shadow: 0 12px 34px rgba(0,0,0,.25); transition: .2s ease; }
.toast.show { visibility: visible; opacity: 1; transform: translate(-50%,0); }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 320px minmax(0,1fr); padding-inline: 18px; }
  .visual-grid { grid-template-columns: 1fr; }
  .details-strip { grid-template-columns: repeat(3,1fr); }
  .records-grid { grid-template-columns: 1fr; padding-inline: 18px; }
  .report-panel { position: static; }
  .summary-cards { margin-inline: 18px; }
  .records-toolbar { margin-inline: 18px; }
  .points-calendar-panel { margin-inline: 18px; }
  .calendar-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .topbar { height: 58px; padding: 0 14px; }
  .brand-mark { width: 39px; height: 39px; }
  .brand-copy small { display: none; }
  .brand-copy strong { font-size: 16px; }
  .source-pill { display: none; }
  .topbar-actions { margin-left: auto; }
  .account-button { min-height: 40px; padding: 5px 8px; }
  .account-button small { display: none; }
  .account-button strong { max-width: 60px; }
  .topnav { display: none; }
  .mobile-bottom-nav { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: calc(62px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3,1fr); gap: 0; margin: 0; padding: 0 5px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); box-shadow: 0 -8px 24px rgba(20,52,41,.08); backdrop-filter: blur(14px); }
  .mobile-bottom-nav .nav-button { min-height: 54px; padding: 0 6px; font-size: 12px; }
  .nav-button.active { border-radius: 12px; background: var(--green-soft); }
  .nav-button.active::after { display: none; }
  .hero { display: none; }
  .workspace { display: block; padding: 10px; }
  .search-panel { position: static; max-height: calc(100dvh - 140px); min-height: calc(100dvh - 140px); border-radius: 16px; padding: 13px; }
  .search-box { min-height: 52px; }
  .search-box input { font-size: 16px; }
  .search-box kbd { display: none; }
  .filters input { height: 44px; font-size: 14px; }
  .filter-meta { padding-top: 11px; }
  .difficulty-hint { font-size: 10px; }
  .product-list { max-height: none; flex: 1; }
  .product-row { min-height: 92px; padding-block: 9px; }
  .detail-panel { display: none; padding: 14px 14px calc(92px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; box-shadow: none; }
  #search-view.mobile-detail-open .search-panel { display: none; }
  #search-view.mobile-detail-open .workspace { padding: 0; }
  #search-view.mobile-detail-open .detail-panel { display: block; }
  body.mobile-detail-active { padding-bottom: 0; }
  body.mobile-detail-active .mobile-bottom-nav { display: none; }
  .mobile-back-button { min-height: 44px; display: flex; align-items: center; gap: 5px; margin: -4px 0 8px; border: 0; background: transparent; padding: 0 2px; color: var(--green); font-weight: 750; }
  .mobile-back-button span { font-size: 29px; line-height: 1; }
  .detail-heading { align-items: flex-start; flex-direction: column; }
  .detail-heading h2 { margin-top: 4px; font-size: 23px; line-height: 1.23; }
  .detail-heading .desktop-register-button { display: none; }
  .tags { gap: 5px; }
  .tags span { font-size: 10px; }
  .mobile-visual-tabs { position: sticky; z-index: 12; top: 58px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 14px 0 10px; border-radius: 12px; background: #e9eeeb; padding: 4px; }
  .mobile-visual-tab { min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 750; }
  .mobile-visual-tab.active { background: #fff; color: var(--green); box-shadow: 0 3px 10px rgba(20,52,41,.08); }
  .visual-grid { display: block; margin-top: 0; }
  .mobile-visual-card { display: none; }
  .mobile-visual-card.active { display: block; }
  .product-photo, .standard-preview { height: min(55dvh, 470px); }
  .card-label { min-height: 48px; }
  .details-strip { grid-template-columns: 1fr 1fr; }
  .detail-item { border-right: 0; }
  .mobile-action-bar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: .72fr 1.28fr; gap: 9px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); box-shadow: 0 -10px 28px rgba(20,52,41,.12); backdrop-filter: blur(14px); }
  .mobile-action-bar button { min-height: 48px; }
  .records-hero { align-items: flex-start; flex-direction: column; gap: 14px; padding: 18px 16px; }
  .records-hero h1 { margin-block: 4px 6px; font-size: 25px; }
  .records-hero p:not(.eyebrow) { font-size: 12px; }
  .records-hero .primary-button { width: 100%; }
  .records-toolbar { flex-wrap: wrap; margin: 11px; }
  .records-toolbar label { width: 100%; justify-content: space-between; }
  .records-toolbar input, .records-toolbar button { min-height: 44px; }
  .summary-cards { grid-template-columns: 1fr 1fr; margin: 11px; }
  .points-calendar-panel { margin: 11px; padding: 14px; }
  .calendar-heading { align-items: flex-end; }
  .calendar-heading label { display: grid; gap: 4px; }
  .calendar-heading input { width: 145px; min-height: 42px; }
  .calendar-weekdays, .points-calendar { gap: 4px; }
  .calendar-day { min-height: 62px; border-radius: 9px; padding: 6px; }
  .calendar-day strong { font-size: 11px; }
  .calendar-day small { display: none; }
  .calendar-blank { min-height: 62px; }
  .range-ledger { padding: 13px; }
  .range-controls input { min-height: 44px; font-size: 13px; }
  .range-actions { grid-template-columns: 1fr; }
  .range-actions button { min-height: 45px; }
  .records-grid { padding: 0 11px 30px; }
  .record-item { position: relative; grid-template-columns: 1fr 1fr; padding-right: 5px; }
  .record-name { grid-column: 1/-1; padding-right: 0; }
  .record-actions { grid-column: 1/-1; display: flex; justify-content: flex-end; }
  .edit-record, .delete-record { min-width: 68px; min-height: 38px; }
  .record-dialog { width: 100%; max-height: calc(100dvh - 10px); margin: auto auto 0; overflow: auto; border-radius: 22px 22px 0 0; }
  .record-dialog form { padding: 18px 16px 10px; }
  .dialog-heading h2 { font-size: 21px; }
  .form-grid { grid-template-columns: 1fr; gap: 11px; margin-top: 16px; }
  .full-width { grid-column: auto; }
  .form-grid input, .form-grid textarea { min-height: 46px; font-size: 16px; }
  .dialog-actions { position: sticky; bottom: 0; margin: 5px -4px 0; padding: 10px 4px calc(4px + env(safe-area-inset-bottom)); background: #fff; }
  .dialog-actions button { min-height: 47px; }
  .care-dialog { width: calc(100% - 28px); border-radius: 22px; }
  .care-card { padding: 25px 20px 21px; }
  .care-dialog h2 { font-size: 23px; }
  .care-dialog #care-message { font-size: 15px; }
  .image-dialog { width: 100vw; height: 100vh; border-radius: 0; }
  .image-dialog-bar { height: 108px; align-items: stretch; flex-direction: column; gap: 7px; padding: 9px 11px; }
  .image-dialog-bar > div:first-child { min-width: 0; }
  .image-dialog-bar #image-dialog-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .zoom-controls { justify-content: flex-start; }
  .zoom-controls button { width: 38px; height: 38px; }
  .zoom-controls .close-image { margin-left: 6px; }
  .image-stage { height: calc(100dvh - 108px); }
  .image-stage img { max-width: calc(100% - 12px); max-height: calc(100% - 12px); }
  .password-dialog { width: 100%; max-height: calc(100dvh - 8px); margin: auto auto 0; overflow: auto; border-radius: 22px 22px 0 0; }
  .password-dialog form { padding: 20px 16px calc(12px + env(safe-area-inset-bottom)); }
}
