/* PhoenAIx workspace. Loaded after the compatibility layer.
 * Scope shell rules to .phoenix-workspace: the original navigation remains usable
 * when JavaScript fails. Keep brand, layout and shared component rules together. */
:root {
  --bg-page: #f7f8fa;
  --bg-sidebar: #fffaf5;
  --bg-card: #fff;
  --bg-hover: #fff3e9;
  --bg-active: #fff0e3;
  --bg-table-header: #faf8f6;
  --accent: #b84b25;
  --accent-dark: #893b22;
  --accent-hover: #a43c1c;
  --accent-pale: #fff0e2;
  --text-primary: #2e2927;
  --text-secondary: #655f5b;
  --text-tertiary: #79716b;
  --border: #e9e3dd;
  --border-focus: #b84b25;
  --success: #227657;
  --error: #bc3636;
  --warning: #946018;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 3px #392a1603, 0 6px 24px #392a1605;
  --shadow-md: 0 18px 56px #392a1614;
  --phoenix-flame: linear-gradient(125deg, #b9422b, #ae541c);
  --workspace-header: 72px;
}
body { background: radial-gradient(ellipse at 95% 0%, #fff0e2 0, transparent 42%), var(--bg-page); }
body::before { display: none; }
.app-header { height: var(--workspace-header); margin: 0; border-radius: 0; padding: 0 28px; background: #ffffffed; box-shadow: none; border: 0; border-bottom: 1px solid var(--border); }
.app-header::before { display: none; }
.brand-mark { border-radius: 12px; box-shadow: none; width: 38px; height: 38px; }
.brand-text strong { font-size: 21px; letter-spacing: -.7px; }
.header-right { gap: 12px; }
.workspace-search-trigger { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; min-width: 220px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text-secondary); background: #f9f9fa; cursor: pointer; font: 12px var(--font-sans); }
.workspace-search-trigger svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.workspace-search-trigger kbd { margin-left: auto; font: 10px var(--font-sans); color: var(--text-tertiary); border: 1px solid var(--border); padding: 3px 5px; border-radius: 5px; background: #fff; }
.workspace-search-dialog { width: min(560px, calc(100vw - 32px)); max-height: min(680px, calc(100dvh - 48px)); padding: 20px; margin: 8dvh auto auto; border: 1px solid var(--border); border-radius: 20px; background: #fff; color: var(--text-primary); box-shadow: 0 28px 90px #36221d40; }
.workspace-search-dialog::backdrop { background: #29232355; backdrop-filter: blur(3px); }
.workspace-search-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 16px; font-weight: 650; }
.workspace-search-close { width: 44px; height: 44px; border: 1px solid var(--border); background: #fff; border-radius: 10px; font-size: 24px; color: var(--text-secondary); cursor: pointer; }
.workspace-search-dialog input { width: 100%; margin-bottom: 12px; }
.workspace-search-results { max-height: 420px; overflow-y: auto; padding: 4px; }
.workspace-search-result { display: flex; justify-content: space-between; gap: 16px; width: 100%; min-height: 48px; border: 0; background: #fff; border-radius: 10px; padding: 12px; font: 14px var(--font-sans); color: var(--text-primary); text-align: left; cursor: pointer; }
.workspace-search-result small { color: var(--text-secondary); font-size: 11px; }
.workspace-search-result:hover, .workspace-search-result:focus-visible { background: #fff0e4; }
.workspace-search-empty { padding: 24px 8px; color: var(--text-secondary); }
.nav-drawer-toggle { min-height: 44px; box-shadow: none; background: #fff; border-radius: 12px; }
.nav-drawer-toggle:hover { transform: none; }
#logoutBtn { min-width: 44px; min-height: 44px; justify-content: center; }
.layout { height: calc(100dvh - var(--workspace-header)); }
.phoenix-workspace main.content { padding-left: 112px; scroll-padding: 24px; }
.workspace-skip { position: fixed; left: 16px; top: -80px; z-index: 9999; padding: 12px 20px; background: #fff; border: 2px solid var(--accent); border-radius: 10px; color: var(--accent-dark); }
.workspace-skip:focus { top: 12px; }

/* Seven category controls instead of a rail containing every individual page. */
body.phoenix-workspace #mainSidebar,
body.phoenix-workspace #mainSidebar:is(:hover, :focus-within, .is-open) {
  width: 88px; left: 16px; top: 88px; bottom: 16px; padding: 12px 8px;
  overflow: visible; transform: none; transition: none; border-radius: 22px;
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
body.phoenix-workspace #mainSidebar::before, body.phoenix-workspace #mainSidebar::after, body.phoenix-workspace .nav-group::before { display: none; }
body.phoenix-workspace #mainSidebar .nav-group { flex-shrink: 0; padding: 0; margin: 0 0 5px; border: 0; }
.workspace-category { width: 70px; min-height: 66px; padding: 10px 3px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--text-secondary); display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font: 600 11px/1.35 var(--font-sans); transition: background .16s ease, color .16s ease; }
.workspace-category svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.workspace-category:hover, .workspace-category[aria-expanded="true"] { background: #fff7f0; color: var(--accent); border-color: #efd4bd; }
.workspace-category.is-current { background: var(--phoenix-flame); color: #fff; box-shadow: 0 5px 12px #b64b2520; }
.workspace-flyout { position: fixed; top: 88px; left: 116px; width: 270px; max-height: calc(100dvh - 104px); overflow-y: auto; padding: 20px 10px 12px; background: #fff; border: 1px solid #e9d6c7; border-radius: 20px; box-shadow: 0 16px 56px #442b1826; }
.workspace-flyout[hidden] { display: none !important; }
.workspace-flyout::before { content: ''; display: block; width: 28px; height: 3px; margin: 0 14px 14px; background: var(--phoenix-flame); border-radius: 2px; }
body.phoenix-workspace #mainSidebar .nav-group-title { display: block; height: auto; opacity: 1; padding: 0 14px 14px; margin: 0; overflow: visible; color: var(--text-secondary); font-size: 12px; letter-spacing: .04em; }
body.phoenix-workspace #mainSidebar .nav-item { display: flex; justify-content: flex-start; width: auto; height: auto; min-height: 46px; margin: 3px 0; padding: 10px 14px; gap: 12px; border-radius: 11px; transform: none; font-size: 14px; box-shadow: none; }
body.phoenix-workspace #mainSidebar .nav-item > span { display: inline-flex; }
body.phoenix-workspace #mainSidebar .nav-item.active { background: #fff0e4; color: var(--accent-dark); box-shadow: inset 3px 0 var(--accent); }
body.phoenix-workspace #mainSidebar .nav-ico { flex: 0 0 20px; }
body.phoenix-workspace #mainSidebar .nav-ico svg { stroke-width: 1.7; filter: none; }
body.phoenix-workspace #mainSidebar .sidebar-foot { display: none; }

/* A concise, editorial header and denser surfaces leave space for actual data. */
body .page { max-width: 1680px; padding: 28px 32px 56px; }
body .page-head { margin-bottom: 24px; padding: 0 0 22px; border-bottom: 1px solid var(--border); gap: 16px; align-items: center; }
body .page-head::before, body .page-head::after, body .page-head > div:first-child::before { content: none; }
body .page-title { font-size: clamp(24px, 2.2vw, 30px); font-weight: 750; color: var(--text-primary); letter-spacing: -.04em; text-shadow: none; }
body .page-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.75; max-width: 850px; margin-top: 7px; }
body .card, body .ops-metric, body .stat-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); }
body .card:hover, body .ops-metric:hover, body .stat-card:hover { transform: none !important; box-shadow: var(--shadow-sm) !important; border-color: var(--border-hover); }
body .card::before, body .card::after, body .stat-card::after { display: none; }
body .ops-metric { padding: 22px 24px; }
body .ops-metric::before { top: 24px; bottom: 24px; width: 3px; background: var(--phoenix-flame); }
body .ops-metric .label { font-size: 12px; letter-spacing: 0; color: var(--text-secondary); }
body .ops-metric .value { font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; margin: 8px 0; }
body .ops-metric .hint { font-size: 12px; color: var(--text-secondary); }
body .data-card-toolbar { padding: 20px 24px; gap: 16px; background: #fff; border-bottom: 1px solid var(--border); align-items: center; }
body .card-h { font-size: 16px; letter-spacing: -.02em; }
body .filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0 !important; background: #f8f7f5; border: 1px solid var(--border); padding: 12px; border-radius: 12px; }
body .filter-bar input:not([type=checkbox]):not([type=radio]), body .filter-bar select { width: auto; max-width: 100%; flex: 1 1 150px; min-width: 0; }
body #page-model-mgmt .model-mgmt-toolbar { position: static; padding: 16px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm); gap: 12px; border-radius: 16px; }
body #page-model-mgmt .model-mgmt-toolbar::before { content: none; }
body input:not([type=checkbox]):not([type=radio]):not([type=range]), body select, body .form-control { min-height: 44px; padding: 10px 12px; color: var(--text-primary); border-color: #d7cec6 !important; }
body input::placeholder, body textarea::placeholder { color: #79716b; }
body .btn { min-height: 44px; padding: 10px 18px; border-radius: 10px; box-shadow: none; font-size: 13px; }
body .btn-primary { background: var(--phoenix-flame); color: #fff; border: 1px solid #ab4826; box-shadow: 0 3px 8px #b64b2515; }
body .btn-primary:hover { background: #a44123; box-shadow: 0 4px 12px #b64b2525; transform: none; }
body .btn-ghost, body .btn-secondary, body .action-btn { background: #fff; color: var(--text-secondary); border-color: #d7cec6; box-shadow: none; }
body .action-btn { min-height: 36px; padding: 7px 12px; }
body .table-wrap { overflow-x: auto; border: 0; border-radius: 0 0 16px 16px; }
body .data-table th { padding: 14px 20px; font-size: 11px; font-weight: 650; letter-spacing: .03em; color: var(--text-secondary); background: #faf8f6; white-space: nowrap; }
body .data-table td { padding: 16px 20px; font-size: 13px; border-bottom: 1px solid #f0ebe6; }
body .provider-status, body .status-badge, body .gw-provider-tag, body .model-category-tag { white-space: nowrap; flex-shrink: 0; }
body .provider-status { padding: 4px 8px; gap: 6px; border: 0; box-shadow: none; background: #f8f7f5; }
body #page-model-mgmt .data-table { min-width: 1160px; }
body #page-model-mgmt .data-table th, body #page-model-mgmt .data-table td { padding: 14px 12px; }
body #page-model-mgmt .data-table td:last-child { white-space: nowrap; }
body .data-table tbody tr:nth-child(even) { background: transparent; }
body .data-table tbody tr:hover { background: #fff9f3; box-shadow: none; }
body .table-sub, body .provider-balance-empty { color: var(--text-secondary); }
body .ops-deck { background: #fff; border: 1px solid var(--border); box-shadow: none; gap: 0; }
body .ops-deck-item { background: #fff; border-right: 1px solid var(--border); padding: 20px; }
body .ops-deck-item::after { display: none; }
body .ops-deck-item small { color: var(--text-secondary); }
body .model-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-sm); }
body .model-card::after { display: none; }
body .model-card:hover { transform: none; border-color: #c98961; box-shadow: 0 8px 24px #6c381410; }

/* Playground: a quiet configuration column and a clean conversation canvas. */
body #page-playground { padding: 24px 28px; height: calc(100dvh - var(--workspace-header)); background: transparent; }
body .pg-grid { gap: 20px; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
body .pg-grid > aside { width: 300px; height: 100%; padding: 0; background: transparent; }
body .cfg-card { border: 1px solid var(--border); background: #fff; border-radius: 16px; box-shadow: none; }
body .cfg-card-title { font-size: 13px; letter-spacing: 0; color: var(--text-primary); }
body .chat-area { border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); }
body .chat-meta-bar { min-height: 56px; background: #fff; border-bottom: 1px solid var(--border); }
body .chat-meta-bar::before { display: none; }
body .chat-messages { background: radial-gradient(ellipse at 50% 0, #fff7ef, transparent 65%), #fff; }
body .chat-input-wrap { padding: 16px 20px 20px; background: #fff; }
body .chat-input-box { border-radius: 14px; box-shadow: none; }
body .chat-input-box:focus-within { transform: none; }
body :is(a,button,input,select,textarea,[tabindex]):focus-visible { outline: 3px solid #af482a; outline-offset: 3px; }
.payment-rate-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)); align-items: end; }
.payment-policy-actions { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:14px 0 22px; }
.payment-channel-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding:0; background:transparent; }
.payment-channel-card { min-width:0; padding:16px; border:1px solid var(--border); border-radius:16px; background:linear-gradient(145deg,#fff,#fff9f3); }
.payment-channel-card[data-ready="true"] { border-color:#8abda8; background:linear-gradient(145deg,#fff,#f1fbf7); }
.payment-channel-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.payment-channel-head strong { color:var(--text-primary); line-height:1.35; }
.payment-channel-meta { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.payment-channel-meta span { padding:4px 8px; border-radius:999px; background:#f4eee8; color:var(--text-secondary); font-size:11px; font-weight:650; }
.payment-channel-action { width:100%; margin-top:13px; }

@media (max-height: 640px) and (min-width: 761px) {
  body.phoenix-workspace #mainSidebar, body.phoenix-workspace #mainSidebar:is(:hover, :focus-within, .is-open) { overflow-y: auto; scrollbar-width: thin; }
  .workspace-category { min-height: 48px; flex-direction: row; font-size: 10px; gap: 4px; padding: 6px 3px; }
  .workspace-category svg { flex: 0 0 18px; }
}
@media (min-width: 761px) { .phoenix-workspace .nav-drawer-backdrop { display: none; } }
@media (max-width: 1100px) {
  .workspace-search-trigger { min-width: 44px; justify-content: center; padding: 0 12px; }
  .workspace-search-trigger span, .workspace-search-trigger kbd { display: none; }
  body .page { padding: 24px 20px 40px; }
  body .pg-grid > aside { width: 260px; }
  body .ops-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .payment-rate-grid, .payment-channel-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  :root { --workspace-header: 64px; }
  .app-header { padding: 0 12px; }
  .header-right { gap: 6px; }
  .brand-text > span, #userName, #userRole { display: none; }
  .brand { gap: 8px; }
  .brand-text strong { font-size: 18px; }
  #userBadge { margin-right: 0 !important; gap: 0 !important; }
  #userAvatar { display: none !important; }
  .phoenix-workspace main.content { padding-left: 0; }
  body.phoenix-workspace #mainSidebar { display: none; top: 76px; left: 8px; bottom: 12px; width: 80px; padding: 8px 4px; z-index: 95; }
  body.phoenix-workspace #mainSidebar.is-open { display: flex; width: 80px; left: 8px; top: 76px; bottom: 12px; padding: 8px 4px; }
  .workspace-category { min-height: 60px; }
  .workspace-flyout { top: 76px; left: 94px; width: calc(100vw - 106px); max-height: calc(100dvh - 88px); padding: 16px 8px; }
  .nav-drawer-backdrop.is-open { inset: 64px 0 0; z-index: 90; background: #34241b38; }
  body .page { padding: 20px 16px 32px; }
  body .page-head { flex-wrap: wrap; align-items: flex-start; }
  body .data-card-toolbar { padding: 16px; }
  body .model-mgmt-toolbar input[type=text], body .model-mgmt-toolbar select { min-width: 0; flex: 1 1 100%; }
  body #page-playground { height: auto; min-height: calc(100dvh - 64px); padding: 16px; overflow: visible; }
  body .pg-grid { flex-direction: column; overflow: visible; }
  body .pg-grid > aside { width: 100%; height: auto; overflow: visible; }
  body .pg-grid > aside > .cfg-card:first-child { max-height: 320px; flex: auto; }
  body .chat-area { min-height: 580px; height: 70dvh; flex: auto; }
  body .ops-deck { grid-template-columns: 1fr; }
  body .ops-deck-item { border-right: 0; border-bottom: 1px solid var(--border); }
  .payment-rate-grid, .payment-channel-grid { grid-template-columns:1fr; }
  .payment-policy-actions { align-items:stretch; flex-direction:column; }
}
@media (max-width: 420px) { body .ops-grid { grid-template-columns: 1fr; } .brand-text { display: none; } }
@media (max-height: 640px) {
  body.phoenix-workspace #mainSidebar, body.phoenix-workspace #mainSidebar:is(:hover, :focus-within, .is-open) { overflow-y: auto; scrollbar-width: thin; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
