:root {
    --ink: #252232;
    --muted: #6e697d;
    --line: rgba(37, 34, 50, .12);
    --cloud: #f7fbfa;
    --paper: #ffffff;
    --coral: #ff4f70;
    --mint: #21b89b;
    --butter: #ffe17c;
    --sky: #bfefff;
    --shadow: 0 18px 50px rgba(37, 34, 50, .12);
    --minute-size: 1.55px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    background: linear-gradient(180deg, #ffffff 0%, #ffffff 42%, #f7fbfa 100%);
    color: var(--ink);
    font-family: "Nunito", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.planner-topbar {
    align-items: center;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    min-height: 4.25rem;
    padding: .75rem clamp(1rem, 3vw, 2rem);
    position: sticky;
    top: 0;
    z-index: 20;
}

.planner-topbar > * {
    min-width: 0;
}

.brand-link,
.topbar-actions,
.primary-button,
.idea-tile,
.panel-heading,
.day-title,
.event-meta,
.route-card,
.form-grid,
.segmented,
.route-details dl {
    align-items: center;
    display: flex;
}

.brand-link {
    color: var(--ink);
    font-family: "Fredoka", "Nunito", sans-serif;
    font-size: 1.05rem;
    font-weight: 900;
    gap: .55rem;
    min-width: 0;
    text-decoration: none;
}

.brand-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-link img {
    border: 2px solid rgba(37, 34, 50, .12);
    border-radius: .95rem;
    box-shadow: 0 4px 0 rgba(37, 34, 50, .10);
    height: 2.4rem;
    width: 2.4rem;
}

.topbar-actions {
    gap: .6rem;
    justify-content: flex-end;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.topbar-actions::-webkit-scrollbar {
    display: none;
}

.icon-button,
.primary-button,
.nav-button {
    border: 0;
    min-height: 2.65rem;
}

.icon-button {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    display: grid;
    height: 2.65rem;
    place-items: center;
    width: 2.65rem;
}

.icon-button:disabled {
    cursor: not-allowed;
    opacity: .38;
}

.icon-button.compact {
    height: 2.25rem;
    min-height: 2.25rem;
    width: 2.25rem;
}

.icon-button svg,
.primary-button svg,
.idea-tile svg {
    height: 1.05rem;
    width: 1.05rem;
}

.primary-button {
    background: var(--ink);
    border: 2px solid rgba(37, 34, 50, .18);
    border-radius: 999px;
    box-shadow: 0 5px 0 rgba(37, 34, 50, .12);
    color: white;
    font-size: .9rem;
    font-weight: 900;
    gap: .45rem;
    padding: 0 1rem;
}

.nav-button {
    align-items: center;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    display: inline-flex;
    font-size: .84rem;
    font-weight: 950;
    gap: .45rem;
    padding: 0 .85rem;
    text-decoration: none;
    white-space: nowrap;
}

.nav-button.soft {
    color: var(--muted);
}

.nav-button svg {
    height: 1.05rem;
    width: 1.05rem;
}

.planner-shell {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(15rem, .75fr) minmax(25rem, 1.75fr) minmax(16rem, .8fr);
    margin: 0 auto;
    max-width: 88rem;
    padding: 1rem clamp(1rem, 3vw, 2rem) 2rem;
    width: 100%;
}

.idea-panel,
.timeline-panel,
.editor-panel {
    max-width: 100%;
    min-width: 0;
}

.idea-panel,
.editor-panel {
    align-self: start;
    background: var(--paper);
    border: 2px solid var(--line);
    border-radius: .9rem;
    padding: .9rem;
    position: sticky;
    top: 5.25rem;
}

.panel-heading {
    justify-content: space-between;
    margin-bottom: .85rem;
}

.panel-heading p {
    font-size: .78rem;
    font-weight: 950;
    letter-spacing: 0;
    margin: 0;
    text-transform: uppercase;
}

.panel-heading span {
    background: var(--cloud);
    border-radius: 999px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
    padding: .25rem .55rem;
}

.idea-list {
    display: grid;
    gap: .6rem;
}

.idea-tile {
    background: var(--cloud);
    border: 1px solid transparent;
    border-radius: .85rem;
    color: var(--ink);
    gap: .8rem;
    justify-content: space-between;
    min-height: 4.35rem;
    padding: .8rem;
    text-align: left;
    width: 100%;
}

.idea-tile:hover,
.idea-tile:focus-visible {
    border-color: var(--coral);
    outline: 0;
}

.idea-tile strong,
.idea-tile small {
    display: block;
    overflow-wrap: break-word;
}

.idea-tile strong {
    font-size: .92rem;
    font-weight: 900;
    line-height: 1.25;
}

.idea-tile small {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 750;
    margin-top: .25rem;
}

.timeline-panel {
    background: var(--paper);
    border: 2px solid var(--line);
    border-radius: .9rem;
    overflow: hidden;
}

.day-title {
    border-bottom: 1px solid var(--line);
    justify-content: space-between;
    padding: 1rem;
}

.day-title p,
.day-title h1,
.day-summary {
    margin: 0;
}

.day-title p {
    color: var(--coral);
    font-size: .78rem;
    font-weight: 950;
    text-transform: uppercase;
}

.day-title h1 {
    font-family: "Fredoka", "Nunito", sans-serif;
    font-size: clamp(1.55rem, 2vw, 2.2rem);
    font-weight: 950;
    line-height: 1.1;
}

.day-summary {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 850;
    text-align: right;
}

.timeline-wrap {
    display: grid;
    grid-template-columns: 4.35rem 1fr;
    max-width: 100%;
    overflow-x: auto;
}

.time-ruler,
.timeline {
    height: calc((var(--day-minutes) * var(--minute-size)) + 1px);
    min-height: 46rem;
}

.time-ruler {
    background: #fbfaf7;
    border-right: 1px solid var(--line);
    position: relative;
}

.time-mark {
    color: var(--muted);
    font-size: .73rem;
    font-weight: 850;
    position: absolute;
    right: .65rem;
    transform: translateY(-50%);
}

.timeline {
    background: linear-gradient(to bottom, rgba(37, 34, 50, .08) 1px, transparent 1px);
    background-size: 100% calc(60 * var(--minute-size));
    min-width: 31rem;
    position: relative;
}

.timeline.is-drop-target {
    box-shadow: inset 0 0 0 2px rgba(255, 79, 112, .5);
}

.timeline-grid,
.timeline-layer,
.route-layer {
    inset: 0;
    position: absolute;
}

.quarter-line {
    border-top: 1px dashed rgba(37, 34, 50, .08);
    left: 0;
    position: absolute;
    right: 0;
}

.event-block {
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: .5rem;
    box-shadow: 0 .45rem 0 rgba(37, 34, 50, .12);
    cursor: grab;
    left: 1rem;
    min-height: 3.8rem;
    overflow: hidden;
    padding: .7rem 2.8rem .7rem .8rem;
    position: absolute;
    right: 30%;
    touch-action: none;
    user-select: none;
    z-index: 2;
}

.event-block:active {
    cursor: grabbing;
}

.event-block.is-selected {
    border-color: var(--coral);
    box-shadow: 0 .45rem 0 rgba(255, 79, 112, .2), 0 0 0 3px rgba(255, 79, 112, .14);
}

.event-block h2 {
    font-size: .96rem;
    font-weight: 950;
    line-height: 1.18;
    margin: 0;
    overflow-wrap: break-word;
}

.event-meta {
    color: var(--muted);
    flex-wrap: wrap;
    font-size: .76rem;
    font-weight: 800;
    gap: .35rem .55rem;
    margin-top: .42rem;
}

.event-address {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.resize-handle {
    background: linear-gradient(90deg, transparent, rgba(37, 34, 50, .26), transparent);
    border: 0;
    bottom: .25rem;
    height: .7rem;
    left: 1rem;
    position: absolute;
    right: 1rem;
}

.route-card {
    background: var(--sky);
    border: 1px solid rgba(37, 34, 50, .16);
    border-radius: .5rem;
    box-shadow: 0 .3rem 0 rgba(37, 34, 50, .08);
    color: var(--ink);
    gap: .5rem;
    left: 72%;
    min-height: 2.45rem;
    overflow: hidden;
    padding: .45rem .55rem;
    position: absolute;
    right: .75rem;
    text-align: left;
    z-index: 3;
}

.route-card.is-selected {
    outline: 3px solid rgba(33, 184, 155, .26);
}

.route-card.is-tight {
    background: var(--butter);
}

.route-card strong,
.route-card small {
    display: block;
    overflow-wrap: break-word;
}

.route-card strong {
    font-size: .76rem;
    font-weight: 950;
    line-height: 1.1;
}

.route-card small {
    font-size: .7rem;
    font-weight: 850;
    line-height: 1.25;
    margin-top: .15rem;
}

.editor-form {
    display: grid;
    gap: .85rem;
}

.editor-form label,
.route-details {
    display: grid;
    gap: .35rem;
}

.editor-form span,
.route-details dt {
    color: var(--muted);
    font-size: .74rem;
    font-weight: 900;
    text-transform: uppercase;
}

.editor-form input {
    background: var(--cloud);
    border: 1px solid transparent;
    border-radius: .5rem;
    color: var(--ink);
    min-height: 2.7rem;
    padding: 0 .75rem;
    width: 100%;
}

.editor-form input:focus {
    border-color: var(--coral);
    outline: 0;
}

.editor-form input:disabled {
    opacity: .58;
}

.address-autocomplete {
    position: relative;
}

.address-suggestions {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: .5rem;
    box-shadow: var(--shadow);
    display: grid;
    gap: .25rem;
    left: 0;
    max-height: 18rem;
    overflow: auto;
    padding: .35rem;
    position: absolute;
    right: 0;
    top: calc(100% + .35rem);
    z-index: 30;
}

.address-suggestion {
    background: transparent;
    border: 0;
    border-radius: .4rem;
    color: var(--ink);
    display: grid;
    gap: .18rem;
    min-height: 3rem;
    padding: .55rem .6rem;
    text-align: left;
    width: 100%;
}

.address-suggestion:hover,
.address-suggestion:focus-visible {
    background: var(--cloud);
    outline: 0;
}

.address-suggestion.is-empty {
    cursor: default;
}

.address-suggestion.is-empty:hover {
    background: transparent;
}

.address-suggestion strong {
    font-size: .86rem;
    font-weight: 950;
    line-height: 1.25;
}

.address-suggestion small {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 850;
    line-height: 1.25;
}

.address-scope {
    align-items: center;
    background: var(--cloud);
    border: 1px solid var(--line);
    border-radius: .5rem;
    display: flex;
    gap: .25rem;
    padding: .25rem;
}

.address-scope button {
    background: transparent;
    border: 0;
    border-radius: .36rem;
    color: var(--muted);
    flex: 1;
    font-size: .76rem;
    font-weight: 950;
    min-height: 2.05rem;
}

.address-scope button.is-active {
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 .18rem .6rem rgba(37, 34, 50, .08);
}

.form-grid {
    gap: .6rem;
}

.form-grid label {
    flex: 1;
}

.route-details {
    background: var(--cloud);
    border-radius: .5rem;
    margin-top: 1rem;
    padding: .8rem;
}

.route-details p {
    font-size: .95rem;
    font-weight: 950;
    line-height: 1.25;
    margin: 0;
}

.segmented {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: .5rem;
    gap: .25rem;
    padding: .25rem;
}

.segmented button {
    background: transparent;
    border: 0;
    border-radius: .36rem;
    color: var(--muted);
    flex: 1;
    font-size: .78rem;
    font-weight: 950;
    min-height: 2.15rem;
}

.segmented button.is-active {
    background: var(--ink);
    color: white;
}

.route-details dl {
    gap: .65rem;
    margin: 0;
}

.route-details dl div {
    background: var(--paper);
    border-radius: .45rem;
    flex: 1;
    padding: .55rem;
}

.route-details dd {
    font-size: .98rem;
    font-weight: 950;
    margin: .1rem 0 0;
}

.toast {
    background: var(--ink);
    border-radius: 999px;
    bottom: 1rem;
    box-shadow: var(--shadow);
    color: white;
    font-size: .9rem;
    font-weight: 850;
    left: 50%;
    max-width: calc(100% - 2rem);
    padding: .75rem 1rem;
    position: fixed;
    transform: translateX(-50%);
    z-index: 40;
}

.planner-mobile-nav {
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--line);
    bottom: 0;
    box-shadow: 0 -12px 40px rgba(37, 34, 50, .1);
    display: none;
    gap: .25rem;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    left: 0;
    padding: .5rem .5rem max(.5rem, env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    z-index: 50;
}

.planner-mobile-nav a {
    border-radius: .9rem;
    color: var(--muted);
    display: grid;
    font-size: .68rem;
    font-weight: 950;
    gap: .16rem;
    min-height: 3.55rem;
    place-items: center;
    text-align: center;
    text-decoration: none;
}

.planner-mobile-nav a.is-active {
    background: var(--ink);
    color: white;
}

.planner-mobile-nav svg {
    height: 1.18rem;
    width: 1.18rem;
}

@media (max-width: 66rem) {
    .planner-shell {
        grid-template-columns: 1fr;
    }

    .idea-panel,
    .editor-panel {
        position: static;
    }

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

@media (max-width: 42rem) {
    body {
        padding-bottom: 5.8rem;
    }

    .planner-topbar {
        gap: .5rem;
        min-height: 3.8rem;
        padding: .65rem .75rem;
    }

    .planner-shell {
        padding: .75rem .75rem 1.5rem;
    }

    .brand-link span,
    .primary-button span {
        display: none;
    }

    .nav-button.soft {
        display: none;
    }

    .topbar-actions {
        gap: .4rem;
    }

    .nav-button {
        min-height: 2.45rem;
        padding: 0 .7rem;
    }

    .idea-list,
    .form-grid,
    .day-title {
        display: grid;
        grid-template-columns: 1fr;
    }

    .day-summary {
        text-align: left;
    }

    .timeline-wrap {
        grid-template-columns: 3.45rem 1fr;
    }

    .timeline {
        min-width: min(27rem, calc(100vw - 5.2rem));
    }

    .event-block {
        left: .65rem;
        padding: .65rem 6.8rem .65rem .7rem;
        right: .65rem;
    }

    .route-card {
        left: auto;
        max-width: 6.2rem;
        right: .65rem;
    }

    .planner-mobile-nav {
        display: grid;
    }
}

@media (max-width: 24rem) {
    .timeline {
        min-width: 22.5rem;
    }

    .event-block {
        padding-right: 5.8rem;
    }

    .route-card {
        max-width: 5.4rem;
    }

    .planner-mobile-nav a {
        font-size: .62rem;
    }
}
