/* ─────────────────────────────────────────────────────────────────────────
 * iido V5 redesign — design tokens + layout.
 * Loaded only when the body has the `.layout-v5` class (i.e. ?v=5).
 * ───────────────────────────────────────────────────────────────────────── */

/* Out-of-palette browser default focus ring (Chrome/Edge: blue auto) gets
 * replaced with amber site-wide. :focus-visible only — keyboard focus only,
 * mouse clicks don't show the ring. */
body.layout-v5 *:focus { outline: none; }
body.layout-v5 button:focus-visible,
body.layout-v5 input:focus-visible,
body.layout-v5 textarea:focus-visible,
body.layout-v5 a:focus-visible,
body.layout-v5 [tabindex]:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}

body.layout-v5 {
    /* surfaces */
    --bg:           #0e1014;
    --bg-elev-1:    #11141a;
    --bg-elev-2:    #161a22;
    --bg-topbar:    #11141a;
    --border:       #20242c;
    --border-soft:  #1a1d24;
    --border-strong:#2a3140;

    /* text */
    --text:         #dadde2;
    --text-strong:  #ffffff;
    --text-muted:   #8a8d97;
    --text-dim:     #5d6068;
    --text-vague:   #a0a4ad;

    /* accents */
    --amber:        #ffb648;
    --amber-on:     #1a1206;
    --now:          #ff7a4d;
    --green:        #79e09b;
    --red:          #f87171;

    /* radii */
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 10px;
    --r-pill: 99px;

    background: var(--bg);
    color: var(--text);
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 14px;
    margin: 0;
    min-height: 100vh;
    /* Document-level scroll — DO NOT add overflow:hidden here; sticky requires this. */
}

/* Visibility driven by body.authed (toggled by v5_topbar.js).
 * Using !important here because some elements still carry inline display:none
 * inherited from the auth flow; we want the body class to be the only switch. */
body.layout-v5 #main-content { display: none !important; }
body.layout-v5.authed #main-content { display: block !important; }
body.layout-v5.authed #login-screen { display: none !important; }

/* ─── Top bar ─── */
.v5-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 52px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    max-width: 1500px;       /* cap on wide monitors */
    margin-left: auto;
    margin-right: auto;
}
.v5-brand {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-strong);
    letter-spacing: -0.4px;
    margin-right: 6px;
}
.v5-brand-dot { color: var(--amber); }

.v5-top-stats {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    margin-left: 4px;
}
.v5-top-stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.v5-top-stat-lbl {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.v5-top-stat-val {
    font-size: 13px;
    color: var(--text-strong);
    font-weight: 600;
    font-family: "JetBrains Mono", ui-monospace, monospace;
}
#v5-stat-timebox { color: var(--amber); }
.v5-top-stat-dim {
    color: var(--text-dim);
    font-weight: 500;
}

.v5-top-right {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.v5-ghost-btn {
    background: transparent;
    color: var(--text-vague);
    border: 1px solid var(--border-strong);
    padding: 7px 12px;
    border-radius: var(--r-md);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.1s, border-color 0.1s;
}
.v5-ghost-btn:hover {
    color: var(--text-strong);
    border-color: var(--text-vague);
}
.v5-icon-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.v5-fast-add-btn {
    background: var(--amber);
    color: var(--amber-on);
    border: 0;
    padding: 7px 14px;
    border-radius: var(--r-md);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: filter 0.1s;
}
.v5-fast-add-btn:hover { filter: brightness(1.1); }

.v5-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-vague);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: color 0.1s, border-color 0.1s;
}
.v5-icon-btn:hover {
    color: var(--text-strong);
    border-color: var(--text-vague);
}

/* Plan-tomorrow badge in topbar */
.v5-planning-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1c2330;
    color: var(--text-strong);
    border: 1px solid #2a3140;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    font-size: 12px;
}
.v5-planning-badge button {
    background: var(--amber);
    color: var(--amber-on);
    border: 0;
    padding: 2px 8px;
    border-radius: var(--r-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* ─── Body — sticky-left + flowing-right ─── */
.v5-body {
    display: flex;
    align-items: flex-start;
    max-width: 1500px;       /* matches topbar cap */
    margin-left: auto;
    margin-right: auto;
    /* DO NOT set height: 100vh here — document-level scroll required for stickiness */
}

.v5-rail {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    min-width: 0;
    position: sticky;
    top: 52px;
    height: calc(100vh - 52px);
    overflow: hidden;
}
.v5-rail-head {
    padding: 20px 28px 14px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.v5-date-big {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-strong);
    letter-spacing: -0.4px;
}
.v5-date-sub {
    font-size: 12px;
    color: #8b8f99;
    margin-top: 4px;
}
.v5-rail-head-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.v5-hour-rail {
    flex: 1;
    overflow-y: auto;
    padding: 16px 28px 24px;
}
.v5-hour-grid {
    position: relative;
    padding-left: 56px;
}
.v5-hour-tick {
    position: relative;
    height: 90px;            /* matches PXMIN = 1.5 in v5_app.js */
    border-top: 1px solid var(--border-soft);
}
.v5-hour-lbl {
    position: absolute;
    left: -56px;
    top: -8px;
    width: 48px;
    font-size: 10px;
    color: var(--text-dim);
    font-family: "JetBrains Mono", monospace;
    text-align: right;
    padding-right: 8px;
}

/* Job blocks on the hour rail */
.v5-job-block {
    position: absolute;
    left: 0;
    right: 8px;
    background: #1c2330;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 6px 10px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: background 0.08s;
}
.v5-job-block:hover { background: #232a38; }
/* Live state: no block-level shading — the LIVE badge inside the controls
 * is the sole signal. */
.v5-job-block.is-live .v5-job-block-name { color: var(--text-strong); }
.v5-job-block.is-finished {
    background: #15171c;
    border-color: var(--border-soft);
    opacity: 0.55;
}
.v5-job-block.is-finished .v5-job-block-name {
    text-decoration: line-through;
    color: var(--text-dim);
}
/* Default-Live: no block-level amber fill (signal lives in the LIVE badge
 * inside the controls). Class kept for future per-state styling hooks. */
.v5-live-badge {
    font-size: 9px;
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.30);
    padding: 1px 6px;
    border-radius: 99px;
    letter-spacing: 0.06em;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    height: 14px;
}
/* Consumed: a Floating Dormant segment whose end is past NOW. Faded — not
 * struck-through (Finished owns the strike-through). Indicates "the day flowed
 * through here while you were on this." */
.v5-job-block.is-consumed {
    opacity: 0.7;
    background: #181c24;
    border-style: dashed;
    border-color: var(--border-soft);
}
.v5-job-block.is-consumed .v5-job-block-name {
    color: var(--text-vague);
}
.v5-job-block-time {
    font-size: 10px;
    color: #8b8f99;
    font-family: "JetBrains Mono", monospace;
}
.v5-job-block-name {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v5-job-block-notes {
    font-size: 11px;
    color: #8b8f99;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v5-job-block-stop {
    background: rgba(14, 16, 20, 0.85);   /* opaque-ish so it sits over jobs */
    border: 1px dashed var(--red);
    color: var(--red);
    font-size: 10px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    cursor: default;
    z-index: 6;            /* above job blocks (default z=1) and above now-line (z=5) */
    pointer-events: none;
    /* override the per-block left/width that the renderer sets on .v5-job-block */
    left: 0 !important;
    width: auto !important;
    right: 8px !important;
}
.v5-job-block-stop:hover { background: rgba(14, 16, 20, 0.85); }

/* Compact layout for blocks under ~36px tall.
 * Reduces padding and lays time + name + duration on a single line so
 * 20-30 minute jobs don't truncate their names completely. */
.v5-job-block.is-compact {
    padding: 3px 8px;
}
.v5-job-block-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.2;
    overflow: hidden;
}
.v5-job-block-inline .v5-job-block-time {
    flex-shrink: 0;
    color: #8b8f99;
}
.v5-job-block-inline .v5-job-block-name {
    flex: 1;
    min-width: 0;
    margin-top: 0;
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v5-job-block-inline .v5-job-block-dur {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--text-dim);
    font-family: "JetBrains Mono", monospace;
}
.v5-job-block.is-compact.is-finished .v5-job-block-name {
    color: var(--text-dim);
    text-decoration: line-through;
}
.v5-job-block.is-compact.is-live .v5-job-block-name {
    color: var(--text-strong);
}

/* Tick + star button group on every block */
.v5-job-ctrls {
    position: absolute;
    top: 4px;
    right: 6px;
    display: flex;
    gap: 4px;
    z-index: 2;
    opacity: 0.55;
    transition: opacity 0.1s;
}
.v5-job-block:hover .v5-job-ctrls,
.v5-job-block .v5-job-ctrls .is-on {
    opacity: 1;
}
.v5-job-tick, .v5-job-star {
    background: transparent;
    border: 0;
    color: var(--text-vague);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 1px 3px;
    border-radius: 3px;
    font-family: inherit;
}
.v5-job-tick:hover, .v5-job-star:hover {
    color: var(--text-strong);
    background: rgba(255,255,255,0.08);
}
.v5-job-star.is-on { color: var(--text-strong); }

/* "Finish + follow-up" button — marks Finished AND opens the follow-up
 * modal. Sits beside the tick. Hidden on already-Finished blocks. */
.v5-job-plus {
    background: transparent;
    border: 0;
    color: var(--text-vague);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: inherit;
    font-weight: 700;
}
.v5-job-plus:hover {
    color: var(--amber);
    background: rgba(255,182,72,0.10);
}
.v5-job-tick.is-on { color: var(--green); }

/* Generic v5 modal — used by edit-job, settings */
.v5-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2500;
    display: none;
    align-items: center;
    justify-content: center;
}
.v5-modal[style*="display:flex"], .v5-modal[style*="display: flex"] { display: flex !important; }
.v5-modal-content {
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    width: 460px;
    max-width: 92%;
    max-height: 86vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.v5-modal-head {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.v5-modal-title {
    color: var(--text-strong);
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}
.v5-modal-close {
    background: transparent;
    border: 0;
    color: var(--text-vague);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.v5-modal-close:hover { color: var(--text-strong); }
.v5-modal-body {
    padding: 16px 18px;
    overflow-y: auto;
}
.v5-modal-jobname {
    font-size: 14px;
    color: var(--text-strong);
    font-weight: 500;
    margin-bottom: 14px;
    word-wrap: break-word;
}
.v5-modal-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    font-size: 11px;
    color: var(--text-vague);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.v5-modal-label input,
.v5-modal-label textarea {
    background: var(--bg-elev-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-strong);
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13px;
    text-transform: none;
    letter-spacing: normal;
    font-weight: normal;
    resize: vertical;
}
.v5-modal-label input:focus,
.v5-modal-label textarea:focus {
    outline: 0;
    border-color: var(--amber);
}
.v5-modal-meta {
    font-size: 11px;
    color: var(--text-dim);
    font-family: "JetBrains Mono", monospace;
    margin-top: 4px;
}
.v5-modal-actions {
    display: flex;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
}
.v5-modal-btn {
    padding: 7px 14px;
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-vague);
}
.v5-modal-btn:hover {
    color: var(--text-strong);
    border-color: var(--text-vague);
}
.v5-modal-btn-primary {
    background: var(--amber);
    color: var(--amber-on);
    border-color: var(--amber);
    font-weight: 600;
}
.v5-modal-btn-primary:hover {
    background: var(--amber);
    color: var(--amber-on);
    filter: brightness(1.1);
}
.v5-modal-btn-danger {
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.3);
}
.v5-modal-btn-danger:hover {
    color: var(--red);
    border-color: var(--red);
    background: rgba(248, 113, 113, 0.08);
}

/* Busy banner — visible while a user-initiated mutation is in flight. */
.v5-busy-banner {
    position: fixed;
    top: 64px;
    right: 24px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 182, 72, 0.10);
    border: 1px solid var(--amber);
    color: var(--amber);
    padding: 6px 14px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}
.v5-busy-banner.is-active {
    opacity: 1;
    transform: translateY(0);
}
.v5-busy-spinner {
    display: inline-block;
    animation: v5-spin 0.9s linear infinite;
}
@keyframes v5-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Drop indicator — shown while dragging a hopper job over the rail */
.v5-drop-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px dashed var(--amber);
    color: var(--amber);
    font-size: 11px;
    font-family: "JetBrains Mono", monospace;
    pointer-events: none;
    z-index: 5;
    padding-left: 56px;
}
body.v5-dragging-hopper .v5-hopper-row { opacity: 0.6; }

/* Now-line + dot + label */
.v5-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px solid var(--now);
    z-index: 5;
}
.v5-now-dot {
    position: absolute;
    left: -6px;
    top: -7px;
    width: 12px;
    height: 12px;
    background: var(--now);
    border-radius: 99px;
}
.v5-now-lbl {
    position: absolute;
    right: 4px;
    top: -18px;
    color: var(--now);
    font-size: 10px;
    font-weight: 600;
    font-family: "JetBrains Mono", monospace;
}

/* ─── Right column ─── */
.v5-side {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.v5-section {
    border-bottom: 1px solid var(--border);
}
.v5-section.v5-hopper {
    background: #1c2330;
}
.v5-section-head {
    padding: 14px 22px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.v5-section-title {
    font-size: 12px;
    color: var(--text-strong);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.v5-section-meta {
    font-size: 11px;
    color: var(--text-dim);
    margin-left: auto;
}

/* Tracker tile */
.v5-tracker-summary {
    padding: 0 22px 10px;
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}
.v5-tracker-bars { padding: 0 22px 8px; }
.v5-tracker-bar {
    display: flex;
    height: 6px;
    border-radius: var(--r-pill);
    overflow: hidden;
    background: var(--border-soft);
}
.v5-tracker-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 12px 22px 14px;
}
.v5-tracker-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.v5-tracker-col-title {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 4px;
}
.v5-tracker-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 2px 0;
}
.v5-tracker-name {
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v5-tracker-time {
    color: var(--text-strong);
    font-weight: 500;
    font-family: "JetBrains Mono", monospace;
}
.v5-legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 99px;
    flex-shrink: 0;
}

/* Hopper container — page-scroll model. Hopper rows grow the page naturally;
 * Denis's ~3000 dormant jobs are filtered down to ~100 visible via the
 * "show all" toggle, so no internal overflow needed. */

/* "Show all 3015 (currently showing 100)" toggle */
.v5-hopper-more {
    margin: 8px 0;
    padding: 6px 10px;
    background: transparent;
    color: var(--text-vague);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    width: 100%;
}
.v5-hopper-more:hover {
    color: var(--text-strong);
    border-color: var(--text-vague);
}

/* Hopper rows */
.v5-hopper-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    margin-bottom: 4px;
    background: #1c2330;
    border: 1px solid #2a3140;
    border-radius: var(--r-md);
    cursor: grab;
}
.v5-hopper-row:hover { background: #232a38; }
.v5-hopper-row.sortable-ghost {
    opacity: 0.35;
    background: #1c2330;
}
.v5-hopper-handle {
    color: var(--border-strong);
    font-size: 14px;
    line-height: 1;
}
.v5-hopper-ord {
    font-size: 10px;
    color: var(--text-dim);
    font-family: "JetBrains Mono", monospace;
    min-width: 36px;
    text-align: right;
    flex-shrink: 0;
}
.v5-hopper-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v5-hopper-age {
    font-size: 10px;
    color: var(--text-dim);
    font-family: "JetBrains Mono", monospace;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
}
.v5-hopper-age:empty { display: none; }
.v5-hopper-dur {
    font-size: 11px;
    color: var(--text-dim);
    font-family: "JetBrains Mono", monospace;
}

/* Coach */
.v5-coach-dot {
    width: 6px;
    height: 6px;
    border-radius: 99px;
    background: var(--text-vague);
    display: inline-block;
}
.v5-coach-msgs {
    max-height: 30vh;
    overflow-y: auto;
    padding: 8px 22px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.v5-coach-new-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-vague);
    font-family: inherit;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    cursor: pointer;
}
.v5-coach-new-btn:hover {
    color: var(--text-strong);
    border-color: var(--text-vague);
}
.v5-coach-input-wrap {
    padding: 8px 22px;
    border-bottom: 1px solid var(--border-soft);
}
.v5-coach-input-box {
    background: var(--bg-elev-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.v5-coach-input {
    flex: 1;
    color: var(--text);
    font-size: 13px;
    background: transparent;
    border: 0;
    outline: 0;
    font-family: inherit;
}
.v5-coach-input::placeholder { color: #8b8f99; }
/* Kill the amber focus-visible outline on this specific input. The global
 * rule applies to all inputs for a11y; coach has its own focus signal via
 * the input-box border-within state below. */
body.layout-v5 .v5-coach-input:focus,
body.layout-v5 .v5-coach-input:focus-visible {
    outline: none !important;
    box-shadow: none;
}
/* Subtle focus-within on the parent box — replaces the amber outline. */
.v5-coach-input-box:focus-within {
    border-color: var(--border-strong);
}
/* type="search" UA artifacts (clear-x button, etc.) — suppress in WebKit. */
.v5-coach-input::-webkit-search-cancel-button,
.v5-coach-input::-webkit-search-decoration,
.v5-coach-input::-webkit-search-results-button,
.v5-coach-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}
/* Override Webkit autofill — Chrome/Safari paint the field white and inject a
 * username when their heuristics misfire. Force the dark theme. */
.v5-coach-input:-webkit-autofill,
.v5-coach-input:-webkit-autofill:hover,
.v5-coach-input:-webkit-autofill:focus,
.v5-coach-input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--bg-elev-1) inset;
    transition: background-color 600000s 0s, color 600000s 0s;
}
.v5-coach-kbd {
    font-size: 10px;
    color: var(--text-dim);
    background: #1c1f26;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: "JetBrains Mono", monospace;
}

/* Coach message bubbles */
.v5-msg-you {
    background: #1c2330 !important;
    border: 1px solid #2a3140 !important;
    color: #ffffff !important;
    padding: 8px 12px;
    border-radius: 10px 10px 4px 10px;
    font-size: 13px;
    line-height: 1.45;
    align-self: flex-end;
    max-width: 85%;
    white-space: pre-wrap;
    word-break: break-word;
}
.v5-msg-coach {
    background: var(--bg-elev-2);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px 10px 10px 4px;
    font-size: 13px;
    line-height: 1.45;
    align-self: flex-start;
    max-width: 92%;
    border: 1px solid var(--border);
    white-space: pre-wrap;
    word-break: break-word;
}
.v5-msg-coach.is-error {
    background: #3a1717;
    border-color: #5a2222;
    color: #ffb4b4;
}
/* URL citations from hosted web_search — chips beneath the assistant bubble */
.v5-coach-sources {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.v5-coach-source-chip {
    display: inline-block;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: var(--bg-elev-1);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    color: var(--text-vague);
    font-size: 11px;
    padding: 3px 10px;
    text-decoration: none;
    transition: color 0.1s, border-color 0.1s;
}
.v5-coach-source-chip:hover {
    color: var(--text-strong);
    border-color: var(--text-vague);
}

.v5-coach-tools-chip {
    font-size: 10px;
    color: var(--text-dim);
    font-family: "JetBrains Mono", monospace;
    margin-bottom: 2px;
    align-self: flex-start;
}
.v5-coach-proposal {
    margin-top: 8px;
    padding: 8px 10px;
    background: #1d2c1f;
    border: 1px solid #2a4a30;
    border-radius: var(--r-md);
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.v5-coach-proposal-text {
    flex: 1;
    min-width: 140px;
    color: #cfe9d3;
}
.v5-coach-proposal-label {
    font-size: 10px;
    color: #7aa380;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}
.v5-coach-btn-confirm {
    padding: 5px 12px;
    background: var(--amber);
    color: var(--amber-on);
    border: 0;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 11px;
    font-family: inherit;
}
.v5-coach-btn-cancel {
    padding: 5px 11px;
    background: transparent;
    color: var(--text-vague);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
}

/* Priorities saved indicator */
body.layout-v5 #priorities-saved-indicator.saving,
body.layout-v5 #longer-term-priorities-saved-indicator.saving { color: var(--text-vague); }
body.layout-v5 #priorities-saved-indicator.saved,
body.layout-v5 #longer-term-priorities-saved-indicator.saved { color: var(--green); }

/* Priorities */
.v5-prio {
    padding: 10px 22px 12px;
    border-bottom: 1px solid var(--border);
}
.v5-prio-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 4px;
}
.v5-prio-textarea {
    width: 100%;
    background: transparent;
    border: 0;
    color: var(--text-vague);
    font-family: inherit;
    font-size: 12px;
    line-height: 1.6;
    padding: 0;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
}
.v5-prio-textarea:focus {
    color: var(--text);
}
.v5-prio-long .v5-prio-textarea {
    color: #8b8f99;
    font-style: italic;
}
.v5-saved {
    font-size: 10px;
    color: var(--text-dim);
}

/* Hopper */
.v5-hopper-list {
    padding: 0 22px 12px;
    display: flex;
    flex-direction: column;
}

/* hide modal overlay backgrounds inherited from styles.css for v5 */
body.layout-v5 #planning-banner { /* override v1 styles when v5 */
    background: transparent;
    border-left: 0;
    padding: 0;
    color: inherit;
}

/* ─── V1 style overrides ─────────────────────────────────────────────────
 * styles.css targets these IDs directly with v1's bright-blue/purple palette.
 * In v5 the same IDs still need to exist (so existing JS wiring keeps
 * working) but they should adopt the v5 ghost / amber styling. */

/* v1 paints #right-column and .job-content with #2a2a2a (warm grey).
 * That bleeds through inside the v5 hopper. Strip it (background only). */
body.layout-v5 .v5-hopper #right-column,
body.layout-v5 .v5-hopper .job-content {
    background: transparent !important;
    background-color: transparent !important;
}
body.layout-v5 .v5-hopper #right-column {
    border-radius: 0 !important;
}

body.layout-v5 #import-calendar-button,
body.layout-v5 #refresh-button,
body.layout-v5 #add-fixed-button,
body.layout-v5 #add-floating-button,
body.layout-v5 #add-defaults-button,
body.layout-v5 #plan-tomorrow-button,
body.layout-v5 #button-container button {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--text-vague) !important;
    border: 1px solid var(--border-strong) !important;
    padding: 7px 12px !important;
    border-radius: var(--r-md) !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    box-shadow: none !important;
    animation: none !important;
    margin: 0 !important;
    transform: none !important;
}
body.layout-v5 #import-calendar-button:hover,
body.layout-v5 #refresh-button:hover,
body.layout-v5 #add-fixed-button:hover,
body.layout-v5 #add-floating-button:hover,
body.layout-v5 #add-defaults-button:hover,
body.layout-v5 #plan-tomorrow-button:hover,
body.layout-v5 #button-container button:hover {
    color: var(--text-strong) !important;
    border-color: var(--text-vague) !important;
    background: transparent !important;
    transform: none !important;
}

/* Fast Add stays amber (v1 was purple) */
body.layout-v5 #fast-add-button {
    background: var(--amber) !important;
    background-color: var(--amber) !important;
    color: var(--amber-on) !important;
    border: 0 !important;
    padding: 7px 14px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: var(--r-md) !important;
    box-shadow: none !important;
    animation: none !important;
}
body.layout-v5 #fast-add-button:hover {
    filter: brightness(1.1);
    background: var(--amber) !important;
    background-color: var(--amber) !important;
    color: var(--amber-on) !important;
    transform: none !important;
}

/* The body shouldn't horizontally scroll — keep things contained */
body.layout-v5 {
    overflow-x: hidden;
}

/* ─── Auth flow (login screen + modals) ──────────────────────────────────
 * Carried over from the inline <style> block in templates/index.html so the
 * v5 template gets the same overlay/modal behaviour. */

body.layout-v5 .login-screen {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
body.layout-v5 .login-screen.show { display: flex; }
body.layout-v5 .login-screen-message {
    text-align: center;
    color: var(--text-strong);
    padding: 20px;
}
body.layout-v5 .login-screen-message h2 {
    color: var(--text-strong);
    font-size: 22px;
    margin: 0;
    font-weight: 500;
}

body.layout-v5 .login-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
}
body.layout-v5 .login-modal-content {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--bg-elev-2);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    width: 400px;
    max-width: 90%;
}
body.layout-v5 .login-modal-content h2 {
    color: var(--text-strong);
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
}
body.layout-v5 .login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
body.layout-v5 .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
body.layout-v5 .form-group label {
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
}
body.layout-v5 .form-group input {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-elev-1);
    color: var(--text-strong);
    font-family: inherit;
    font-size: 13px;
}
body.layout-v5 .form-group input:focus {
    outline: 0;
    border-color: var(--amber);
}
body.layout-v5 .login-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}
body.layout-v5 .auth-button {
    padding: 8px 16px;
    border: none;
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
}
body.layout-v5 .login-button {
    background: var(--amber);
    color: var(--amber-on);
    font-weight: 600;
}
body.layout-v5 .login-button:hover { filter: brightness(1.1); }
body.layout-v5 .error-message {
    color: var(--red);
    font-size: 12px;
    margin-top: 4px;
}
body.layout-v5 .v5-topbar {
    flex-wrap: wrap;
    row-gap: 8px;
}
body.layout-v5 .v5-top-stats {
    flex-wrap: wrap;
    row-gap: 6px;
}
