/* EstiFlow — app styles (clean, framework-free). */
:root {
  --navy: #1E2130; --navy-2: #2D3561; --purple: #6C5CE7;
  --ink: #1E2130; --muted: #6B7280; --line: #E5E7EB; --bg: #F4F5F7; --card: #fff;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); }

/* left sidebar — the canonical chrome owns the top: the full-width feedback
   bar (34px) + the AE OS header (56px) stack above. The sidebar starts below
   the header; its top tracks the same selector ae-header.css uses, so it lands
   at 56px (header only) or 90px (feedback bar + header). */
#shell { position: fixed; top: 56px; left: 0; bottom: 0; width: 216px; background: var(--navy); color: #fff; z-index: 20; overflow-y: auto; }
body:has(.fb-fab.fb-visible) #shell { top: 90px; }
.side-nav { display: flex; flex-direction: column; min-height: 100%; padding: 16px 12px; }
.side-brand { font-size: 15px; font-weight: 800; letter-spacing: .02em; color: #fff; padding: 2px 10px 14px; }
.side-links { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-link { color: #b9bed0; text-decoration: none; font-size: 13.5px; font-weight: 600; padding: 9px 12px; border-radius: 8px; }
.side-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-link.on { color: #fff; background: rgba(108,92,231,.28); }
.side-role { display: flex; align-items: center; gap: 8px; padding: 12px 6px 2px; margin-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.side-role .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--purple); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.side-role-name { font-size: 12px; font-weight: 700; color: #fff; }
.side-role .u-role { margin-left: auto; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: #b9bed0; }

/* page (right of the sidebar) */
.view { margin-left: 216px; padding: 26px 32px; }
@media (max-width: 760px) {
  #shell { position: static; width: auto; }
  .side-nav { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 14px; }
  .side-links { flex-direction: row; flex-wrap: wrap; }
  .side-brand { padding: 0 10px 0 0; }
  .side-role { border-top: none; margin: 0 0 0 auto; padding: 0; }
  .view { margin-left: 0; padding: 18px; }
}
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.loading, .empty { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 40px; text-align: center; color: var(--muted); }
.empty p { margin: 4px 0; } .muted { color: var(--muted); }

/* buttons */
.btn { font: inherit; font-weight: 600; padding: 8px 15px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.btn:hover { border-color: #cfd3dc; }
.btn-primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn-primary:hover { background: #5a4ad1; }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: #c0392b; background: #fdecea; }

/* table */
.tbl { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 16px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tr.row { cursor: pointer; }
.tbl tr.row:hover td { background: #f7f6fe; }
.p-name { font-weight: 700; }
.p-sub { font-size: 12px; color: var(--muted); }
.status { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #eef0f3; color: #4b5563; }
.status.s-draft { background: #eef0f3; color: #4b5563; }
.status.s-active, .status.s-inreview { background: #fff3df; color: #9a6700; }
.status.s-submitted { background: #e6f1fb; color: #185fa5; }
.status.s-final, .status.s-completed, .status.s-approved { background: #e6f7ec; color: #1b7a43; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13px; font-weight: 600; box-shadow: 0 12px 32px rgba(0,0,0,.28); transition: all .22s ease; z-index: 100; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: #1b7a43; } .toast.error { background: #c0392b; } .toast.info { background: var(--navy); }

/* wizard */
.head-actions { display: flex; align-items: center; gap: 12px; }
.wz-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 880px) { .wz-layout { grid-template-columns: 1fr; } }
.wz-form { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 800; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.fld { display: block; margin-bottom: 12px; }
.fld:last-child { margin-bottom: 0; }
.fld-l { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.in { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.in:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(108,92,231,.15); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 720px) { .grid-3, .grid-5 { grid-template-columns: 1fr 1fr; } }
.sub-list { display: flex; flex-direction: column; gap: 8px; }
.conn-row { display: grid; grid-template-columns: 110px 90px 1fr 36px; gap: 8px; align-items: center; }
.addons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.addon { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.addon .muted { margin-left: auto; }

/* readout */
.wz-side { position: sticky; top: 76px; }
.readout { background: var(--navy); color: #fff; border-radius: 12px; padding: 16px 18px; }
.ro-head { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #b9bed0; font-weight: 700; }
.ro-rule { font-size: 12px; color: #b9bed0; margin: 4px 0 12px; }
.ro-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.ro-row span:last-child { font-weight: 700; }
.ro-row.strong { font-size: 15px; padding-top: 7px; }
.ro-row.strong span:last-child { color: #b9a8ff; }
.ro-div { height: 1px; background: rgba(255,255,255,.14); margin: 8px 0; }

/* pricing grid */
.hint { font-size: 12px; margin: 0 0 14px; }
.in-sm { width: 64px; padding: 5px 6px; text-align: right; }
.pricing-tbl td, .pricing-tbl th { padding: 8px 10px; }
.pricing-tbl .num { text-align: right; white-space: nowrap; }
.pricing-tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.pricing-tbl tfoot td { border-top: 2px solid var(--line); font-size: 14px; }
.pricing-tbl .strong { font-weight: 800; }
.price-totals { margin-top: 16px; max-width: 360px; margin-left: auto; }
.price-totals .pt-basis { font-size: 12px; text-align: right; margin-bottom: 8px; }
.price-totals .pt-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; }
.price-totals .pt-row .strong { font-weight: 800; color: var(--purple); }

/* gantt */
.gantt-controls { display: flex; gap: 16px; margin-bottom: 18px; }
.gantt-controls .fld { margin: 0; }
.gantt-controls .in { width: 160px; }
.gantt { margin-bottom: 20px; }
.gtrack { position: relative; height: 38px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.gbar { position: absolute; top: 4px; height: 30px; border-radius: 6px; display: flex; align-items: center; overflow: hidden; min-width: 2px; }
.gbar-l { color: #fff; font-size: 11px; font-weight: 700; padding: 0 8px; white-space: nowrap; }
.gantt-tbl .num { text-align: right; white-space: nowrap; }
.gantt-tbl tfoot td { border-top: 2px solid var(--line); }
.gantt-tbl .strong { font-weight: 800; }

/* workflow */
.stepper { display: flex; gap: 8px; margin: 8px 0 20px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--muted); font-size: 13px; font-weight: 600; }
.step-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--line); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.step.done { color: var(--ink); } .step.done .step-dot { background: var(--green, #00B894); }
.step.on { border-color: var(--purple); color: var(--purple); } .step.on .step-dot { background: var(--purple); }
.wf-side-status { margin-bottom: 16px; font-weight: 700; color: var(--muted); }
.wf-summary { max-width: 480px; margin-bottom: 18px; }
.sum-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.sum-row span:last-child { font-weight: 700; }
.sum-row.strong { font-size: 15px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.sum-row.strong span:last-child { color: var(--purple); }
.wf-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* config */
.team-row { display: grid; grid-template-columns: 1fr 1.4fr 130px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.add-member { display: grid; grid-template-columns: 1fr 1.4fr 130px auto; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 720px) { .team-row, .add-member { grid-template-columns: 1fr 1fr; } }

/* conversation */
.convo { max-width: 620px; margin-top: 18px; }
.convo-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.convo-msg { border-left: 3px solid var(--purple); padding: 6px 0 6px 12px; }
.convo-meta { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.convo-author { font-weight: 700; }
.convo-role { text-transform: uppercase; letter-spacing: .03em; font-size: 11px; }
.convo-at { margin-left: auto; }
.convo-body { font-size: 13px; margin-top: 2px; white-space: pre-wrap; }
.convo-input { width: 100%; resize: vertical; font-family: inherit; }
.convo-post { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.convo-post .btn { white-space: nowrap; }

/* summary / report */
.report { max-width: 820px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px; }
.report-head { border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 18px; }
.report-head h1 { margin: 0 0 4px; font-size: 24px; }
.report section { margin-bottom: 22px; }
.report section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 5px; margin: 0 0 10px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.kv { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.kv-l { color: var(--muted); } .kv-v { font-weight: 700; }
.report-totals { max-width: 360px; margin-left: auto; }
.kv.grand { font-size: 16px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.kv.grand .kv-v { color: var(--purple); }

/* pmo comparison editor */
.pmo-tbl td, .pmo-tbl th { padding: 8px 10px; }
.pmo-tbl .num { text-align: right; }
.pmo-tbl tr.pmo-changed { background: #FFF7E6; }
.pmo-tbl tr.pmo-changed td:first-child { border-left: 3px solid #BA7517; }
.pmo-totals { max-width: 360px; margin-left: auto; margin-top: 16px; }
.pmo-totals .kv { padding: 6px 0; font-size: 15px; }
.pmo-totals .kv-v.up { color: #c0392b; }
.pmo-totals .kv-v.down { color: #1b7a43; }

/* access / edit-lock */
.lock-banner { background: #FFF7E6; border: 1px solid #F0D9A8; color: #8a6d1f; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600; margin: 0 0 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

@media print {
  #shell, #ae-shared-header, .no-print, #toast { display: none !important; }
  body, .view { background: #fff !important; margin: 0; padding: 0; }
  .report { border: none; border-radius: 0; max-width: none; padding: 0; }
  .report-totals .kv.grand .kv-v { color: #000; }
}
