:root {
  --bg: #f3f6f7;
  --panel: #ffffff;
  --panel-2: #f8fafb;
  --text: #162023;
  --muted: #687579;
  --line: #dce5e7;
  --brand: #0f766e;
  --brand-2: #115e59;
  --good: #16794b;
  --warn: #a46608;
  --bad: #b42318;
  --info: #1d4ed8;
  --shadow: 0 10px 30px rgba(10, 35, 38, .07);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tiny { font-size: .76rem; }
.strong { font-weight: 700; }
.right { text-align: right; }
.positive { color: var(--good); }
.negative { color: var(--bad); }
.warning { color: var(--warn); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: #102a2d; color: #e8f5f4; padding: 22px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #14b8a6, #0f766e); font-weight: 900; }
.brand-name { font-size: 1.15rem; font-weight: 800; }
.brand-sub { color: #9cc7c4; font-size: .74rem; }
.project-switch { border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 12px; margin-bottom: 22px; background: rgba(255,255,255,.04); }
.project-switch select { width: 100%; background: #16373a; color: white; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; padding: 9px 10px; margin-top: 7px; }
.nav-title { color: #82aaa7; text-transform: uppercase; font-size: .68rem; letter-spacing: .12em; margin: 18px 10px 7px; }
.nav-btn { width: 100%; border: 0; background: transparent; color: #dcebea; padding: 10px 12px; text-align: left; border-radius: 10px; margin: 2px 0; display: flex; align-items: center; gap: 9px; }
.nav-btn:hover, .nav-btn.active { background: rgba(20,184,166,.16); color: white; }
.nav-btn.active { box-shadow: inset 3px 0 0 #2dd4bf; }
.sidebar-footer { margin-top: 25px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; color: #9cc7c4; }

.main { min-width: 0; }
.topbar { height: 70px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 8; backdrop-filter: blur(10px); }
.topbar h1 { font-size: 1.25rem; margin: 0; }
.top-actions { display: flex; gap: 9px; align-items: center; }
.content { padding: 28px; max-width: 1500px; margin: 0 auto; }

.btn { border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; background: white; color: var(--text); font-weight: 650; }
.btn:hover { border-color: #aebfc2; }
.btn.primary { background: var(--brand); color: white; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.icon { padding: 8px 10px; }
.btn.large { padding: 12px 18px; }

.grid { display: grid; gap: 18px; }
.grid.kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.flat { box-shadow: none; }
.card h2, .card h3 { margin: 0 0 12px; }
.kpi-card .label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.kpi-card .value { font-size: 1.8rem; font-weight: 850; margin-top: 7px; }
.kpi-card .sub { margin-top: 8px; color: var(--muted); font-size: .86rem; }
.kpi-card.attention { border-color: #f2c4bc; }
.kpi-card.good { border-color: #b6dfca; }

.section-head { display: flex; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { background: #f7fafb; color: #526164; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid #edf1f2; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfdfd; }

.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: .76rem; font-weight: 700; background: #eef3f4; color: #46585b; }
.badge.good { background: #e8f7ef; color: var(--good); }
.badge.warn { background: #fff3dd; color: var(--warn); }
.badge.bad { background: #feeceb; color: var(--bad); }
.badge.info { background: #eaf0ff; color: var(--info); }

.progress { height: 9px; border-radius: 999px; background: #e6edef; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

.alert { display: flex; gap: 12px; padding: 13px 14px; border-radius: 12px; background: #fafcfc; border: 1px solid var(--line); margin: 9px 0; }
.alert.bad { border-left: 4px solid var(--bad); }
.alert.warn { border-left: 4px solid var(--warn); }
.alert.good { border-left: 4px solid var(--good); }
.alert .symbol { font-size: 1.15rem; }
.alert .title { font-weight: 800; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 750; margin-bottom: 6px; font-size: .87rem; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #cfdadd; border-radius: 10px; padding: 10px 11px; background: white; color: var(--text); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #62aaa3; box-shadow: 0 0 0 3px rgba(15,118,110,.11); }
.field textarea { min-height: 92px; resize: vertical; }
.help { color: var(--muted); font-size: .78rem; margin-top: 5px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(6, 23, 25, .55); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { width: min(820px, 100%); max-height: 90vh; overflow-y: auto; background: white; border-radius: 18px; box-shadow: 0 28px 80px rgba(0,0,0,.24); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 20px; border-top: 1px solid var(--line); background: #fafcfc; }

.wizard-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 20px; }
.wizard-step { height: 6px; background: #e1e9eb; border-radius: 99px; }
.wizard-step.active, .wizard-step.done { background: var(--brand); }

.empty { text-align: center; padding: 55px 20px; color: var(--muted); }
.empty .big { font-size: 2rem; margin-bottom: 10px; }

.timeline { display: grid; gap: 12px; }
.timeline-row { display: grid; grid-template-columns: 170px 1fr 110px; gap: 12px; align-items: center; }
.timeline-track { height: 12px; background: #e7edef; border-radius: 99px; position: relative; overflow: hidden; }
.timeline-track span { position: absolute; inset-block: 0; border-radius: inherit; background: var(--brand); }

.cash-bars { display: grid; gap: 10px; }
.cash-row { display: grid; grid-template-columns: 95px 1fr 105px; gap: 12px; align-items: center; }
.cash-track { height: 18px; border-radius: 99px; background: #edf2f3; position: relative; overflow: hidden; }
.cash-track span { display: block; height: 100%; border-radius: inherit; }
.cash-track .in { background: #5fb78b; }
.cash-track .out { background: #dd8f86; }
.cash-track .netpos { background: #6aa9df; }
.cash-track .netneg { background: #d77a70; }

.hero { background: linear-gradient(135deg, #0f766e, #174c52); color: white; border-radius: 20px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.hero h2 { margin: 0 0 7px; font-size: 1.55rem; }
.hero .meta { color: #c4e8e4; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.hero-stat { background: rgba(255,255,255,.08); padding: 12px; border-radius: 12px; }
.hero-stat .label { color: #b7ddd9; font-size: .76rem; }
.hero-stat .value { font-weight: 800; font-size: 1.1rem; margin-top: 4px; }

.project-card { display: grid; grid-template-columns: 1fr auto; gap: 20px; }
.project-card h3 { margin: 0 0 4px; }
.project-card .metrics { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 13px; }
.project-card .metric .label { color: var(--muted); font-size: .74rem; }
.project-card .metric .value { font-weight: 750; margin-top: 2px; }

.fab { position: fixed; right: 28px; bottom: 28px; z-index: 20; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--brand); color: white; font-size: 1.8rem; box-shadow: 0 10px 30px rgba(15,118,110,.35); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #122d30; color: white; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; }

.mobile-nav { display: none; }

@media (max-width: 1050px) {
  .grid.kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: 1fr 1fr; }
  .app-shell { grid-template-columns: 220px 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 60px; padding: 0 15px; }
  .content { padding: 16px 14px 86px; }
  .grid.kpi, .grid.two, .grid.three, .form-grid { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: 1fr; }
  .project-card { grid-template-columns: 1fr; }
  .project-card > div:last-child { display: flex; justify-content: flex-end; }
  .timeline-row { grid-template-columns: 115px 1fr; }
  .timeline-row > :last-child { display: none; }
  .mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 66px; display: grid; grid-template-columns: repeat(5, 1fr); background: white; border-top: 1px solid var(--line); z-index: 25; }
  .mobile-nav button { border: 0; background: transparent; color: #556568; font-size: .72rem; display: grid; place-content: center; gap: 3px; }
  .mobile-nav .plus { width: 44px; height: 44px; margin: auto; border-radius: 50%; background: var(--brand); color: white; font-size: 1.5rem; }
  .fab { display: none; }
}

/* Projectia V2 */
.boot{min-height:100vh;display:grid;place-items:center;color:#607376;font-weight:700}
.auth-shell{min-height:100vh;display:grid;grid-template-columns:1.1fr .9fr;background:#f4f7f7}
.auth-side{background:linear-gradient(145deg,#102a2d,#0f766e);color:#fff;padding:8vw;display:flex;flex-direction:column;justify-content:center}
.auth-side h1{font-size:clamp(2.2rem,5vw,4.5rem);margin:0 0 12px}.auth-side p{max-width:620px;color:#c4e8e4;font-size:1.1rem;line-height:1.6}
.auth-panel{display:grid;place-items:center;padding:30px}.auth-card{width:min(440px,100%);background:#fff;border:1px solid var(--line);border-radius:20px;padding:28px;box-shadow:var(--shadow)}
.auth-card h2{margin-top:0}.auth-error{background:#feeceb;color:#9f2d28;padding:11px 12px;border-radius:10px;margin:10px 0}
.user-chip{display:flex;align-items:center;gap:8px;color:#526164;font-size:.85rem}.user-dot{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#e5f5f2;color:#0f766e;font-weight:900}
.mono{font-variant-numeric:tabular-nums}.stack{display:grid;gap:10px}.muted-line{border-top:1px solid var(--line);margin:16px 0}.right{text-align:right}.negative{color:#b13a31}.positive{color:#15714a}.neutral{color:#526164}
.explain-box{background:#f7fafb;border:1px dashed #c8d6d8;border-radius:12px;padding:14px}.explain-box strong{display:block;margin-bottom:5px}
@media(max-width:760px){.auth-shell{grid-template-columns:1fr}.auth-side{display:none}.auth-panel{padding:18px}.top-actions .user-chip{display:none}}
