/* ============================================================================
   Shared Agent design system  —  Studio (EntroVy)
   ----------------------------------------------------------------------------
   One source of truth for every agent surface (Case Butler, Counsel,
   Case Agent, Agents start page, …).

   Direction:
     • Agent surfaces have a SOFT, rounded look (sidebars, buttons, inputs,
       selects, cards, modals, bubbles) — distinct from the flat/sharp main app,
       which suits the conversational agent UIs.
     • Brand cyan accent, no heavy shadow.

   All colours alias the app-wide tokens from styles.css, so dark mode and any
   future re-theme flow through automatically — no per-agent colour blocks.
   ========================================================================== */

:root {
    --ag-bg: var(--color-bg);
    --ag-surface: var(--color-card-bg);
    --ag-input: var(--color-card-bg);
    --ag-border: var(--color-border);
    --ag-text: var(--color-text);
    --ag-muted: var(--muted-text);
    --ag-accent: var(--entrovy-cyan);
    --ag-accent-hover: var(--entrovy-cyan-600);
    --ag-accent-soft: color-mix(in srgb, var(--entrovy-cyan) 12%, transparent);
    --ag-danger: #ef4444;
    --ag-ok: #10b981;

    /* Soft, rounded agent surfaces (chrome + bubbles) */
    --ag-radius: 8px;
    --ag-radius-bubble: 10px;
    --ag-radius-lg: 12px;

    /* Layout */
    --ag-sidebar-w: 280px;
    --ag-readable: 1040px;     /* readable chat column — wider than the old 860 */
}

/* Solid input surface in dark mode (app input bg is transparent) */
[data-theme="dark"] {
    --ag-input: #242424;
    --ag-surface: #242424;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ag-input: #242424;
        --ag-surface: #242424;
    }
}

/* ----------------------------------------------------------------------------
   Shared primitives — opt-in helper classes any agent template can use.
   -------------------------------------------------------------------------- */

/* Rounded primary button */
.ag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: var(--ag-radius);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
    background: var(--ag-accent);
    color: #fff;
}

.ag-btn:hover { background: var(--ag-accent-hover); }
.ag-btn:disabled { opacity: .55; cursor: not-allowed; }

.ag-btn.ghost {
    background: transparent;
    color: var(--ag-text);
    border-color: var(--ag-border);
}
.ag-btn.ghost:hover {
    background: transparent;
    border-color: var(--ag-accent);
    color: var(--ag-accent);
}

/* Rounded control (select / secondary action) */
.ag-control {
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-radius);
    background: var(--ag-input);
    color: var(--ag-text);
    padding: 6px 10px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.ag-control:hover { border-color: var(--ag-accent); }
.ag-control:focus { outline: none; border-color: var(--ag-accent); }

/* ----------------------------------------------------------------------------
   Shared workspace picker — one polished look reused by every agent sidebar.
   Native <select> with a custom chevron so it renders identically everywhere.
   -------------------------------------------------------------------------- */
.ag-ws-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px 8px;
}

.ag-ws-select {
    flex: 1;
    min-width: 0;
    height: 36px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-radius);
    background-color: var(--ag-input);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    color: var(--ag-text);
    padding: 0 30px 0 12px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-overflow: ellipsis;
}

.ag-ws-select:hover { border-color: var(--ag-accent); }
.ag-ws-select:focus { outline: none; border-color: var(--ag-accent); }

.ag-ws-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-radius);
    background: var(--ag-input);
    color: var(--ag-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: border-color .15s, color .15s;
}

.ag-ws-icon:hover { border-color: var(--ag-accent); color: var(--ag-accent); }
.ag-ws-icon.danger:hover { border-color: var(--ag-danger); color: var(--ag-danger); }

/* Sidebar section caption (e.g. "WORKSPACE") */
.ag-side-label {
    padding: 4px 16px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ag-muted);
}

/* ----------------------------------------------------------------------------
   Centered header tabs: [left flex] [tabs natural width] [right flex]
   Wrap the left cluster and right cluster in .ag-head-side so the tab group
   lands dead-centre regardless of how wide either side is.
   -------------------------------------------------------------------------- */
.ag-head-side {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ag-head-side.right {
    justify-content: flex-end;
}
