/* Estim.AI — client portal (login + dashboard) */

/* ---------- Shared dashboard components (also used in the homepage hero) ---------- */
.side-top { display: flex; align-items: center; gap: 10px; }
.side-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--blue); display: grid; place-items: center; flex: none; }
.side-mark svg { width: 26px; height: 26px; }
.side-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.side-tabs a { height: 44px; border-radius: 12px; display: grid; place-items: center; background: #EEF1F4; color: var(--ink-3); transition: background-color .2s var(--ease), color .2s var(--ease); }
.side-tabs a:hover { background: #E3E7EC; }
.side-tabs a.on { background: var(--ink); color: #fff; }
.side-block { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; background: #fff; }
.side-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side-label { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.side-hint, .side-count { font-size: 12px; color: var(--muted); }
.side-big { font-size: 32px; font-weight: 300; margin: 6px 0 8px; line-height: 1.1; }
.spark { height: 56px; display: flex; align-items: flex-end; gap: 3px; margin-bottom: 12px; }
.spark i { flex: 1; border-radius: 2px; background: var(--gray-2); min-height: 6px; }
.spark i.hi { background: linear-gradient(180deg, var(--blue-600), var(--blue-300)); }
.side-minis { gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.side-minis > div { flex: 1; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.side-minis small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.side-minis b { grid-column: 2; font-size: 22px; font-weight: 400; line-height: 1.1; }
.badge { grid-row: span 2; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.badge .i { width: 14px; height: 14px; }
.badge-warn { background: #FFF4D6; color: #8A6100; }
.badge-blue { background: var(--blue-100); color: var(--blue-700); }

.trade-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.trade-list button {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center;
  text-align: left; padding: 10px; min-height: 44px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.trade-list button .bar { grid-column: 1 / -1; height: 4px; }
.trade-list button .num { font-size: 13px; color: var(--muted); }
.trade-list button:hover { background: var(--blue-50); }
.trade-list button[aria-pressed="true"] { background: var(--blue-50); border-color: rgba(30, 143, 239, .4); }
.trade-list button[aria-pressed="true"] .num { color: var(--blue-700); }

.stage-chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.callout { position: absolute; width: 210px; padding: 12px 14px; border-radius: var(--r); transform: translate(18px, -100%); z-index: 4; pointer-events: none; }
.callout-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; }
.callout small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.callout-row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.callout-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px rgba(30, 143, 239, .2); }
.callout b { font-size: 26px; font-weight: 300; line-height: 1; }

.panel-dark { border-radius: var(--r-lg); padding: 20px 22px; }
.pd-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pd-head h2 { font-size: 20px; font-weight: 400; letter-spacing: -0.02em; }
.pd-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.75); }
.pd-cols { display: flex; gap: 6px; margin-top: 16px; }
.pd-cols > div { min-width: 0; }
.pd-cols b { font-size: 22px; font-weight: 300; display: block; }
.pd-cols small { font-size: 12px; color: rgba(255,255,255,.72); white-space: nowrap; }
.pd-bar { display: block; height: 3px; border-radius: 3px; margin-top: 10px; }
.b-blue { background: var(--blue-300); }
.b-white { background: #fff; }
.b-dim { background: rgba(255,255,255,.3); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--ink-3); white-space: nowrap; }
.pill-blue { background: var(--blue-100); color: var(--blue-700); }
.pill-green { background: #DDF5E7; color: #0B6B35; }
.pill-warn { background: #FFF4D6; color: #7A5600; }
.pp-avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-600); color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.pp-avatar--ink { background: var(--ink); }

.drop { position: relative; display: grid; justify-items: center; gap: 6px; padding: 24px 16px; border: 1.5px dashed var(--gray-2); border-radius: var(--r); background: var(--bg); text-align: center; cursor: pointer; color: var(--muted); font-size: 14px; transition: border-color .2s var(--ease), background-color .2s var(--ease); }
.drop:hover { border-color: var(--blue); background: var(--blue-50); }
.drop .i { color: var(--blue-600); }
.drop b { color: var(--ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop:focus-within { outline: 2.5px solid var(--blue-600); outline-offset: 3px; }

.icon-btn-sm { width: 40px; height: 40px; border-radius: 10px; }

/* ---------- LOGIN ---------- */
.login-body { background: #fff; }
.login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-art {
  position: relative; overflow: hidden; color: #fff; padding: 40px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(70% 60% at 100% 100%, rgba(30, 143, 239, .7), transparent 70%),
    radial-gradient(50% 40% at 20% 0%, rgba(74, 176, 245, .25), transparent 70%),
    linear-gradient(160deg, #16191D, #1D2531);
}
.login-model { position: absolute; inset: 12% 4% 26% 4%; opacity: .95; }
.login-art .iso-grid line { stroke: rgba(255,255,255,.08); }
.login-art .k-slab.f-t { fill: rgba(255,255,255,.06); stroke: rgba(255,255,255,.2); }
.login-art .k-slab.f-r, .login-art .k-slab.f-l { fill: rgba(255,255,255,.04); stroke: rgba(255,255,255,.12); }
.login-art-copy { position: relative; max-width: 460px; }
.login-art-copy h2 { font-size: clamp(28px, 2.8vw, 40px); font-weight: 400; }
.login-art-copy p { margin-top: 14px; color: rgba(255,255,255,.75); font-size: 16px; }
.login-float { position: absolute; right: 40px; top: 120px; display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--r); color: var(--ink); background: rgba(255,255,255,.9); }
.login-float b { display: block; font-size: 14px; }
.login-float small { font-size: 12px; color: var(--muted); }
.lf-ic { width: 32px; height: 32px; border-radius: 10px; background: #DDF5E7; color: #0B6B35; display: grid; place-items: center; }
.login-main { position: relative; display: grid; place-items: center; padding: 72px 24px 40px; }
.back-link { position: absolute; top: 24px; left: 24px; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--muted); border-radius: 8px; }
.back-link:hover { color: var(--ink); }
.login-card { width: 100%; max-width: 420px; display: grid; gap: 18px; }
.login-logo-sm { display: none; }
.login-card h1 { font-size: 36px; font-weight: 400; }
.login-sub { color: var(--muted); margin-top: -10px; }
#login-form { display: grid; gap: 16px; }
.label-row { display: flex; justify-content: space-between; align-items: center; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--blue-600); font-weight: 600; font-size: 14px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.pw-toggle:hover { color: var(--ink); }
.pw-toggle[aria-pressed="true"] { color: var(--blue-600); }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--blue-600); }
.form-msg { font-size: 14px; color: var(--muted); min-height: 1em; }
.form-msg.err-msg { color: var(--danger); font-weight: 500; }
.form-msg.ok-msg { color: #0B6B35; font-weight: 500; }
.demo-box[hidden] { display: none; }
.demo-box { border: 1px solid var(--blue-100); background: var(--blue-50); border-radius: var(--r); padding: 16px; font-size: 14px; }
.demo-head { display: flex; align-items: center; gap: 6px; color: var(--blue-700); margin-bottom: 4px; }
.demo-box p { color: var(--ink-3); }
.demo-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.demo-acct { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line); text-decoration: none; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.demo-acct:hover { border-color: var(--blue); box-shadow: var(--shadow-sm); }
.demo-acct .pp-avatar { width: 34px; height: 34px; font-size: 12px; border-radius: 10px; }
.demo-acct b { display: block; font-size: 13px; line-height: 1.3; }
.demo-acct small { font-size: 12px; color: var(--muted); }
.login-foot { text-align: center; font-size: 14px; color: var(--muted); }
.login-foot a { color: var(--blue-600); font-weight: 600; }
@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-logo-sm { display: inline-flex; }
}
@media (max-width: 420px) { .demo-btns { grid-template-columns: 1fr; } }

/* ---------- DASHBOARD ---------- */
.app-body {
  background:
    radial-gradient(50% 40% at 100% 100%, rgba(30, 143, 239, .18), transparent 70%),
    linear-gradient(180deg, #F6F7F9, #EDF0F4);
  background-attachment: fixed;
}
.app { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; padding: 16px; max-width: 1680px; margin: 0 auto; }
.app-side {
  position: sticky; top: 16px; height: calc(100vh - 32px); border-radius: var(--r-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 14px; overflow-y: auto; background: rgba(255,255,255,.82);
}
.side-search { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; height: 40px; padding: 0 10px; border-radius: 10px; background: #F1F3F6; color: var(--muted); }
.side-search input { border: 0; background: transparent; outline: none; width: 100%; min-width: 0; font-size: 14px; color: var(--ink); }
.side-search:focus-within { box-shadow: 0 0 0 3px rgba(30, 143, 239, .25); }
#notif-btn { position: relative; }
.notif-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); border: 2px solid #fff; }
.side-projects { flex: 1; min-height: 0; }
.proj-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.proj-item { width: 100%; text-align: left; display: grid; gap: 6px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; transition: border-color .2s var(--ease), background-color .2s var(--ease); }
.proj-item:hover { border-color: var(--gray-2); }
.proj-item[aria-current="true"] { border-color: var(--blue); background: var(--blue-50); box-shadow: inset 3px 0 0 var(--blue); }
.pi-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.pi-top b { font-size: 14px; font-weight: 600; line-height: 1.3; }
.proj-item small { font-size: 12px; color: var(--muted); }
.proj-item .bar { height: 4px; }
.empty { font-size: 13px; color: var(--muted); padding: 10px 2px 0; }
.side-foot { display: grid; gap: 10px; }
.client-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); }
.client-card > div { flex: 1; min-width: 0; }
.client-card b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-card small { font-size: 12px; color: var(--muted); }

.app-main { display: grid; gap: 16px; align-content: start; min-width: 0; padding-top: 8px; }
.app-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 8px 8px 4px; }
.greet { font-size: 14px; color: var(--muted); font-weight: 500; }
.app-head h1 { font-size: clamp(32px, 3.6vw, 48px); font-weight: 300; letter-spacing: -0.035em; margin-top: 4px; }
.head-right { display: grid; justify-items: end; gap: 6px; }
.head-right .pill { font-size: 13px; padding: 6px 14px; }
.updated { font-size: 13px; color: var(--muted); }

.model-card {
  position: relative; height: 560px; border-radius: var(--r-xl); overflow: hidden; border: 1px solid #fff; box-shadow: var(--shadow);
  background:
    radial-gradient(55% 60% at 96% 110%, rgba(11, 111, 208, .55), rgba(30, 143, 239, .2) 50%, transparent 75%),
    linear-gradient(180deg, #F9FAFB, #EEF1F5);
}
.model-wrap { position: absolute; inset: 0 300px 0 0; cursor: grab; touch-action: none; }
.model-wrap.dragging { cursor: grabbing; }
.model-tools { position: absolute; left: 16px; top: 16px; display: grid; gap: 6px; z-index: 3; }
.model-tools .icon-btn { width: 40px; height: 40px; border-radius: 10px; }
.model-hint { position: absolute; left: 16px; bottom: 14px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); background: rgba(255,255,255,.7); padding: 6px 10px; border-radius: 999px; z-index: 3; }
.trades-panel { position: absolute; right: 16px; top: 16px; bottom: 16px; width: 280px; border-radius: var(--r-lg); padding: 16px; overflow-y: auto; z-index: 3; background: rgba(255,255,255,.8); }

.row-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.row-2 .panel-dark { background: linear-gradient(140deg, #16191D, #1C2633 60%, #0F3A68 130%); }
.prog-big { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; }
.prog-big b { font-size: 44px; font-weight: 300; line-height: 1; }
.prog-big span { color: rgba(255,255,255,.72); font-size: 14px; }
.out-stack { display: flex; height: 10px; border-radius: 10px; overflow: hidden; margin-top: 18px; gap: 2px; }
.out-stack i { display: block; height: 100%; transition: flex-grow .5s var(--ease); }
.s-mat { background: var(--blue-300); }
.s-lab { background: var(--blue); }
.s-oh { background: #fff; }
.s-mu { background: rgba(255,255,255,.35); }
.cost-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 0; }
.cost-grid dt { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.72); }
.cost-grid dt i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }
.cost-grid dd { margin: 4px 0 0; font-size: 18px; }

.row-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; min-width: 0; }
.row-main > *, .row-2 > *, .stack > * { min-width: 0; }
.app-head > div:first-child { min-width: 0; }
.app-head h1 { overflow-wrap: anywhere; }
.pcard { padding: 22px; }
.pcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.pcard-head h2 { font-size: 20px; font-weight: 500; }
.pcard-head p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.mat-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.mat-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px; border-bottom: 1px solid var(--line); }
.mat-table th:nth-child(n+3) { text-align: right; }
.mat-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mat-table td.r { text-align: right; white-space: nowrap; }
.mat-table td small { color: var(--muted); }
.mat-table tfoot td { font-weight: 700; text-align: right; border-bottom: 0; padding-top: 14px; }
.mat-table tfoot td:first-child { text-align: left; }
.phase { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--bg); font-size: 12px; font-weight: 600; color: var(--ink-3); }
.mat-table tbody tr:hover td { background: var(--blue-50); }

.file-list, .feed { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; transition: background-color .2s var(--ease); }
.file-list li:hover { background: var(--bg); }
.file-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue-600); flex: none; }
.file-meta { flex: 1; min-width: 0; }
.file-meta b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta small { font-size: 12px; color: var(--muted); }
.feed li { display: flex; gap: 12px; padding: 10px 4px; font-size: 14px; border-bottom: 1px dashed var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.feed-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); color: var(--ink-3); flex: none; }

.project-view { display: grid; gap: 16px; min-width: 0; }
.project-view[hidden], .empty-state[hidden], .demo-note[hidden] { display: none; }
.empty-state { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 64px 24px; margin-top: 8px; }
.empty-state h1 { font-size: 32px; font-weight: 400; }
.empty-state p { max-width: 460px; color: var(--muted); }
.app-loading { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(243, 245, 248, .92); color: var(--ink-3); font-weight: 500; transition: opacity .3s var(--ease); }
.app-loading.done { opacity: 0; pointer-events: none; }
.app-loading.error { color: var(--danger); }
.app-loading.error .spinner { display: none; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--blue-100); border-top-color: var(--blue-600); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.demo-note { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 13px; color: var(--muted); padding: 8px 0 16px; }

/* modal */
.modal { border: 0; padding: 0; border-radius: var(--r-lg); width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(22, 25, 29, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-inner { padding: 24px; display: grid; gap: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-size: 22px; font-weight: 500; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal { max-height: calc(100vh - 32px); overflow-y: auto; }
.modal .field[hidden] { display: none; }
.trade-pick { border: 0; padding: 0; margin: 0; min-width: 0; }
.trade-pick legend { padding: 0; margin-bottom: 4px; }
.trade-checks { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.out-stack .t0 { background: var(--blue-300); } .out-stack .t1 { background: var(--blue); }
.out-stack .t2 { background: #fff; } .out-stack .t3 { background: rgba(255,255,255,.35); }
.cost-grid .t0 { background: var(--blue-300); } .cost-grid .t1 { background: var(--blue); }
.cost-grid .t2 { background: #fff; } .cost-grid .t3 { background: rgba(255,255,255,.35); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal[open] { animation: modalIn .25s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; z-index: 100; max-width: min(520px, calc(100vw - 32px)); padding: 14px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); transition: opacity .25s var(--ease), transform .25s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1280px) {
  .row-main { grid-template-columns: minmax(0, 1fr); }
  .stack { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .row-main { grid-template-columns: minmax(0, 1fr); }
  .app-side { position: relative; top: 0; height: auto; overflow: visible; }
  .side-projects { flex: none; }
  .model-card { height: auto; display: flex; flex-direction: column; }
  .model-wrap { position: relative; inset: auto; height: 380px; }
  .trades-panel { position: relative; inset: auto; width: auto; margin: 0 12px 12px; }
  .model-hint { display: none; }
  .row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .app-head { flex-direction: column; }
  .head-right { justify-items: start; }
  .model-wrap { height: 280px; }
  .stack { grid-template-columns: minmax(0, 1fr); }
  .pd-cols > div { flex: 1 1 0 !important; }
  .pd-cols small { white-space: normal; }
  .cost-grid { grid-template-columns: 1fr 1fr; }
  .pcard { padding: 18px; }
  .form-2 { grid-template-columns: 1fr; }
  .pcard-head { flex-direction: column; }
}
