:root {
  --navy: #0b1f3a; --navy-deep: #071528; --teal: #007D80; --teal-dark: #006568;
  --teal-light: #ccfbf1; --slate: #334155; --muted: #64748b; --border: #e2e8f0;
  --bg: #f1f5f9; --white: #ffffff; --success: #059669; --warning: #d97706;
  --danger: #dc2626; --radius: 12px;
  --shadow: 0 1px 2px rgba(11,31,58,0.04), 0 4px 16px rgba(11,31,58,0.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--slate); background: var(--bg);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--white); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 24px; }
.brand img { height: 28px; width: auto; }
.brand-fallback { font-weight: 800; color: var(--navy); font-size: 15px; letter-spacing: -0.02em; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--muted);
}
.nav a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; flex-shrink: 0; }
.nav a.active { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
.nav a:hover:not(.active) { background: #f8fafc; color: var(--navy); }
.nav-section {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: #94a3b8; padding: 16px 12px 6px;
}
.sidebar-foot { padding: 12px 8px 0; border-top: 1px solid var(--border); margin-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-chip .name { font-size: 13px; font-weight: 600; color: var(--navy); }
.user-chip .role { font-size: 11.5px; color: var(--muted); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: var(--white); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 700; color: var(--navy); letter-spacing: -0.02em; }
.topbar .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.greeting { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.example-badge {
  font-size: 11px; font-weight: 600; color: var(--muted); background: #f8fafc;
  border: 1px solid var(--border); padding: 3px 9px; border-radius: 999px;
}
.top-actions { display: flex; gap: 8px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; transition: background .15s;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: var(--white); color: var(--slate); border: 1px solid var(--border); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-call { background: var(--navy); color: white; }
.btn-done { background: #ecfdf5; color: var(--success); border: 1px solid #a7f3d0; }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.content { padding: 22px 28px; display: flex; flex-direction: column; gap: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 700; color: var(--navy); letter-spacing: -0.03em; margin-top: 2px; }
.stat .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat .hint.up { color: var(--success); }
.stat .hint.warn { color: var(--warning); }
.grid-2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; }
.card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid #f1f5f9;
}
.card-head h2 {
  font-size: 13.5px; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 8px;
}
.card-head h2 svg { width: 16px; height: 16px; stroke: var(--teal); fill: none; stroke-width: 1.75; }
.badge-count {
  font-size: 11px; font-weight: 700; background: var(--teal-light); color: var(--teal-dark);
  padding: 2px 7px; border-radius: 999px;
}
.card-body { padding: 6px 10px 12px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px;
}
.item:hover { background: #f8fafc; }
.item + .item { border-top: 1px solid #f1f5f9; }
.item-icon {
  width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: #f1f5f9;
}
.item-icon svg { width: 17px; height: 17px; stroke: var(--navy); fill: none; stroke-width: 1.75; }
.item-icon.teal { background: var(--teal-light); }
.item-icon.teal svg { stroke: var(--teal-dark); }
.item-icon.warn { background: #fff7ed; }
.item-icon.warn svg { stroke: var(--warning); }
.item-icon.danger { background: #fef2f2; }
.item-icon.danger svg { stroke: var(--danger); }
.item-icon.purple { background: #f5f3ff; }
.item-icon.purple svg { stroke: #7c3aed; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 13.5px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill-teal { background: var(--teal-light); color: var(--teal-dark); }
.pill-amber { background: #fff7ed; color: #c2410c; }
.pill-red { background: #fef2f2; color: #b91c1c; }
.pill-green { background: #ecfdf5; color: #047857; }
.pill-slate { background: #f1f5f9; color: #475569; }
.right-col { display: flex; flex-direction: column; gap: 14px; }
.empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.table-wrap { overflow: auto; }
table.clients { width: 100%; border-collapse: collapse; }
table.clients th, table.clients td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13px;
}
table.clients th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
table.clients tr:hover td { background: #f8fafc; }
table.clients a.rowlink { color: var(--navy); font-weight: 600; }
.search {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; min-width: 220px;
}
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card {
  width: 100%; max-width: 380px; background: white; border-radius: 16px; padding: 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card h1 { font-size: 20px; color: var(--navy); margin-bottom: 4px; }
.login-card p { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--navy); }
.field input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.error { color: var(--danger); font-size: 13px; margin-bottom: 10px; display: none; }
.profile-grid { display: grid; grid-template-columns: 1fr 320px; gap: 14px; }
.hero-card { padding: 18px 20px; }
.hero-top { display: flex; gap: 16px; align-items: flex-start; }
.company-mark {
  width: 48px; height: 48px; border-radius: 12px; background: var(--teal-light); color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.hero-info h2 { font-size: 17px; font-weight: 700; color: var(--navy); }
.hero-info .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid #f1f5f9;
}
.hs .l { font-size: 11.5px; color: var(--muted); }
.hs .v { font-size: 15px; font-weight: 700; color: var(--navy); margin-top: 2px; }
.policy {
  display: grid; grid-template-columns: 1.4fr 1fr 0.9fr 0.9fr auto; gap: 12px; align-items: center;
  padding: 12px 4px; border-bottom: 1px solid #f1f5f9;
}
.policy:last-child { border-bottom: none; }
.policy .name { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.policy .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.policy .cell { font-size: 13px; }
.policy .cell strong { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 1px; }
.form-grid { display: grid; gap: 10px; }
.form-grid .field { margin: 0; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--teal-dark); font-weight: 500; }
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--navy); color: white;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; display: none; z-index: 50;
}
@media (max-width: 980px) {
  .sidebar { display: none; }
  .stats, .grid-2, .profile-grid { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .policy { grid-template-columns: 1fr 1fr; }
}

.gap-note {
  font-size: 11.5px; color: var(--muted); background: #f8fafc;
  border: 1px dashed var(--border); border-radius: 8px;
  padding: 10px 12px; margin: 4px 8px 8px; line-height: 1.4;
}
.empty { padding: 20px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* v1.2 forms, pipeline, modals */
.field textarea, .field select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  width: 100%; background: white;
}
.field-check label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--slate); font-weight: 500; }
.field-check input { width: 16px; height: 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.modal-root { display: none; position: fixed; inset: 0; z-index: 80; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(7,21,40,0.45); }
.modal-card {
  position: relative; margin: 5vh auto; width: min(560px, 94vw); max-height: 90vh; overflow: auto;
  background: white; border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; font-weight: 700; color: var(--navy); }
.modal-x { font-size: 22px; line-height: 1; color: var(--muted); padding: 0 6px; }
.modal-body { padding: 16px; }
.pipeline-board {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px;
  align-items: start;
}
.pipeline-col {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; min-height: 120px;
}
.pipeline-col-head {
  padding: 10px 12px; font-size: 12px; font-weight: 700; color: var(--navy);
  border-bottom: 1px solid #eef2f7; display: flex; justify-content: space-between; gap: 8px;
}
.pipeline-col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.deal-card {
  background: white; border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  box-shadow: 0 1px 2px rgba(11,31,58,0.04); cursor: pointer;
}
.deal-card .t { font-size: 13px; font-weight: 600; color: var(--navy); }
.deal-card .m { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.warn-banner {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  padding: 10px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 10px;
}
.stage-select { font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); max-width: 100%; }
.nav-badge {
  margin-left: auto; background: var(--teal-light); color: var(--teal-dark);
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
}
@media (max-width: 980px) {
  .form-grid-2, .pipeline-board { grid-template-columns: 1fr; }
}

/* v1.3 approvals + templates */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: #eef3f7; color: var(--muted);
}
.tab.active { background: var(--teal); color: white; }
.hidden { display: none !important; }
.draft-item { cursor: pointer; }
.audio-row { margin: 8px 0; width: 100%; }
.example-badge { display: none; }

/* v1.3.1 settings */
.field-hint { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 4px; }
.readonly-rule {
  background: #f8fafc; border: 1px dashed var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 13.5px; color: var(--navy); line-height: 1.5;
}
.status-grid { display: flex; flex-direction: column; gap: 0; }
.status-row {
  display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #f1f5f9;
}
.status-row:last-child { border-bottom: none; }
.status-row .l { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.status-row .v { font-size: 13.5px; color: var(--navy); }
.item-selected { background: var(--teal-light); }
.muted { color: var(--muted); }
@media (max-width: 980px) {
  .status-row { grid-template-columns: 1fr; gap: 4px; }
}
