﻿.form-page {
    width: 100%;
    max-width: 1536px;
    margin: 0 auto;
    padding: 4.25rem 1rem 1rem;
    box-sizing: border-box;
    display: grid;
    gap: 1.5rem;
}

.form-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.form-page-title {
    margin: 0;
    font-size: clamp(1.9rem, 4vw, 2.45rem);
    line-height: 1.05;
    font-weight: 800;
    color: var(--ink);
}

.form-page-subtitle {
    margin: 0.35rem 0 0;
    max-width: 48rem;
    color: var(--muted);
    font-size: 0.96rem;
    line-height: 1.45;
}

.form-status-alert {
    margin: 0;
}

.form-page-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
    align-items: start;
}

.form-page-column {
    display: grid;
    gap: 1.2rem;
}

.form-card {
    position: relative;
    overflow: hidden;
    border-radius: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.055);
    background:
        linear-gradient(180deg, rgba(15, 18, 22, 0.78), rgba(13, 16, 20, 0.84)),
        linear-gradient(160deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.006) 42%, rgba(255, 255, 255, 0.012) 100%);
    -webkit-backdrop-filter: blur(20px) saturate(128%);
    backdrop-filter: blur(20px) saturate(128%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        inset 0 -1px 0 rgba(255, 255, 255, 0.015),
        0 14px 24px rgba(0, 0, 0, 0.08);
}

.form-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background:
        radial-gradient(circle at 14% 12%, rgba(255, 255, 255, 0.06), transparent 22%),
        radial-gradient(circle at 82% 0%, rgba(255, 255, 255, 0.025), transparent 28%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 26%, transparent 68%, rgba(255, 255, 255, 0.014));
    opacity: 0.78;
}

.form-card::after {
    content: "";
    position: absolute;
    inset: 1px;
    pointer-events: none;
    border-radius: calc(1.1rem - 1px);
    border: 1px solid rgba(255, 255, 255, 0.018);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 34%);
}

.form-card > * {
    position: relative;
    z-index: 1;
}

.form-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1.25rem 1.45rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.form-card-icon {
    width: 2.2rem;
    height: 2.2rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.8rem;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.form-card-icon .mud-icon-root {
    font-size: 1.1rem;
}

.form-card-title {
    color: var(--ink);
    font-size: 1.06rem;
    font-weight: 700;
    line-height: 1.2;
}

.form-card-desc {
    margin-top: 0.16rem;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.35;
}

.form-card-body {
    display: grid;
    gap: 0.95rem;
    padding: 1.25rem 1.45rem 1.45rem;
}

.form-field-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

.form-field-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-span-all {
    grid-column: 1 / -1;
}

.form-field-list {
    display: grid;
}

.form-field {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.form-field:first-child {
    padding-top: 0;
}

.form-field:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.form-input .mud-input-control {
    margin-top: 0;
    width: 100%;
}

.form-input .mud-input-label,
.form-input .mud-input-helper-text {
    color: var(--muted);
}

.form-input .mud-input-control-input-container,
.form-input .mud-input,
.form-input .mud-input-root,
.form-input .mud-input-root.mud-input-outlined,
.form-input .mud-input-root-outlined,
.form-input .mud-input-slot,
.form-input input,
.form-input textarea {
    width: 100%;
    max-width: 100%;
}

.form-input .mud-input-slot,
.form-input input,
.form-input textarea {
    color: var(--ink);
}

/* NO min-height HERE. It was `min-height: 2rem`, and it made every field in the app
   13px taller than MudBlazor draws it — 69px against a default of 56px.

   .mud-input-root is not the bordered box. It is the INNER slot (the <input>, or for
   a MudSelect the <div class="mud-input-slot">), and MudBlazor already sizes it:

       div.mud-input-slot.mud-input-root { height: 1lh; box-sizing: content-box }
       div.mud-input-slot.mud-input-root-outlined { padding: 18.5px 14px }

   Under content-box a min-height governs the CONTENT box, so the 37px of vertical
   padding is added on top of it rather than absorbed by it: 32 + 37 = 69. The taller
   the min-height, the worse it got — .form-input-lg asked for 5rem and drew 117px.
   MudBlazor's own sizing is correct; anything we add here is a tax on it. */
/* Fill and radius belong to the BORDERED BOX, not to the slot inside it.

   Painted on .mud-input-root they came apart on every multi-line field, because
   MudBlazor pads an <input> but MARGINS a <textarea>:

       .mud-input > input.mud-input-root-outlined    { padding: 18.5px 14px }
       .mud-input > textarea.mud-input-root-outlined { margin-top: 18.5px;
                                                       padding: 0 14px 18.5px }

   A background covers padding and never covers margin, so Address and Receipt
   Footer drew their fill 18.5px short at the top — a strip of bare page showing
   between the outline and the fill, under the label — and our 0.75rem corners sat
   inside MudBlazor's squarer ones. Single-line fields hid the same bug because
   padding happens to fill the box.

   On .mud-input the fill covers the whole control whatever it wraps, and the
   fieldset that draws the outline is given the matching radius. */
.form-input .mud-input.mud-input-outlined {
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
}

.form-input .mud-input-outlined-border {
    border-radius: 0.75rem;
    border-color: rgba(255, 255, 255, 0.08);
}

/* No hover or focus rules here. The pair that used to sit at this spot could never
   match anything: .mud-input-outlined-border is a SIBLING of the slot, not a child,
   so `.mud-input-root:hover .mud-input-outlined-border` described a descendant that
   does not exist — and `.mud-focused` is a class MudBlazor puts on .mud-input, never
   on .mud-input-root. Both states were being drawn by MudBlazor the whole time
   (:hover → --mud-palette-action-default, :focus-within → 2px --mud-palette-primary,
   which is what makes the focused field espresso under the café theme). */

/* .form-input-lg is gone, and with it the 117px fields. Both of its declarations were
   doing nothing we wanted: the min-height inflated the slot as described above, and
   `align-items` was a no-op on an element that is not a flex container.

   Nothing is lost. A multi-line field asks for its own height through the component —
   MudTextField Lines="2" renders a textarea that MudBlazor sizes with
   `.mud-input-root-multiline { height: auto; padding: 0 }` — so the two fields this
   class existed for (Address, Receipt Footer) draw exactly two rows without it. The
   class is inert wherever it is still spelled in markup; harmless, worth sweeping up. */

.form-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.form-toggle-copy {
    display: grid;
    gap: 0.18rem;
}

.form-toggle-title {
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
}

.form-toggle-desc {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.form-helper {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.form-page-note {
    color: var(--muted);
    text-align: center;
    font-size: 0.82rem;
}

.form-map-placeholder {
    min-height: 8.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    text-align: center;
    font-size: 0.9rem;
}

.form-map-placeholder .mud-icon-root {
    font-size: 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.form-primary-action {
    min-width: 164px;
    font-weight: 800;
    border-radius: 0.8rem;
    color: var(--accent-contrast);
    background: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 82%, black 18%);
    box-shadow: 0 10px 20px color-mix(in srgb, var(--accent) 22%, transparent);
}

.form-primary-action:hover,
.form-primary-action:focus-visible {
    background: color-mix(in srgb, var(--accent) 88%, white 12%);
}

.form-primary-action.mud-button-root:hover {
    background: color-mix(in srgb, var(--accent) 88%, white 12%);
}

.form-accent-card {
    display: grid;
    gap: 0.7rem;
}

.form-accent-badge {
    display: inline-block;
    justify-self: start;
    padding: 0.28rem 0.72rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.form-accent-badge.member {
    color: var(--accent);
    background: rgba(215, 179, 106, 0.18);
}

.form-accent-badge.silver {
    color: var(--tag-preference-ink);
    background: rgba(101, 184, 166, 0.18);
}

.form-accent-badge.gold {
    color: var(--accent-strong);
    background: rgba(116, 168, 255, 0.18);
}

.form-accent-meta {
    color: var(--muted);
    font-size: 0.82rem;
}

.form-preview-block {
    padding-bottom: 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.15rem;
}

.form-preview-label {
    color: var(--muted);
    font-size: 0.84rem;
    margin-bottom: 0.55rem;
}

.theme-light .form-card {
    border: 1px solid rgba(32, 29, 24, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 251, 245, 0.72), rgba(246, 238, 226, 0.78)),
        linear-gradient(160deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08) 42%, rgba(255, 250, 244, 0.14) 100%);
    -webkit-backdrop-filter: blur(20px) saturate(135%);
    backdrop-filter: blur(20px) saturate(135%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.38),
        inset 0 -1px 0 rgba(255, 255, 255, 0.12),
        0 16px 30px rgba(83, 62, 20, 0.07);
}

.theme-light .form-card::before {
    background:
        radial-gradient(circle at 14% 12%, rgba(255, 255, 255, 0.34), transparent 22%),
        radial-gradient(circle at 82% 0%, rgba(255, 255, 255, 0.16), transparent 28%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 26%, transparent 68%, rgba(255, 255, 255, 0.08));
    opacity: 0.88;
}

.theme-light .form-card::after {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 34%);
}

.theme-light .form-card-head,
.theme-light .form-field,
.theme-light .form-actions,
.theme-light .form-preview-block {
    border-color: rgba(32, 29, 24, 0.08);
}

.theme-light .form-card-icon {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Day roast. Same move as the base rule: the fill goes on the bordered box, so it
   covers a textarea's top margin instead of stopping short of it. The hover and
   focus twins are gone for the same reason as their base counterparts — they named
   an element that is not there. */
.theme-light .form-input .mud-input.mud-input-outlined {
    background: rgba(255, 255, 255, 0.42);
}

.theme-light .form-input .mud-input-outlined-border {
    border-color: rgba(32, 29, 24, 0.10);
}

.theme-light .form-map-placeholder {
    border-color: rgba(32, 29, 24, 0.08);
    background: rgba(255, 255, 255, 0.28);
}

@media (max-width: 960px) {
    .form-page-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .form-page {
        padding: 4rem 1rem 1.5rem;
    }

    .form-card-head,
    .form-card-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .form-field-grid-2 {
        grid-template-columns: 1fr;
    }

    .form-toggle-row,
    .form-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .form-primary-action {
        width: 100%;
    }
}

/* Dashboard pages (Insights, Reports): rendered inside MainLayout whose appbar
   is in-flow, so there's no floating chrome to clear — top padding matches the
   other three sides (unlike .form-page's 4.25rem clearance). */
.dash-page {
    width: 100%;
    max-width: 1536px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
    display: grid;
    gap: 1.5rem;
}
