:root {
    --bg: #101114;
    --surface: #191b20;
    --surface-light: #22252b;

    --text: #f6f4ef;
    --muted: #999da7;

    --accent: #e9b949;
    --accent-dark: #c99a30;

    --danger: #ff7272;

    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;

    min-height: 100vh;

    background:
        radial-gradient(
            circle at top,
            #24211a 0%,
            var(--bg) 42%
        );

    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

.app-shell {
    width: 100%;
    max-width: 520px;

    min-height: 100vh;

    margin: 0 auto;

    padding:
        max(32px, env(safe-area-inset-top))
        24px
        max(32px, env(safe-area-inset-bottom));
}

.login-view {
    min-height: 80vh;

    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand {
    margin-bottom: 42px;
}

.brand-icon {
    font-size: 52px;
    margin-bottom: 18px;
}

.brand h1 {
    margin: 0 0 10px;

    font-size: clamp(36px, 10vw, 48px);
    line-height: 1;
    letter-spacing: -1.5px;
}

.brand p {
    margin: 0;

    color: var(--muted);

    font-size: 18px;
    line-height: 1.45;
}

.login-form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    color: var(--muted);

    font-size: 13px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.field input {
    width: 100%;

    padding: 16px;

    border: 1px solid #34373f;
    border-radius: 14px;

    background: var(--surface);

    color: var(--text);

    font-size: 17px;

    outline: none;

    transition:
        border-color 0.15s ease,
        background 0.15s ease;
}

.field input:focus {
    border-color: var(--accent);
    background: var(--surface-light);
}

button {
    min-height: 54px;

    border: 0;
    border-radius: 14px;

    background: var(--accent);

    color: #18150e;

    font-weight: 800;
    font-size: 17px;

    cursor: pointer;
}

button:active {
    transform: scale(0.99);
}

button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.secondary-button {
    background: var(--surface-light);
    color: var(--text);

    margin-top: 30px;
}

.error-message {
    min-height: 20px;

    margin: -4px 0 0;

    color: var(--danger);

    font-size: 14px;
}

.hidden {
    display: none !important;
}

.app-view {
    padding-top: 80px;
}

.eyebrow {
    margin: 0 0 8px;

    color: var(--accent);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.12em;
}

.app-view h1 {
    margin: 0;

    font-size: 42px;
    letter-spacing: -1px;
}

.success-message {
    color: var(--muted);

    font-size: 17px;
    line-height: 1.5;
}

.app-view {
    padding-top: 24px;
}

.app-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 34px;
}

.app-header h1 {
    margin: 0;

    font-size: clamp(32px, 9vw, 44px);
    line-height: 1.05;

    letter-spacing: -1.5px;
}

.event-date {
    margin: 8px 0 0;

    color: var(--muted);

    font-size: 15px;
}

.icon-button {
    width: 46px;
    min-height: 46px;

    flex: 0 0 auto;

    padding: 0;

    background: var(--surface-light);
    color: var(--muted);

    border-radius: 50%;
}


.budget-hero {
    padding: 28px;

    background: var(--surface);

    border: 1px solid #2d3036;
    border-radius: 24px;

    margin-bottom: 16px;
}

.budget-label {
    margin: 0 0 6px;

    color: var(--muted);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.1em;
}

.budget-amount {
    font-size: clamp(52px, 16vw, 72px);
    font-weight: 800;

    line-height: 1;

    letter-spacing: -3px;
}

.budget-subtitle {
    margin: 14px 0 0;

    color: var(--muted);

    font-size: 14px;
}


.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 10px;

    margin-bottom: 34px;
}

.summary-item {
    min-width: 0;

    padding: 16px 12px;

    background: var(--surface);

    border-radius: 16px;
}

.summary-item span {
    display: block;

    margin-bottom: 5px;

    color: var(--muted);

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-item strong {
    display: block;

    font-size: clamp(17px, 5vw, 22px);
}

.summary-item.highlight strong {
    color: var(--accent);
}


.empty-state {
    padding: 28px 10px;

    text-align: center;
}

.empty-icon {
    margin-bottom: 12px;

    font-size: 40px;
}

.empty-state h2 {
    margin: 0 0 8px;

    font-size: 20px;
}

.empty-state p {
    max-width: 310px;

    margin: 0 auto;

    color: var(--muted);

    line-height: 1.5;
}


.categories-section {
    padding-bottom: 40px;
}


.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    margin-bottom: 16px;
}


.section-heading h2 {
    margin: 0;

    font-size: 24px;
    letter-spacing: -0.5px;
}


/* -----------------------------------------------------
   QUICK ADD
----------------------------------------------------- */

button,
input,
select {
    font: inherit;
}

.field select {
    width: 100%;
    padding: 16px;
    border: 1px solid #34373f;
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    font-size: 17px;
    outline: none;
}

.field select:focus {
    border-color: var(--accent);
    background: var(--surface-light);
}

.quick-add-button {
    position: fixed;
    right: max(24px, calc((100vw - 520px) / 2 + 24px));
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 20;

    width: 62px;
    height: 62px;
    min-height: 62px;

    padding: 0;

    border-radius: 50%;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.38);

    font-size: 34px;
    font-weight: 500;
    line-height: 1;
}

.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;

    background: rgba(0, 0, 0, 0.64);
    backdrop-filter: blur(3px);
}

.quick-add-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 40;

    width: min(100%, 520px);
    max-height: 92vh;

    overflow-y: auto;

    padding:
        10px
        24px
        max(28px, env(safe-area-inset-bottom));

    transform: translateX(-50%);

    background: #15171b;

    border: 1px solid #30333a;
    border-bottom: 0;
    border-radius: 26px 26px 0 0;

    box-shadow:
        0 -18px 50px rgba(0, 0, 0, 0.45);
}

.sheet-handle {
    width: 44px;
    height: 5px;

    margin: 0 auto 18px;

    background: #3a3d44;
    border-radius: 999px;
}

.sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 24px;
}

.sheet-header h2 {
    margin: 0;

    font-size: 30px;
    letter-spacing: -0.8px;
}

.sheet-close-button {
    width: 44px;
    height: 44px;
    min-height: 44px;

    flex: 0 0 auto;

    padding: 0;

    background: var(--surface-light);
    color: var(--muted);

    border-radius: 50%;

    font-size: 28px;
    font-weight: 400;
}

.quick-add-form {
    display: grid;
    gap: 17px;
}

.money-input {
    display: flex;
    align-items: center;

    border: 1px solid #34373f;
    border-radius: 14px;

    background: var(--surface);

    overflow: hidden;
}

.money-input:focus-within {
    border-color: var(--accent);
    background: var(--surface-light);
}

.money-input span {
    padding-left: 16px;

    color: var(--muted);

    font-size: 17px;
    font-weight: 700;
}

.money-input input {
    width: 100%;

    padding: 16px 16px 16px 8px;

    border: 0;
    outline: 0;

    background: transparent;
    color: var(--text);

    font-size: 17px;
}

body.sheet-open {
    overflow: hidden;
}

@media (max-width: 560px) {
    .quick-add-button {
        right: 24px;
    }
}


/* -----------------------------------------------------
   SHOPPING LIST
----------------------------------------------------- */

.items-section {
    padding-bottom: 110px;
}

.item-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 30px;
    height: 30px;

    padding: 0 9px;

    background: var(--surface-light);
    color: var(--muted);

    border-radius: 999px;

    font-size: 13px;
    font-weight: 800;
}

.item-list {
    display: grid;
    gap: 12px;
}

.item-card {
    padding: 18px;

    background: var(--surface);

    border: 1px solid #2d3036;
    border-radius: 18px;
}

.item-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 14px;
}

.item-title-wrap {
    display: flex;
    align-items: flex-start;

    min-width: 0;

    gap: 11px;
}

.item-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    flex: 0 0 auto;

    font-size: 20px;
}

.item-title {
    margin: 0;

    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
}

.item-subtitle {
    margin: 5px 0 0;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.4;
}

.item-status {
    flex: 0 0 auto;

    padding: 6px 8px;

    background: var(--surface-light);
    color: var(--muted);

    border-radius: 999px;

    font-size: 9px;
    font-weight: 900;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.item-status.purchased,
.item-status.wrapped,
.item-status.complete {
    color: var(--accent);
}

.item-card-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 14px;

    margin-top: 16px;
    padding-top: 14px;

    border-top: 1px solid #292c32;
}

.item-amount-label {
    display: block;

    margin-bottom: 3px;

    color: var(--muted);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.item-amount {
    font-size: 20px;
    font-weight: 800;
}

.item-store {
    max-width: 45%;

    color: var(--muted);

    font-size: 11px;
    text-align: right;
}

.items-section .empty-state {
    padding: 24px 10px 10px;
}


/* -----------------------------------------------------
   ITEM MANAGER
----------------------------------------------------- */

.item-card {
    cursor: pointer;

    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        transform 0.15s ease;
}

.item-card:active {
    transform: scale(0.99);
    background: var(--surface-light);
}

.item-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.danger-button {
    margin-top: 2px;

    background: transparent;
    color: var(--danger);

    border: 1px solid rgba(255, 114, 114, 0.35);
}

.danger-button:active {
    background: rgba(255, 114, 114, 0.08);
}


/* -----------------------------------------------------
   GIFT PLANNER
----------------------------------------------------- */

.gift-planner-section {
    margin-top: 28px;
}

.recipient-planner-list {
    display: grid;
    gap: 10px;
}

.recipient-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    width: 100%;
    padding: 16px 17px;

    background: var(--surface);
    color: var(--text);

    border: 1px solid #2d3036;
    border-radius: 18px;

    text-align: left;
    cursor: pointer;
}

.recipient-card:active {
    background: var(--surface-light);
}

.recipient-card-name {
    margin: 0 0 5px;
    font-size: 16px;
    font-weight: 800;
}

.recipient-card-meta {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.recipient-card-arrow {
    color: var(--accent);
    font-size: 20px;
    font-weight: 800;
}

.recipient-planner-view {
    padding-bottom: 110px;
}

.planner-view-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.planner-view-header h2 {
    margin: 2px 0 0;
}

.planner-back-button,
.small-accent-button {
    width: auto;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
}

.planner-back-button {
    background: var(--surface);
    color: var(--text);
    border: 1px solid #30333a;
}

.small-accent-button {
    background: var(--accent);
    color: #161616;
    font-weight: 900;
}

.idea-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.idea-summary-card {
    padding: 12px 8px;
    background: var(--surface);
    border: 1px solid #2d3036;
    border-radius: 14px;
    text-align: center;
}

.idea-summary-value {
    display: block;
    font-size: 16px;
    font-weight: 900;
}

.idea-summary-label {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.planner-subheading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 18px 2px 10px;
}

.planner-subheading h3 {
    margin: 0;
    font-size: 16px;
}

.planner-subheading span {
    color: var(--muted);
    font-size: 12px;
}

.planner-shopping-heading {
    margin-top: 28px;
}

.idea-list {
    display: grid;
    gap: 10px;
}

.idea-card {
    padding: 16px;
    background: var(--surface);
    border: 1px solid #2d3036;
    border-radius: 18px;
}

.idea-card-main {
    cursor: pointer;
}

.idea-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}

.idea-card-meta {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.idea-card-notes {
    margin: 11px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.idea-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.idea-card-actions button,
.idea-card-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 36px;
    padding: 0 11px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 900;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.idea-link-button {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid #343840;
}

.idea-promote-button,
.secondary-accent-button {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(233,185,73,.45);
}

.secondary-accent-button {
    margin-top: 2px;
}

.idea-shopping-status {
    color: var(--accent);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

textarea {
    width: 100%;
    padding: 13px 14px;
    resize: vertical;

    background: var(--surface-light);
    color: var(--text);

    border: 1px solid #343840;
    border-radius: 12px;

    font: inherit;
    line-height: 1.4;
}

textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.hidden {
    display: none !important;
}


/* -----------------------------------------------------
   RECIPIENTS PAGE + RECIPIENT OVERLAY
----------------------------------------------------- */

.text-action-button {
    width: auto;
    min-height: 36px;
    padding: 0 10px;
    background: transparent;
    color: var(--accent);
    border: 0;
    font-size: 12px;
    font-weight: 900;
}

.recipient-planner-preview {
    display: grid;
    gap: 10px;
}

.recipient-preview-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px;
    background: var(--surface);
    border: 1px solid #2d3036;
    border-radius: 16px;
}

.recipient-preview-card p {
    margin: 0;
}

.recipient-preview-name {
    font-size: 15px;
    font-weight: 800;
}

.recipient-preview-meta {
    margin-top: 4px !important;
    color: var(--muted);
    font-size: 10px;
}

.recipients-page {
    padding-bottom: 110px;
}

.page-header {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.page-header h2 {
    margin: 2px 0 0;
}

.page-intro {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.recipient-overlay {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 1002;

    width: min(100%, 520px);
    max-height: 88vh;
    overflow-y: auto;

    padding: 22px 20px 34px;

    transform: translateX(-50%);

    background: var(--bg);

    border: 1px solid #30333a;
    border-bottom: 0;
    border-radius: 24px 24px 0 0;

    box-shadow: 0 -18px 60px rgba(0,0,0,.42);
}

.recipient-overlay-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.recipient-overlay-header h2 {
    margin: 2px 0 0;
}

.recipient-add-idea-button {
    margin-bottom: 22px;
    background: var(--accent);
    color: #161616;
    font-weight: 900;
}

@media (min-width: 600px) {
    .recipient-overlay {
        bottom: 5vh;
        max-height: 90vh;
        border-bottom: 1px solid #30333a;
        border-radius: 24px;
    }
}

.recipient-page-hidden { display: none !important; }


/* -----------------------------------------------------
   NESTED SHEET STACKING FIX
   Recipient overlay sits at 1002. Forms opened from it
   must sit above both the overlay and its backdrop.
----------------------------------------------------- */

#ideaBackdrop {
    z-index: 1100;
}

#ideaSheet {
    z-index: 1101;
}

#itemManagerBackdrop {
    z-index: 1100;
}

#itemManagerSheet {
    z-index: 1101;
}

#quickAddBackdrop {
    z-index: 1100;
}

#quickAddSheet {
    z-index: 1101;
}


/* -----------------------------------------------------
   CATEGORY CARDS + CATEGORY PAGE — V1.2
----------------------------------------------------- */

#categoryList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.category-card {
    min-width: 0;
    padding: 15px;
    background: var(--surface);
    border: 1px solid #2d3036;
    border-radius: 18px;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.category-card:active {
    transform: scale(0.985);
    background: var(--surface-light);
}

.category-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.category-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.category-card-icon {
    flex: 0 0 auto;
    font-size: 21px;
    line-height: 1;
}

.category-card-name {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.category-card-amount {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
}

.category-card-caption {
    margin: 4px 0 10px;
    color: var(--muted);
    font-size: 9px;
}

.category-card-remaining {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 10px;
}

/* One progress-bar system only. */
.category-progress {
    position: relative;
    width: 100%;
    height: 5px;
    overflow: hidden;
    background: #2a2d33;
    border-radius: 999px;
}

.category-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
    transition: width 0.3s ease;
}

.category-page {
    padding-bottom: 110px;
}

.category-page-hidden {
    display: none !important;
}

.category-page-summary {
    margin: 18px 0 24px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid #2d3036;
    border-radius: 18px;
}

.category-page-summary-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.category-page-summary-icon {
    font-size: 30px;
}

.category-page-summary-amount {
    font-size: 22px;
    font-weight: 900;
}

.category-page-summary-label {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.category-page-summary-remaining {
    margin-top: 14px;
    color: var(--muted);
    font-size: 12px;
}

.category-page-summary .category-progress {
    height: 7px;
    margin-top: 16px;
}

.category-page-empty {
    padding: 18px 12px;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed #30333a;
    border-radius: 16px;
    font-size: 12px;
    text-align: center;
}


/* PRODUCT LINKS — V1.3 */
.product-link-button {
    display:flex;
    align-items:center;
    justify-content:center;
    width:100%;
    min-height:44px;
    margin-top:-2px;
    padding:0 14px;
    background:var(--surface-light);
    color:var(--text);
    border:1px solid #343840;
    border-radius:12px;
    font-size:11px;
    font-weight:900;
    letter-spacing:.04em;
    text-decoration:none;
    text-transform:uppercase;
}


/* -----------------------------------------------------
   BUDGET EDITOR — V1.6
----------------------------------------------------- */

#budgetEditorBackdrop {
    z-index: 1200;
}

#budgetEditorSheet {
    z-index: 1201;
}

.budget-editor-section-label {
    margin: 6px 0 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.budget-category-fields {
    display: grid;
    gap: 10px;
}

.budget-category-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px;
    align-items: center;
    gap: 12px;
}

.budget-category-row label {
    min-width: 0;
    font-size: 14px;
    font-weight: 800;
}

.compact-money-input input {
    padding-top: 12px;
    padding-bottom: 12px;
}

.budget-allocation-summary {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid #30333a;
    border-radius: 14px;
}

.budget-allocation-summary > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.budget-allocation-summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.budget-allocation-summary strong {
    font-size: 13px;
}

.budget-allocation-summary .overallocated span,
.budget-allocation-summary .overallocated strong {
    color: var(--danger);
}


/* V1.6.1 — interactive Total Budget card */
.summary-action {
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 16px 12px;
    background: var(--surface);
    color: var(--text);
    border: 0;
    border-radius: 16px;
    text-align: left;
}

.summary-action:active {
    background: var(--surface-light);
    transform: scale(.985);
}

.summary-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


/* -----------------------------------------------------
   NAVIGATION CLEANUP — V1.7
----------------------------------------------------- */

.header-menu-wrap {
    position: relative;
    flex: 0 0 auto;
}

.account-menu {
    position: absolute;
    top: 54px;
    right: 0;
    z-index: 900;

    min-width: 156px;
    padding: 6px;

    background: var(--surface-light);
    border: 1px solid #343840;
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0,0,0,.38);
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;

    width: 100%;
    min-height: 44px;
    padding: 0 12px;

    background: transparent;
    color: var(--text);
    border: 0;
    border-radius: 10px;

    text-align: left;
    font-size: 14px;
    font-weight: 750;
}

.account-menu-item:active {
    background: #2d3037;
}

.account-menu-icon {
    color: var(--muted);
    font-size: 18px;
}

.page-header {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 14px;
}

.page-header .planner-back-button {
    justify-self: start;
}

.planner-back-button {
    min-height: 44px;
    padding: 0 15px;

    background: var(--surface-light);
    color: var(--accent);
    border: 1px solid #383b42;
    border-radius: 14px;

    font-size: 14px;
    font-weight: 850;
}

.planner-back-button:active {
    background: #2d3037;
    transform: scale(.98);
}

.planner-back-button:focus-visible,
.account-menu-item:focus-visible,
#accountMenuButton:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


/* -----------------------------------------------------
   UNIFIED OVERLAY NAVIGATION — V1.8
----------------------------------------------------- */

#categoryOverlayBackdrop {
    z-index: 1000;
}

.category-overlay {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 1001;

    width: min(100%, 520px);
    height: min(94vh, 900px);
    max-height: 94vh;
    overflow-y: auto;

    padding: 22px 20px 40px;

    transform: translateX(-50%);

    background: var(--bg);
    border: 1px solid #30333a;
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -18px 60px rgba(0,0,0,.42);

    overscroll-behavior: contain;
}

.category-overlay-header {
    position: sticky;
    top: -22px;
    z-index: 3;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;

    margin: -22px -20px 18px;
    padding: 22px 20px 14px;

    background: linear-gradient(to bottom, var(--bg) 82%, rgba(16,17,20,0));
}

.category-overlay-header h2 {
    margin: 2px 0 0;
}

/* Item Manager sits above Category and returns to it when closed. */
#itemManagerBackdrop {
    z-index: 1100;
}

#itemManagerSheet {
    z-index: 1101;
}

@media (min-width: 600px) {
    .category-overlay {
        bottom: 3vh;
        height: min(90vh, 900px);
        max-height: 90vh;
        border-bottom: 1px solid #30333a;
        border-radius: 24px;
    }
}
