/* Page-header buttons and the intro icon — ONE definition for every dashboard
   page of both sides (ticket ff24f1e6, 2026-11-22). Loaded by templates/base.html.
   Plain CSS on purpose: no Tailwind rebuild, and no page may restyle these names.

   Buttons (on <a> or <button>):
     .tp-head-btn .tp-head-btn--primary   flat orange, white label
     .tp-head-btn .tp-head-btn--outline   white ground, orange rim, dark orange label
     .tp-head-split > .tp-head-btn.tp-head-split__main + .tp-head-btn.tp-head-split__toggle
                                          "+ Add ▾"; the chevron is .tp-head-split__chevron
                                          (.is-open turns it)
   One shape for all of them: pill, 14px / 600, no glow, no lift, 40px high
   from 640px. The class sets display:
   hide or show one with a wrapper or a page rule of higher specificity, not a
   display utility such as `hidden` on the button itself (this sheet loads after
   output.css and wins over it).

   Intro icon (templates/components/section_intro_icon.html):
     .tp-intro-icon   a small outlined play mark next to the page title

   ── Round 34 (ticket 7789407b, 2026-11-23): ONE header size on phones, ONE
   segmented toggle, ONE back link, ONE title icon, ONE select chevron. Other
   pages USE these names; keep them stable and never restyle them per page.

     PHONES (max-width: 639px)
       .tp-head-btn            38px visible, 44px tap area (an invisible ::after
                               3px above and below), 14px / 500 (medium), 15px
                               side padding, 1px rim, 16px icons
       .tp-head-split__toggle  slim arrow half: 32px wide, 14px chevron, a 1px
                               divider at 35% white
     FROM 640px                unchanged: 40px, 14px / 600, 18px side padding,
                               1.5px rim
     .tp-head-actions          a row of header buttons: 8px gap, wraps; buttons
                               keep their content width (never stretched)
     .tp-seg > .tp-seg__item (.is-current on the current one; a <span
                               aria-current="page"> or an <a>)
                               segmented toggle (Track | Write, Finder | Platform):
                               the buttons' height (38px phones, 40px from 640px,
                               44px tap area), 14px / 500 on every segment; the
                               current segment fills the full height (no inner
                               gap), white with a 1px rim in day colours, #3A3944
                               with white text at night; full width on phones,
                               content width from 640px; 12px below the line above
     .tp-back-link             "Back to Dashboard" (templates/components/
                               desk_back_link.html): top left, every width, 13px /
                               600 muted, 44px tap height on phones
     .tp-page-title            the title row: .tp-page-icon + <h1> + intro icon;
                               h1 24px / 700
     .tp-page-icon             20px line icon in front of the title, in the
                               dashboard tile's colour (--opportunities,
                               --applications, --crm, --tasks, --calendar,
                               --files, --prompts); drawn by templates/components/
                               desk_page_icon.html
     .tp-page-sub              the sub-line under the title, 14px muted
     .tp-select-chevron        a <select> with appearance:none and the Search
                               Profile's chevron (14px, 13px from the right edge)

   Header order on a page with a toggle: back link → title + sub-line → toggle →
   the current tab's actions → content. Actions valid for both tabs stay on the
   title row. */

.tp-head-btn {
    box-sizing: border-box;
    position: relative; /* holds the phone tap-area ::after */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    height: 40px;
    min-height: 40px;
    padding: 0 1.125rem;
    border: 1.5px solid transparent;
    border-radius: 9999px;
    background-image: none;
    box-shadow: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: normal;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transform: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.tp-head-btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.tp-head-btn:hover,
.tp-head-btn:active {
    transform: none;
    box-shadow: none;
    text-decoration: none;
}
.tp-head-btn:focus {
    outline: none;
}
.tp-head-btn:focus-visible {
    outline: 2px solid rgba(216, 90, 48, .6);
    outline-offset: 2px;
}
/* `hidden` (attribute or the plain utility) still hides; responsive display
   utilities (sm:hidden …) need a wrapper, see the note at the top. */
.tp-head-btn[hidden],
.tp-head-btn.hidden,
.tp-head-split[hidden],
.tp-head-split.hidden {
    display: none;
}
.tp-head-btn:disabled,
.tp-head-btn[aria-disabled="true"] {
    opacity: .5;
    cursor: not-allowed;
}

.tp-head-btn--primary {
    background-color: #D85A30; /* tp-orange */
    border-color: #D85A30;
    color: #fff;
}
.tp-head-btn--primary:hover:not(:disabled):not([aria-disabled="true"]) {
    background-color: #C24E27;
    border-color: #C24E27;
    color: #fff;
}

.tp-head-btn--outline {
    background-color: #fff;
    border-color: #D85A30;
    color: #B4521A; /* 5:1 on white */
}
.tp-head-btn--outline:hover:not(:disabled):not([aria-disabled="true"]) {
    background-color: #FFF4EC;
    color: #9A4515;
}

/* Split button: two halves of one pill, the same height and colour. */
.tp-head-split {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    flex-shrink: 0;
}
.tp-head-split__main {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.tp-head-split__toggle {
    min-width: 40px;
    padding: 0 .625rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left-color: rgba(255, 255, 255, .5);
    border-left-width: 1px;
}
.tp-head-split__chevron {
    width: .875rem !important;
    height: .875rem !important;
    transition: transform .15s ease;
}
.tp-head-split__chevron.is-open {
    transform: rotate(180deg);
}

/* Intro icon: a thin outlined play mark, muted, no disc. */
.tp-intro-icon {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: #776981; /* tp-muted: 4.9:1 on white, above the 3:1 an icon needs */
    cursor: pointer;
    transition: color .15s ease;
}
.tp-intro-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}
.tp-intro-icon:hover {
    color: #D85A30;
}
.tp-intro-icon:focus {
    outline: none;
}
.tp-intro-icon:focus-visible {
    outline: 2px solid rgba(216, 90, 48, .6);
    outline-offset: 1px;
    color: #D85A30;
}

/* ── Round 34 shared pieces (names and sizes: the note at the top) ── */
.tp-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.tp-head-actions > .tp-head-btn,
.tp-head-actions > .tp-head-split {
    flex: 0 0 auto;
}
/* Actions of the current tab sit 12px under the toggle. */
.tp-seg + .tp-head-actions {
    margin-top: 12px;
}

.tp-seg {
    box-sizing: border-box;
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    height: 40px;
    margin-top: 12px;
    padding: 0;
    border-radius: 9999px;
    background: #EAE5EE;
    overflow: visible;
}
.tp-seg__item {
    box-sizing: border-box;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-width: 6.5rem;
    height: 100%;
    margin: 0;
    padding: 0 1.25rem;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    color: #6E6378;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
a.tp-seg__item:hover {
    color: #493657;
    background: rgba(255, 255, 255, .5);
    text-decoration: none;
}
/* The current segment: medium like the rest (14px / 500), white on the violet track.
   A 1px rim in the track's own colour keeps the track's end visible where a white
   current segment meets a white page (Platform's right end) — a rim, not a glow. */
.tp-seg__item.is-current {
    background: #fff;
    border: 1px solid #D6CEDD;
    color: #2D2235;
    font-weight: 500;
    box-shadow: none;
}
.tp-seg__item:focus {
    outline: none;
}
.tp-seg__item:focus-visible {
    outline: 2px solid rgba(216, 90, 48, .7);
    outline-offset: 2px;
}

.tp-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 .75rem;
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25rem;
    color: #776981;
    text-decoration: none;
    cursor: pointer;
    transition: color .15s ease;
}
/* A section of the dashboard page (Finder, Pocket CRM: the button form of
   desk_back_link.html) starts 24px higher than a Desk page from 640px (py-4 against
   pt-10); this lines its back link up with every other Desk page. */
.tp-back-link.tp-back-link--section {
    margin-top: 24px;
}
.tp-back-link svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.tp-back-link:hover {
    color: #D85A30;
    text-decoration: none;
}
.tp-back-link:focus {
    outline: none;
}
.tp-back-link:focus-visible {
    outline: 2px solid rgba(216, 90, 48, .6);
    outline-offset: 2px;
    border-radius: 6px;
}

.tp-page-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
    max-width: 100%;
}
.tp-page-title h1,
.tp-page-title h2 {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
    margin: 0;
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    color: #111827;
}
.tp-page-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #493657;
}
.tp-page-icon--opportunities { color: #D85A30; }
.tp-page-icon--applications { color: #493657; }
.tp-page-icon--crm { color: #059669; }
.tp-page-icon--tasks { color: #D97706; }
.tp-page-icon--calendar { color: #0284C7; }
.tp-page-icon--files { color: #493657; }
.tp-page-icon--prompts { color: #493657; }
.tp-page-sub {
    margin: .25rem 0 0;
    font-size: .875rem;
    line-height: 1.25rem;
    color: #6B7280;
}

.tp-select-chevron {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23776981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 14px 14px;
    cursor: pointer;
}
.tp-select-chevron::-ms-expand {
    display: none;
}

@media (max-width: 639px) {
    /* 38px visible, 44px to the finger: the ::after reaches 3px above and below. */
    .tp-head-btn {
        height: 38px;
        min-height: 38px;
        padding: 0 15px;
        border-width: 1px;
        font-size: 14px;
        font-weight: 500;
    }
    .tp-head-btn::after {
        content: "";
        position: absolute;
        top: -3px;
        right: 0;
        bottom: -3px;
        left: 0;
    }
    .tp-head-btn svg {
        width: 16px;
        height: 16px;
    }
    .tp-head-split__toggle {
        min-width: 32px;
        padding: 0 8px;
        border-left-width: 1px;
        border-left-color: rgba(255, 255, 255, .35);
    }
    .tp-head-split__toggle .tp-head-split__chevron {
        width: 14px !important;
        height: 14px !important;
    }
    .tp-seg {
        display: flex;
        width: 100%;
        height: 38px;
    }
    .tp-seg__item {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 .75rem;
    }
    .tp-seg__item::after {
        content: "";
        position: absolute;
        top: -3px;
        right: 0;
        bottom: -3px;
        left: 0;
    }
    .tp-back-link {
        min-height: 44px;
        margin: -.75rem 0 0;
    }
    /* A section of the dashboard page (Finder, Pocket CRM) starts 8px higher than a
       Desk page (py-4 against pt-6): the back link makes up the difference, so it
       sits at the same place on every Desk page. */
    .tp-back-link.tp-back-link--section {
        margin-top: calc(-.75rem + 8px);
    }
    /* 44px tap target around the 20px mark; the negative margin keeps the
       title row as tight as before. */
    .tp-intro-icon {
        width: 44px;
        height: 44px;
        margin: -8px;
    }
}

/* Body buttons on the creative Desk (founder 2026-11-22: "the same flat orange
   without glow everywhere on the Desk, so header and body buttons match").
   Only the fill, the glow and the hover lift are set: each button keeps its own
   size, radius, type, focus and disabled look (.btn:disabled, .opp-search-now[disabled]).
     .agent-dashboard .btn-primary      the dashboard's tab buttons (Search now, Edit
                                        portfolio, Generate Letter, Add Contact, Find Clients …)
     .artist-interface .tp-pill-primary the pill of input.css ("Find new clients")
   Scoped to the creative shell's <main> / the dashboard root on purpose: public
   pages, the community and the admin panel keep their own buttons. */
.artist-interface .tp-pill-primary,
.agent-dashboard .btn-primary {
    background-color: #D85A30; /* tp-orange */
    background-image: none;
    color: #fff;
    box-shadow: none;
    transform: none;
}
.artist-interface .tp-pill-primary:hover:not(:disabled),
.agent-dashboard .btn-primary:hover:not(:disabled) {
    background-color: #C24E27;
    background-image: none;
    color: #fff;
    box-shadow: none;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .tp-head-btn,
    .tp-intro-icon,
    .tp-head-split__chevron,
    .tp-seg__item,
    .tp-back-link {
        transition: none;
    }
}

/* Night colours inside the app (creative side, docs/AGENCY_DARK_MODE.md):
   the orange fill stays; the outline gets the night surface. */
html[data-theme="dark"] .tp-head-btn--outline {
    background-color: #18181C;
    border-color: #E9693D;
    color: #F0A06B;
}
html[data-theme="dark"] .tp-head-btn--outline:hover:not(:disabled):not([aria-disabled="true"]) {
    background-color: rgba(233, 122, 48, .14);
    color: #F5B88E;
}
html[data-theme="dark"] .tp-intro-icon {
    color: #A79DB0;
}
html[data-theme="dark"] .tp-intro-icon:hover,
html[data-theme="dark"] .tp-intro-icon:focus-visible {
    color: #E9693D;
}

/* Night (round 34): the track is the dark ground, the current segment clearly
   lighter with white medium text, the others muted. */
html[data-theme="dark"] .tp-seg {
    background: #1F1F25;
}
html[data-theme="dark"] .tp-seg__item {
    color: #A79DB0;
}
html[data-theme="dark"] a.tp-seg__item:hover {
    color: #ECEBEF;
    background: rgba(255, 255, 255, .06);
}
html[data-theme="dark"] .tp-seg__item.is-current {
    background: #3A3944;
    border-color: #3A3944;
    color: #fff;
    font-weight: 500;
    box-shadow: none;
}
html[data-theme="dark"] .tp-back-link,
html[data-theme="dark"] .tp-page-sub {
    color: #A79DB0;
}
html[data-theme="dark"] .tp-back-link:hover {
    color: #F0A06B;
}
html[data-theme="dark"] .tp-page-title h1,
html[data-theme="dark"] .tp-page-title h2 {
    color: #ECEBEF;
}
html[data-theme="dark"] .tp-page-icon--applications,
html[data-theme="dark"] .tp-page-icon--files,
html[data-theme="dark"] .tp-page-icon--prompts {
    color: #ECEBEF;
}
html[data-theme="dark"] .tp-page-icon--crm { color: #34D399; }
html[data-theme="dark"] .tp-page-icon--tasks { color: #FBBF24; }
html[data-theme="dark"] .tp-page-icon--calendar { color: #38BDF8; }
html[data-theme="dark"] .tp-page-icon--opportunities { color: #E9693D; }
html[data-theme="dark"] .tp-select-chevron {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A79DB0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
}
