/* ==========================================================================
   Dan's Record Collection — main stylesheet

   Adapted from the design mocks in public/design-mock/. Mock-only details
   (mockup banner, demo behaviors) have been dropped; structure has been
   tightened for production use.

   Sections:
     1. Tokens (custom properties)
     2. Reset + base
     3. Accessibility (skip link, reduced motion, focus rings)
     4. Typography
     5. Layout (header, main, footer)
     6. Search bar
     7. Catalog cards
     8. Location markers
     9. Detail modal
    10. Forms (placeholder for Phase 4)
    11. Utility helpers
    12. Responsive
   ========================================================================== */


/* 1. Tokens ──────────────────────────────────────────────────────────────── */

:root {
    /* Paper / ink — cool stone, true black ink */
    --paper-bg:      #EDEBE4;
    --paper-surface: #F5F3EC;
    --paper-deep:    #E2DFD7;
    --ink:           #14161B;
    --ink-soft:      #3A3D45;
    --ink-muted:     #46494F;

    /* Hairlines */
    --rule:          #C8C5BD;
    --rule-strong:   #14161B;

    /* Oxblood accent */
    --accent:        #7A1F2B;
    --accent-soft:   #A33845;
    --accent-pale:   #F4E5E7;

    /* Location markers */
    --hawkinsville:  #2E5C3A;
    --tucker:        #2E4A6B;

    /* Typography */
    --font-display: 'Spectral', Georgia, 'Times New Roman', serif;
    --font-body:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

    /* Sizes */
    --content-max:  1100px;
    --gap:          16px;
    --tap-target:   44px;
}


/* 2. Reset + base ────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/*
 * Honor the `hidden` attribute as a platform-level "do not display" rule.
 * Without this, custom display rules (e.g. .field { display: flex }) win
 * against the user-agent default and leave hidden elements visible.
 */
[hidden] { display: none !important; }

html { font-size: 18px; }

body {
    background: var(--paper-bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-feature-settings: "tnum" 1, "kern" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body.modal-open { overflow: hidden; }

img, svg { max-width: 100%; height: auto; }

button { font-family: inherit; }


/* 3. Accessibility ───────────────────────────────────────────────────────── */

/* Skip link — off-screen until focused */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    z-index: 1100;
    background: var(--ink);
    color: var(--paper-bg);
    padding: 12px 20px;
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    border-radius: 0 0 4px 0;
    transition: top 0.15s ease;
}
.skip-link:focus { top: 0; outline: 3px solid var(--accent-soft); outline-offset: -3px; }

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


/* 4. Typography ──────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    color: var(--ink);
}
p, li { color: var(--ink-soft); }


/* 5. Layout ──────────────────────────────────────────────────────────────── */

/* Header bar */
.app-header {
    background: var(--ink);
    color: var(--paper-bg);
    border-bottom: 4px solid var(--accent);
    flex-shrink: 0;
}
.app-header-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.app-header-inner h1 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: 0.005em;
    color: var(--paper-bg);
    margin: 0;
}
.app-header-inner h1 a {
    color: inherit;
    text-decoration: none;
}
.app-header-inner h1 a:hover,
.app-header-inner h1 a:focus-visible {
    text-decoration: underline;
    text-decoration-color: var(--accent-soft);
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
    outline: none;
}

.header-sep {
    color: var(--accent-soft);
    font-size: 13px;
    font-family: var(--font-mono);
}

.app-header-inner nav { display: inline-flex; gap: 4px; }
.app-header-inner nav a {
    color: var(--paper-deep);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 12px 12px;
    min-height: var(--tap-target);
    display: inline-flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}
.app-header-inner nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.app-header-inner nav a[aria-current="page"] {
    color: var(--paper-bg);
    text-decoration: underline;
    text-decoration-color: var(--accent-soft);
    text-decoration-thickness: 3px;
    text-underline-offset: 8px;
}
.app-header-inner nav a:focus-visible {
    outline: 3px solid var(--accent-pale);
    outline-offset: -3px;
}

/* Main content area */
main {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 32px 24px;
}

/* Footer */
.app-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--rule);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-muted);
    letter-spacing: 0.06em;
    flex-shrink: 0;
}
.app-footer p { margin: 0; }


/* 6. Search bar ──────────────────────────────────────────────────────────── */

.search-wrap {
    background: var(--ink);
    padding: 0 16px 20px;
    flex-shrink: 0;
}
.search-inner { max-width: var(--content-max); margin: 0 auto; }
.search-box {
    display: flex;
    align-items: stretch;
    background: var(--paper-bg);
    border: 1px solid var(--ink);
    border-bottom-width: 4px;
}
.search-icon {
    padding: 0 16px;
    color: var(--ink-muted);
    font-size: 20px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}
.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 16px 0;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    color: var(--ink);
    outline: none;
    min-height: 56px;
}
.search-input::placeholder { color: var(--ink-muted); font-style: italic; font-weight: 400; }
.search-input:focus { background: rgba(255, 255, 255, 0.5); }

.search-clear {
    padding: 0 18px;
    color: var(--ink-muted);
    font-size: 22px;
    cursor: pointer;
    display: none;
    background: none;
    border: none;
    min-width: 56px;
}
.search-clear:hover, .search-clear:focus { color: var(--accent); outline: none; }
.search-input:not(:placeholder-shown) ~ .search-clear { display: inline-block; }


/* 7. Catalog cards ───────────────────────────────────────────────────────── */

.results-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 16px;
    padding: 0 2px;
}
.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: stretch;
}

.result-card {
    background: var(--paper-surface);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 18px 20px 20px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
    text-align: left;
    display: flex;
    flex-direction: column;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    width: 100%;
}
.result-card:hover {
    border-color: var(--accent);
    background: var(--paper-bg);
}
.result-card:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-pale);
}
.result-card:hover .card-title,
.result-card:focus-visible .card-title { color: var(--accent); }

.card-category {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    margin-bottom: 8px;
}
.card-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.15;
    margin-bottom: 4px;
    transition: color 0.15s;
}
.card-subtitle {
    font-size: 16px;
    color: var(--ink-soft);
    margin-bottom: 14px;
    font-weight: 400;
}
.card-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: auto; /* pin to bottom in equal-height cards */
}
.card-label {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink-muted);
    flex: 1;
    min-width: 0;
    letter-spacing: 0.02em;
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--ink-muted);
}
.empty-state h2 { font-size: 22px; margin-bottom: 8px; }


/* 8. Location markers ────────────────────────────────────────────────────── */

.locations { display: flex; gap: 16px; flex-shrink: 0; flex-wrap: wrap; }
.loc {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}
.loc::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ink-muted);
    flex-shrink: 0;
}
.loc-h::before { background: var(--hawkinsville); }
.loc-t::before { background: var(--tucker); }


/* 9. Detail modal ────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 27, 0.72);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-dialog {
    background: var(--paper-surface);
    width: 100%;
    max-height: 95vh;
    border-radius: 8px 8px 0 0;
    border-top: 4px solid var(--accent);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 6px;
    gap: 12px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--rule);
}
.modal-heading-text { flex: 1; min-width: 0; padding-bottom: 14px; }
.modal-category {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    margin-bottom: 8px;
}
.modal-title {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.1;
    letter-spacing: -0.005em;
}
.modal-close {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: var(--ink);
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: var(--paper-deep); color: var(--accent); }
.modal-close:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: -3px;
}
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.modal-subtitle {
    font-family: var(--font-display);
    font-size: 17px;
    font-style: italic;
    color: var(--ink-soft);
    margin-bottom: 24px;
    line-height: 1.4;
}
.modal-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--rule);
}
.modal-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.modal-section-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent);
    margin-bottom: 10px;
}
.modal-section-body { font-size: 17px; color: var(--ink); }
.modal-section-body.cat-num {
    font-family: var(--font-mono);
    font-size: 16px;
    letter-spacing: 0.02em;
}
.modal-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px 24px;
    font-size: 15px;
    margin: 0;
}
.modal-row > div { display: flex; flex-direction: column; gap: 2px; }
.modal-row dt {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
}
.modal-row dt strong { font-weight: inherit; }
.modal-row dd { margin: 0; font-weight: 500; color: var(--ink); }

.modal-notes {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--ink-soft);
    white-space: pre-wrap;
    line-height: 1.55;
}
.modal-notes-empty {
    font-style: italic;
    color: var(--ink-muted);
}

.modal-work {
    border-left: 3px solid var(--accent);
    padding: 4px 0 4px 14px;
    margin-bottom: 16px;
}
.modal-work:last-child { margin-bottom: 0; }
.modal-work-composer {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}
.modal-work-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 500;
    font-style: italic;
    color: var(--ink);
    line-height: 1.25;
    margin-bottom: 4px;
}
.modal-work-performers {
    font-size: 14px;
    color: var(--ink-muted);
}

.modal-copy {
    background: var(--paper-bg);
    border: 1px solid var(--rule);
    padding: 14px 16px;
    margin-bottom: 10px;
}
.modal-copy:last-child { margin-bottom: 0; }
.modal-copy-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}
.modal-copy-num {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--ink-muted);
    letter-spacing: 0.14em;
}
.modal-copy-notes { font-size: 14px; color: var(--ink-soft); }

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-top: 2px solid var(--ink);
    background: var(--paper-bg);
    flex-shrink: 0;
}


/* 10. Forms (placeholder for Phase 4) ────────────────────────────────────── */

.btn {
    flex: 1;
    padding: 14px 18px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border-radius: 0;
}
.btn-primary {
    background: var(--ink);
    color: var(--paper-bg);
    border-color: var(--ink);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--accent);
    border-color: var(--accent);
    outline: none;
}
.btn-secondary {
    background: var(--paper-surface);
    color: var(--ink);
    border-color: var(--ink);
}
.btn-secondary:hover, .btn-secondary:focus {
    background: var(--ink);
    color: var(--paper-bg);
    outline: none;
}
.btn:focus-visible {
    outline: 3px solid var(--accent-soft);
    outline-offset: 2px;
}


/* 10b. Sign-in screen ────────────────────────────────────────────────────── */

.signin {
    max-width: 480px;
    margin: 80px auto;
    padding: 0 24px;
    text-align: center;
}
.signin h1 {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.1;
}
.signin .lead {
    color: var(--ink-muted);
    margin-bottom: 32px;
}
.signin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    background: var(--ink);
    color: var(--paper-bg);
    border: 1px solid var(--ink);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    min-height: 52px;
    transition: background 0.15s, border-color 0.15s;
}
.signin-btn:hover, .signin-btn:focus {
    background: var(--accent);
    border-color: var(--accent);
    outline: none;
}
.signin-btn:focus-visible {
    outline: 3px solid var(--accent-soft);
    outline-offset: 2px;
}
.signin-note {
    margin-top: 48px;
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.6;
}


/* 10c. Add / Edit Record form ───────────────────────────────────────────── */

.record-form-page { max-width: 880px; }

.page-head { margin-bottom: 24px; }
.page-head h1 {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 600;
    margin: 0;
}

.form-errors {
    background: var(--accent-pale);
    border-left: 4px solid var(--accent);
    padding: 14px 18px;
    margin-bottom: 24px;
    border-radius: 0 6px 6px 0;
}
.form-errors p { margin: 0 0 6px; color: var(--ink); }
.form-errors ul { margin: 0; padding-left: 20px; color: var(--ink-soft); }

.flash-success {
    background: #D4EDD9;
    border-left: 4px solid var(--hawkinsville);
    padding: 12px 18px;
    margin-bottom: 18px;
    color: var(--ink);
    border-radius: 0 6px 6px 0;
}

.record-form { display: block; }

.catalog-section {
    background: var(--paper-surface);
    border: 1px solid var(--rule);
    border-left: 4px solid var(--accent);
    padding: 18px 22px;
    margin-bottom: 24px;
    border-radius: 0 6px 6px 0;
}
.catalog-section-hint {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-muted);
    margin: 0 0 14px;
    letter-spacing: 0.04em;
    line-height: 1.5;
}

.form-section {
    background: var(--paper-surface);
    border: 1px solid var(--rule);
    border-radius: 6px;
    margin-bottom: 24px;
    overflow: hidden;
}
.form-section-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--rule);
    background: var(--paper-bg);
}
.form-section-num {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.05em;
}
.form-section-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}
.form-section-body { padding: 18px 22px 22px; }

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.field:last-child { margin-bottom: 0; }
.field label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
    background: #fff;
    border: 1px solid var(--rule);
    border-bottom-width: 2px;
    border-radius: 0;
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--ink);
    width: 100%;
    appearance: none;
    transition: border-color 0.15s, background 0.15s;
    min-height: 44px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: #FFFFFE;
}
.field textarea { resize: vertical; min-height: 60px; line-height: 1.4; }
.field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2314161B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}
.field input[type="number"] { max-width: 120px; }
.field input.is-auto-filled {
    background: var(--accent-pale);
    border-color: var(--accent-soft);
}

.filed-under-hint {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-muted);
    margin: 0 0 14px;
    letter-spacing: 0.04em;
}

/*
 * Generic 2-column grid for form fields. Used by Works (composer/title/etc.)
 * and Filed Under. .full spans both columns.
 */
.row-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px 18px;
}
.row-grid > .field { margin-bottom: 0; }
@media (min-width: 700px) {
    .row-grid { grid-template-columns: 1fr 1fr; }
    .row-grid > .full { grid-column: span 2; }
}

/*
 * Copy block has two horizontal rows of fields (format/type/speed/size, then
 * channel/discs/location), each using auto-fit so they collapse on mobile.
 * Hidden fields (Type when not CD, Speed/Size when not vinyl) drop out.
 */
.copy-format-row,
.copy-meta-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px 18px;
    align-items: end;
    margin-bottom: 14px;
}
.copy-format-row > .field,
.copy-meta-row > .field { margin-bottom: 0; }

.work-block, .copy-block {
    background: var(--paper-bg);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--ink);
    padding: 14px 16px 18px;
    margin-bottom: 12px;
}
.work-block:last-child, .copy-block:last-child { margin-bottom: 0; }
.work-block { border-left-color: var(--accent); }

.row-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rule);
}
.row-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent);
    margin: 0;
}
.work-block .row-title { color: var(--accent); }
.copy-block .row-title { color: var(--ink-muted); }

.filed-under-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 6px 4px;
    min-height: 36px;
}
.filed-under-radio input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.row-remove {
    margin-left: auto;
    background: none;
    border: 1px solid var(--rule);
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 0;
}
.work-block .filed-under-radio + .row-remove { margin-left: 0; }
.row-remove:hover, .row-remove:focus {
    background: var(--accent);
    color: var(--paper-bg);
    border-color: var(--accent);
    outline: none;
}

.btn-add-row {
    background: none;
    border: 1px dashed var(--rule);
    color: var(--ink-soft);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    padding: 12px 16px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-add-row:hover, .btn-add-row:focus {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--paper-surface);
    outline: none;
}

.save-bar {
    display: flex;
    gap: 18px;
    align-items: center;
    margin-top: 28px;
}
.save-bar .btn { flex: 0 0 auto; }
.btn-cancel {
    color: var(--ink-muted);
    font-family: var(--font-body);
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 4px;
}
.btn-cancel:hover, .btn-cancel:focus { color: var(--accent); outline: none; }

/* Danger zone — Remove from collection */
.danger-zone {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: flex-end;
}
.btn-remove-record {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 0;
    padding: 10px 18px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    min-height: 44px;
}
.btn-remove-record:hover, .btn-remove-record:focus {
    background: var(--accent);
    color: var(--paper-bg);
    outline: none;
}

.remove-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    border: 1px solid var(--rule);
    border-top: 4px solid var(--accent);
    border-radius: 6px;
    background: var(--paper-surface);
    padding: 24px;
    max-width: 460px;
    width: calc(100vw - 32px);
    color: var(--ink);
    font-family: var(--font-body);
}
.remove-dialog::backdrop { background: rgba(20, 22, 27, 0.6); }
.remove-dialog h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 10px;
    line-height: 1.2;
}
.remove-dialog p {
    font-size: 15px;
    color: var(--ink-soft);
    margin: 0 0 18px;
    line-height: 1.5;
}
.remove-dialog form { display: flex; flex-direction: column; gap: 16px; }
.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 8px;
}
.dialog-actions button {
    padding: 12px 20px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    border: 1px solid var(--ink);
    background: var(--paper-bg);
    color: var(--ink);
    border-radius: 0;
    min-height: 44px;
}
.dialog-actions button:hover, .dialog-actions button:focus {
    background: var(--paper-deep);
    outline: none;
}
.dialog-actions .btn-confirm-remove {
    background: var(--accent);
    color: var(--paper-bg);
    border-color: var(--accent);
}
.dialog-actions .btn-confirm-remove:hover,
.dialog-actions .btn-confirm-remove:focus {
    background: var(--ink);
    border-color: var(--ink);
}


/* 10d. Autocomplete dropdown ─────────────────────────────────────────────── */

.ac-wrap { position: relative; }

.ac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background: #fff;
    border: 1px solid var(--ink);
    border-top: none;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 18px rgba(20, 22, 27, 0.12);
}
.ac-dropdown[hidden] { display: none; }

.ac-item {
    padding: 10px 14px;
    font-size: 15px;
    color: var(--ink);
    cursor: pointer;
    border-bottom: 1px solid var(--rule);
    line-height: 1.3;
    min-height: 40px;
    display: flex;
    align-items: center;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active {
    background: var(--paper-surface);
    color: var(--accent);
}
.ac-item mark {
    background: none;
    color: var(--accent);
    font-weight: 700;
}

.ac-empty {
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-muted);
    background: var(--paper-bg);
    letter-spacing: 0.04em;
}


/* 11. Utility helpers ────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.text-muted { color: var(--ink-muted); }


/* 12. Responsive ─────────────────────────────────────────────────────────── */

/* Mobile: header drops nav below the title */
@media (max-width: 600px) {
    .header-sep { display: none; }
    .app-header-inner h1 { flex: 1 0 100%; margin-bottom: 4px; }
    .app-header-inner nav a { padding: 10px 14px 10px 0; }
}

/* Tablet+ */
@media (min-width: 700px) {
    .app-header-inner { padding: 16px 32px; }
    .search-wrap { padding: 6px 32px 22px; }
    main { padding: 28px 32px 56px; }
    .results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    .modal-overlay { align-items: center; padding: 32px; }
    .modal-dialog {
        max-width: 760px;
        max-height: 90vh;
        border: 1px solid var(--rule);
        border-top: 4px solid var(--accent);
        border-radius: 8px;
    }
}
