/* =========================================================
   RainMakers · MVP v1.0 — Design tokens & base
   ========================================================= */

:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --surface-2:      #f9f9f7;
  --surface-3:      #f2f1ed;
  --card-bg:        #ffffff;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11,11,11,0.10); 
  --border-strong:  rgba(11,11,11,0.18);

  --series-1: #2a78d6; /* blue */ 
  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* yellow */
  --series-5: #e87ba4; /* magenta */ 
  --series-6: #008300; /* green */ 
  --series-7: #4a3aa7; /* violet */
  --series-8: #e34948; /* red */ 

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;
  --success-text:    #006300;

  --seq-100:#cde2fb; --seq-200:#9ec5f4; --seq-300:#6da7ec; --seq-400:#3987e5; --seq-500:#256abf; --seq-600:#184f95; --seq-700:#0d366b;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 14px;
  --shadow-s: 0 1px 2px rgba(11,11,11,0.06);
  --shadow-m: 0 4px 16px rgba(11,11,11,0.10);
  --shadow-l: 0 12px 32px rgba(11,11,11,0.16);
  --font: -apple-system, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --surface-2:      #0d0d0d;
    --surface-3:      #222220;
    --card-bg:        #201f1d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255,255,255,0.10);
    --border-strong:  rgba(255,255,255,0.18);

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --success-text: #0ca30c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1:      #1a1a19;
  --surface-2:      #0d0d0d;
  --surface-3:      #222220;
  --card-bg:        #201f1d;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --gridline:       #2c2c2a;
  --baseline:       #383835;
  --border:         rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.18);

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --success-text: #0ca30c;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--text-secondary); }
.tiny { font-size: 12px; }
a { color: inherit; }
button { font-family: inherit; }

/* ---------- layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 244px;
  flex: none;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: margin-left .18s ease;
}
.app-shell.sidebar-collapsed .sidebar { margin-left: -244px; }

.brand { padding: 6px 4px 18px; }
.brand-logo-card {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 12px 16px; display: flex; align-items: center; justify-content: center;
}
.brand-logo { width: 100%; max-width: 156px; height: auto; display: block; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; margin-top: 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-s);
  text-decoration: none; color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
}
.nav a:hover { background: var(--surface-3); color: var(--text-primary); }
.nav a.active { background: var(--series-1); color: #fff; }
.nav-ic { width: 16px; text-align: center; opacity: .85; font-size: 13px; }

.sidebar-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.version-tag { text-align: center; color: var(--text-muted); font-size: 11px; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: var(--radius-s); background: var(--surface-3);
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--series-1), var(--series-7));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11.5px;
}
.user-info { flex: 1; min-width: 0; line-height: 1.25; }
.user-info strong { display: block; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info small { color: var(--text-muted); font-size: 10.5px; }
.user-chip .btn-icon { padding: 5px 7px; font-size: 12px; flex: none; }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--surface-2); }
.login-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  width: 100%; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow-m); padding: 32px 30px 26px; text-align: center;
}
.login-logo-card {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 18px 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 22px;
}
.login-logo { width: 200px; max-width: 100%; height: auto; display: block; }
.login-card h1 { font-size: 19px; margin-bottom: 4px; }
.login-card > p.muted { font-size: 12.5px; margin-bottom: 22px; }
.login-card form { text-align: left; }
.login-card .field:last-of-type { margin-bottom: 6px; }
.login-error {
  background: color-mix(in srgb, var(--status-critical) 12%, transparent);
  color: var(--status-critical); border: 1px solid color-mix(in srgb, var(--status-critical) 30%, transparent);
  border-radius: var(--radius-s); padding: 8px 10px; font-size: 12.5px; font-weight: 600; margin-bottom: 14px;
}
.login-success {
  background: color-mix(in srgb, var(--status-good) 12%, transparent);
  color: var(--status-good); border: 1px solid color-mix(in srgb, var(--status-good) 30%, transparent);
  border-radius: var(--radius-s); padding: 8px 10px; font-size: 12.5px; font-weight: 600; margin-bottom: 14px;
}
.login-demo {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); text-align: left;
}
.login-demo strong { font-size: 12px; }
.login-demo p { font-size: 11.5px; color: var(--text-muted); margin: 4px 0 10px; }
.login-demo-account {
  display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-variant-numeric: tabular-nums;
  background: var(--surface-3); border-radius: var(--radius-s); padding: 7px 10px; margin-bottom: 6px; color: var(--text-secondary);
}
.login-theme-toggle { font-size: 12.5px; }

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: var(--surface-1); position: sticky; top: 0; z-index: 5;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 19px; }
.topbar-title p { font-size: 12.5px; margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.view { padding: 22px 24px 60px; flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--card-bg);
  color: var(--text-primary); padding: 8px 14px; border-radius: var(--radius-s);
  font-size: 13px; font-weight: 600; cursor: pointer; line-height: 1.2;
  transition: background .12s, border-color .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.btn-primary:hover { background: var(--seq-500); }
.btn-danger { background: var(--status-critical); border-color: var(--status-critical); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px 9px; border-radius: var(--radius-s); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 650; color: var(--text-secondary); }
.field .hint { font-size: 11px; color: var(--text-muted); }
input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text-primary);
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-s); padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--series-1); outline-offset: -1px; }
textarea { resize: vertical; min-height: 64px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .field.full { grid-column: 1 / -1; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-m); padding: 12px 14px 2px; margin: 0 0 16px; }
legend { font-size: 12px; font-weight: 700; color: var(--text-secondary); padding: 0 6px; }

/* ---------- toolbar / filters ---------- */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 12px; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--radius-m);
}
.toolbar input, .toolbar select { width: auto; min-width: 140px; }
.toolbar .search { flex: 1; min-width: 180px; }
.toolbar-spacer { flex: 1; }

/* ---------- cards / stat tiles ---------- */
.section-block { margin-bottom: 28px; }
.section-heading { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.section-heading h2 { font-size: 15px; }
.section-heading .count-pill {
  background: var(--surface-3); color: var(--text-secondary); font-size: 11px;
  padding: 2px 8px; border-radius: 999px; font-weight: 700;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.stat-tile {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-s);
}
.stat-tile .label { font-size: 11.5px; color: var(--text-secondary); font-weight: 650; text-transform: uppercase; letter-spacing: .02em; }
.stat-tile .value { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; }
.stat-tile .delta { font-size: 11.5px; font-weight: 650; }
.stat-tile .delta.pos { color: var(--success-text); }
.stat-tile .delta.neg { color: var(--status-critical); }
.stat-tile.accent-good   { border-left: 3px solid var(--status-good); }
.stat-tile.accent-warn   { border-left: 3px solid var(--status-warning); }
.stat-tile.accent-serious{ border-left: 3px solid var(--status-serious); }
.stat-tile.accent-crit   { border-left: 3px solid var(--status-critical); }

.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 16px 18px; box-shadow: var(--shadow-s);
}
.card-title { font-size: 13px; font-weight: 700; margin-bottom: 12px; display:flex; align-items:center; justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1080px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- bars / mini charts (plain HTML, no canvas) ---------- */
.hbar-list { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 128px 1fr 52px; align-items: center; gap: 10px; font-size: 12.5px; }
.hbar-track { background: var(--surface-3); border-radius: 4px; height: 10px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; }
.hbar-name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 650; }

.legend-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-secondary); }
.legend-dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut {
  width: 118px; height: 118px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.donut-hole {
  width: 66px; height: 66px; border-radius: 50%; background: var(--card-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-hole .n { font-size: 17px; font-weight: 750; }
.donut-hole .l { font-size: 9.5px; color: var(--text-muted); }

/* progress bar with threshold coloring */
.progress { background: var(--surface-3); border-radius: 5px; height: 9px; overflow: hidden; position: relative; }
.progress > span { display: block; height: 100%; border-radius: 5px; }
.progress.thin { height: 6px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-neutral { background: var(--surface-3); color: var(--text-secondary); }
.badge-blue    { background: color-mix(in srgb, var(--series-1) 16%, transparent); color: var(--series-1); }
.badge-good    { background: color-mix(in srgb, var(--status-good) 16%, transparent); color: var(--success-text); }
.badge-warn    { background: color-mix(in srgb, var(--status-warning) 24%, transparent); color: #8a5a00; }
.badge-serious { background: color-mix(in srgb, var(--status-serious) 20%, transparent); color: #9c4322; }
.badge-crit    { background: color-mix(in srgb, var(--status-critical) 18%, transparent); color: var(--status-critical); }
:root[data-theme="dark"] .badge-warn,
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .badge-warn { color: #ffce6a; } }
:root[data-theme="dark"] .badge-serious { color: #ffb08c; }

/* ---------- table ---------- */
.table-wrap { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-m); overflow: auto; box-shadow: var(--shadow-s); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.lead-name-link { text-decoration: none; }
.lead-name-link strong { color: var(--text-primary); }
.lead-name-link:hover strong { color: var(--series-1); text-decoration: underline; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; background: var(--card-bg);
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--gridline); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-3); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .big { font-size: 30px; margin-bottom: 8px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab-btn {
  background: transparent; border: none; padding: 10px 14px; font-weight: 650; font-size: 13px;
  color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--series-1); border-bottom-color: var(--series-1); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,11,11,.44);
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px;
  overflow-y: auto; z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card-bg); border-radius: var(--radius-l); width: 100%; max-width: 620px;
  box-shadow: var(--shadow-l); border: 1px solid var(--border);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 20px; max-height: 76vh; overflow-y: auto; }
.modal.modal-wide { max-width: 880px; }

/* ---------- toasts ---------- */
.toast-stack { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--text-primary); color: var(--surface-1); padding: 10px 16px; border-radius: var(--radius-s);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-m); opacity: 0; transform: translateY(6px);
  animation: toast-in .18s ease forwards;
}
.toast.toast-error { background: var(--status-critical); color: #fff; }
.toast.toast-good { background: var(--status-good); color: #fff; }
@keyframes toast-in { to { opacity: 1; transform: translateY(0); } }

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.kv-list { display: flex; flex-direction: column; gap: 8px; }
.kv-row { display: flex; justify-content: space-between; font-size: 13px; gap: 12px; }
.kv-row .k { color: var(--text-secondary); }
.kv-row .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.link-btn { background: none; border: none; color: var(--series-1); font-weight: 650; cursor: pointer; padding: 0; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.pill-choice { display: flex; gap: 10px; margin-bottom: 16px; }
.pill-choice .choice {
  flex: 1; border: 1px solid var(--border-strong); border-radius: var(--radius-m); padding: 16px;
  cursor: pointer; text-align: left; background: var(--surface-1);
}
.pill-choice .choice:hover { border-color: var(--series-1); background: var(--surface-3); }
.pill-choice .choice strong { display: block; margin-bottom: 4px; font-size: 13.5px; }
.pill-choice .choice span { font-size: 12px; color: var(--text-secondary); }

.history-list { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; }
.history-item { font-size: 12px; color: var(--text-secondary); padding: 6px 8px; background: var(--surface-3); border-radius: var(--radius-s); }

/* ---------- record page ("Salesforce style"): cliente.php / proyecto.php ---------- */
.rp-topbar {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 20px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-m); box-shadow: var(--shadow-s); margin-bottom: 14px;
}
.rp-topbar-icon {
  width: 42px; height: 42px; border-radius: var(--radius-m); flex: none;
  background: linear-gradient(135deg, var(--series-1), var(--series-7));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.rp-topbar-info { flex: 1; min-width: 0; }
.rp-kicker { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin-bottom: 3px; }
.rp-title { font-size: 20px; overflow-wrap: anywhere; }
.rp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-more { position: relative; }
.rp-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-m);
  box-shadow: var(--shadow-m); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.rp-menu button {
  background: transparent; border: none; text-align: left; padding: 8px 10px; font-size: 13px;
  border-radius: var(--radius-s); cursor: pointer; color: var(--text-primary); font-weight: 600; font-family: inherit;
}
.rp-menu button:hover { background: var(--surface-3); }
.rp-menu-danger { color: var(--status-critical) !important; }

.rp-highlights {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-m);
  box-shadow: var(--shadow-s); padding: 14px 18px; margin-bottom: 14px;
}
.rp-hl { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rp-hl-label { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 700; }
.rp-hl-value { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rp-body { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.rp-body-full { grid-template-columns: 1fr; }
.rp-main { min-width: 0; }
.rp-side { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1080px) { .rp-body { grid-template-columns: 1fr; } }

.rp-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.rp-tab {
  background: transparent; border: none; padding: 9px 14px; font-size: 13px; font-weight: 650; font-family: inherit;
  color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.rp-tab:hover { color: var(--text-primary); }
.rp-tab.active { color: var(--series-1); border-bottom-color: var(--series-1); }

.rp-panel {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-m);
  box-shadow: var(--shadow-s); padding: 16px 18px;
}
.rp-panel-board { background: transparent; border: none; box-shadow: none; padding: 0; }

.rp-fieldgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.rp-field.full { grid-column: 1 / -1; }
.rp-field label { display: block; font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; margin-bottom: 4px; }
.rp-field-value { font-size: 13.5px; }
@media (max-width: 640px) { .rp-fieldgrid { grid-template-columns: 1fr; } }

.rp-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-m);
  box-shadow: var(--shadow-s); overflow: hidden;
}
.rp-card-head { font-size: 12.5px; font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.rp-card-body { padding: 14px; }

.rp-nota-form { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.rp-notas-list { display: flex; flex-direction: column; gap: 10px; }
.rp-nota { background: var(--surface-3); border-radius: var(--radius-s); padding: 10px 12px; }
.rp-nota-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.rp-nota-head .btn-icon { margin-left: auto; padding: 3px 6px; font-size: 11px; }
.rp-nota-body { font-size: 13px; }

.link-copy-row { display: flex; gap: 8px; margin-bottom: 10px; }
.link-copy-row input { font-size: 12px; }

/* ---------- tablero Kanban (proyecto.php) ---------- */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.kanban-col {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-m);
  width: 260px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 260px);
}
.kanban-col-head {
  font-size: 12.5px; font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
}
.kanban-col-count {
  background: var(--surface-3); color: var(--text-secondary); border-radius: 999px;
  font-size: 11px; padding: 1px 7px; font-weight: 700;
}
.kanban-cards { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kanban-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow-s);
}
.kanban-card:hover { border-color: var(--border-strong); }
.kanban-card.kanban-dragging { opacity: .4; }
.kanban-card-title { font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.kanban-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kanban-card-assignee { margin-top: 6px; font-size: 11.5px; color: var(--text-secondary); }
.kanban-add-btn { margin: 4px 8px 10px; justify-content: center; width: calc(100% - 16px); }

/* ---------- chatbot ---------- */
.chat-launcher {
  position: fixed; bottom: 24px; right: 24px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--series-1); color: #fff; border: none;
  font-size: 22px; cursor: pointer; box-shadow: var(--shadow-l);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s;
}
.chat-launcher:hover { transform: scale(1.06); }

.chat-panel {
  position: fixed; bottom: 90px; right: 24px; z-index: 60;
  width: 340px; max-width: calc(100vw - 32px);
  height: 460px; max-height: calc(100vh - 120px);
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow-l); display: none; flex-direction: column; overflow: hidden;
}
.chat-panel.open { display: flex; }

.chat-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-1);
}
.chat-panel-head strong { font-size: 13.5px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg {
  max-width: 84%; padding: 8px 12px; border-radius: var(--radius-m);
  font-size: 13px; line-height: 1.4; white-space: pre-wrap;
}
.chat-msg-bot { align-self: flex-start; background: var(--surface-3); color: var(--text-primary); border-bottom-left-radius: 3px; }
.chat-msg-user { align-self: flex-end; background: var(--series-1); color: #fff; border-bottom-right-radius: 3px; }
.chat-msg-typing { color: var(--text-muted); font-style: italic; }

.chat-input-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface-1); }
.chat-input-row input { flex: 1; }

@media (max-width: 480px) {
  .chat-panel { right: 12px; left: 12px; width: auto; bottom: 84px; }
  .chat-launcher { right: 16px; }
}

@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 40; margin-left: -244px; box-shadow: var(--shadow-l); }
  .app-shell.sidebar-collapsed .sidebar { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .view { padding: 16px; }
}

/* ---------- tablero Kanban: responsable en tarjeta + filtro ---------- */
.kanban-card-assignee {
  margin-top: 8px; display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary); font-weight: 550;
}
.kanban-card-assignee.is-empty { color: var(--text-muted); font-weight: 400; font-style: italic; }
.kanban-avatar {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--series-1), var(--series-7));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; font-style: normal;
}
.kanban-card-assignee.is-empty .kanban-avatar { background: var(--surface-1); color: var(--text-muted); border: 1px dashed var(--border-strong); }
.kanban-toolbar { margin-bottom: 12px; }
