/* P3 header account entry — Dashboard + Watchlist.
   Sits inside the existing header action cluster and never changes its layout:
   it is one more inline flex item, 44px tall, collapsing to an icon on phones. */

.p3-account-entry {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    min-width: 44px;
    padding: 0 12px;
    border: 1px solid rgba(94, 242, 230, 0.24);
    border-radius: 9px;
    background: rgba(94, 242, 230, 0.06);
    color: #e8f6f7;
    font: 600 12px/1 'Inter', system-ui, sans-serif;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 420px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.p3-account-entry:hover,
.p3-account-entry:focus-visible {
    border-color: rgba(94, 242, 230, 0.55);
    background: rgba(94, 242, 230, 0.11);
    color: #e8f6f7;
    text-decoration: none;
    outline: none;
}
.p3-account-entry:focus-visible {
    outline: 2px solid #5ef2e6;
    outline-offset: 2px;
}

.p3-account-entry__icon {
    color: #5ef2e6;
    font-size: 13px;
    line-height: 1;
    flex: 0 0 auto;
}

.p3-account-entry__text {
    display: inline-flex;
    --p3-entry-label: 1;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.p3-account-entry__lines {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.p3-account-entry__label {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 168px;
}

/* Second line: tier · source · until date, from GET /accounts/me. */
.p3-account-entry__status {
    font: 500 9.5px/1.15 'JetBrains Mono', ui-monospace, monospace;
    letter-spacing: 0.01em;
    color: #a8c1c9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 330px;
}
.p3-account-entry__meta { display: none; }

.p3-account-entry__badge {
    font: 700 9.5px/1 'JetBrains Mono', ui-monospace, monospace;
    letter-spacing: 0.06em;
    padding: 3px 6px;
    border-radius: 999px;
    border: 1px solid rgba(120, 164, 180, 0.3);
    color: #a8c1c9;
    flex: 0 0 auto;
}
.p3-account-entry__badge[data-tier="pro"] {
    color: #05070c;
    background: #5ef2e6;
    border-color: #5ef2e6;
}
.p3-account-entry__badge[hidden] { display: none; }

/* Tablet: tighter, the e-mail truncates before the icon shrinks. */
@media (max-width: 1024px) {
    .p3-account-entry { max-width: 300px; padding: 0 10px; }
    .p3-account-entry__label { max-width: 96px; }
    /* Wrap instead of clipping the date once the header gets tight. */
    .p3-account-entry__status { max-width: 210px; white-space: normal; line-height: 1.2; }
}

/* Phone: icon-only control, full accessible name kept via aria-label. */
@media (max-width: 640px) {
    .p3-account-entry {
        min-width: 44px;
        width: 44px;
        padding: 0;
        justify-content: center;
        max-width: 44px;
        gap: 0;
    }
    .p3-account-entry__text { display: none; }
    /* The status line is already inside the collapsed text block; this keeps
       the rule explicit and pinned by the entry regression test. */
    .p3-account-entry__status { display: none; }
    .p3-account-entry__icon { font-size: 15px; }
    /* The PRO state stays visible as a dot on the icon when the text collapses. */
    .p3-account-entry[data-tier-tone="pro"] .p3-account-entry__icon { color: #5ef2e6; }
}

.p3-workspace-header [data-account-entry-state="signed_in"] { position: relative; }
.p3-workspace-header .p3-entry-toggle {
    box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
    gap: 4px; min-height: 44px; min-width: 44px; padding: 0 5px;
    border: 1px solid rgba(244,242,236,.30); border-radius: 4px;
    background: #0b0b0b; color: #b9b6ad; cursor: pointer;
    font: 600 10px/1 'JetBrains Mono', ui-monospace, monospace;
}
.p3-entry-toggle [data-tier="pro"] { color: #67e8f9; }
.p3-entry-toggle [data-tier="expired"] { color: #fbbf24; }
.p3-entry-chevron { width: 5px; height: 5px; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(-1px) rotate(45deg); }
.p3-entry-toggle[aria-expanded="true"] .p3-entry-chevron { transform: translateY(1px) rotate(225deg); }
.p3-workspace-header .p3-entry-panel:not([hidden]) {
    box-sizing: border-box; display: grid; gap: 8px; position: absolute; z-index: 10;
    top: 100%; right: 0; width: min(280px, calc(100vw - 16px)); max-height: calc(100dvh - 150px);
    padding: 12px; overflow: auto; overflow-wrap: anywhere; white-space: normal; text-align: left;
    border: 1px solid rgba(244,242,236,.30); border-radius: 4px; background: #101010; color: #f4f2ec;
    font: 500 13px/1.4 Inter, system-ui, sans-serif;
}
.p3-entry-panel [data-account-entry-status] { color: #b9b6ad; }
.p3-entry-panel a { display: flex; align-items: center; min-height: 44px; border-top: 1px solid rgba(244,242,236,.14); color: #67e8f9; }
.p3-entry-toggle:focus-visible, .p3-entry-panel a:focus-visible { outline: 2px solid #67e8f9; outline-offset: 2px; }
@media (max-width: 760px) {
    .p3-workspace-header [data-account-entry-state="signed_in"] { position: static; }
    .p3-workspace-header .p3-entry-panel:not([hidden]) { right: 6px; }
}
/* Keep the existing toolbar row at 320px, including the longest status. */
@media (max-width: 360px) {
    .p3-workspace-header .p3-entry-toggle {
        display: grid; grid-template-columns: auto auto; align-content: center;
        width: 44px; padding: 0; gap: 3px; justify-items: center;
    }
    .p3-entry-toggle [data-account-tier] { grid-column: span 2; grid-row: 2; font-size: 9px; }
}
