:root {
  --bg: #f7f3ed;
  --panel: #fffdf9;
  --panel-2: #f3ece2;
  --ink: #201a17;
  --muted: #74665d;
  --line: #ded3c5;
  --brand: #136f63;
  --brand-2: #0f5a51;
  --warn: #b96018;
  --bad: #a9342d;
  --good: #267147;
  --shadow: 0 14px 34px rgba(36, 28, 20, .10);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.hidden { display: none !important; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: #1f2f2b; color: #f8f1e8; padding: 22px 18px; display: flex; flex-direction: column; gap: 20px; }
.brand { display: flex; flex-direction: column; gap: 3px; padding: 4px 4px 14px; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand strong { font-size: 19px; }
.brand span { color: rgba(255,255,255,.66); font-size: 13px; }
.nav { display: grid; gap: 6px; }
.nav button { text-align: left; background: transparent; color: rgba(255,255,255,.76); padding: 10px 12px; border-radius: 8px; }
.nav button.active, .nav button:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; }
.ghost { background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 8px; padding: 9px 11px; }
.main { min-width: 0; padding: 26px clamp(16px, 3vw, 36px); }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.05; letter-spacing: 0; }
.subtitle { margin: 7px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.primary, .secondary, .danger { border-radius: 8px; padding: 10px 13px; font-weight: 650; }
.primary { background: var(--brand); color: #fff; }
.primary:hover { background: var(--brand-2); }
.secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.danger { background: #fbebe9; color: var(--bad); border: 1px solid #e7b9b4; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(6, minmax(120px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.kpi { padding: 16px; min-height: 96px; display: grid; align-content: space-between; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi strong { font-size: 25px; }
.section { margin-top: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
h2 { margin: 0; font-size: 20px; letter-spacing: 0; }
.table-wrap { overflow: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; background: #fbf7f1; }
tr:hover td { background: #fdfaf5; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.badge.good { background: #e7f3eb; color: var(--good); }
.badge.bad { background: #fae9e7; color: var(--bad); }
.badge.warn { background: #fbeddc; color: var(--warn); }
.pipeline { display: grid; grid-template-columns: repeat(7, minmax(180px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.stage { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-height: 240px; }
.stage h3 { margin: 0; padding: 12px; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.stage-dropzone { min-height: 190px; padding: 1px 0 10px; border-radius: 0 0 8px 8px; transition: background .15s ease, box-shadow .15s ease; }
.stage-dropzone.drag-over { background: #e8f3ef; box-shadow: inset 0 0 0 2px rgba(19,111,99,.35); }
.deal-card { margin: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: grid; gap: 7px; cursor: grab; }
.deal-card:active { cursor: grabbing; }
.deal-card.dragging { opacity: .52; transform: rotate(.5deg); }
.deal-card strong { font-size: 14px; }
.deal-card span { color: var(--muted); font-size: 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search { flex: 1; min-width: 220px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(19,111,99,.14); }
textarea { min-height: 92px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 650; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(27, 22, 18, .45); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { width: min(780px, 100%); max-height: 92vh; overflow: auto; background: var(--panel); border-radius: 8px; box-shadow: 0 24px 70px rgba(0,0,0,.26); border: 1px solid var(--line); }
.modal header, .modal footer { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.modal footer { border-top: 1px solid var(--line); border-bottom: 0; justify-content: flex-end; }
.modal .body { padding: 18px; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.auth-hero { background: #1f2f2b; color: #fff; padding: clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: flex-end; }
.auth-hero h1 { max-width: 680px; }
.auth-hero p { color: rgba(255,255,255,.72); font-size: 18px; max-width: 620px; }
.auth-panel { display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); padding: 24px; }
.empty { padding: 26px; color: var(--muted); text-align: center; }
.toast { position: fixed; right: 16px; bottom: 16px; background: #1f2f2b; color: #fff; padding: 12px 14px; border-radius: 8px; box-shadow: var(--shadow); z-index: 30; }
.link-button { background: transparent; color: var(--brand); padding: 0; font-weight: 700; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 10; padding: 12px; }
  .brand { border: 0; padding: 0; }
  .nav { grid-template-columns: repeat(3, 1fr); }
  .sidebar-footer { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { min-height: 280px; }
}
@media (max-width: 640px) {
  .main { padding: 16px; }
  .topbar { flex-direction: column; }
  .actions { justify-content: flex-start; }
  .kpis, .form-grid { grid-template-columns: 1fr; }
  .nav { grid-template-columns: repeat(2, 1fr); }
}
