/* ═══ STUDIOHAUS PORTAL — Bots (route #team) ═══
   Desktop: inbox | thread, and Details beside the thread from 1440px or over
   it below that. Phones (768px): the inbox is the screen, a thread opens full
   screen with Back, bot filter and Details are bottom sheets. Monochrome:
   emphasis comes from weight, outline and fill, never colour. */

    .team {
      display: grid;
      grid-template-columns: 320px minmax(0, 1fr);
      height: 100vh;
      height: 100dvh;
      margin: -28px -36px;
      background: var(--bg);
      position: relative;
    }
    .team.has-details { grid-template-columns: 320px minmax(0, 1fr) 300px; }
    @media (max-width: 1100px) { .team { grid-template-columns: 280px minmax(0, 1fr); } }
    /* Negative margins cancel .app-content padding (sidebar.css): 24px on tablet */
    @media (min-width: 769px) and (max-width: 1024px) { .team { margin: -24px; grid-template-columns: 260px minmax(0, 1fr); } }

    /* Dots: filled = waiting for you, ring = open, faint = done */
    .team-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; box-sizing: border-box; }
    .team-dot--waiting { background: var(--text); }
    .team-dot--open { border: 1.5px solid var(--text-45); }
    .team-dot--done { background: var(--text-20); }
    .team-dot--working { background: var(--text-60); animation: teamBlink 1.2s infinite; }

    .team-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; font-weight: var(--fw-semi); color: var(--text); background: var(--bg-elevated); border: 1px solid var(--border-hover); letter-spacing: 0; }
    .team-avatar--all { width: 22px; height: 22px; color: var(--text-60); }
    .team-avatar--all svg { width: 12px; height: 12px; }
    .team-menu-item .team-avatar--all { width: 28px; height: 28px; }
    .team-menu-item .team-avatar--all svg { width: 14px; height: 14px; }

    .team-link { background: none; border: none; color: var(--text-45); font-family: var(--font); font-size: 12px; cursor: pointer; padding: 0; transition: color 0.2s; display: inline-flex; align-items: center; }
    .team-link:hover, .team-link.is-open { color: var(--text); }
    .team-icon-btn { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: none; color: var(--text-45); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-family: var(--font); font-size: 12px; flex-shrink: 0; transition: color 0.2s, border-color 0.2s, background 0.2s; }
    .team-icon-btn svg { width: 14px; height: 14px; }
    .team-icon-btn:hover, .team-icon-btn.is-open { color: var(--text); border-color: var(--border-hover); background: var(--bg-card-hover); }
    .team-empty { font-size: 13px; color: var(--text-45); padding: 20px; text-align: center; }

    kbd { font-family: var(--font); font-size: 9px; letter-spacing: 0.5px; color: var(--text-45); background: var(--bg-card); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; line-height: 1.4; margin-left: 6px; vertical-align: middle; }
    .btn-primary kbd { color: var(--bg); background: rgba(0,0,0,0.12); border-color: rgba(0,0,0,0.2); }
    /* Key hints in the thread header and approval buttons only where there is room */
    @media (max-width: 1279px) { .team-kbd { display: none; } }

    /* ── inbox column ── */
    .team-inbox { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg-glass); }
    .team-inbox-head { padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 12px; position: relative; }
    .team-inbox-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
    .team-inbox-title { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--text); letter-spacing: -0.01em; }
    .team-inbox-tools { display: flex; gap: 6px; align-items: center; }
    .team-inbox-role { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-45); min-width: 0; }
    .team-inbox-role span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .team-filter-wrap { position: relative; }
    .team-filter { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); font-family: var(--font); font-size: var(--fs-sm); cursor: pointer; text-align: left; transition: border-color 0.2s, background 0.2s; }
    .team-filter:hover, .team-filter.is-open { border-color: var(--border-hover); background: var(--bg-card-hover); }
    .team-filter .team-avatar { font-size: 10px !important; }
    .team-filter-name { flex: 1; min-width: 0; font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .team-filter > svg { width: 14px; height: 14px; color: var(--text-45); flex-shrink: 0; }

    .team-pop { position: absolute; z-index: 60; background: var(--bg-elevated); border: 1px solid var(--border-hover); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0,0,0,0.45); padding: 6px; }
    [data-theme="light"] .team-pop { box-shadow: 0 16px 40px rgba(0,0,0,0.12); }
    .team-pop--bots { top: calc(100% + 6px); left: 0; right: 0; display: flex; flex-direction: column; gap: 2px; }
    .team-menu-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--text-60); font-family: var(--font); text-align: left; cursor: pointer; width: 100%; transition: background 0.2s, color 0.2s; }
    .team-menu-item:hover { background: var(--bg-card-hover); color: var(--text); }
    .team-menu-item.active { background: var(--bg-card); border-color: var(--border); color: var(--text); }
    .team-menu-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
    .team-menu-name { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text); }
    .team-menu-line { font-size: 11px; color: var(--text-45); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .team-menu-count { font-size: 11px; color: var(--text-45); font-variant-numeric: tabular-nums; min-width: 16px; text-align: right; }

    .team-tabs { display: flex; gap: 4px; padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
    .team-tab { background: none; border: 1px solid transparent; color: var(--text-45); font-family: var(--font); font-size: 12px; padding: 5px 10px; border-radius: 100px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: color 0.2s, background 0.2s, border-color 0.2s; }
    .team-tab span { font-size: 10px; color: var(--text-45); background: var(--bg-card); border: 1px solid var(--border); border-radius: 100px; padding: 0 6px; line-height: 15px; font-variant-numeric: tabular-nums; }
    .team-tab:hover { color: var(--text); }
    .team-tab.active { color: var(--text); background: var(--bg-card); border-color: var(--border); }
    .team-tab.active span { color: var(--text); }

    .team-thread-list { flex: 1; overflow-y: auto; padding: 6px 8px 12px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
    /* Row grid: unread dot | avatar | text. Every row has the same columns. */
    .team-thread { display: grid; grid-template-columns: 6px 28px minmax(0, 1fr); column-gap: 10px; align-items: start; padding: 10px 10px 10px 6px; border-radius: var(--radius-sm); border: 1px solid transparent; background: none; text-align: left; cursor: pointer; font-family: var(--font); width: 100%; transition: background 0.2s, border-color 0.2s; }
    .team-thread:hover { background: var(--bg-card-hover); }
    .team-thread.active { background: var(--bg-card); border-color: var(--border-hover); }
    .team-thread-unread { width: 6px; height: 6px; border-radius: 50%; margin-top: 11px; }
    .team-thread.unread .team-thread-unread { background: var(--text); }
    .team-thread .team-avatar { font-size: 11px !important; }
    .team-thread-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
    .team-thread-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
    .team-thread-title { font-size: var(--fs-sm); font-weight: var(--fw-regular); color: var(--text-60); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
    .team-thread.unread .team-thread-title, .team-thread.active .team-thread-title { color: var(--text); }
    .team-thread.unread .team-thread-title { font-weight: var(--fw-semi); }
    .team-thread-time { font-size: 11px; color: var(--text-45); flex-shrink: 0; font-variant-numeric: tabular-nums; line-height: 1.6; }
    .team-thread-meta { font-size: 12px; color: var(--text-45); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .team-thread-status { font-size: 12px; color: var(--text-45); display: flex; align-items: center; gap: 7px; min-width: 0; }
    .team-thread-status > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .team-empty--list { padding: 28px 16px; }

    .team-inbox-foot { position: relative; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
    .team-pop--keys { bottom: calc(100% - 4px); left: 12px; width: 260px; padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
    .team-pop-title { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-45); margin-bottom: 2px; }
    .team-key-row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: center; font-size: 12px; color: var(--text-60); }
    .team-key-row kbd { margin: 0 4px 0 0; }

    /* ── thread ── */
    .team-convo { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
    .team-convo--empty { align-items: center; justify-content: center; }
    .team-convo-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px 14px; border-bottom: 1px solid var(--border); min-width: 0; }
    .team-convo-heading { flex: 1; min-width: 0; }
    .team-convo-title { font-size: var(--fs-lg); font-weight: var(--fw-medium); color: var(--text); letter-spacing: -0.01em; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .team-convo-sub { font-size: 12px; color: var(--text-45); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .team-convo-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
    .team-chip { font-size: 11px; color: var(--text-60); border: 1px dashed var(--border-hover); border-radius: 100px; padding: 3px 10px; white-space: nowrap; cursor: default; }
    .team-details-btn { display: inline-flex; align-items: center; gap: 6px; }
    .team-details-btn svg { width: 13px; height: 13px; }
    .team-details-btn.is-on { color: var(--text); border-color: var(--border-hover); background: var(--bg-card-hover); }
    .team-back { display: none; }

    .team-messages { flex: 1; overflow-y: auto; padding: 24px 24px 12px; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
    .team-about { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-45); padding-bottom: 12px; border-bottom: 1px dashed var(--border); max-width: 720px; }

    .team-msg { display: flex; gap: 10px; max-width: 720px; }
    .team-msg--wide { max-width: 760px; align-self: stretch; }
    .team-msg--wide .team-msg-body { flex: 1; }
    .team-msg--user { align-self: flex-end; flex-direction: column; align-items: flex-end; }
    .team-msg-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
    .team-bubble { font-size: var(--fs-base); line-height: 1.55; color: var(--text); padding: 12px 16px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
    .team-msg--user .team-bubble { background: var(--text); color: var(--bg); border-color: transparent; border-bottom-right-radius: 4px; }
    .team-msg--bot .team-bubble { border-bottom-left-radius: 4px; }
    .team-msg-time { font-size: 11px; color: var(--text-45); padding: 0 4px; }
    .team-msg-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-45); padding: 0 4px; }
    .team-typing { display: flex; gap: 4px; align-items: center; padding: 14px 16px; }
    .team-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-40); animation: teamBlink 1.2s infinite; }
    .team-typing i:nth-child(2) { animation-delay: 0.2s; } .team-typing i:nth-child(3) { animation-delay: 0.4s; }
    @keyframes teamBlink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

    .team-event { display: flex; align-items: center; gap: 8px; align-self: stretch; font-size: 11px; color: var(--text-45); padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-glass); max-width: 720px; }
    .team-event svg { width: 12px; height: 12px; flex-shrink: 0; }
    .team-event-time { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }
    .team-event > span:first-of-type { min-width: 0; }

    /* cards inside a message: draft quote and invoice, payments, shoots */
    .team-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elevated); padding: 16px 18px; max-width: 520px; }
    .team-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
    .team-card-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-45); font-weight: var(--fw-medium); }
    .team-card-total { font-size: var(--fs-lg); font-weight: var(--fw-medium); color: var(--text); font-variant-numeric: tabular-nums; }
    .team-card-title { font-size: var(--fs-md); color: var(--text); }
    .team-card-sub { font-size: 12px; color: var(--text-45); margin-bottom: 12px; }
    .team-card-lines { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
    .team-card-line { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
    .team-card-line > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    .team-card-svc { color: var(--text); }
    .team-card-desc { color: var(--text-45); font-size: 12px; }
    .team-card-amt { color: var(--text); font-variant-numeric: tabular-nums; flex-shrink: 0; }
    .team-card-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
    .team-card-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
    .team-card-tags:empty { display: none; }
    .team-card-tags .team-qs { display: inline; }
    .team-card-line--sum { color: var(--text-45); font-size: 12px; padding: 6px 0; }
    .team-card-line--muted { color: var(--text-45); }
    .team-card-note { font-size: 12px; color: var(--text-60); margin-top: 10px; font-weight: var(--fw-medium); }
    .team-tag { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-60); border: 1px solid var(--border); border-radius: 100px; padding: 2px 8px; white-space: nowrap; }

    /* quote and invoice status words: weight and opacity, no colour */
    .team-qs { display: block; font-style: normal; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-45); }
    .team-qs--paid, .team-qs--sent, .team-qs--approved, .team-qs--invoiced { color: var(--text-60); }
    .team-qs--draft, .team-qs--pending_custom { color: var(--text-45); }
    .team-qs--declined, .team-qs--overdue { color: var(--text); font-weight: var(--fw-semi); }

    /* inbound email */
    .team-email { align-self: stretch; max-width: 720px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-glass); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
    .team-email-head { display: flex; align-items: flex-start; gap: 10px; }
    .team-email-icon { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-60); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
    .team-email-icon svg { width: 14px; height: 14px; }
    .team-email-meta { min-width: 0; flex: 1; }
    .team-email-from { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
    .team-email-subject { font-size: 12px; color: var(--text-60); margin-top: 2px; overflow-wrap: anywhere; }
    .team-email-time { font-size: 11px; color: var(--text-45); white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }
    .team-email-to { font-size: 11px; color: var(--text-45); overflow-wrap: anywhere; }
    .team-email-body { font-size: 13px; line-height: 1.55; color: var(--text-60); white-space: pre-wrap; overflow-wrap: anywhere; }
    .team-email-body.is-collapsed { max-height: 220px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
    .team-email-more { align-self: flex-start; }
    .team-mail-draft .team-email-body { margin-top: 10px; }

    /* approvals: an outlined card, the label in full weight */
    .team-approval { align-self: stretch; max-width: 600px; border-color: var(--text-20); background: var(--bg-elevated); }
    .team-approval .team-card-head { align-items: center; }
    .team-approval-label { color: var(--text); font-weight: var(--fw-semi); }
    .team-approval-text { font-size: 13px; color: var(--text-60); line-height: 1.5; margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
    .team-approval-quote { margin: 8px 0 0; padding: 8px 12px; background: var(--bg-card); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-60); white-space: pre-wrap; overflow-wrap: anywhere; }
    .team-approval-help { margin: 10px 0 0; }
    .team-approval-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
    .team-field { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 12px; color: var(--text-45); }
    .team-field--wide { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .team-field input, .team-field select { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 13px; padding: 8px 10px; outline: none; min-width: 0; width: 100%; }
    .team-field input::placeholder { color: var(--text-45); }
    .team-field input:focus, .team-field select:focus { border-color: var(--border-hover); }
    .team-approval-time { margin-left: auto; font-size: 11px; color: var(--text-45); }
    .team-approval button[disabled] { opacity: 0.5; cursor: default; }

    .team-checklist { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
    .team-check { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); }
    .team-check-box { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--text-40); }
    .team-check-text { line-height: 1.4; overflow-wrap: anywhere; }
    .team-check-fix { white-space: nowrap; }

    /* daily digest */
    .team-digest { max-width: none; padding: 18px 20px 14px; }
    .team-digest .team-card-title { margin-bottom: 14px; }
    .team-dg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; margin-bottom: 18px; }
    .team-dg-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border-hover); border-radius: var(--radius-sm); background: var(--bg-card); }
    .team-dg-stat-n { font-size: var(--fs-xl); font-weight: var(--fw-medium); color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; }
    .team-dg-stat-l { font-size: 11px; color: var(--text-45); }
    .team-dg-stat.is-zero { border-color: var(--border); background: none; }
    .team-dg-stat.is-zero .team-dg-stat-n { color: var(--text-40); }
    .team-dg-group { padding: 12px 0 4px; border-top: 1px solid var(--border); }
    .team-dg-gtitle { font-size: 10px; font-weight: var(--fw-semi); letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-45); margin-bottom: 8px; }
    .team-dg-sec { margin-bottom: 12px; }
    .team-dg-stitle { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: var(--fw-medium); color: var(--text); margin-bottom: 4px; }
    .team-dg-count { font-size: 11px; color: var(--text-45); font-variant-numeric: tabular-nums; }
    .team-dg-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 0 -10px; width: calc(100% + 20px); border: none; border-radius: var(--radius-sm); background: none; text-align: left; font-family: var(--font); color: inherit; }
    .team-dg-row.is-link { cursor: pointer; transition: background 0.2s; }
    .team-dg-row.is-link:hover { background: var(--bg-card-hover); }
    .team-dg-row > svg { width: 14px; height: 14px; color: var(--text-40); flex-shrink: 0; }
    .team-dg-row.is-link:hover > svg { color: var(--text); }
    .team-dg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
    .team-dg-text { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .team-dg-sub { font-size: 12px; color: var(--text-45); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .team-dg-quiet { font-size: 12px; color: var(--text-45); padding: 2px 0 8px; line-height: 1.5; }
    .team-dg-more { margin: 2px 0 0; }

    /* composer: one rounded box the width of the thread, send inside it */
    .team-composer { padding: 12px 24px 20px; background: var(--bg); }
    /* the assistant button sits in the bottom right corner: keep send clear of it */
    body:has(.as-fab) .team-composer { padding-right: 88px; }
    body:has(.as-fab) .team.has-details .team-composer { padding-right: 24px; }
    .team-composer-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-input); padding: 6px 6px 6px 14px; transition: border-color 0.2s, background 0.2s; }
    .team-composer-box:focus-within { border-color: var(--border-hover); background: var(--bg-card-hover); }
    .team-composer textarea { flex: 1; min-width: 0; resize: none; background: none; border: none; color: var(--text); font-family: var(--font); font-size: var(--fs-base); line-height: 1.5; padding: 6px 0; outline: none; max-height: 160px; }
    .team-composer textarea::placeholder { color: var(--text-45); }
    .team-send { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--text); color: var(--bg); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: opacity 0.2s; }
    .team-send svg { width: 15px; height: 15px; }
    .team-send:hover { opacity: 0.85; }

    /* a bot with no threads yet */
    .team-bot-empty { max-width: 380px; padding: 32px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
    .team-bot-empty .team-avatar { font-size: 17px !important; }
    .team-bot-empty-name { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--text); }
    .team-bot-empty p { font-size: 13px; line-height: 1.55; color: var(--text-60); }
    .team-bot-empty-mode { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-45); border: 1px dashed var(--border-hover); border-radius: var(--radius-sm); padding: 6px 12px; text-align: left; }
    .team-bot-empty .btn-secondary { margin-top: 4px; }

    /* ── Details ── */
    .team-details { border-left: 1px solid var(--border); overflow-y: auto; padding: 18px 20px 88px; display: flex; flex-direction: column; gap: 18px; background: var(--bg-elevated); min-height: 0; }
    /* Below 1440px it opens over the thread */
    .team.has-details-over .team-details { position: absolute; top: 0; right: 0; bottom: 0; width: 320px; z-index: 50; box-shadow: -20px 0 40px rgba(0,0,0,0.35); animation: teamSlide 0.2s ease; }
    [data-theme="light"] .team.has-details-over .team-details { box-shadow: -20px 0 40px rgba(0,0,0,0.08); }
    @keyframes teamSlide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
    .team-details-head { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--text); }
    .team-details-section { display: flex; flex-direction: column; gap: 8px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
    .team-details-section:last-child { border-bottom: none; padding-bottom: 0; }
    .team-details-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-45); margin-bottom: 2px; }
    .team-detail-row { display: grid; grid-template-columns: 88px 1fr; gap: 10px; font-size: 12px; }
    .team-detail-row span:first-child { color: var(--text-45); }
    .team-detail-row span:last-child { color: var(--text); overflow-wrap: anywhere; }
    .team-detail-muted { font-size: 12px; color: var(--text-45); line-height: 1.5; }
    .team-detail-sub { font-size: 11px; color: var(--text-45); margin-top: 6px; }
    .team-detail-quote { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
    .team-detail-quote small { display: block; color: var(--text-45); font-size: 11px; }
    .team-detail-quote > span:last-child { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
    .team-detail-actions { display: flex; gap: 14px; margin-top: 4px; }
    .team-detail-botline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
    .team-switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; color: var(--text); margin-top: 4px; }
    .team-switch-row small { display: block; color: var(--text-45); font-size: 11px; margin-top: 2px; }
    /* Switch: on = filled track (white in dark, near black in light), off = outline */
    .team-switch { width: 34px; height: 20px; border-radius: 100px; border: 1px solid var(--border-hover); background: var(--bg-card); position: relative; cursor: pointer; flex-shrink: 0; padding: 0; transition: background 0.2s, border-color 0.2s; }
    .team-switch i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-40); transition: transform 0.2s, background 0.2s; }
    .team-switch.on { background: var(--text); border-color: var(--text); }
    .team-switch.on i { transform: translateX(14px); background: var(--bg); }

    /* ── loading ── */
    .team--loading { grid-template-columns: 1fr; }
    .team-loading { margin: auto; }

    /* ═══ Tablets: a narrower inbox ═══ */
    @media (min-width: 769px) and (max-width: 1024px) {
      .team-tabs { gap: 2px; padding: 0 10px 10px; }
      .team-tab { padding: 5px 4px; flex: 1 1 0; justify-content: center; }
      .team-chip, .team-details-txt { display: none; }
    }

    /* ═══ Phones ═══ */
    @media (max-width: 768px) {
      .team { display: block; height: auto; margin: -16px -16px 0; background: none; }
      .team-inbox { border-right: none; background: none; }
      .team-inbox-head { padding: 12px 16px 12px; }
      .team-inbox-title { font-size: var(--fs-xl); }
      .team-filter { min-height: 44px; font-size: var(--fs-base); }
      .team-tabs { padding: 0 12px 10px; }
      .team-tab { min-height: 36px; padding: 6px 14px; font-size: 13px; }
      .team-thread-list { overflow: visible; padding: 6px 8px 8px; }
      .team-thread { padding: 12px 10px 12px 6px; }
      .team-thread-title { font-size: var(--fs-base); }
      .team-thread-time { line-height: 1.5; }
      .team-thread-unread { margin-top: 12px; }
      .team-thread.active { background: none; border-color: transparent; }
      .team-thread:active { background: var(--bg-card-hover); }
      .team-bot-empty { margin: 8px auto 0; }
      .team-chip { display: none; }

      /* the thread is the screen */
      .team > .team-convo { display: none; }
      .team--m-thread > .team-inbox { display: none; }
      .team--m-thread > .team-convo {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 200;
        background: var(--bg);
      }
      body:has(.team--m-thread) .as-fab { display: none; }
      .team-convo-head { padding: calc(8px + env(safe-area-inset-top)) 12px 10px 4px; gap: 6px; }
      .team-back { display: inline-flex; align-items: center; min-height: 44px; min-width: 40px; padding: 0 4px; border: none; background: none; color: var(--text-60); font-family: var(--font); font-size: var(--fs-md); cursor: pointer; flex-shrink: 0; }
      .team-back svg { width: 22px; height: 22px; }
      .team-back span { display: none; }
      .team-convo-title { font-size: var(--fs-md); }
      .team-convo-actions .btn-xs { min-height: 36px; }
      .team-details-txt { display: none; }
      .team-details-btn { width: 36px; padding: 0; justify-content: center; }
      .team-details-btn svg { width: 16px; height: 16px; }
      .team-messages { padding: 16px 12px 12px; gap: 14px; }
      .team-about { display: none; }
      .team-msg { max-width: 100%; }
      .team-msg--bot > .team-avatar { display: none; }
      .team-card, .team-approval { max-width: none; }
      .team-card { padding: 14px; }
      .team-field { grid-template-columns: minmax(0, 1fr); gap: 6px; }
      .team-field input, .team-field select { min-height: 44px; font-size: 16px; }
      .team-check { grid-template-columns: 16px minmax(0, 1fr); }
      .team-check-fix { grid-column: 2; justify-self: start; min-height: 36px; }
      /* approval buttons: full width, thumb sized */
      .team-approval-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
      .team-approval-actions .btn-xs { min-height: 48px; font-size: var(--fs-base); justify-content: center; }
      .team-approval-time { grid-column: 1 / -1; margin: 0; text-align: center; }
      .team-dg-stats { grid-template-columns: 1fr 1fr; }
      .team-composer, body:has(.as-fab) .team-composer { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
      .team-composer textarea { font-size: 16px; }
      .team-send { width: 36px; height: 36px; }

      /* sheets */
      .team-sheet-menu { display: flex; flex-direction: column; gap: 4px; }
      .team-sheet-menu .team-menu-item { min-height: 56px; }
      .m-sheet .team-details { border: none; padding: 4px 0 8px; background: none; overflow: visible; }
    }
