:root {
  --ink: #242823;
  --muted: #70766f;
  --green: #174f3d;
  --green-2: #2d6a53;
  --mint: #edf3ef;
  --paper: #ffffff;
  --canvas: #f8f7f3;
  --line: #dedfd9;
  --amber: #a85d13;
  --amber-bg: #fff2d7;
  --red: #a6403b;
  --red-bg: #fde9e7;
  --gray-bg: #ecefed;
  --shadow: none;
  --control-height: 46px;
  --control-radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
.container { width: min(1160px, calc(100% - 32px)); margin-inline: auto; }
.topbar { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar__inner { min-height: 64px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.brand { width: max-content; color: var(--ink); font-size: .78rem; font-weight: 800; letter-spacing: .11em; text-decoration: none; }
.brand span { color: var(--green); }
.nav { display: flex; align-self: stretch; align-items: center; gap: 26px; }
.nav a { height: 100%; display: inline-flex; align-items: center; color: var(--muted); border-bottom: 2px solid transparent; text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--green); }
.profile-menu { position: relative; justify-self: end; }
.profile-menu > summary { width: 36px; height: 36px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 50%; cursor: pointer; font-size: .78rem; font-weight: 800; list-style: none; }
.profile-menu > summary::-webkit-details-marker { display: none; }
.profile-menu__content { position: absolute; top: calc(100% + 10px); right: 0; width: 230px; display: grid; padding: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 45px rgba(26, 36, 30, .14); }
.profile-menu__content::before { content: ""; position: absolute; top: -11px; right: 0; width: 50px; height: 11px; }
.profile-menu__identity { display: grid; gap: 1px; margin-bottom: 5px; padding: 8px 9px 10px; border-bottom: 1px solid var(--line); }
.profile-menu__identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu__identity span { overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu__content > a, .profile-menu__button { width: 100%; display: block; padding: 9px; color: var(--ink); background: transparent; border: 0; border-radius: 7px; text-align: left; text-decoration: none; }
.profile-menu__content > a:hover, .profile-menu__button:hover { background: var(--mint); }
.profile-menu__content form { margin: 0; }
.mobile-nav { display: none; }
.install-button { min-height: 36px; padding: 7px 12px; color: var(--green); border: 1px solid #cfe3db; border-radius: 10px; background: var(--mint); font-size: .78rem; font-weight: 800; }
.install-button[hidden] { display: none; }
.install-dialog { width: min(440px, calc(100% - 24px)); padding: 22px; color: var(--ink); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 24px 80px rgba(20, 45, 37, .24); }
.install-dialog::backdrop { background: rgba(16, 36, 30, .62); backdrop-filter: blur(3px); }
.install-dialog__header { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.install-dialog__header h2 { margin-bottom: 14px; }
.install-dialog__close { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; padding: 0; color: var(--muted); border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 1.5rem; line-height: 1; }
.page { padding-block: 34px 72px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 28px; padding: 18px 0 30px; }
.hero__actions { flex: 0 0 min(520px, 48vw); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hero__actions .button { width: 100%; white-space: nowrap; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 720px; margin-bottom: 8px; font: 750 clamp(2rem, 4vw, 3.1rem)/1.05 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: -.035em; }
h2 { font: 750 1.3rem/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
h3 { margin-bottom: 7px; font-size: 1.15rem; line-height: 1.25; }
.hero p { max-width: 620px; margin-bottom: 0; color: var(--muted); font-size: 1.05rem; }
.eyebrow { margin-bottom: 7px; color: var(--green-2); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); }
.button { display: inline-flex; min-height: var(--control-height); align-items: center; justify-content: center; padding: 10px 17px; border: 1px solid transparent; border-radius: var(--control-radius); font-weight: 750; line-height: 1.2; text-align: center; text-decoration: none; }
.button--primary { color: white; background: var(--green); }
.button--primary:hover { background: #0e503e; }
.button--secondary { color: var(--green); background: var(--mint); border-color: #cfe3db; }
.button--telegram { color: white; background: #229ed9; }
.button--telegram:hover { background: #1788bd; }
.button--ghost { border-color: var(--line); background: white; }
.button--ghost:hover { color: var(--green); border-color: #b9cec5; background: var(--mint); }
.button--danger { color: white; background: var(--red); }
.button--danger:hover { background: #8d302c; }
.button--wide { width: 100%; }
.confirm-dialog { width: min(460px, calc(100% - 24px)); padding: 25px; color: var(--ink); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 24px 80px rgba(20, 45, 37, .28); }
.confirm-dialog::backdrop { background: rgba(16, 36, 30, .62); backdrop-filter: blur(4px); }
.confirm-dialog__icon { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 18px; color: var(--red); background: var(--red-bg); border-radius: 16px; }
.confirm-dialog__icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.confirm-dialog__content .eyebrow { color: var(--red); }
.confirm-dialog__content h2 { margin-bottom: 9px; font-size: 1.45rem; }
.confirm-dialog__content > p:last-child { margin-bottom: 0; color: var(--muted); }
.confirm-dialog__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { min-height: 112px; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); text-decoration: none; }
.stat span { color: var(--muted); font-size: .84rem; font-weight: 700; }
.stat strong { font: 800 2rem/1 Georgia, serif; }
.stat--green { border-top: 4px solid var(--green-2); }
.stat--amber { border-top: 4px solid #d8872e; }
.stat--red { border-top: 4px solid var(--red); }
.stat--gray { border-top: 4px solid #89938f; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); }
.filters { margin-bottom: 30px; }
.filter-form { display: grid; grid-template-columns: minmax(220px, 1fr) 190px 170px auto auto; align-items: stretch; gap: 10px; }
.filter-form > * { min-width: 0; }
.filter-form .clear-link { display: inline-flex; min-height: var(--control-height); align-items: center; justify-content: center; padding-inline: 8px; }
input, select, textarea { width: 100%; min-height: var(--control-height); padding: 10px 12px; color: var(--ink); background: white; border: 1px solid #cdd7d2; border-radius: var(--control-radius); outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(35,124,96,.13); }
.clear-link, .back-link { color: var(--green); font-weight: 700; text-decoration: none; }
.dashboard-page { width: min(860px, 100%); margin-inline: auto; }
.dashboard-search { margin: 2px 0 32px; }
.dashboard-command { display: grid; grid-template-columns: minmax(0, 1fr) 48px auto; gap: 8px; }
.dashboard-command__input { position: relative; min-width: 0; }
.dashboard-command__input > svg { position: absolute; z-index: 1; top: 15px; left: 15px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.dashboard-command__input input { height: 48px; padding-left: 43px; border-radius: 10px; }
.dashboard-scan { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.dashboard-scan svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.dashboard-add { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; color: white; background: var(--green); border: 1px solid var(--green); border-radius: 10px; font-weight: 700; text-decoration: none; }
.dashboard-add:hover { background: #103f30; }
.dashboard-refine { display: grid; grid-template-columns: auto minmax(160px, 220px) 1fr; align-items: center; gap: 8px; margin-top: 10px; }
.dashboard-refine label { color: var(--muted); font-size: .82rem; }
.dashboard-refine select { min-height: 38px; height: 38px; padding: 6px 9px; border-radius: 8px; }
.dashboard-refine a { justify-self: end; color: var(--green); font-size: .84rem; text-decoration: none; }
.dashboard-statuses { display: flex; gap: 6px; margin-top: 18px; overflow-x: auto; scrollbar-width: none; }
.dashboard-statuses::-webkit-scrollbar { display: none; }
.dashboard-statuses a { display: inline-flex; gap: 7px; flex: 0 0 auto; padding: 8px 11px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; white-space: nowrap; }
.dashboard-statuses a[aria-current="page"] { color: white; background: var(--green); border-color: var(--green); }
.dashboard-statuses strong { font-weight: 750; }
.dashboard-inventory__heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.dashboard-inventory__heading h1 { margin: 0; font-size: 1.35rem; }
.dashboard-inventory__heading span { color: var(--muted); font-size: .82rem; }
.medicine-list { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.medicine-row { min-height: 96px; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 14px 16px; border-top: 1px solid var(--line); }
.medicine-row:first-child { border-top: 0; }
.medicine-row__date { min-height: 52px; display: grid; place-items: center; align-content: center; padding: 5px; color: var(--muted); background: var(--mint); border-radius: 8px; font-variant-numeric: tabular-nums; }
.medicine-row__date strong { font-size: 1.12rem; line-height: 1; }
.medicine-row__date span { margin-top: 3px; font-size: .7rem; }
.medicine-row__content { min-width: 0; }
.medicine-row__status { margin-bottom: 3px; color: var(--muted); font-size: .76rem; }
.medicine-row h2 { overflow: hidden; margin-bottom: 3px; font-size: 1.02rem; text-overflow: ellipsis; white-space: nowrap; }
.medicine-row__meta { overflow: hidden; margin-bottom: 0; color: var(--muted); font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.medicine-row__open { padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.medicine-row__open:hover { color: var(--green); border-color: #b9c9c1; background: var(--mint); }
.medicine-row--expired .medicine-row__date, .medicine-row--expired .medicine-row__status { color: var(--red); background: var(--red-bg); }
.medicine-row--expired .medicine-row__status { background: transparent; }
.medicine-row--expiring .medicine-row__date, .medicine-row--expiring .medicine-row__status { color: var(--amber); background: var(--amber-bg); }
.medicine-row--expiring .medicine-row__status { background: transparent; }
.medicine-row--depleted, .medicine-row--disposed { opacity: .68; }
.dashboard-empty { padding: 50px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.dashboard-empty h2 { margin-bottom: 8px; }
.dashboard-empty p { margin-bottom: 13px; color: var(--muted); }
.dashboard-empty a { color: var(--green); font-weight: 700; text-decoration: none; }
.dashboard-empty__actions { display: flex; align-items: center; justify-content: center; gap: 14px; }
.dashboard-empty__actions .button--primary { color: white; }
#inventory-results, #catalog-results { scroll-margin-top: 82px; }
.data-heading { max-width: 860px; margin-inline: auto; }
.data-export { max-width: 860px; margin-inline: auto; border-top: 1px solid var(--line); }
.data-export__row { min-height: 118px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 28px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.data-export__row h2 { margin-bottom: 6px; font-size: 1.08rem; }
.data-export__row p { max-width: 620px; margin-bottom: 0; color: var(--muted); }
.data-export__note { max-width: 860px; margin: 18px auto 0; color: var(--muted); font-size: .84rem; }
.section-heading, .page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-heading { align-items: start; }
.page-subtitle { max-width: 670px; margin: 6px 0 0; }
.page-heading h1 { font-size: clamp(2.1rem, 4vw, 3.4rem); }
.medicine-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.medicine-card { display: flex; min-height: 285px; flex-direction: column; padding: 19px; border: 1px solid var(--line); border-left: 4px solid var(--green-2); border-radius: 17px; background: var(--paper); box-shadow: var(--shadow); }
.medicine-card--expiring { border-left-color: #d8872e; }
.medicine-card--expired { border-left-color: var(--red); }
.medicine-card--depleted, .medicine-card--disposed { border-left-color: #89938f; opacity: .76; }
.medicine-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 17px; }
.kit-pill { overflow: hidden; color: var(--green); font-size: .78rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.status { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; font-size: .7rem; font-weight: 800; }
.status--green { color: var(--green); background: var(--mint); }
.status--amber { color: var(--amber); background: var(--amber-bg); }
.status--red { color: var(--red); background: var(--red-bg); }
.status--gray { color: #5f6b67; background: var(--gray-bg); }
.status--outline { color: var(--muted); border: 1px solid var(--line); }
.medicine-card__inn { margin-bottom: 12px; color: var(--muted); font-size: .88rem; }
.medicine-meta { display: grid; gap: 3px; color: var(--muted); font-size: .86rem; }
.medicine-card__notes { margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: .85rem; }
.card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.card-actions form { display: flex; min-width: 0; margin: 0; }
.card-actions a, .card-actions button { display: inline-flex; width: 100%; min-height: 42px; align-items: center; justify-content: center; padding: 8px 10px; color: var(--green); background: var(--mint); border: 1px solid #cfe3db; border-radius: 10px; font-size: .82rem; font-weight: 800; line-height: 1.2; text-align: center; text-decoration: none; }
.card-actions a:hover, .card-actions button:hover { color: white; border-color: var(--green); background: var(--green); }
.row-actions a, .row-actions button { min-height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; color: var(--green); background: var(--mint); border: 1px solid #d7e5df; border-radius: 9px; font-size: .82rem; font-weight: 800; line-height: 1; text-decoration: none; }
.row-actions a:hover, .row-actions button:hover { border-color: #b9cec5; background: #e4eee9; }
.row-actions svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.row-actions form { display: flex; margin: 0; }
.row-actions form button { color: var(--red); background: #fff8f7; border-color: #efd9d6; }
.empty-state { padding: 58px 20px; border: 1px dashed #b9c8c2; border-radius: 20px; text-align: center; background: rgba(255,255,255,.45); }
.empty-state__icon { width: 52px; aspect-ratio: 1; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 16px; color: white; background: var(--green); font-size: 32px; }
.form-panel { max-width: 850px; }
.form-stack { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 17px; }
.field { display: grid; align-content: start; gap: 6px; }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: .85rem; font-weight: 800; }
.field small { color: var(--muted); }
.field > input, .field > select { height: 48px; min-height: 48px; }
.field-error, .form-error { color: var(--red); font-size: .84rem; }
.form-actions { display: flex; gap: 10px; padding-top: 5px; }
.danger-zone { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.danger-link { color: var(--red); background: none; border: 0; padding: 0; font-weight: 700; }
.two-column { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; align-items: start; }
.kit-list { display: grid; gap: 10px; }
.kit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; border-top: 1px solid var(--line); }
.kit-row:first-child { border-top: 0; }
.kit-row strong, .kit-row span { display: block; }
.kit-row span { color: var(--muted); font-size: .82rem; }
.row-actions { display: flex; gap: 12px; }
.kit-list--manage { gap: 0; }
.kit-list--manage .kit-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 0; }
.kit-row__primary { min-width: 0; min-height: 84px; display: grid; grid-template-columns: 44px minmax(0, 1fr) 20px; align-items: center; gap: 12px; padding: 13px 0; border-radius: 10px; text-decoration: none; }
.kit-row__primary:hover strong { color: var(--green); }
.kit-row__icon { width: 44px; height: 44px; display: grid !important; place-items: center; color: var(--green); background: var(--mint); border-radius: 12px; }
.kit-row__icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.kit-row__content { min-width: 0; }
.kit-row__content strong { overflow: hidden; margin-bottom: 2px; font-size: 1.02rem; text-overflow: ellipsis; white-space: nowrap; }
.kit-row__content > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-row__chevron { width: 20px; height: 20px; fill: none; stroke: #9aa09a; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.messages { display: grid; gap: 8px; margin-bottom: 18px; }
.message { padding: 12px 14px; border-radius: 12px; background: var(--mint); }
.message--error { color: var(--red); background: var(--red-bg); }
.auth-card { width: min(440px, 100%); margin: 8vh auto; padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 2.45rem; }
.social-login { display: grid; gap: 10px; margin: 22px 0 18px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; color: var(--muted); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.household-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.member-actions { display: flex; align-items: center; gap: 8px; }
.member-actions form { margin: 0; }
.member-remove, .link-button { padding: 5px 0; color: var(--red); background: transparent; border: 0; font-size: .8rem; font-weight: 750; }
.invitation-panel { margin-top: 18px; }
.invitation-list { display: grid; gap: 12px; }
.invitation-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.invitation-row form { margin: 0; }
.invitation-copy { width: 100%; min-width: 0; min-height: 46px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 9px 8px 12px; color: var(--ink); background: white; border: 1px solid #cdd7d2; border-radius: var(--control-radius); text-align: left; }
.invitation-copy:hover { border-color: #b3c8be; background: #fbfdfc; }
.invitation-copy:focus-visible { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(35,124,96,.13); outline: none; }
.invitation-copy__url { min-width: 0; overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.invitation-copy__status { padding: 5px 7px; color: var(--green); background: var(--mint); border-radius: 7px; font-size: .72rem; font-weight: 800; }
.selected-medicine { display: grid; gap: 3px; margin: -4px 0 22px; padding: 16px 18px; border: 1px solid #cfe3db; border-radius: 14px; background: var(--mint); }
.selected-medicine__label { color: var(--green-2); font-size: .7rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.selected-medicine strong { font-size: 1.15rem; }
.selected-medicine span:not(.selected-medicine__label), .selected-medicine small { color: var(--muted); }
.catalog-heading { margin-bottom: 24px; }
.catalog-search { margin-bottom: 30px; }
.catalog-search__form { display: grid; gap: 14px; }
.catalog-search__main { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 12px; }
.catalog-search__main .button { min-width: 120px; }
.parsed-query { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.parsed-query__label { color: var(--muted); font-size: .78rem; font-weight: 750; }
.parsed-query__chip { padding: 6px 9px; border: 1px solid #cfe3db; border-radius: 999px; color: var(--green); background: var(--mint); font-size: .78rem; }
.parsed-query__chip strong { color: var(--ink); }
.query-validation { padding: 10px 12px; border: 1px solid #ead4b9; border-radius: 10px; color: var(--amber); background: var(--amber-bg); font-size: .84rem; font-weight: 700; }
.barcode-dialog { width: min(560px, calc(100% - 24px)); padding: 22px; color: var(--ink); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 24px 80px rgba(20, 45, 37, .24); }
.barcode-dialog::backdrop { background: rgba(16, 36, 30, .62); backdrop-filter: blur(3px); }
.barcode-dialog__header { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.barcode-dialog__header h2 { margin-bottom: 0; font-size: 1.55rem; }
.barcode-dialog__close { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; padding: 0; color: var(--muted); border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 1.5rem; line-height: 1; }
.barcode-camera { position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 16px; background: #10251f; }
.barcode-camera video { width: 100%; height: 100%; object-fit: cover; }
.barcode-camera__frame { position: absolute; inset: 34% 8%; border: 2px solid white; border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); }
.barcode-status { min-height: 48px; margin: 14px 0; color: var(--muted); font-size: .88rem; }
.barcode-status--error { color: var(--amber); }
.barcode-dialog__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.barcode-photo-button { cursor: pointer; }
.barcode-manual { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.barcode-manual > label { display: block; margin-bottom: 7px; font-size: .82rem; font-weight: 800; }
.barcode-manual__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.barcode-context { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 1px solid #cfe3db; border-radius: 12px; background: var(--mint); }
.barcode-context strong { font-variant-numeric: tabular-nums; }
.barcode-context__actions { display: inline-flex; flex-wrap: wrap; gap: 14px; }
.barcode-context__actions a { color: var(--green); font-weight: 800; text-decoration: none; }
.barcode-product { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 18px; align-items: center; margin-top: 14px; padding: 16px 18px; border: 1px solid #bdd8f5; border-radius: 14px; background: #f1f7ff; }
.barcode-product > div { display: grid; gap: 5px; }
.barcode-product strong { color: var(--ink); font-size: 1.08rem; line-height: 1.35; }
.barcode-product > span { color: var(--muted); line-height: 1.45; }
.source-label--barcode { color: #406cc4; }
.barcode-lookup-error { margin-top: 14px; }
.search-options { padding-top: 13px; border-top: 1px solid var(--line); }
.search-options summary { width: max-content; color: var(--green); cursor: pointer; font-size: .84rem; font-weight: 800; }
.search-options[open] summary { margin-bottom: 14px; }
.search-options__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 13px 17px; }
.checkbox-field { display: flex; min-height: 44px; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; font-weight: 750; cursor: pointer; }
.checkbox-field input { flex: 0 0 auto; width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.search-options__reset { align-self: center; justify-self: end; font-size: .84rem; }
.catalog-results { margin-top: 6px; }
.catalog-results--external { margin-top: 34px; padding-top: 30px; border-top: 1px solid var(--line); }
.source-label { margin-bottom: 5px; font-size: .68rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.source-label--home { color: var(--green-2); }
.source-label--grls { color: #406cc4; }
.catalog-results .section-heading h2 { margin-bottom: 0; }
.catalog-list { display: grid; gap: 12px; }
.catalog-card { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.catalog-card h3 { margin-bottom: 5px; }
.catalog-card__content { min-width: 0; }
.catalog-card__inn { margin-bottom: 8px; color: var(--muted); font-size: .87rem; }
.catalog-card--external { border-left: 4px solid #6c8bc9; }
.catalog-card__title-row { display: flex; align-items: start; gap: 10px; }
.catalog-card__title-row h3 { margin-right: auto; }
.catalog-card__actions { flex: 0 0 170px; display: grid; justify-items: stretch; gap: 9px; text-align: center; }
.catalog-card__actions form, .catalog-card__actions .button { width: 100%; }
.catalog-card__actions > a { color: #406cc4; font-size: .78rem; font-weight: 750; text-decoration: none; }
.catalog-card .medicine-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.catalog-card .medicine-meta span + span { position: relative; }
.catalog-card .medicine-meta span + span::before { content: "·"; position: absolute; left: -10px; color: #a5b1ad; }
.empty-state--compact { padding-block: 38px; }
.catalog-empty-line { margin: 0; padding: 17px 19px; border: 1px dashed #c8d4cf; border-radius: 14px; color: var(--muted); }
.source-notice { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border: 1px solid #d7deed; border-radius: 14px; color: var(--muted); background: #f5f7fc; }
.source-notice strong, .source-notice span { display: block; }
.source-notice a { flex: 0 0 auto; color: #406cc4; font-weight: 750; text-decoration: none; }
.source-notice--warning { display: grid; justify-content: stretch; color: var(--amber); border-color: #ead4b9; background: var(--amber-bg); }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 18px; }
.pagination > :last-child { justify-self: end; }
.pagination__current { color: var(--muted); font-size: .84rem; font-weight: 750; }
.search-limit-notice { margin-top: 14px; }
.catalog-tip { max-width: 720px; padding: 4px 2px; color: var(--muted); }
.catalog-tip strong { color: var(--ink); }
.catalog-tip p { margin: 5px 0 0; }
.manual-create { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 30px; padding: 18px 2px; border-top: 1px solid var(--line); color: var(--muted); }
.manual-create a { color: var(--green); font-weight: 800; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.offline-page { min-height: 100dvh; display: grid; place-items: center; padding: 22px; }
.offline-card { width: min(460px, 100%); text-align: center; }
.offline-card img { display: block; margin: 0 auto 20px; border-radius: 22px; }
.offline-card h1 { margin-inline: auto; font-size: clamp(2.3rem, 10vw, 3.7rem); }
.offline-card .button { margin-top: 8px; }
@media (max-width: 900px) {
  .hero { align-items: stretch; flex-direction: column; }
  .hero__actions { flex-basis: auto; width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .medicine-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-form { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .two-column { grid-template-columns: 1fr; }
  .household-grid { grid-template-columns: 1fr; }
  .dashboard-command { grid-template-columns: minmax(0, 1fr) 48px; }
  .dashboard-add { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .container { width: min(100% - 22px, 1160px); }
  .topbar__inner { min-height: 58px; grid-template-columns: 1fr auto; }
  .nav { display: none; }
  .install-button { padding-inline: 9px; }
  .page { padding: 20px 0 102px; }
  .mobile-nav { position: fixed; z-index: 9; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 7px max(6px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(30, 43, 36, .05); }
  .mobile-nav a { min-width: 0; min-height: 49px; display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: .75rem; font-weight: 650; line-height: 1.15; text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .mobile-nav__item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; }
  .mobile-nav a[aria-current="page"] { color: var(--green); font-weight: 800; }
  .mobile-nav .mobile-nav__add { width: 52px; height: 52px; min-height: 52px; justify-self: center; align-self: center; color: white; background: var(--green); border-radius: 50%; box-shadow: 0 6px 14px rgba(23, 79, 61, .2); transform: translateY(-7px); }
  .mobile-nav .mobile-nav__add svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2; }
  .mobile-nav .mobile-nav__add[aria-current="page"] { outline: 3px solid #cfe3db; outline-offset: 2px; }
  .profile-menu__content { position: fixed; top: 66px; right: 11px; }
  .dashboard-search { margin-bottom: 28px; }
  .dashboard-refine { grid-template-columns: auto 1fr; }
  .dashboard-refine a { grid-column: 1 / -1; justify-self: start; }
  .dashboard-statuses { margin-right: -11px; padding-right: 11px; }
  .dashboard-inventory__heading { align-items: flex-end; }
  .dashboard-inventory__heading span { text-align: right; }
  .dashboard-empty__actions { align-items: stretch; flex-direction: column; }
  .medicine-row { grid-template-columns: 46px minmax(0, 1fr); gap: 11px; padding: 14px; }
  .medicine-row__date { min-height: 48px; }
  .medicine-row__open { grid-column: 2; justify-self: start; margin-top: 2px; }
  .medicine-row h2, .medicine-row__meta { white-space: normal; }
  .data-export__row { grid-template-columns: 1fr; gap: 14px; padding-block: 20px; }
  .data-export__row .button { width: 100%; }
  .hero__actions { grid-template-columns: 1fr; }
  .barcode-product { grid-template-columns: 1fr; }
  .barcode-dialog { padding: 17px; border-radius: 18px; }
  .confirm-dialog { padding: 20px; border-radius: 18px; }
  .confirm-dialog__actions { grid-template-columns: 1fr; }
  .confirm-dialog__actions .button--ghost { order: 2; }
  .barcode-dialog__actions, .barcode-manual__row { grid-template-columns: 1fr; }
  .stats { gap: 9px; }
  .stat { min-height: 94px; padding: 13px; }
  .filter-form, .form-grid { grid-template-columns: 1fr; }
  .search-field, .field--wide { grid-column: auto; }
  .filter-form .button { width: 100%; }
  .medicine-grid { grid-template-columns: 1fr; }
  .medicine-card { min-height: 260px; }
  .page-heading { align-items: start; flex-direction: column-reverse; }
  .panel { padding: 17px; border-radius: 16px; }
  .kit-row { align-items: start; flex-direction: column; }
  .kit-list--manage .kit-row { display: grid; grid-template-columns: 1fr; gap: 0; }
  .kit-row__primary { width: 100%; min-height: 78px; }
  .kit-list--manage .row-actions { padding: 0 0 13px 56px; }
  .invitation-row { grid-template-columns: 1fr; }
  .catalog-search__main, .search-options__grid { grid-template-columns: 1fr; }
  .catalog-search__main .button { width: 100%; }
  .search-options__reset { justify-self: start; }
  .catalog-card { align-items: stretch; flex-direction: column; }
  .catalog-card .button { width: 100%; }
  .catalog-card__actions { flex-basis: auto; width: 100%; }
  .catalog-card .medicine-meta { display: grid; gap: 3px; }
  .catalog-card .medicine-meta span + span::before { content: none; }
  .manual-create { align-items: flex-start; flex-direction: column; }
  .source-notice { align-items: flex-start; flex-direction: column; }
  .pagination { grid-template-columns: 1fr 1fr; }
  .pagination__current { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
  .pagination > :first-child { grid-column: 1; }
  .pagination > :last-child { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
