:root {
  --navy: #12183a; --navy-2: #1b2350; --accent: #4f6df5; --bg: #f4f6fb; --card: #ffffff; --border: #e6e9f2;
  --text: #1b2136; --text-muted: #6b7290; --green: #17a673; --orange: #e08a1e; --red: #e0435c; --purple: #7c5cf0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

/* ---- login page ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy), var(--navy-2)); }
.login-card { background: var(--card); border-radius: 16px; padding: 40px 36px; width: 360px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { font-size: 20px; margin: 0 0 4px; } .login-card p { color: var(--text-muted); margin: 0 0 24px; font-size: 13px; }
.field { margin-bottom: 16px; } .field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.field input { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; font: inherit; }
.btn { border: 1px solid var(--border); background: var(--card); border-radius: 10px; height: 40px; padding: 0 16px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn-solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-solid:hover { filter: brightness(1.06); }
.btn-outline:hover { background: #f4f6fb; }
.btn-wide { width: 100%; height: 44px; justify-content: center; }
.error-message { color: var(--red); font-size: 12.5px; margin-top: 6px; min-height: 16px; }

/* ---- shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--navy); color: #cfd4ea; flex: none; display: flex; flex-direction: column; padding: 18px 0; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 18px; font-weight: 800; color: #fff; font-size: 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px; }
.sidebar .brand small { display: block; font-weight: 400; font-size: 11px; color: #9aa2c7; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; cursor: pointer; font-size: 13.5px; color: #cfd4ea; border-left: 3px solid transparent; }
.nav-item i { width: 18px; text-align: center; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: rgba(79,109,245,.18); border-left-color: var(--accent); color: #fff; }
.nav-spacer { flex: 1; }
.topbar { height: 62px; background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { padding: 22px 26px 60px; flex: 1; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.page-head h2 { margin: 0 0 4px; font-size: 20px; }
.page-head p { margin: 0; color: var(--text-muted); font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.stat-value { font-size: 24px; font-weight: 800; } .stat-label { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; }
.panel-title { font-weight: 700; font-size: 14.5px; margin-bottom: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.s-new, .s-website_demo, .s-website_contact { background: #e8ecff; color: var(--accent); }
.s-confirmed, .s-active, .s-won, .s-qualified, .s-completed { background: #e3f7ee; color: var(--green); }
.s-pending, .s-contacted, .s-manual, .s-demo_booked { background: #fdf1de; color: var(--orange); }
.s-cancelled, .s-lost, .s-no_show, .s-suspended { background: #fbe6ea; color: var(--red); }
.s-rescheduled, .s-trial { background: #efe9fd; color: var(--purple); }

.icon-btn { border: none; background: none; cursor: pointer; color: var(--text-muted); font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: #f4f6fb; color: var(--text); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { height: 38px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; font: inherit; background: #fafbff; }

.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.cf-field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.cf-field input, .cf-field select, .cf-field textarea { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; font: inherit; background: #fafbff; }
.cf-field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.cf-actions { display: flex; gap: 10px; margin-top: 16px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .big-icon { font-size: 30px; margin-bottom: 10px; opacity: .5; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10,14,30,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.error { background: var(--red); }

@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 40; height: 100vh; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
}
