/* Byabsayik Khata hi-fi. Uses ../prototype/css/tokens.css (Practical UI base). */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg-screen); color: var(--text-strong); font-family: var(--font-ui); font-size: var(--type-small); line-height: var(--lh-small); -webkit-tap-highlight-color: transparent; }
.app { max-width: 400px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; background: var(--bg-screen); position: relative; }
main { padding: var(--space-16) var(--grid-margin) 160px; outline: none; min-width: 0; }
/* Round 3 margin rule: long text wraps inside the 16px side margin, it never pushes the page wider. Unbreakable strings break anywhere.
   Single line rows use text-overflow: ellipsis on their own class. */
main, .sheet, .toast, .topbar { overflow-wrap: anywhere; }
main.bare { padding-bottom: var(--space-32); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.ic { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ic-sm { width: 18px; height: 18px; }
:focus-visible { outline: var(--size-focus-ring) solid var(--stroke-focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top bar (F-R3): logo, name, circular profile only */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-12); padding: var(--space-8) var(--grid-margin); background: var(--surface-card); border-bottom: 1px solid var(--stroke-card); min-height: 66px; }
.topbar .back { width: 48px; height: 48px; margin-left: -12px; border: 0; background: none; border-radius: var(--radius-full); display: grid; place-items: center; cursor: pointer; }
.topbar .back:hover { background: var(--fill-hover); }
.topbar .back:active { background: var(--fill-press); }
/* R3-11 home top bar: avatar, name button (name, then role and business), bell with a count */
.topbar { gap: var(--space-8); }
.topbar .who { display: flex; align-items: center; gap: var(--space-4); flex: 1; min-width: 0; min-height: 48px; padding: 0 var(--space-8); border: 0; border-radius: var(--radius-card); background: none; color: var(--text-strong); text-align: left; cursor: pointer; font: inherit; }
.topbar .who:hover { background: var(--fill-hover); }
.topbar .who:active { background: var(--fill-press); }
.who-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.who-name { font-weight: var(--weight-medium); font-size: var(--type-small); line-height: var(--lh-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { display: flex; align-items: center; gap: 2px; min-width: 0; font-size: var(--type-tiny); line-height: var(--lh-tiny); color: var(--text-weak); }
.who-biz { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The arrow sits right after the role and business line, because only the business switches. The name never changes. */
.who-chev { flex: none; width: 18px; height: 18px; color: var(--text-weak); }
.topbar .bell { position: relative; flex-shrink: 0; margin-right: -8px; }
.bell-n { position: absolute; top: 4px; right: 2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-full); background: var(--fill-error-strong); color: var(--text-on-action); font-size: var(--type-caption); line-height: var(--lh-tiny); font-weight: var(--weight-medium); text-align: center; box-shadow: 0 0 0 2px var(--surface-card); }
.title { font-size: var(--type-h4); line-height: var(--lh-h4); font-weight: var(--weight-strong); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 48px; height: 48px; border-radius: 100%; border: 0; background: var(--stroke-brand); color: var(--text-brand-strong); font-weight: var(--weight-medium); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; display: block; }
.avatar:hover { box-shadow: 0 0 0 4px var(--fill-hover); }
.avatar:active { box-shadow: 0 0 0 4px var(--fill-press); }
.logo { flex-shrink: 0; overflow: visible; }

/* headings and text */
h1 { font-size: var(--type-h3); line-height: var(--lh-h3); font-weight: var(--weight-strong); margin: 0 0 var(--space-4); }
h2 { font-size: var(--type-h4); line-height: var(--lh-h4); font-weight: var(--weight-strong); margin: var(--space-24) 0 var(--space-12); }
h3 { font-size: var(--type-small); line-height: var(--lh-small); font-weight: var(--weight-strong); margin: 0; }
p { margin: 0; }
.weak { color: var(--text-weak); font-size: var(--type-tiny); line-height: var(--lh-tiny); }
.tiny { font-size: var(--type-tiny); line-height: var(--lh-tiny); }
.strong { font-weight: var(--weight-strong); }
.num { font-variant-numeric: tabular-nums; }
.big { font-size: var(--type-h2); line-height: var(--lh-h2); font-weight: var(--weight-strong); }
.t-error { color: var(--text-error); } .t-success { color: var(--text-success); } .t-warning { color: var(--text-warning); } .t-brand { color: var(--text-brand); } .t-info { color: var(--text-info); }
.row { display: flex; gap: var(--space-8); align-items: center; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--space-12); }
.grow { flex: 1; min-width: 0; }
.mt8 { margin-top: var(--space-8); } .mt16 { margin-top: var(--space-16); } .mt24 { margin-top: var(--space-24); }

/* surfaces */
.card { background: var(--surface-card); border: 1px solid var(--stroke-card); border-radius: var(--radius-card); }
/* R1-21: separate cards. Wrap cards in .cards (12px gap). For a tappable shop or memo card use <a class="li card-item">. */
.cards { display: flex; flex-direction: column; gap: var(--card-gap); }
.card-item { background: var(--surface-card); border: 1px solid var(--stroke-card); border-radius: var(--radius-card); }
.pad { padding: var(--space-16); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: var(--space-24) 0 var(--space-8); }
.section-head h2 { margin: 0; }
.link-btn { min-height: 48px; min-width: 48px; padding: 0 var(--space-8); margin-right: calc(-1 * var(--space-8)); border: 0; background: none; color: var(--text-brand); font-weight: var(--weight-medium); font-size: var(--type-tiny); line-height: var(--lh-tiny); cursor: pointer; border-radius: var(--radius-control); }
.link-btn:hover { background: var(--fill-hover); }
.link-btn:active { background: var(--fill-press); }

/* list rows */
.list > * + * { border-top: 1px solid var(--stroke-weak); }
.li { display: flex; align-items: center; gap: var(--space-12); min-height: 64px; padding: var(--space-12) var(--space-16); text-decoration: none; color: inherit; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.li:hover { background: var(--fill-hover); }
.li:active { background: var(--fill-press); }
.li:first-child { border-top-left-radius: var(--radius-card); border-top-right-radius: var(--radius-card); }
.li:last-child { border-bottom-left-radius: var(--radius-card); border-bottom-right-radius: var(--radius-card); }
.li.card-item { border: 1px solid var(--stroke-card); border-radius: var(--radius-card); background: var(--surface-card); width: 100%; }
.li.card-item:hover { box-shadow: inset 0 0 0 999px var(--fill-hover); }
.li.card-item:active { box-shadow: inset 0 0 0 999px var(--fill-press); }
.li.card-item.static:hover, .li.card-item.static:active { box-shadow: none; }
.li .main { flex: 1; min-width: 0; }
.li .main > div:first-child { overflow: hidden; text-overflow: ellipsis; }
.li .end { text-align: right; flex-shrink: 0; }
.li.static { cursor: default; }
.li.static:hover, .li.static:active { background: none; }
.chev { color: var(--icon-neutral); }

/* buttons */
.btn { min-height: var(--size-control); padding: 0 var(--space-16); border-radius: var(--radius-control); border: 1px solid transparent; font-weight: var(--weight-medium); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8); text-decoration: none; transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn-primary { background: var(--fill-action); color: var(--text-on-action); }
.btn-primary:hover:not(:disabled) { background: var(--fill-action-hover); }
.btn-primary:active:not(:disabled) { background: var(--fill-action-press); }
.btn-secondary { background: var(--bg-base); color: var(--text-strong); border-color: var(--stroke-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--fill-hover); }
.btn-secondary:active:not(:disabled) { background: var(--fill-press); }
.btn-danger { background: var(--fill-error-strong); color: var(--text-on-action); }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn-ghost { background: none; color: var(--text-brand); }
.btn-ghost:hover:not(:disabled) { background: var(--fill-hover); }
.btn-ghost:active:not(:disabled) { background: var(--fill-press); }
.btn:disabled { background: var(--fill-disabled); color: var(--text-weak); border-color: transparent; cursor: not-allowed; }
.link-inline { position: relative; display: inline; padding: 0 2px; border: 0; background: none; font: inherit; font-weight: var(--weight-medium); color: var(--text-brand); text-decoration: underline; cursor: pointer; border-radius: 4px; }
.link-inline::after { content: ""; position: absolute; inset: -14px -4px; }
.link-inline:hover { background: var(--fill-hover); }
.link-inline:active { background: var(--fill-press); }
.offline-line { display: flex; gap: var(--space-8); align-items: center; padding: var(--space-8) 0; font-size: var(--type-tiny); line-height: var(--lh-tiny); color: var(--text-info); }
.btn-sm { min-height: 48px; padding: 0 var(--space-12); font-size: var(--type-tiny); line-height: var(--lh-tiny); position: relative; }
.btn-lg { min-height: var(--size-control-lg); }
.btn-block { width: 100%; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--grid-gutter); }
.why { margin-top: var(--space-4); color: var(--text-weak); font-size: var(--type-tiny); line-height: var(--lh-tiny); }
.icon-btn { width: 48px; height: 48px; border: 0; background: none; border-radius: var(--radius-full); display: grid; place-items: center; cursor: pointer; color: var(--text-strong); }
.icon-btn:hover { background: var(--fill-hover); }
.icon-btn:active { background: var(--fill-press); }
.icon-btn:disabled { color: var(--icon-disabled); cursor: not-allowed; }

/* chips and segmented */
/* R1-36: a chip row moves sideways by touch swipe and by mouse drag (core.js). The thin scrollbar stays visible so a mouse user can also use it.
   Add .wrap to a chip row to wrap it onto lines instead. */
.chips { display: flex; gap: var(--space-8); overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; padding: var(--space-8) var(--grid-margin); margin: 0 calc(-1 * var(--grid-margin)); scrollbar-width: thin; scrollbar-color: var(--stroke-strong) transparent; cursor: grab; }
.chips.dragging { cursor: grabbing; user-select: none; }
.chips.dragging .chip { pointer-events: none; }
.chips.wrap { flex-wrap: wrap; overflow-x: visible; cursor: auto; }
.chips-in, .suggest .chips { margin-left: calc(-1 * var(--space-12)); margin-right: calc(-1 * var(--space-12)); padding-left: var(--space-12); padding-right: var(--space-12); }
.sheet .chips { margin-left: calc(-1 * var(--grid-margin)); margin-right: calc(-1 * var(--grid-margin)); padding-left: var(--grid-margin); padding-right: var(--grid-margin); }
.chips-amt { padding-top: var(--space-8); padding-bottom: var(--space-4); }
.chip { flex-shrink: 0; min-height: 48px; min-width: 48px; padding: 0 var(--space-12); /* Round 3 E-1: 48dp touch target */ border-radius: var(--radius-card); border: 1px solid var(--stroke-card); background: var(--surface-card); color: var(--text-strong); font-size: var(--type-tiny); line-height: var(--lh-tiny); font-weight: var(--weight-regular); cursor: pointer; position: relative; white-space: nowrap; }
.chip:disabled { background: var(--fill-disabled); color: var(--text-weak); cursor: not-allowed; }
.chip:hover:not(:disabled) { box-shadow: inset 0 0 0 999px var(--fill-hover); }
.chip:active:not(:disabled) { box-shadow: inset 0 0 0 999px var(--fill-press); }
.chip[aria-pressed="true"] { background: var(--fill-selected); color: var(--text-on-action); border-color: transparent; font-weight: var(--weight-medium); }
.chip .count { margin-left: 4px; }
.seg { display: flex; background: var(--fill-weak); border-radius: var(--radius-segment); padding: var(--space-4); }
.seg button { flex: 1; min-width: 0; min-height: 48px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--text-weak); font-size: var(--type-tiny); line-height: var(--lh-tiny); cursor: pointer; }
.seg button:hover { color: var(--text-strong); background: var(--fill-hover); }
.seg button:active { background: var(--fill-press); }
.seg button:disabled { color: var(--text-weak); cursor: not-allowed; }
.seg button[aria-pressed="true"] { background: var(--surface-card); color: var(--text-strong); font-weight: var(--weight-medium); box-shadow: 0 0 0 1px var(--stroke-card); }

/* forms */
.field { display: block; }
.field + .field { margin-top: var(--space-16); }
.field label, .label { display: block; font-size: var(--type-tiny); line-height: var(--lh-tiny); font-weight: var(--weight-medium); margin-bottom: var(--space-4); }
.field .opt { font-weight: var(--weight-regular); color: var(--text-weak); }
.input { width: 100%; min-width: 0; min-height: var(--size-control); padding: 0 var(--space-12); border: 1px solid var(--stroke-strong); border-radius: var(--radius-control); background-color: var(--surface-card); }
.input:hover:not(:disabled):not([readonly]) { border-color: var(--text-strong); }
.input:disabled { background-color: var(--fill-disabled); color: var(--text-weak); cursor: not-allowed; }
/* R1-09: every select. The arrow sits 12px inside the right edge, the whole field is the touch target, 48px high. */
select.input { -webkit-appearance: none; appearance: none; cursor: pointer; min-height: 48px !important; padding-right: calc(var(--inset-field-arrow) + 28px); text-overflow: ellipsis;
  background-repeat: no-repeat; background-position: right var(--inset-field-arrow) center; background-size: 20px 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000D4D' stroke-opacity='.65' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
[data-theme="dark"] select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-opacity='.7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
select.input option { color: var(--text-strong); background: var(--bg-overlay); }
/* money and counts are typed. No up and down arrows anywhere. */
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
textarea.input { padding: var(--space-12); min-height: 96px; resize: vertical; }
.input::placeholder { color: var(--text-weak); }
.input[readonly] { background: var(--fill-weak); color: var(--text-weak); }
.field.error .input { border: 2px solid var(--stroke-error); background: var(--fill-error-weak); }
.msg { display: none; gap: var(--space-4); margin-top: var(--space-4); font-size: var(--type-tiny); line-height: var(--lh-tiny); color: var(--text-error); }
.field.error .msg { display: flex; }
.msg .ic { width: 16px; height: 16px; margin-top: 2px; }
.hint { margin-top: var(--space-4); font-size: var(--type-tiny); line-height: var(--lh-tiny); color: var(--text-weak); }
.pw { position: relative; }
.pw .input { padding-right: 52px; }
.pw .icon-btn { position: absolute; right: 0; top: 0; }

/* choice cards (role, business type) */
.choices { display: grid; gap: var(--grid-gutter); }
.choices.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.choice { display: flex; align-items: center; gap: var(--space-12); min-height: 64px; padding: var(--space-12); border: 1px solid var(--stroke-strong); border-radius: var(--radius-card); background: var(--surface-card); text-align: left; cursor: pointer; }
.choice:hover { background: var(--fill-hover); }
.choice:active { background: var(--fill-press); }
.choice[aria-pressed="true"] { border: 2px solid var(--stroke-focus); background: var(--fill-brand-weak); padding: 11px; }
.choice .ic { color: var(--icon-brand); }

/* badges and alerts */
.badge { display: inline-flex; align-items: center; gap: var(--space-4); padding: 2px var(--space-8); border-radius: var(--radius-card); font-size: var(--type-tiny); line-height: var(--lh-tiny); white-space: nowrap; }
.b-warning { color: var(--text-warning); background: var(--fill-warning-weak); box-shadow: inset 0 0 0 1px var(--icon-warning); }
.b-success { color: var(--text-success); background: var(--fill-success-weak); box-shadow: inset 0 0 0 1px var(--icon-success); }
.b-error { color: var(--text-error); background: var(--fill-error-weak); box-shadow: inset 0 0 0 1px var(--icon-error); }
.b-info { color: var(--text-info-strong); background: var(--fill-info-weak); box-shadow: inset 0 0 0 1px var(--icon-info); }
.b-neutral { color: var(--text-weak); background: var(--fill-weak); box-shadow: inset 0 0 0 1px var(--stroke-weak); }
.alert { display: flex; gap: var(--space-8); padding: var(--space-12); border-radius: var(--radius-control); font-size: var(--type-small); line-height: var(--lh-small); }
.alert { flex-wrap: wrap; align-items: flex-start; }
.alert > .grow, .alert > div { min-width: 0; overflow-wrap: anywhere; }
.alert > .grow { flex: 1 1 200px; }
.alert > .btn { margin-left: 28px; }
.alert .ic { width: 20px; height: 20px; }
.alert-info { background: var(--fill-info-weak); box-shadow: inset 0 0 0 1px var(--icon-info); }
.alert-info .ic { color: var(--icon-info); }
.alert-warning { background: var(--fill-warning-weak); box-shadow: inset 0 0 0 1px var(--icon-warning); }
.alert-warning .ic { color: var(--icon-warning); }
.alert-error { background: var(--fill-error-weak); box-shadow: inset 0 0 0 1px var(--icon-error); }
.alert-error .ic { color: var(--icon-error); }

/* stock capsule (tokens.md) */
.stock { display: inline-flex; align-items: center; gap: var(--space-8); }
.capsule { width: 48px; height: 16px; border-radius: var(--radius-full); box-shadow: inset 0 0 0 1px var(--stroke-strong); padding: 2px; flex-shrink: 0; }
.capsule i { display: block; height: 100%; border-radius: var(--radius-full); min-width: 4px; }
.lvl-out .capsule i { display: none; }
.lvl-verylow i { background: var(--fill-error-strong); }
.lvl-low i { background: var(--fill-warning-strong); }
.lvl-medium i { background: var(--icon-neutral); }
.lvl-good i { background: var(--fill-success-strong); }
.stock-label { font-size: var(--type-tiny); line-height: var(--lh-tiny); white-space: nowrap; }
.lvl-out .stock-label, .lvl-verylow .stock-label { color: var(--text-error); }
.lvl-low .stock-label { color: var(--text-warning); }
.lvl-medium .stock-label { color: var(--text-weak); }
.lvl-good .stock-label { color: var(--text-success); }

/* progress bar (target) */
.bar { height: 8px; border-radius: var(--radius-full); background: var(--fill-weak); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--fill-action); border-radius: var(--radius-full); }

/* photo slot (F-R9) */
.thumb { width: 56px; height: 56px; border-radius: var(--radius-control); background: var(--fill-weak); border: 1px solid var(--stroke-weak); display: grid; place-items: center; color: var(--icon-neutral); overflow: hidden; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-lg { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius-card); background: var(--fill-weak); border: 1px dashed var(--stroke-strong); display: grid; place-items: center; color: var(--text-weak); overflow: hidden; text-align: center; }
.photo-lg img { width: 100%; height: 100%; object-fit: cover; }
/* F-28: until a photo exists the slot is a short strip, so it does not fill the first screen */
.photo-lg.no-photo { aspect-ratio: auto; height: 96px; }

/* search (F-R7) */
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 12px; color: var(--icon-neutral); pointer-events: none; }
.search .input { padding-left: 44px; padding-right: 48px; background-color: var(--surface-card); }
.search .clear { position: absolute; right: 0; top: 0; }
.suggest { margin-top: var(--space-8); padding: var(--space-12); }
.suggest .label { color: var(--text-weak); font-weight: var(--weight-regular); }
.suggest .chips { padding-top: 0; }
.mark { background: var(--fill-warning-weak); box-shadow: inset 0 -2px 0 var(--icon-warning); }

/* bottom nav */
/* R1-12: five equal columns, no side padding, so every tab has the same space on both sides. Label centred under the icon. */
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 400px; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface-card); border-top: 1px solid var(--stroke-card); padding: var(--space-4) var(--grid-margin) calc(var(--space-8) + env(safe-area-inset-bottom)); }
.nav button { min-width: 0; min-height: 56px; margin: 0; padding: 0; border: 0; background: none; color: var(--text-weak); font-size: var(--type-tiny); line-height: var(--lh-tiny); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); cursor: pointer; border-radius: var(--radius-control); text-align: center; }
.nav .nav-label { display: block; width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav button:disabled { color: var(--icon-disabled); cursor: not-allowed; }
.nav .pill { display: grid; place-items: center; width: 56px; height: 32px; border-radius: var(--radius-full); transition: background var(--duration-fast) var(--ease-standard); }
.nav button:hover .pill { background: var(--fill-hover); }
.nav button:active .pill { background: var(--fill-press); }
.nav button[aria-current="page"] { color: var(--text-strong); font-weight: var(--weight-medium); }
.nav button[aria-current="page"] .pill { background: var(--stroke-brand); color: var(--text-brand); }
.nav .ic { width: 22px; height: 22px; stroke-width: 1.75; }
.fab { position: fixed; z-index: 21; bottom: calc(88px + env(safe-area-inset-bottom)); right: max(var(--grid-margin), calc(50% - 200px + var(--grid-margin))); width: var(--size-fab); height: var(--size-fab); border-radius: var(--radius-fab); border: 0; background: var(--fill-action); color: var(--text-on-action); display: grid; place-items: center; cursor: pointer; transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard); }
.fab .ic { width: var(--size-icon-fab); height: var(--size-icon-fab); }
.fab:hover { background: var(--fill-action-hover); }
.fab:active { background: var(--fill-action-press); transform: scale(0.96); }
/* Round 3: hides on scroll down, returns on scroll up. It slides off the bottom edge and stays focusable, focus brings it back. */
.fab { transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard); }
.fab.fab-hidden { transform: translateY(calc(100% + 120px)); opacity: 0; pointer-events: none; }
.fab:focus-visible { outline: 3px solid var(--stroke-focus); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .fab { transition: none; } .fab.fab-hidden { transform: none; } }
/* R1-46: no FAB behind a sheet */
body.has-sheet .fab { display: none; }

/* bottom sheet */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--fill-scrim); animation: fade var(--duration-default) var(--ease-standard); }
.sheet { position: fixed; z-index: 41; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 400px; max-height: 88vh; overflow-y: auto; background: var(--bg-overlay); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; padding: var(--space-8) var(--screen-margin) calc(var(--space-24) + env(safe-area-inset-bottom)); animation: up var(--duration-default) var(--ease-standard); }
.sheet .grab { width: 32px; height: 4px; border-radius: 2px; background: var(--stroke-strong); margin: 0 auto var(--space-16); }
.sheet h2 { margin-top: 0; }
.sheet-actions { position: sticky; bottom: calc(-1 * var(--space-24)); background: var(--bg-overlay); padding: var(--space-16) 0 var(--space-8); margin-top: var(--space-16); }
/* R2-07: quick add as compact rows. 48px row, 20px icon, one line label. */
.qa-grid { display: flex; flex-direction: column; gap: var(--space-8); }
.qa-item { min-height: 48px; display: flex; align-items: center; gap: var(--space-12); padding: 0 var(--space-12); border: 1px solid var(--stroke-card); border-radius: var(--radius-card); background: var(--surface-card); text-align: left; cursor: pointer; font-size: var(--type-small); line-height: var(--lh-small); }
.qa-item:hover { background: var(--fill-hover); }
.qa-item:active { background: var(--fill-press); }
.qa-item:disabled { background: var(--fill-disabled); color: var(--text-weak); cursor: not-allowed; }
.qa-item .ic { width: 20px; height: 20px; color: var(--icon-brand); }
.qa-item .strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }@keyframes up { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim, .onb-art * { animation: none !important; } }

/* toast and net popup (F-R3) */
.toast { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: calc(160px + env(safe-area-inset-bottom)); width: calc(100% - 32px); max-width: 368px; background: var(--bg-inverse); color: var(--text-inverse); border-radius: var(--radius-control); padding: var(--space-12) var(--space-16); font-size: var(--type-small); line-height: var(--lh-small); display: flex; gap: var(--space-12); align-items: center; animation: fade var(--duration-default) var(--ease-standard); }
.toast .ic { width: 20px; height: 20px; }
.toast .progress { flex: 1; height: 4px; border-radius: 2px; background: rgba(127,127,127,.35); overflow: hidden; margin-top: 6px; }
.toast .progress i { display: block; height: 100%; width: 0; background: var(--text-inverse); transition: width 900ms linear; }

/* onboarding (F-R2) */
.onb { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: var(--space-16) var(--grid-margin) var(--space-24); background: var(--bg-screen); }
.onb-top { display: flex; justify-content: space-between; align-items: center; min-height: 48px; }
.onb-art { flex: 1; display: grid; place-items: center; min-height: 260px; }
.onb-art svg { width: 100%; max-width: 280px; height: auto; }
.onb h1 { font-size: var(--type-h3); line-height: var(--lh-h3); margin-top: var(--space-16); }
.onb p { color: var(--text-weak); margin-top: var(--space-8); }
.dots { display: flex; gap: var(--space-8); justify-content: center; margin: var(--space-24) 0; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--stroke-strong); transition: width var(--duration-default) var(--ease-standard), background var(--duration-default); }
.dots i.on { width: 24px; background: var(--fill-action); }
.art-in { animation: artIn 260ms var(--ease-standard); }
@keyframes artIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* auth */
.auth { min-height: 100vh; min-height: 100dvh; padding: var(--space-24) var(--grid-margin); background: var(--bg-screen); display: flex; flex-direction: column; }
.auth .head { display: flex; align-items: center; gap: var(--space-12); margin-bottom: var(--space-24); }
.or { display: flex; align-items: center; gap: var(--space-12); color: var(--text-weak); font-size: var(--type-tiny); margin: var(--space-24) 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--stroke-weak); }
.steps { display: flex; gap: var(--space-4); margin-bottom: var(--space-16); }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--fill-weak); }
.steps i.on { background: var(--fill-action); }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-8); }
.otp input { text-align: center; padding: 0; font-size: var(--type-h4); }

/* memo print (F-R10) */
/* The memo itself is styled in orders.css (R3-10). Print shows the memo only, on A4. */
@media print {
  @page { size: A4; margin: 0; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  body * { visibility: hidden; }
  .memo, .memo * { visibility: visible; }
  .memo { position: absolute; left: 0; top: 0; width: 100%; border: 0 !important; border-radius: 0 !important; }
}

/* order line editor */
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-8); padding: var(--space-12) var(--space-16); }
.line > * { min-width: 0; }
.line .badge { white-space: normal; max-width: 100%; }
/* R1-07: quantity stepper, built by qtyStepper() in core.js. Every part is 48px. */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--stroke-strong); border-radius: var(--radius-control); background-color: var(--surface-card); }
.qty button { width: 48px; height: 48px; border: 0; background: none; cursor: pointer; border-radius: var(--radius-control); display: grid; place-items: center; color: var(--text-strong); }
.qty button:hover { background: var(--fill-hover); }
.qty button:active { background: var(--fill-press); }
.qty button:disabled { color: var(--icon-disabled); cursor: not-allowed; }
.qty input { width: 56px; min-width: 0; height: 48px; padding: 0; border: 0; border-radius: 0; text-align: center; background: none; font-size: var(--type-small); }
.qty input:focus-visible { outline-offset: -3px; }
.sticky-total { position: sticky; bottom: 0; z-index: 5; background: var(--surface-card); border-top: 1px solid var(--stroke-card); margin: var(--space-16) calc(-1 * var(--screen-margin)) 0; padding: var(--space-12) var(--screen-margin); }
.empty { text-align: center; padding: var(--space-32) var(--space-16); color: var(--text-weak); }
.empty .ic { width: 40px; height: 40px; color: var(--icon-neutral); margin-bottom: var(--space-8); }

/* R1-22: searchable picker, built by pickerField() in core.js */
.pk-list { list-style: none; margin: var(--space-4) 0 0; padding: 0; max-height: 280px; overflow-y: auto; }
.pk-opt { display: flex; align-items: center; gap: var(--space-12); min-height: 56px; padding: var(--space-8) var(--space-16); cursor: pointer; }
.pk-opt + .pk-opt { border-top: 1px solid var(--stroke-weak); }
.pk-opt .main { flex: 1; min-width: 0; }
.pk-opt .end { flex-shrink: 0; text-align: right; }
.pk-opt:hover { background: var(--fill-hover); }
.pk-opt:active { background: var(--fill-press); }
.pk-opt[aria-selected="true"] { background: var(--fill-brand-weak); box-shadow: inset 4px 0 0 var(--fill-action); }
.pk-note { padding: var(--space-12) var(--space-16); color: var(--text-weak); font-size: var(--type-tiny); line-height: var(--lh-tiny); }

/* QA panel */
.qa { border: 1px dashed var(--stroke-strong); }

/* R2-02 required star */
.req { color: var(--text-error); margin-left: 2px; font-weight: var(--weight-medium); }


/* ---------- Phase 7 round 2 fixes ---------- */
:root { --text-brand-strong: #005A2B; --text-info-strong: #14628D; }
/* Round 3 type audit: two steps from the Practical UI scale that tokens.css does not carry yet.
   h1 36/44 is the one large number on a home screen. Caption 12/16 is the floor: bell count, memo fine print. Nothing renders below it. */
:root { --type-h1: 36px; --lh-h1: 44px; --type-caption: 12px; --lh-caption: 16px; }
[data-theme="dark"] { --text-brand-strong: var(--text-brand); --text-info-strong: var(--text-info); }
.link-btn.btn-block { margin-right: 0; text-align: center; }
.sheet:focus { outline: none; }
/* F-45: a card you can tap has a stronger edge than a card you cannot. Hover and pressed fills stay. */
a.card-item, button.card-item, .li.card-item:not(.static) { border-color: var(--stroke-strong); }
/* F-24: a toast with a button. Each button is 48px. */
.toast .grow { min-width: 0; }
.toast-btn { flex-shrink: 0; min-height: 48px; min-width: 48px; padding: 0 var(--space-12); margin: calc(-1 * var(--space-12)) calc(-1 * var(--space-8)) calc(-1 * var(--space-12)) 0; border: 0; border-radius: var(--radius-control); background: none; color: var(--text-inverse); font-weight: var(--weight-medium); cursor: pointer; display: inline-grid; place-items: center; }
.toast-btn:hover { background: rgba(127, 127, 127, .25); }
.toast-btn:active { background: rgba(127, 127, 127, .4); }
.toast-btn:focus-visible { outline: var(--size-focus-ring) solid var(--text-inverse); outline-offset: -3px; }
.toast-btn:disabled { opacity: .5; cursor: not-allowed; }
.toast-x .ic { width: 20px; height: 20px; }
/* F-11: visit product row. The reaction chips sit on their own line under the product. */
.li.vr { flex-wrap: wrap; }
.vr-chips { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: var(--space-8); padding-top: var(--space-4); }
/* F-13: date field. Chips and the chosen date in day first form. */
.dp-chips { padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; cursor: auto; }
.dp-show { margin-top: var(--space-4); font-size: var(--type-tiny); line-height: var(--lh-tiny); font-weight: var(--weight-medium); }
/* F-38: memo footer on two lines */
.memo-foot { margin-top: var(--space-32); font-size: var(--type-caption); line-height: var(--lh-caption); display: flex; flex-direction: column; gap: var(--space-8); }
/* F-03: the meeting report prints on its own */
@media print { .print-area, .print-area * { visibility: visible; } .print-area { position: absolute; left: 0; top: 0; width: 100%; } }