/* Agent4 brand overrides — layered on top of platform.css (which stays pristine). */

/* Script fonts for client typed signatures (OFL, bundled locally). */
@font-face {
  font-family: 'SigGreatVibes';
  src: url('../fonts/scripts/GreatVibes-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'SigAllura';
  src: url('../fonts/scripts/Allura-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'SigParisienne';
  src: url('../fonts/scripts/Parisienne-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'SigAlexBrush';
  src: url('../fonts/scripts/AlexBrush-Regular.ttf') format('truetype');
  font-display: swap;
}

.sig-font-great-vibes { font-family: 'SigGreatVibes', cursive; }
.sig-font-allura { font-family: 'SigAllura', cursive; }
.sig-font-parisienne { font-family: 'SigParisienne', cursive; }
.sig-font-alex-brush { font-family: 'SigAlexBrush', cursive; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  flex: 0 0 auto;
}

.brand-name {
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
}

.brand-slogan {
  font-weight: 400;
  font-size: 0.68rem;
  opacity: 0.65;
  letter-spacing: 0.02em;
}

/* Error pages */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem;
}

.error-page h1 {
  font-size: 4rem;
  margin: 0;
}

/* Error viewer */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82em; word-break: break-all; }
pre.trace {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 10px;
  overflow: auto;
  max-height: 420px;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.def-list { display: grid; grid-template-columns: 110px 1fr; gap: 0.4rem 1rem; margin: 1rem 0; }
.def-list dt { font-weight: 600; color: #64748b; }
.def-list dd { margin: 0; }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.filter-row .input[type="search"] { flex: 1 1 220px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.section-title { margin: 1.5rem 0 0.75rem; }
.err-msg { max-width: 420px; }
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: 1rem; }
.pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: #e2e8f0; color: #334155; }
.pill-error, .pill-exception, .pill-fatal, .pill-critical { background: #fee2e2; color: #b91c1c; }
.pill-warning { background: #fef3c7; color: #b45309; }
.pill-notice, .pill-deprecated { background: #e0e7ff; color: #4338ca; }
.pill-status-new { background: #fee2e2; color: #b91c1c; }
.pill-status-acknowledged { background: #fef3c7; color: #b45309; }
.pill-status-resolved { background: #dcfce7; color: #15803d; }
/* Error-triage category pills (admin/error_triage_*.twig) */
.pill-info { background: #e0e7ff; color: #4338ca; }
.pill-success { background: #dcfce7; color: #15803d; }
.pill-triage-genuine_defect { background: #fee2e2; color: #b91c1c; }
.pill-triage-test_artifact { background: #e2e8f0; color: #475569; }
.pill-triage-transient { background: #fef3c7; color: #b45309; }
.field { display: block; margin-bottom: 1rem; }
.field > span { display: block; font-weight: 600; margin-bottom: 0.35rem; }

/* Client portal shell (moved from inline <style>; templates stay CSS-free) */
.client-shell { min-height: 100vh; display: flex; flex-direction: column; }
.client-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; border-bottom: 1px solid var(--border); background: #fff; flex-wrap: wrap; }
.client-top .brand { padding: 0; }
.client-top .brand-logo { height: 32px; width: auto; }
.client-nav { display: flex; gap: 4px; flex-wrap: wrap; }
/* platform.css .nav-item is built for the admin sidebar (width:100%, slide-in
   hover, ::before active bar). Neutralize those for the horizontal client top nav. */
.client-nav .nav-item { width: auto; }
.client-nav .nav-item:hover { transform: none; }
.client-nav .nav-item.active::before { content: none; }
.client-nav .nav-item { color: var(--muted); }
.client-nav .nav-item:hover { color: var(--text); }
.client-nav .nav-item.active { background: var(--brand-soft); color: var(--brand); }
.client-body { flex: 1; padding: 28px 22px; max-width: 1080px; width: 100%; margin: 0 auto; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }

/* Server-rendered flash messages */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.flash-stack:empty { display: none; }

/* Notification bell badge */
.notif-btn { position: relative; }
.notif-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; line-height: 18px; text-align: center; }

/* Prompt 12 — global AI assistant popup */
.ai-assist-btn { position: fixed; right: 18px; bottom: 18px; z-index: 200; width: 52px; height: 52px; border-radius: 50%; border: none; font-size: 24px; cursor: pointer; background: var(--brand, #6c4cf1); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.ai-assist-btn:hover { transform: scale(1.05); }
.ai-assist-modal { position: fixed; inset: 0; z-index: 210; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: flex-end; padding: 84px 18px 18px; }
.ai-assist-modal[hidden] { display: none; }
.ai-assist-card { background: #fff; border-radius: 14px; width: min(400px, 100%); max-height: min(560px, 80vh); display: flex; flex-direction: column; box-shadow: 0 18px 50px rgba(0,0,0,.3); overflow: hidden; }
.ai-assist-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ai-assist-log { padding: 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 160px; max-height: 360px; }
.ai-msg { padding: 9px 12px; border-radius: 10px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.ai-q { background: var(--brand-soft, #f0eaff); align-self: flex-end; max-width: 90%; }
.ai-a { background: #f4f4f6; align-self: flex-start; max-width: 95%; }
.ai-err { background: #fdecec; }
.ai-assist-card form { padding: 10px 14px 12px; border-top: 1px solid var(--border); }
.ai-assist-inputrow { display: flex; gap: 8px; }
.ai-assist-inputrow .input { flex: 1; }

/* Prompt 12 — AI image studio thumbnails */
.ai-thumb { width: 100%; border-radius: 8px; display: block; margin-bottom: 8px; }

/* ==========================================================================
   Agent4 premium brand layer (redesign 0A)
   Brand-only refinements on top of platform.css. Additive — nothing below
   changes working behavior. Fixes: --border was referenced but never
   defined (now aliased to platform's --line).
   ========================================================================== */
:root { --border: var(--line); }

/* Frosted sticky client-portal top bar */
.client-top {
  position: sticky; top: 0; z-index: 90;
  background: rgba(255, 255, 255, .74);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(16, 17, 22, .07);
  box-shadow: 0 8px 28px rgba(35, 43, 61, .07);
}

/* Logo mark — premium ring + glow */
.brand-logo {
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 6px 16px rgba(79, 89, 245, .25);
}

/* AI assistant FAB — breathing brand glow */
.ai-assist-btn {
  background: linear-gradient(135deg, #4f59f5, #8a5cf6);
  animation: brandBreathe 3.2s ease-in-out infinite;
}
@keyframes brandBreathe {
  0%, 100% { box-shadow: 0 6px 20px rgba(79, 89, 245, .38); }
  50%      { box-shadow: 0 6px 32px rgba(122, 92, 255, .62); }
}
.ai-assist-btn:hover { transform: scale(1.06); }

/* AI assistant card — frosted glass */
.ai-assist-card {
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 18px;
}

/* Error pages — premium gradient wash + gradient headline */
.error-page {
  background:
    radial-gradient(900px 480px at 10% 0%, rgba(122, 92, 255, .10), transparent 60%),
    linear-gradient(160deg, #f5f2fe 0%, #eef4fe 50%, #edfaf3 100%);
}
.error-page h1 {
  background: linear-gradient(115deg, #4f59f5 10%, #8a5cf6 55%, #0fb5a8 115%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* Error-viewer pills keep their flat status colors (override any gradients) */
.pill-error, .pill-exception, .pill-fatal, .pill-critical,
.pill-warning, .pill-notice, .pill-deprecated,
.pill-status-new, .pill-status-acknowledged, .pill-status-resolved,
.pill-info, .pill-success,
.pill-triage-genuine_defect, .pill-triage-test_artifact, .pill-triage-transient {
  background-image: none;
  border: 0;
  box-shadow: none;
}

/* ==========================================================================
   Phase 1 — File Manager
   ========================================================================== */

/* Three-zone browser: tree | center | preview drawer */
.files-browser {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 0;
  gap: 16px;
  align-items: start;
}
.files-browser.has-selection { grid-template-columns: 250px minmax(0, 1fr) 330px; }
.files-tree { max-height: 70vh; overflow: auto; padding: 14px; }
.files-tree .tree-client { margin-bottom: 6px; }
.files-tree .tree-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: none; padding: 8px 10px; border-radius: 10px;
  font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; text-align: left;
}
.files-tree .tree-head:hover { background: rgba(79, 89, 245, .07); }
.files-tree .tree-head.active { background: var(--brand-soft); color: var(--brand); }
.files-tree .tree-kids { margin-left: 14px; border-left: 2px solid var(--line); padding-left: 8px; }
.files-tree .tree-kid {
  display: block; padding: 5px 8px; border-radius: 8px; font-size: 12.5px;
  color: var(--muted); cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.files-tree .tree-kid:hover { color: var(--text); background: rgba(79, 89, 245, .06); }
.files-tree .tree-kid.active { color: var(--brand); font-weight: 700; background: var(--brand-soft); }
.files-tree .tree-proj { font-weight: 650; color: var(--text); margin-top: 4px; }

/* Center: view toggle + search */
.files-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.files-toolbar .search { flex: 1 1 220px; }

/* Grid + list */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.file-card {
  border-radius: 16px; padding: 14px; cursor: pointer; position: relative;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.file-card:hover { transform: translateY(-2px); }
.file-card.selected { outline: 2px solid var(--brand); }
.file-card .f-thumb {
  height: 84px; border-radius: 12px; background: #eef0ff; display: grid;
  place-items: center; font-size: 30px; margin-bottom: 10px; overflow: hidden;
}
.file-card .f-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .f-name { font-size: 12.5px; font-weight: 650; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-card .f-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.file-card .f-badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.file-list .file-row { cursor: pointer; }
.file-list .file-row.selected { background: #f3f4ff; }

/* Preview drawer */
.preview-drawer { position: sticky; top: 12px; max-height: 70vh; overflow: auto; padding: 16px; display: none; }
.files-browser.has-selection .preview-drawer { display: block; }
.preview-drawer .pv-frame { border-radius: 12px; overflow: hidden; background: #0f172a; min-height: 180px;
  display: grid; place-items: center; color: #fff; font-size: 13px; }
.preview-drawer .pv-frame iframe, .preview-drawer .pv-frame img { width: 100%; height: 240px; border: 0; display: block; background: #fff; }

/* Upload zone + progress */
.upload-progress { display: none; margin-top: 12px; }
.upload-progress.show { display: block; }
.upload-progress .up-track { height: 8px; border-radius: 999px; background: #e8ebf1; overflow: hidden; }
.upload-progress .up-bar { height: 100%; width: 0; border-radius: 999px; background: var(--grad-brand); transition: width .15s; }
.upload-queue { margin-top: 10px; display: grid; gap: 8px; }
.upload-item { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.upload-item .up-track { flex: 1; }

/* Version rows */
.version-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.version-row:last-child { border-bottom: 0; }
.version-row .v-num { font-weight: 800; color: var(--brand); }

/* Share link rows */
.share-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; flex-wrap: wrap; }
.share-row:last-child { border-bottom: 0; }
.share-row code { background: #eef1f5; padding: 4px 8px; border-radius: 8px; font-size: 11.5px; word-break: break-all; }

/* Signature modal extras (builds on .sig-* from platform.css) */
.sig-fonts { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.sig-fonts button {
  border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px;
  font-size: 20px; cursor: pointer; color: #2b3a67;
}
.sig-fonts button.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sig-saved { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px;
  background: #f6fff9; border: 1.5px dashed #bfe9d2; margin-bottom: 12px; flex-wrap: wrap; }
.sig-saved img { max-height: 70px; background: #fff; border-radius: 10px; padding: 6px 12px; }
.sig-embed { width: 100%; height: 320px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.sig-modal-card { max-width: 720px; }

/* File detail preview frame */
.file-preview-frame { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.file-preview-frame iframe, .file-preview-frame img { width: 100%; height: 480px; border: 0; display: block; }
.file-preview-frame .pv-text { padding: 18px; white-space: pre-wrap; font-size: 13px; max-height: 480px; overflow: auto; }

@media (max-width: 1100px) {
  .files-browser, .files-browser.has-selection { grid-template-columns: 220px minmax(0, 1fr); }
  .files-browser.has-selection .preview-drawer { display: none; }
}
@media (max-width: 768px) {
  .files-browser, .files-browser.has-selection { grid-template-columns: 1fr; }
  .files-tree { max-height: none; }
  .file-preview-frame iframe, .file-preview-frame img { height: 320px; }
}

/* Phase 1b — signature pad touch fix: drawing must not scroll the page */
.sig-pad canvas { touch-action: none; }

/* ==== Phase 2 — Support Desk (2026-09-23) ==== */
/* Client upload queue rows (support-client.js). */
.su-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px;
  background: rgba(255,255,255,.75); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; }
.su-row .su-info { flex: 1; min-width: 0; }
.su-row .su-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.su-row .su-info small { color: var(--muted); }
.su-bar { height: 6px; background: #e8ecf2; border-radius: 999px; overflow: hidden; flex: 2; }
.su-bar i { display: block; height: 100%; width: 0; background: var(--grad-brand); border-radius: 999px; transition: width .2s; }
.su-row.done { border-color: #bfe9d2; }
.su-row.error { border-color: #f3b8bd; }
.su-status { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.su-remove { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 6px; }
.su-remove:hover { color: #c0392b; }
/* Snippet autocomplete menu (support-admin.js; reusable for Phase 3). */
.snippet-menu { position: absolute; z-index: 200; min-width: 260px; max-width: 440px; }
.snippet-menu .sm-item { cursor: pointer; }
.snippet-menu .sm-item.active, .snippet-menu .sm-item:hover { background: var(--brand-soft); }

/* ==== Phase 4I — AI project planning + AI contract drafting (2026-09-23) ==== */
/* Alert banners (used across admin templates). */
.alert { border-radius: 12px; padding: 12px 16px; font-size: 13.5px; margin: 0 0 16px;
  background: rgba(255,255,255,.7); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.alert-warning { border-color: #f0c96a; background: rgba(255, 248, 230, .85); }
.alert-info { border-color: #9ec7f0; background: rgba(232, 243, 255, .85); }
.alert strong { font-weight: 700; }
/* AI plan preview list. */
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.plan-milestone { background: rgba(255,255,255,.72); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; }
.plan-milestone > strong { font-size: 14.5px; }
.plan-tasks { margin: 8px 0 0; padding: 0 0 0 18px; display: grid; gap: 4px; font-size: 13px; }
.plan-tasks small { font-size: 12px; }
/* Contract draft preview — document look. */
.doc-preview { background: rgba(255,255,255,.8); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px 24px; font-size: 13.5px; line-height: 1.65; }
.doc-preview h2 { font-size: 15px; margin: 18px 0 8px; }
.doc-preview h2:first-child { margin-top: 0; }
.doc-preview ul { margin: 8px 0; padding-left: 20px; }
@media (max-width: 640px) { .doc-preview { padding: 14px 16px; } }
