/* ===========================================================================
   Radiant Mel CRM & Lead Management System
   Brand: Deep/Royal Blue · Gold · White — clean premium corporate.
   Powered by Quickbiz Systems
   =========================================================================== */

:root {
  --blue-900: #061c46;
  --blue-800: #0b2e6b;
  --blue-700: #123f8f;
  --blue-600: #1a4fa8;
  --blue-500: #2f66c4;
  --blue-100: #e8eefa;
  --blue-050: #f4f7fd;

  --gold-700: #a8871c;
  --gold-600: #c9a227;
  --gold-500: #d4af37;
  --gold-300: #ecd67f;
  --gold-100: #fbf3d9;

  --white: #ffffff;
  --ink: #16213c;
  --ink-soft: #47506b;
  --muted: #7b849d;
  --line: #e2e7f1;
  --surface: #f6f8fc;

  --green: #1e8e4e;
  --green-bg: #e6f5ec;
  --red: #b3261e;
  --red-bg: #fdeceb;
  --amber: #b7791f;
  --amber-bg: #fdf3e0;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(11, 46, 107, .06), 0 1px 3px rgba(11, 46, 107, .08);
  --shadow: 0 4px 14px rgba(11, 46, 107, .09);
  --shadow-lg: 0 18px 48px rgba(6, 28, 70, .22);

  --sidebar-w: 250px;
  --header-h: 62px;

  --font: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4rem; font-weight: 650; color: var(--blue-900); letter-spacing: -.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6rem; }
small { font-size: .78rem; }

/* --- Login ---------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(212, 175, 55, .16), transparent 60%),
    linear-gradient(150deg, var(--blue-900) 0%, var(--blue-800) 45%, #0d3781 100%);
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 34px 34px 26px;
  border-top: 5px solid var(--gold-500);
}
.login-logo { display: block; margin: 0 auto 14px; max-width: 230px; height: auto; }
.login-title { text-align: center; font-size: 1.1rem; margin-bottom: 2px; }
.login-tagline {
  text-align: center; color: var(--muted); font-size: .74rem;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 22px;
}
.login-footer { text-align: center; margin-top: 20px; color: var(--muted); font-size: .76rem; }
.login-footer strong { color: var(--blue-800); }

/* --- Layout --------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--blue-900), var(--blue-800) 55%, #0a2a63);
  color: #ccd8ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.sidebar-brand {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand img { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.sidebar-brand .name { color: #fff; font-weight: 700; font-size: .9rem; line-height: 1.15; }
.sidebar-brand .sub { color: var(--gold-300); font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; }

.nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.nav-group-label {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .11em;
  color: rgba(255, 255, 255, .42); padding: 14px 12px 5px;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: #ccd8ee; font-size: .875rem; text-decoration: none; margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(212, 175, 55, .16); color: #fff; box-shadow: inset 3px 0 0 var(--gold-500); }
.nav a .icon { width: 18px; text-align: center; font-size: 1rem; flex: 0 0 18px; }
.nav a .badge-count {
  margin-left: auto; background: var(--gold-500); color: var(--blue-900);
  border-radius: 10px; padding: 0 6px; font-size: .68rem; font-weight: 700; min-width: 18px; text-align: center;
}
.sidebar-footer {
  padding: 10px 14px; border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: .7rem; color: rgba(255, 255, 255, .55); text-align: center;
}
.sidebar-footer strong { color: var(--gold-300); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  position: sticky; top: 0; z-index: 30;
}
.hamburger { display: none; background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--blue-800); }

.global-search { position: relative; flex: 1; max-width: 520px; }
.global-search input {
  width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 20px;
  padding: 0 14px 0 36px; font-size: .875rem; background: var(--blue-050); font-family: var(--font);
}
.global-search input:focus { outline: none; border-color: var(--blue-500); background: #fff; box-shadow: 0 0 0 3px rgba(47, 102, 196, .12); }
.global-search .search-icon { position: absolute; left: 12px; top: 9px; color: var(--muted); }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 420px; overflow-y: auto; z-index: 60;
}
.search-results .item { padding: 9px 14px; border-bottom: 1px solid var(--blue-050); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.search-results .item:hover { background: var(--blue-050); }
.search-results .item .title { font-weight: 600; font-size: .86rem; }
.search-results .item .sub { color: var(--muted); font-size: .76rem; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative; background: none; border: 1px solid transparent; border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer; font-size: 1.05rem; color: var(--ink-soft);
}
.icon-btn:hover { background: var(--blue-050); border-color: var(--line); }
.icon-btn .dot {
  position: absolute; top: 4px; right: 3px; background: var(--red); color: #fff;
  border-radius: 9px; font-size: .62rem; padding: 0 4px; min-width: 15px; font-weight: 700;
}

.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 8px; border-radius: 20px; cursor: pointer; border: 1px solid var(--line); background: #fff; }
.user-chip:hover { background: var(--blue-050); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-500)); color: #fff; font-weight: 700; font-size: .76rem;
}
.user-chip .who { line-height: 1.1; text-align: left; }
.user-chip .who .n { font-size: .8rem; font-weight: 600; }
.user-chip .who .r { font-size: .68rem; color: var(--muted); }

.content { flex: 1; padding: 20px 22px 40px; }
.page-header { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-header .titles { flex: 1; min-width: 220px; }
.page-header .subtitle { color: var(--muted); font-size: .84rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.app-footer {
  border-top: 1px solid var(--line); background: #fff;
  padding: 12px 22px; color: var(--muted); font-size: .78rem;
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.app-footer strong { color: var(--blue-800); }

/* --- Cards ---------------------------------------------------------------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.card-head {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: .95rem; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }

.kpi {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--blue-700);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.kpi.gold { border-left-color: var(--gold-500); }
.kpi.green { border-left-color: var(--green); }
.kpi.red { border-left-color: var(--red); }
.kpi.amber { border-left-color: var(--amber); }
.kpi .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 1.5rem; font-weight: 700; color: var(--blue-900); line-height: 1.25; margin-top: 2px; }
.kpi .meta { font-size: .74rem; color: var(--muted); }
.kpi.clickable { cursor: pointer; transition: transform .1s, box-shadow .1s; }
.kpi.clickable:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 7px 13px; font-size: .845rem; font-weight: 600;
  cursor: pointer; font-family: var(--font); white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--blue-050); border-color: #cdd8ea; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue-800); border-color: var(--blue-800); color: #fff; }
.btn-primary:hover { background: var(--blue-700); border-color: var(--blue-700); }
.btn-gold { background: var(--gold-500); border-color: var(--gold-500); color: var(--blue-900); }
.btn-gold:hover { background: var(--gold-600); border-color: var(--gold-600); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #98201a; border-color: #98201a; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue-700); }
.btn-ghost:hover { background: var(--blue-050); }
.btn-sm { padding: 4px 9px; font-size: .78rem; }
.btn-block { width: 100%; }

/* --- Forms ---------------------------------------------------------------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.field .hint { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.field.required label::after { content: " *"; color: var(--red); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], input[type="url"], input[type="tel"],
select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: .86rem; font-family: var(--font); color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(47, 102, 196, .12);
}
input:disabled, select:disabled, textarea:disabled { background: var(--blue-050); color: var(--muted); }
textarea { min-height: 78px; resize: vertical; }
select[multiple] { min-height: 110px; }

.checkbox, .radio { display: flex; align-items: center; gap: 8px; font-size: .85rem; cursor: pointer; padding: 3px 0; }
.checkbox input, .radio input { width: 16px; height: 16px; accent-color: var(--blue-700); cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }

.fieldset-title {
  grid-column: 1 / -1; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--blue-700); border-bottom: 1px solid var(--line);
  padding-bottom: 5px; margin: 14px 0 10px;
}
.fieldset-title:first-child { margin-top: 0; }

.strength-meter { height: 5px; border-radius: 4px; background: var(--line); margin-top: 6px; overflow: hidden; }
.strength-meter span { display: block; height: 100%; transition: width .2s, background .2s; }

/* --- Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .845rem; }
table.data th {
  text-align: left; padding: 9px 11px; background: var(--blue-050); color: var(--blue-800);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { background: var(--blue-100); }
table.data td { padding: 9px 11px; border-bottom: 1px solid #eef1f7; vertical-align: middle; }
table.data tbody tr:hover { background: var(--blue-050); }
table.data tbody tr.selected { background: var(--gold-100); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .nowrap { white-space: nowrap; }
.row-link { cursor: pointer; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty .big { font-size: 1.8rem; margin-bottom: 6px; }

.pagination { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pagination .info { color: var(--muted); font-size: .8rem; margin-right: auto; }

/* --- Badges & pills ------------------------------------------------------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 11px; font-size: .72rem;
  font-weight: 700; background: var(--blue-100); color: var(--blue-800); white-space: nowrap;
}
.badge.gold { background: var(--gold-100); color: var(--gold-700); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.grey { background: #eef0f5; color: var(--muted); }
.badge.stage { color: #fff; }

.rating-Hot { background: var(--red-bg); color: var(--red); }
.rating-Warm { background: var(--amber-bg); color: var(--amber); }
.rating-Cold { background: var(--blue-100); color: var(--blue-700); }
.rating-Nurture { background: #eef0f5; color: var(--muted); }
.rating-Strategic { background: var(--gold-100); color: var(--gold-700); }

.overdue { color: var(--red) !important; font-weight: 700; }
tr.overdue-row { background: var(--red-bg) !important; }
tr.overdue-row:hover { background: #fbdedb !important; }

.filters {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--blue-050);
}
.filters .field { margin-bottom: 0; }
.filter-actions { display: flex; gap: 8px; align-items: end; }

.bulk-bar {
  display: flex; align-items: center; gap: 9px; padding: 9px 16px;
  background: var(--gold-100); border-bottom: 1px solid var(--gold-300); flex-wrap: wrap;
}
.bulk-bar .count { font-weight: 700; color: var(--gold-700); }

/* --- Kanban --------------------------------------------------------------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kanban-col {
  flex: 0 0 262px; background: #eef1f7; border-radius: var(--radius);
  max-height: calc(100vh - 220px); display: flex; flex-direction: column;
}
.kanban-col.drag-over { background: var(--gold-100); outline: 2px dashed var(--gold-500); }
.kanban-col-head { padding: 9px 12px; border-bottom: 2px solid var(--blue-800); border-radius: var(--radius) var(--radius) 0 0; background: #fff; }
.kanban-col-head .name { font-weight: 700; font-size: .8rem; color: var(--blue-900); display: flex; align-items: center; gap: 6px; }
.kanban-col-head .stats { font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; margin-top: 2px; }
.kanban-cards { overflow-y: auto; padding: 9px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 60px; }
.kanban-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 10px; box-shadow: var(--shadow-sm); cursor: grab; font-size: .8rem;
}
.kanban-card:hover { box-shadow: var(--shadow); border-color: #cdd8ea; }
.kanban-card.dragging { opacity: .45; }
.kanban-card .company { font-weight: 700; color: var(--blue-900); margin-bottom: 3px; }
.kanban-card .row { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: .74rem; }
.kanban-card .value { font-weight: 700; color: var(--green); }

/* --- Timeline ------------------------------------------------------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 5px; bottom: 5px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 15px; }
.timeline-item::before {
  content: ""; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--blue-700); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--blue-100);
}
.timeline-item.gold::before { background: var(--gold-500); box-shadow: 0 0 0 2px var(--gold-100); }
.timeline-item .when { font-size: .72rem; color: var(--muted); }
.timeline-item .what { font-weight: 600; font-size: .86rem; }
.timeline-item .body { font-size: .82rem; color: var(--ink-soft); white-space: pre-wrap; }

/* --- Tabs ----------------------------------------------------------------- */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 15px; overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 13px;
  font-size: .855rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; font-family: var(--font);
}
.tabs button:hover { color: var(--blue-700); }
.tabs button.active { color: var(--blue-800); border-bottom-color: var(--gold-500); }

/* --- Modal ---------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6, 28, 70, .55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 34px 16px; z-index: 100; overflow-y: auto; backdrop-filter: blur(1.5px);
}
.modal {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px; overflow: hidden; animation: modal-in .14s ease-out;
}
@keyframes modal-in { from { transform: translateY(-8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal.wide { max-width: 940px; }
.modal.xwide { max-width: 1180px; }
.modal-head {
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; background: var(--blue-050);
}
.modal-head h3 { margin: 0; }
.modal-head .close { margin-left: auto; background: none; border: 0; font-size: 1.35rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px; max-height: 68vh; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--blue-050); }

/* --- Toast ---------------------------------------------------------------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; max-width: 380px; }
.toast {
  background: var(--blue-900); color: #fff; padding: 11px 15px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: .85rem; border-left: 4px solid var(--gold-500);
  animation: toast-in .16s ease-out;
}
@keyframes toast-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.error { border-left-color: #ff6b60; }
.toast.success { border-left-color: #4ade80; }
.toast .title { font-weight: 700; margin-bottom: 1px; }

/* --- Notification panel --------------------------------------------------- */
.panel {
  position: absolute; top: 52px; right: 14px; width: 372px; max-height: 76vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 70;
}
.panel-head { padding: 11px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; background: var(--blue-050); }
.panel-head h4 { margin: 0; font-size: .9rem; }
.notif { padding: 10px 14px; border-bottom: 1px solid #f1f4f9; cursor: pointer; display: flex; gap: 10px; }
.notif:hover { background: var(--blue-050); }
.notif.unread { background: #fbfaf3; }
.notif .sev { width: 4px; border-radius: 3px; background: var(--blue-500); flex: 0 0 4px; }
.notif.urgent .sev { background: var(--red); }
.notif.warning .sev { background: var(--amber); }
.notif.success .sev { background: var(--green); }
.notif .t { font-weight: 600; font-size: .84rem; }
.notif .b { font-size: .78rem; color: var(--muted); }
.notif .w { font-size: .7rem; color: var(--muted); margin-top: 2px; }

/* --- Charts --------------------------------------------------------------- */
.chart { width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; font-size: .76rem; color: var(--ink-soft); }
.chart-legend .item { display: flex; align-items: center; gap: 5px; }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 2px; }

.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.funnel-row .lbl { width: 92px; font-size: .78rem; color: var(--ink-soft); flex: 0 0 92px; }
.funnel-row .bar-wrap { flex: 1; background: var(--blue-050); border-radius: 5px; overflow: hidden; height: 22px; }
.funnel-row .bar { height: 100%; border-radius: 5px; display: flex; align-items: center; padding: 0 7px; color: #fff; font-size: .74rem; font-weight: 700; }
.funnel-row .rate { width: 62px; text-align: right; font-size: .76rem; color: var(--muted); flex: 0 0 62px; }

.progress { height: 8px; background: var(--blue-050); border-radius: 5px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-700), var(--blue-500)); }
.progress.over span { background: linear-gradient(90deg, var(--green), #34c47a); }

/* --- Calendar ------------------------------------------------------------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.calendar .dow { background: var(--blue-050); padding: 7px; font-size: .72rem; font-weight: 700; text-align: center; color: var(--blue-800); text-transform: uppercase; }
.calendar .day { background: #fff; min-height: 104px; padding: 5px; }
.calendar .day.other { background: #fafbfe; color: var(--muted); }
.calendar .day.today { background: var(--gold-100); }
.calendar .day .n { font-size: .74rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 3px; }
.cal-event {
  font-size: .7rem; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px;
  background: var(--blue-100); color: var(--blue-800); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--blue-700);
}
.cal-event.Confirmed { background: var(--green-bg); color: var(--green); border-left-color: var(--green); }
.cal-event.Completed { background: #eef0f5; color: var(--muted); border-left-color: var(--muted); }
.cal-event.Cancelled, .cal-event.No.Show { background: var(--red-bg); color: var(--red); border-left-color: var(--red); text-decoration: line-through; }
.cal-event.Proposed { background: var(--amber-bg); color: var(--amber); border-left-color: var(--amber); }

/* --- Permission matrix ---------------------------------------------------- */
.perm-module { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.perm-module .head { background: var(--blue-050); padding: 9px 13px; font-weight: 700; font-size: .85rem; display: flex; align-items: center; gap: 10px; }
.perm-module .head .spacer { flex: 1; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 3px 14px; padding: 11px 13px; }

/* --- Quick add ------------------------------------------------------------ */
.quick-add { position: fixed; right: 22px; bottom: 22px; z-index: 80; }
.quick-add .fab {
  width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--gold-500); color: var(--blue-900); font-size: 1.7rem; font-weight: 300;
  box-shadow: 0 8px 22px rgba(212, 175, 55, .48); line-height: 1;
}
.quick-add .fab:hover { background: var(--gold-600); }
.quick-add .menu {
  position: absolute; right: 0; bottom: 64px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; min-width: 196px;
}
.quick-add .menu button {
  display: block; width: 100%; text-align: left; padding: 10px 15px; border: 0;
  background: none; cursor: pointer; font-size: .86rem; font-family: var(--font); color: var(--ink);
}
.quick-add .menu button:hover { background: var(--blue-050); }

/* --- Utilities ------------------------------------------------------------ */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.gap-6 { gap: 6px; } .gap-10 { gap: 10px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: .78rem; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-10 { margin-top: 10px; } .mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-10 { margin-bottom: 10px; } .mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.spinner {
  width: 17px; height: 17px; border: 2px solid var(--blue-100); border-top-color: var(--blue-700);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 44px; text-align: center; color: var(--muted); }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: .85rem; margin-bottom: 12px; border: 1px solid; }
.alert-error { background: var(--red-bg); border-color: #f4c7c3; color: #8c1d18; }
.alert-warn { background: var(--amber-bg); border-color: #f2dcb3; color: #7c4d10; }
.alert-info { background: var(--blue-050); border-color: #cddcf5; color: var(--blue-800); }
.alert-success { background: var(--green-bg); border-color: #b6e2c7; color: #14663a; }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .hamburger { display: block; }
  .content { padding: 14px 12px 34px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .panel { right: 6px; left: 6px; width: auto; }
  .header { padding: 0 10px; }
  .user-chip .who { display: none; }
  .calendar .day { min-height: 74px; }
  table.data { font-size: .8rem; }
  table.data th, table.data td { padding: 7px 8px; }
}
@media (max-width: 560px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 1.3rem; }
  .modal-body { max-height: 74vh; }
}

@media print {
  .sidebar, .header, .quick-add, .page-actions, .filters, .pagination { display: none !important; }
  .content { padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}
