/* ===== Blazor defaults (template) ===== */
h1:focus { outline: none; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred."; }
.darker-border-checkbox.form-check-input { border-color: #929292; }

/* ===== App base ===== */
:root {
    --c-bg: #f4f5f7;
    --c-surface: #ffffff;
    --c-border: #e5e7eb;
    --c-text: #1f2937;
    --c-muted: #6b7280;
    --c-header-bg: #0F1729;
    --c-header-text: #ffffff;
    --c-accent: #16A34A;   /* Bryan-green "go" color — same green as the modal Save (.btn-save), unifying primary actions/focus/selected */

    /* CARD_DESIGN.md §1 palette */
    --green-bg:  #D1FADF; --green-text:  #027A48;
    --blue-bg:   #DBEAFE; --blue-text:   #1E40AF;
    --amber-bg:  #FEF3C7; --amber-text:  #92400E;
    --red-bg:    #FEE2E2; --red-text:    #B91C1C;
    --purple-bg: #EEEDFE; --purple-text: #534AB7;
    --navy-bg:   #534AB7; --navy-text:   #ffffff;
    --gray-bg:   #f3f4f6; --gray-text:   #4b5563;
    --slate-bg:  #E2E8F0; --slate-text:  #475569;

    /* Slice 8 — FunctionalArea swatch slots (curated; opt-in per-FA color). Green reuses
       --green-* above. Collisions with Bryan-shaped dimensions accepted as opt-in risk. */
    --teal-bg:   #CCFBF1; --teal-text:   #0F766E;
    --cyan-bg:   #CFFAFE; --cyan-text:   #0E7490;
    --lime-bg:   #ECFCCB; --lime-text:   #4D7C0F;
    --rose-bg:   #FCE7F3; --rose-text:   #9D174D;
    --orange-bg: #FFEDD5; --orange-text: #C2410C;
    --indigo-bg: #E0E7FF; --indigo-text: #4338CA;
    --brown-bg:  #EFE4D8; --brown-text:  #78350F;
    --pink-bg:   #FAE8FF; --pink-text:   #A21CAF;
    --sand-bg:   #FAEEDC; --sand-text:   #92702A;
}

html, body {
    margin: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /* CARD_DESIGN_V2.md ADDENDUM A.2 — comfortable reading size + relaxed line-height to match Bryan's feel. */
    font-size: 15px;
    line-height: 1.5;
}

/* ===== Badge palette per CARD_DESIGN §1 ===== */
/* CARD_DESIGN_V2.md ADDENDUM A.1: every badge IS clickable — affordance lives here,
   wiring (badge → board filter) lands in Chunk 3 when the filter system exists. */
.badge {
    display: inline-flex;
    align-items: baseline;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.5;
    white-space: nowrap;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter 0.1s ease, transform 0.1s ease;
    user-select: none;
}
.badge:hover  { filter: brightness(0.93); }
.badge:active { filter: brightness(0.86); transform: translateY(1px); }
.badge:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 1px;
}
.badge .badge-sub {
    margin-left: 4px;
    font-weight: 400;
    opacity: 0.78;
    text-transform: none;
}
.badge .badge-sub em { font-style: italic; }

/* Product — navy fill, white text */
.badge-product { background: var(--navy-bg); color: var(--navy-text); }

/* Functional Area — default green. Per-FA color (Slice 8) is layered via the .badge-color-*
   modifier classes below: the Badge component emits e.g. "badge-functionalarea badge-color-teal"
   and the modifier — later in source, equal specificity — wins. Only the FA badge passes
   ColorKind, so Type/State/Priority/Visibility/Product are untouched. */
.badge-functionalarea { background: var(--green-bg); color: var(--green-text); }
.badge-color-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-color-teal   { background: var(--teal-bg);   color: var(--teal-text); }
.badge-color-cyan   { background: var(--cyan-bg);   color: var(--cyan-text); }
.badge-color-lime   { background: var(--lime-bg);   color: var(--lime-text); }
.badge-color-rose   { background: var(--rose-bg);   color: var(--rose-text); }
.badge-color-orange { background: var(--orange-bg); color: var(--orange-text); }
.badge-color-indigo { background: var(--indigo-bg); color: var(--indigo-text); }
.badge-color-brown  { background: var(--brown-bg);  color: var(--brown-text); }
.badge-color-pink   { background: var(--pink-bg);   color: var(--pink-text); }
.badge-color-sand   { background: var(--sand-bg);   color: var(--sand-text); }
/* Gate 2d C2: neutral fallback when an FA's color is null (deactivated-but-referenced edge). */
.badge-color-neutral { background: var(--gray-bg); color: var(--gray-text); }

/* InitiativeType — Slice 7: uniform slate across all six (one color per dimension).
   Type badges are our addition (Bryan's tool doesn't render Type on the card face);
   slating them avoids duplicating the Bryan-shaped palette and fixes the FA-vs-Type
   "Infrastructure" twin-pill collision (Card #5) + the two-green case (Card #6). */
.badge-type-bug,
.badge-type-hardening,
.badge-type-newfeature,
.badge-type-clientcommitment,
.badge-type-salesenablement,
.badge-type-infrastructure { background: var(--slate-bg); color: var(--slate-text); }

/* PrimaryState — blue universal per palette */
.badge-state { background: var(--blue-bg); color: var(--blue-text); }

/* Priority — amber, but Critical → red per palette */
.badge-priority          { background: var(--amber-bg); color: var(--amber-text); }
.badge-priority-critical { background: var(--red-bg);   color: var(--red-text); }

/* Visibility — Internal red, Public green, ClientSpecific purple */
.badge-visibility-internal       { background: var(--red-bg);    color: var(--red-text); }
.badge-visibility-public         { background: var(--green-bg);  color: var(--green-text); }
.badge-visibility-clientspecific { background: var(--purple-bg); color: var(--purple-text); }

/* CARD_DESIGN_V2.md §3.1 — Internal-description textarea pale-yellow tint.
   Lives in global app.css (not scoped) because <InputTextArea> renders its own
   <textarea> which doesn't inherit the parent component's scope attribute. */
.desc-input-internal {
    background: #FFFBEB !important;
}

/* ===== Form controls (global — Blazor InputText/InputTextArea/InputSelect render
   their own <input>/<textarea>/<select> which don't carry the parent .razor.css
   scope attribute, so atomic control styles must live here, not in scoped CSS). ===== */
.form-input {
    width: 100%;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    padding: 10px 13px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--c-text);
    box-sizing: border-box;
    line-height: 1.5;
}
.form-input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}
.form-textarea {
    resize: vertical;
    min-height: 96px;
    white-space: pre-wrap;
    line-height: 1.55;
}

.form-label {
    font-size: 13.5px;
    color: var(--c-muted);
    font-weight: 500;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.form-label em {
    color: var(--red-text);
    font-style: normal;
}

.form-hint {
    font-size: 11px;
    color: var(--c-muted);
    margin-top: 4px;
    font-style: italic;
}

.validation-message {
    color: var(--red-text);
    font-size: 12px;
    margin-top: 4px;
}

.form-alert {
    background: var(--red-bg);
    color: var(--red-text);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
}

/* Buttons */
.btn-secondary {
    background: transparent;
    color: var(--c-text);
    border: 1px solid var(--c-border);
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.btn-secondary:hover:not(:disabled) { background: var(--c-bg); }
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-link-dark {
    background: transparent;
    color: var(--c-muted);
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
}
.btn-link-dark:hover { color: var(--c-text); text-decoration: underline; }

/* CARD_DESIGN_V2.md §2 — Save is solid green (Bryan's tool), replaces the V1 purple. */
.btn-save {
    background: #16A34A;
    color: #fff;
    border: none;
    padding: 9px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-save:hover:not(:disabled) { background: #15803D; }
.btn-save:disabled { opacity: 0.55; cursor: not-allowed; }

/* Slice 4 (corrected): Discard for unsaved drafts only. Red so it reads as destructive,
   but distinct from a future Cancel action on a saved card (which is workflow, not delete). */
.btn-danger {
    background: transparent;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.btn-danger:hover:not(:disabled) { background: #fef2f2; border-color: #b91c1c; }
.btn-danger:disabled { opacity: 0.55; cursor: not-allowed; }

.discard-confirm {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 8px 12px;
}
.discard-confirm-msg {
    flex: 1;
    color: #7f1d1d;
    font-size: 14px;
    font-weight: 500;
}

/* ===== App chrome — shared shell + navy header (Slice 8 Gate 2d A1) =====
   Moved here from Board.razor.css so Board AND the Manage page render the same
   navy header bar + Settings dropdown. (Login does not use these.) */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
    background: var(--c-header-bg);
    color: var(--c-header-text);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.app-header-left, .app-header-right { display: flex; align-items: center; gap: 12px; }
.app-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: 0.01em; }
.app-subtitle {
    color: rgba(255,255,255,0.65);
    font-size: 12px;
    border-left: 1px solid rgba(255,255,255,0.2);
    padding-left: 12px;
}
.who { color: rgba(255,255,255,0.85); font-size: 13px; }

.btn-primary {
    background: var(--c-accent);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: #15803D; }   /* darker green, matches .btn-save:hover */
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-link {
    background: transparent;
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
}
.btn-link:hover { border-color: rgba(255,255,255,0.6); }

/* Header-parity slice — Bryan's two-row top nav (Board only). New classes; .app-header
   (admin pages) is left untouched. Bar 1 navy = brand + built actions; Bar 2 light = built
   filter/display controls; then the "Initiatives  X/83" title row. */
.nav-bar1 {
    background: var(--c-header-bg);
    color: var(--c-header-text);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.nav-brand, .nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-logo { color: var(--c-accent); flex-shrink: 0; display: block; }   /* green line-chart mark */

.nav-bar2 {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 8px 24px;
    display: flex;
    justify-content: flex-start;   /* cluster the built controls on the left for now (Chunk 3 sets final layout) */
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: var(--c-text);
}
.nav-bar2 .board-filter,
.nav-bar2 .board-sort {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--c-text); cursor: pointer; user-select: none;
}
.nav-bar2 .board-filter > span,
.nav-bar2 .board-sort > span { font-size: 12px; color: var(--c-muted); }
.nav-bar2 .board-filter .form-input,
.nav-bar2 .board-sort .form-input { padding: 4px 8px; font-size: 13px; width: auto; }
/* Cap the filter selects so a long Customer name can't balloon the bar; the closed control
   truncates, the open native list still shows full names. */
.nav-bar2 .board-filter .form-input { max-width: 180px; }
.nav-bar2 .board-sort { margin-left: auto; }   /* push Sort to the right of the filter cluster */

/* Bryan-style tab strip: full-width light bottom border, "Initiatives" as the active tab with a
   green underline indicator (sets up the future View switcher), progress pill far-right. */
.board-tabs {
    display: flex; align-items: flex-end; justify-content: space-between;
    border-bottom: 1px solid var(--c-border);
    padding: 0 24px;
}
.board-tabs-left { display: flex; align-items: flex-end; gap: 4px; }
.board-tab {
    font-size: 14px; font-weight: 600; color: var(--c-muted);
    padding: 12px 4px 10px; margin-bottom: -1px;
    border-bottom: 2px solid transparent; cursor: default;
}
.board-tab-active { color: var(--c-text); border-bottom-color: var(--c-accent); }
.progress-pill {
    align-self: center;
    font-size: 12px; font-weight: 700; color: #fff;
    background: var(--c-accent);
    border-radius: 999px; padding: 3px 11px; font-variant-numeric: tabular-nums;
}

/* Settings dropdown (toggle + transparent backdrop closes on outside-click). */
.settings-menu { position: relative; display: inline-flex; }
.dropdown-backdrop { position: fixed; inset: 0; z-index: 50; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 51;
    margin-top: 6px;
    min-width: 200px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    padding: 4px;
}
.dropdown-item { display: block; padding: 8px 12px; border-radius: 6px; font-size: 13px; color: var(--c-text); text-decoration: none; }
.dropdown-item:hover { background: var(--c-bg); }
.dropdown-divider { height: 1px; background: var(--c-border); border: 0; margin: 5px -4px; }

.muted { color: var(--c-muted); }

/* Slice 11 — drag-to-reorder */
.drag-handle {
    cursor: grab; color: var(--c-muted); font-size: 14px; line-height: 1;
    padding: 2px 4px; margin-right: 2px; user-select: none; border-radius: 4px;
}
.drag-handle:hover { background: var(--c-bg); color: var(--c-text); }
.drag-handle:active { cursor: grabbing; }
.drag-handle.disabled { opacity: 0.25; cursor: default; pointer-events: none; }

.card.sortable-ghost  { opacity: 0.4; border: 1px dashed var(--c-accent); }
.card.sortable-chosen { box-shadow: 0 0 0 2px var(--c-accent); }
.card.sortable-drag   { opacity: 0.9; }

/* Color swatch fills (Slice 8) — global so both the Manage table rows and the
   ColorSwatchPicker component can render them. Layout of swatches stays scoped. */
.swatch {
    display: inline-block;
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    flex: none;
}
.swatch-green  { background: var(--green-bg); }
.swatch-teal   { background: var(--teal-bg); }
.swatch-cyan   { background: var(--cyan-bg); }
.swatch-lime   { background: var(--lime-bg); }
.swatch-rose   { background: var(--rose-bg); }
.swatch-orange { background: var(--orange-bg); }
.swatch-indigo { background: var(--indigo-bg); }
.swatch-brown  { background: var(--brown-bg); }
.swatch-pink   { background: var(--pink-bg); }
.swatch-sand   { background: var(--sand-bg); }
