:root {
    --ink: #17212b;
    --muted: #66717c;
    --line: #dce1e5;
    --surface: #ffffff;
    --canvas: #f4f6f7;
    --wine: #741c36;
    --wine-dark: #571329;
    --sage: #dce9df;
    --sage-ink: #315944;
    --focus: #3478a5;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 64px;
    padding: 0 max(24px, calc((100vw - 1280px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
}

.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 800; text-decoration: none; }
.brand-mark { display: inline-block; width: 25px; height: 32px; background: var(--wine); clip-path: polygon(32% 0, 68% 0, 68% 17%, 80% 30%, 80% 91%, 68% 100%, 32% 100%, 20% 91%, 20% 30%, 32% 17%); }
.brand-mark.large { width: 36px; height: 46px; }
.app-header nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.app-header nav a { text-decoration: none; font-weight: 700; }
.user-name { color: var(--muted); }
.account-link { display: inline-flex; align-items: center; gap: 8px; }
.account-initial { width: 34px; height: 34px; display: none; place-items: center; border-radius: 50%; color: white; background: var(--wine); font-size: 13px; }
.icon-link { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; font-size: 20px; }

.app-main { width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 64px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 4px 0 0; font-size: clamp(30px, 4vw, 44px); line-height: 1; letter-spacing: 0; }
.eyebrow { margin: 0; color: var(--wine); text-transform: uppercase; font-size: 12px; font-weight: 800; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 700; }
.heading-stats { display: flex; align-items: center; gap: 18px; }
.heading-stats > span { display: flex; flex-direction: column; color: var(--muted); font-size: 12px; }
.heading-stats strong { color: var(--ink); font-size: 20px; }
.heading-actions { display: flex; align-items: center; gap: 10px; }

.button { min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-weight: 750; }
.button.primary { color: white; background: var(--wine); }
.button.primary:hover { background: var(--wine-dark); }
.button.secondary { color: var(--ink); border-color: var(--line); background: white; }
.button.small { min-height: 34px; padding-inline: 12px; font-size: 13px; }
.button.wide { width: 100%; }

.cellar-list { display: grid; gap: 10px; }
.cellar-row { min-height: 92px; padding: 16px 20px; display: grid; grid-template-columns: 52px 1fr auto 24px; align-items: center; gap: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; }
.cellar-row:hover { border-color: #a9b2b9; }
.cellar-symbol { width: 48px; height: 48px; border-radius: 6px; background: var(--sage); position: relative; }
.cellar-symbol::after { content: ""; position: absolute; inset: 11px; border: 2px solid var(--sage-ink); background: repeating-linear-gradient(90deg, transparent 0 7px, var(--sage-ink) 7px 9px); }
.cellar-row-main, .cellar-stat { display: flex; flex-direction: column; gap: 4px; }
.cellar-row-main strong { font-size: 18px; }
.cellar-row small, .cellar-stat small { color: var(--muted); }
.cellar-stat { min-width: 108px; }
.cellar-stat strong { font-size: 20px; }
.row-arrow { font-size: 30px; color: var(--muted); }

.empty-state { min-height: 330px; display: grid; place-content: center; justify-items: center; gap: 14px; border: 1px dashed #b8c0c6; background: var(--surface); }
.empty-state.compact { min-height: 230px; }
.empty-state h2 { margin: 0; font-size: 22px; }
.empty-mark { width: 62px; height: 62px; border: 2px solid var(--line); border-radius: 50%; position: relative; }
.empty-mark::before, .empty-mark::after { content: ""; position: absolute; background: var(--wine); left: 18px; right: 18px; height: 2px; top: 29px; }
.empty-mark::after { transform: rotate(90deg); }

.zone-stack { display: grid; gap: 26px; }
.cellar-finder { margin: -8px 0 24px; padding: 14px 16px; position: relative; border: 1px solid var(--line); background: var(--surface); }
.cellar-finder > label { margin-bottom: 8px; }
.cellar-finder-input { position: relative; }
.cellar-finder-input input { padding-right: 44px; }
.cellar-finder-input button { width: 36px; height: 36px; position: absolute; top: 4px; right: 4px; border: 0; border-radius: 4px; background: #eef1f3; cursor: pointer; font-size: 21px; }
.cellar-search-results { margin-top: 8px; display: grid; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.cellar-search-result { min-height: 48px; padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 0; border-bottom: 1px solid var(--line); background: white; cursor: pointer; text-align: left; }
.cellar-search-result:last-child { border-bottom: 0; }
.cellar-search-result:hover, .cellar-search-result:focus-visible { background: #f5e9ed; }
.cellar-search-result strong { font-size: 13px; }
.cellar-search-result span { color: var(--muted); font-size: 12px; text-align: right; }
.cellar-search-status { min-height: 18px; margin: 7px 0 -4px; color: var(--muted); font-size: 12px; }
.unassigned-panel { margin-bottom: 24px; border-top: 3px solid #a56b1b; background: var(--surface); }
.unassigned-panel > header { min-height: 70px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.unassigned-panel h2 { margin: 2px 0 0; font-size: 21px; }
.unassigned-panel > header > strong { color: #8b5b17; font-size: 14px; }
.unassigned-list { display: grid; }
.unassigned-row { min-height: 64px; padding: 10px 18px; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(360px, 1.4fr); align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.unassigned-row:last-child { border-bottom: 0; }
.unassigned-row > div { display: grid; gap: 3px; }
.unassigned-row > div span, .unassigned-no-space { color: var(--muted); font-size: 12px; }
.unassigned-row form { display: grid; grid-template-columns: minmax(180px, 1fr) 76px auto; align-items: center; gap: 8px; }
.unassigned-row input, .unassigned-row select { min-height: 36px; padding-block: 6px; font-size: 12px; }
.zone-section { border-top: 3px solid var(--ink); background: var(--surface); }
.zone-header { min-height: 70px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.zone-header h2 { margin: 0 0 4px; font-size: 20px; }
.zone-header span { color: var(--muted); font-size: 13px; }
.zone-actions { display: flex; align-items: center; gap: 8px; }
.zone-empty { min-height: 130px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.zone-empty button { border: 0; padding: 0; color: var(--wine); background: none; cursor: pointer; font-weight: 750; }
.unit-layout { padding: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); align-items: start; gap: 16px; }
.storage-unit { min-width: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.storage-unit > header { min-height: 52px; padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #f8f9fa; border-bottom: 1px solid var(--line); }
.storage-unit h3 { margin: 0; font-size: 15px; }
.storage-unit header span { color: var(--muted); font-size: 12px; }
.unit-actions { display: flex; align-items: center; gap: 10px; }
.unit-actions button { min-height: 30px; padding: 0 9px; color: var(--ink); border: 1px solid var(--line); border-radius: 5px; background: white; cursor: pointer; font-size: 11px; font-weight: 750; }
.slot-grid { padding: 18px 14px; display: grid; grid-template-columns: repeat(var(--slot-columns), minmax(68px, 1fr)); align-items: start; gap: 12px 8px; overflow-x: auto; background: #f8f9fa; }
.storage-slot { min-width: 68px; min-height: 84px; padding: 4px; display: flex; flex-direction: column; justify-content: center; gap: 5px; color: var(--ink); border: 0; border-radius: 6px; background: transparent; cursor: pointer; text-align: center; }
.storage-slot:hover { background: #e9edef; }
.storage-slot:focus-visible { outline: 3px solid rgba(52, 120, 165, .25); }
.storage-slot.is-search-match { background: #f5e9ed; box-shadow: inset 0 0 0 2px var(--wine); }
.storage-slot.is-search-dimmed { opacity: .28; }
.storage-slot.is-search-target { animation: slot-target 1.4s ease; }
@keyframes slot-target { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.12); background: #f3dfe5; } }
.storage-slot strong { overflow-wrap: anywhere; font-size: 12px; }
.storage-slot small { color: var(--muted); font-size: 10px; }
.slot-label { display: grid; gap: 3px; }
.rack-bottles { width: 62px; height: 54px; margin: 0 auto; display: flex; align-items: center; justify-content: center; position: relative; }
.rack-bottle { --bottle-body: #aab0b4; --bottle-ring: #7f878c; width: 34px; height: 34px; margin-left: -16px; position: relative; flex: 0 0 auto; border: 3px solid var(--bottle-ring); border-radius: 50%; background: radial-gradient(circle at 36% 30%, rgba(255,255,255,.72) 0 8%, transparent 9%), var(--bottle-body); box-shadow: inset -5px -6px 8px rgba(20,25,28,.22), 0 3px 5px rgba(20,25,28,.16); }
.rack-bottle:only-child { width: 50px; height: 50px; margin-left: 0; border-width: 4px; }
.rack-bottle:first-child { margin-left: 0; }
.rack-bottle::before { content: ""; width: 42%; height: 42%; position: absolute; inset: 29%; border: 2px solid rgba(30,35,38,.18); border-radius: 50%; }
.rack-bottle::after { content: ""; width: 12%; height: 12%; position: absolute; inset: 44%; border-radius: 50%; background: rgba(30,35,38,.3); }
.bottle-red { --bottle-body: #b64045; --bottle-ring: #7d242b; }
.bottle-white { --bottle-body: #e1cf70; --bottle-ring: #aa9137; }
.bottle-rose { --bottle-body: #dc929a; --bottle-ring: #a95060; }
.bottle-sparkling { --bottle-body: #e1cf70; --bottle-ring: #aa9137; }
.bottle-sweet { --bottle-body: #d6a04c; --bottle-ring: #94651f; }
.bottle-empty, .bottle-unknown { --bottle-body: #d4d8da; --bottle-ring: #aab1b5; }
.bottle-empty { opacity: .62; box-shadow: inset -5px -6px 8px rgba(20,25,28,.1); }
.bottle-overflow { min-width: 24px; height: 24px; position: absolute; right: -2px; top: 0; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--ink); font-size: 10px; font-weight: 800; }
.slot-contents { display: grid; gap: 8px; color: var(--wine); font-size: 12px; font-weight: 750; }
.slot-wine-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slot-wine-row > span { display: grid; gap: 3px; }
.slot-wine-row small { color: var(--muted); font-weight: 600; }
.slot-wine-status { display: flex; align-items: center; gap: 7px; }
.slot-wine-status .maturity { width: max-content; }
.slot-color-form { display: flex; align-items: center; gap: 6px; }
.slot-color-form label { display: block; }
.slot-color-form select { min-height: 32px; padding: 5px 28px 5px 8px; font-size: 11px; }
.slot-bottle-controls { width: min(100%, 360px); display: grid; gap: 7px; }
.slot-detail-dialog .slot-move-form { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: 6px; }
.slot-detail-dialog .slot-unassign-form { display: flex; justify-content: flex-end; }
.slot-bottle-controls select { min-height: 34px; padding-block: 5px; font-size: 11px; }
.visually-hidden { width: 1px; height: 1px; position: absolute; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.app-dialog { width: min(480px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 20px 70px rgba(18, 28, 36, .25); }
.app-dialog::backdrop { background: rgba(18, 28, 36, .55); }
.app-dialog form { padding: 22px; display: grid; gap: 15px; }
.app-dialog header, .app-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-dialog h2 { margin: 0; font-size: 21px; }
.app-dialog footer { justify-content: flex-end; padding-top: 8px; }
.dialog-close { width: 36px; height: 36px; border: 0; border-radius: 5px; background: #eef1f3; cursor: pointer; font-size: 23px; }
.slot-detail-dialog { width: min(680px, calc(100% - 28px)); max-height: min(86vh, 820px); }
.cellar-settings-dialog { width: min(540px, calc(100% - 28px)); }
.cellar-settings-dialog .dialog-shell > header { padding: 22px; border-bottom: 1px solid var(--line); }
.cellar-settings-dialog .dialog-shell > form { padding: 22px; }
.cellar-settings-dialog .dialog-shell > form .button { justify-self: end; }
.danger-zone { padding: 22px; border-top: 1px solid #e1b8bc; background: #fff7f7; }
.danger-zone h3 { margin: 0; color: #8b2730; font-size: 16px; }
.danger-zone p { margin: 7px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.danger-zone form { padding: 0; }
.danger-zone .button { justify-self: start; }
.slot-detail-dialog .dialog-shell { max-height: min(86vh, 820px); display: flex; flex-direction: column; }
.slot-detail-dialog .dialog-shell > header { flex: 0 0 auto; padding: 22px; border-bottom: 1px solid var(--line); }
.slot-detail-dialog .eyebrow { margin: 0 0 4px; }
.slot-dialog-body { overflow-y: auto; overscroll-behavior: contain; }
.slot-dialog-section { margin: 0; padding: 18px 22px; border-top: 1px solid var(--line); }
.slot-dialog-section:first-child, .slot-empty-message:first-child { border-top: 0; }
.slot-dialog-section h3 { margin: 0 0 13px; font-size: 15px; }
.slot-empty-message { margin: 0; padding: 18px 22px; color: var(--muted); }
.slot-detail-dialog form { padding: 0; display: grid; gap: 12px; }
.slot-detail-dialog .slot-color-form { display: flex; }
.slot-dialog-disclosure > summary { cursor: pointer; list-style: none; font-size: 14px; font-weight: 800; }
.slot-dialog-disclosure > summary::after { content: "+"; float: right; color: var(--wine); font-size: 20px; line-height: .8; }
.slot-dialog-disclosure[open] > summary::after { content: "−"; }
.slot-dialog-disclosure > summary::-webkit-details-marker { display: none; }
.slot-dialog-disclosure > form { margin-top: 16px; }
.new-wine-fields { display: grid; gap: 12px; }
.vintage-results { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; background: white; }
.vintage-results button { width: 100%; min-height: 43px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--ink); border: 0; border-bottom: 1px solid #edf0f2; background: white; cursor: pointer; text-align: left; font-size: 12px; }
.vintage-results button:last-of-type { border-bottom: 0; }
.vintage-results button:hover, .vintage-results button[aria-selected="true"] { background: #f5e9ed; }
.vintage-results button strong { min-width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: var(--wine); background: #f3dfe5; font-size: 11px; }
.vintage-results p { margin: 0; padding: 14px; color: var(--muted); font-size: 13px; }
.selected-vintage { margin: -3px 0 0; color: var(--muted); font-size: 12px; }
.selected-vintage.is-selected { color: var(--wine); font-weight: 750; }
.account-heading { margin-bottom: 22px; }
.account-panel { width: min(520px, 100%); padding: 24px; border-top: 3px solid var(--wine); background: white; }
.account-panel form { display: grid; gap: 13px; }
.account-panel .button { margin-top: 7px; }
label { display: grid; gap: 7px; color: #34414b; font-size: 13px; font-weight: 750; }
input, select { width: 100%; min-height: 43px; padding: 9px 11px; color: var(--ink); border: 1px solid #bdc6cc; border-radius: 5px; background: white; }
input:focus, select:focus { outline: 3px solid rgba(52, 120, 165, .18); border-color: var(--focus); }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-columns.three { grid-template-columns: repeat(3, 1fr); }
.segmented-control { margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #bdc6cc; border-radius: 6px; overflow: hidden; }
.segmented-control legend { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.segmented-control label { display: block; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span { min-height: 42px; display: grid; place-items: center; cursor: pointer; font-size: 12px; }
.segmented-control label + label { border-left: 1px solid #bdc6cc; }
.segmented-control input:checked + span { color: white; background: var(--wine); }
[hidden] { display: none !important; }

.login-main { width: 100%; min-height: 100vh; padding: 0; display: grid; place-items: center; background: #eef2f1; }
.login-shell { width: min(860px, calc(100% - 32px)); min-height: 500px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); background: white; box-shadow: 0 24px 60px rgba(22, 32, 42, .12); }
.login-brand { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: white; background: var(--wine); font-size: 26px; }
.login-brand .brand-mark { background: white; }
.login-form { padding: 54px 48px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.login-form h1 { margin: 0 0 12px; font-size: 30px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox-line input { width: 17px; min-height: 17px; }
.form-error, .flash { padding: 11px 13px; border-radius: 5px; font-size: 13px; }
.form-error, .flash-error { color: #7a1b22; background: #fbe7e8; }
.flash-stack { position: fixed; top: 76px; right: 20px; z-index: 30; }
.flash-success { color: #24513a; background: #dfefe4; }

.collection-subtitle { margin: 10px 0 0; color: var(--muted); }
.collection-search { margin-bottom: 18px; padding: 12px; display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; align-items: end; gap: 9px; border: 1px solid var(--line); background: white; }
.collection-search > a { align-self: center; color: var(--wine); font-size: 13px; font-weight: 750; }
.wine-list { display: grid; gap: 18px; }
.wine-record { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.wine-record-header { min-height: 82px; padding: 16px 18px; display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); }
.wine-record-header h2 { margin: 0 0 5px; font-size: 19px; }
.wine-record-header p { margin: 0; color: var(--muted); font-size: 13px; }
.wine-record-header > strong { font-size: 13px; }
.wine-record-actions { display: flex; align-items: center; gap: 10px; }
.wine-record-actions > strong { font-size: 13px; white-space: nowrap; }
.wine-color { width: 12px; height: 42px; border-radius: 3px; background: #731b35; }
.wine-color-blanc { background: #d7bc56; }
.wine-color-rose { background: #dc8490; }
.wine-color-effervescent { background: #8aafba; }
.wine-color-moelleux { background: #b87d27; }
.vintage-block + .vintage-block { border-top: 1px solid var(--line); }
.vintage-block > header { min-height: 58px; padding: 10px 18px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; background: #f8f9fa; }
.vintage-block > header > div { display: flex; align-items: center; gap: 12px; }
.vintage-year { font-size: 18px; }
.vintage-block header small { color: var(--muted); }
.vintage-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.maturity { padding: 5px 8px; border-radius: 999px; color: #42505b; background: #e8ecef; font-size: 11px; font-weight: 800; }
.maturity-peak { color: #315944; background: var(--sage); }
.maturity-young { color: #365778; background: #deebf5; }
.maturity-soon, .maturity-past { color: #7b332a; background: #f5e3df; }
.maturity-unknown { color: #675426; background: #f3ebcf; }
.bottle-list { padding: 0 18px 12px; }
.bottle-row { border-bottom: 1px solid var(--line); }
.bottle-row summary { min-height: 54px; display: grid; grid-template-columns: 58px 1fr auto 20px; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.bottle-row summary::-webkit-details-marker { display: none; }
.bottle-row summary strong { font-size: 13px; }
.bottle-row summary small, .bottle-number { color: var(--muted); font-size: 12px; }
.bottle-actions { padding: 12px; display: grid; grid-template-columns: 2fr 1fr; gap: 12px; background: #f8f9fa; }
.bottle-actions form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; }
.button.danger { color: #8b2730; border-color: #d9afb3; background: white; }
.vintage-empty { color: var(--muted); font-size: 13px; }
.maturity-fields { border: 1px solid var(--line); border-radius: 6px; }
.maturity-fields summary { padding: 12px; cursor: pointer; font-size: 13px; font-weight: 750; }
.year-grid { padding: 0 12px 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.wine-dialog { width: min(680px, calc(100% - 28px)); }
.edit-wine-dialog, .batch-dialog { max-height: min(88vh, 860px); }
.edit-wine-dialog .dialog-shell, .batch-dialog .dialog-shell { max-height: min(88vh, 860px); overflow-y: auto; }
.edit-wine-dialog .dialog-shell > header, .batch-dialog .dialog-shell > header { padding: 22px; position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--line); background: white; }
.edit-wine-dialog .dialog-shell > form, .batch-dialog .dialog-shell > form { padding: 22px; }
.edit-wine-dialog .dialog-shell > form > .button, .batch-dialog .dialog-shell > form > .button { justify-self: end; }
.vintage-edit-list { padding: 22px; border-top: 1px solid var(--line); background: #f8f9fa; }
.vintage-edit-list > h3, .batch-dialog form h3 { margin: 0 0 14px; font-size: 16px; }
.vintage-edit-list form { padding: 16px 0; }
.vintage-edit-list form + form { border-top: 1px solid var(--line); }
.vintage-edit-list .year-grid { padding: 0; }
.batch-dialog .danger-zone form { padding: 0; }
.unassigned { color: #8b5b17; }

.dashboard-metrics { margin-bottom: 22px; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 3px solid var(--wine); background: white; }
.dashboard-metrics > div { min-height: 112px; padding: 18px; display: flex; flex-direction: column; justify-content: center; gap: 4px; border-right: 1px solid var(--line); }
.dashboard-metrics > div:last-child { border-right: 0; }
.dashboard-metrics span, .dashboard-metrics small { color: var(--muted); font-size: 12px; }
.dashboard-metrics strong { font-size: 26px; }
.dashboard-grid { margin-bottom: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dashboard-section { background: white; border: 1px solid var(--line); }
.dashboard-section > header { min-height: 58px; padding: 13px 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dashboard-section h2 { margin: 0; font-size: 18px; }
.dashboard-section > header span { color: var(--muted); font-size: 12px; }
.dashboard-bars { padding: 16px; display: grid; gap: 13px; }
.dashboard-bars > div { display: grid; grid-template-columns: minmax(105px, 1fr) 2fr 28px; align-items: center; gap: 10px; font-size: 12px; }
.dashboard-bars strong { text-align: right; }
.dashboard-bar { height: 9px; overflow: hidden; border-radius: 5px; background: #e8ecef; }
.dashboard-bar i { width: var(--bar-size); height: 100%; display: block; border-radius: inherit; background: var(--wine); }
.priority-list > div { min-height: 58px; padding: 10px 17px; display: grid; grid-template-columns: 135px 1fr auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.priority-list > div:last-child { border-bottom: 0; }
.priority-list > div > span:last-child { color: var(--muted); font-size: 12px; }
.priority-list > p, .dashboard-bars > p { margin: 0; padding: 17px; color: var(--muted); font-size: 13px; }

.import-panel { padding: 24px; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(280px, 1fr); gap: 28px; border-top: 3px solid var(--wine); background: white; }
.import-panel h2 { margin: 7px 0 8px; }
.import-panel p { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.import-panel form { display: grid; align-content: center; gap: 12px; }
.import-history { margin-top: 22px; padding: 20px; background: white; border: 1px solid var(--line); }
.import-history h2 { margin-top: 0; font-size: 18px; }
.import-history > div { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); }
.import-history span { color: var(--muted); font-size: 13px; }
.import-preview { display: grid; gap: 14px; }
.import-notice { padding: 14px 16px; display: flex; justify-content: space-between; gap: 16px; color: #675426; background: #f3ebcf; }
.import-notice span { font-size: 13px; }
.import-table-wrap { overflow-x: auto; border: 1px solid var(--line); background: white; }
.import-table { width: 100%; min-width: 940px; border-collapse: collapse; }
.import-table th { padding: 11px 8px; color: var(--muted); background: #f8f9fa; text-align: left; font-size: 11px; text-transform: uppercase; }
.import-table td { padding: 7px 5px; border-top: 1px solid var(--line); }
.import-table input, .import-table select { min-height: 38px; padding: 7px 8px; }
.import-table th:first-child, .import-table td:first-child { width: 58px; text-align: center; }
.import-table th:nth-child(2) { width: 42%; }
.import-table th:not(:nth-child(2)) { width: 10%; }
.import-table .row-check { width: 18px; min-height: 18px; }
.import-actions { display: flex; justify-content: flex-end; gap: 10px; }
.import-actions .button { display: inline-grid; place-items: center; text-decoration: none; }

@media (max-width: 760px) {
    .app-header { padding: 0 16px; }
    .app-header nav > a:first-child, .user-name { display: none; }
    .account-initial { display: grid; }
    .app-main { width: min(100% - 28px, 1280px); padding-top: 24px; }
    .page-heading, .cellar-heading { align-items: stretch; flex-direction: column; }
    .heading-actions { width: 100%; }
    .heading-actions .button { flex: 1; }
    .heading-stats { display: grid; grid-template-columns: 1fr 1fr; }
    .heading-stats .button { grid-column: 1 / -1; }
    .cellar-row { grid-template-columns: 44px 1fr 18px; padding-inline: 14px; gap: 12px; }
    .cellar-symbol { width: 42px; height: 42px; }
    .cellar-stat { display: none; }
    .unit-layout { padding: 12px; grid-template-columns: 1fr; }
    .cellar-search-result { align-items: flex-start; flex-direction: column; gap: 3px; }
    .cellar-search-result span { text-align: left; }
    .unassigned-row { grid-template-columns: 1fr; }
    .unassigned-row form { grid-template-columns: 1fr 72px; }
    .unassigned-row form .button { grid-column: 1 / -1; }
    .slot-detail-dialog[open] { width: 100%; max-width: none; max-height: 90dvh; margin: 0; inset: auto 0 0; border-radius: 14px 14px 0 0; }
    .slot-detail-dialog .dialog-shell { max-height: 90dvh; }
    .slot-detail-dialog .dialog-shell > header { padding: 18px; }
    .slot-dialog-section { padding: 17px 18px; }
    .slot-wine-row { align-items: flex-start; flex-direction: column; }
    .slot-color-form { width: 100%; }
    .slot-color-form label { flex: 1; }
    .slot-bottle-controls { width: 100%; }
    .login-main { background: white; }
    .login-shell { min-height: auto; grid-template-columns: 1fr; box-shadow: none; }
    .login-brand { min-height: 150px; }
    .login-form { padding: 32px 24px; }
    .form-columns.three, .year-grid { grid-template-columns: 1fr 1fr; }
    .collection-search { grid-template-columns: 1fr auto; }
    .collection-search > a { grid-column: 1 / -1; }
    .vintage-block > header { grid-template-columns: 1fr auto; }
    .vintage-block > header small { grid-column: 1 / -1; grid-row: 2; }
    .wine-record-header { grid-template-columns: 14px 1fr; }
    .wine-record-actions { grid-column: 2; justify-content: space-between; }
    .vintage-actions { grid-column: 2; }
    .bottle-row summary { grid-template-columns: 48px 1fr 18px; }
    .bottle-row summary small { display: none; }
    .bottle-actions { grid-template-columns: 1fr; }
    .import-panel { padding: 18px; grid-template-columns: 1fr; }
    .import-notice, .import-history > div { align-items: flex-start; flex-direction: column; }
    .dashboard-metrics { grid-template-columns: 1fr 1fr; }
    .dashboard-metrics > div:nth-child(2) { border-right: 0; }
    .dashboard-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .priority-list > div { grid-template-columns: 1fr auto; }
    .priority-list .maturity { grid-column: 1 / -1; }
}
