:root {
  --navy: #0a1628;
  --navy-2: #12203a;
  --accent: #10a37f;
  --accent-2: #0e8a6b;
  --bg: #eef1f5;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #6b7683;
  --border: #e2e7ee;
  --danger: #d23b3b;
  --warn: #d98c1e;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(10,22,40,.08), 0 4px 14px rgba(10,22,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 7px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #f5f7fa; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--danger); border-color: #f0c9c9; }
.btn.danger:hover { background: #fdf1f1; }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); }
.login-card { background: #fff; padding: 34px 32px; border-radius: 14px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-mark { width: 46px; height: 46px; border-radius: 12px; background: var(--navy); color: #7ce3c6; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; margin-bottom: 14px; }
.login-logo { width: 210px; max-width: 100%; height: auto; display: block; margin-bottom: 18px; }
.login-card h1 { margin: 0 0 2px; font-size: 19px; color: var(--navy); }
.login-sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 11px; font-size: 14px; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- topbar ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; background: var(--navy); color: #fff; box-shadow: var(--shadow); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: rgba(124,227,198,.16); color: #7ce3c6; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .3px; }
.brand-logo-chip { background: #fff; border-radius: 7px; padding: 5px 9px; display: inline-flex; align-items: center; }
.brand-logo-chip img { height: 20px; display: block; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.search { padding: 8px 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; border-radius: 8px; font-size: 13px; width: 240px; }
.search::placeholder { color: rgba(255,255,255,.5); }
.search:focus { outline: none; border-color: #7ce3c6; }
.topbar .btn.primary { background: var(--accent); }
.topbar .btn.ghost { color: #fff; }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.1); }
.user-menu { position: relative; }
.dropdown { position: absolute; right: 0; top: 38px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); min-width: 150px; z-index: 50; overflow: hidden; }
.dd-item { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: none; font-size: 13px; cursor: pointer; color: var(--text); }
.dd-item:hover { background: #f5f7fa; }

/* ---------- dashboard ---------- */
.dashboard { display: flex; gap: 12px; flex-wrap: wrap; padding: 14px 18px 0; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); cursor: pointer; }
.stat:hover { border-color: var(--accent); }
.stat-num { font-size: 22px; font-weight: 700; color: var(--navy); }
.stat-label { font-size: 12px; color: var(--muted); }

/* ---------- kanban ---------- */
.board { flex: 1; display: flex; gap: 12px; padding: 14px 18px 18px; overflow-x: auto; overflow-y: hidden; align-items: stretch; }
.col { min-width: 250px; width: 260px; background: #e7ebf1; border-radius: var(--radius); display: flex; flex-direction: column; max-height: 100%; }
.col-head { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--navy); }
.col-count { background: rgba(0,0,0,.08); border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
.col-body { overflow-y: auto; padding: 4px 8px 10px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; box-shadow: 0 1px 2px rgba(10,22,40,.06); transition: box-shadow .12s, transform .08s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.card-name { font-weight: 600; font-size: 13.5px; color: var(--navy); word-break: break-word; }
.card-site { font-size: 12px; color: var(--muted); margin-top: 1px; word-break: break-all; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #eef2f6; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.chip.owner { background: #e6f4ee; color: var(--accent-2); }
.chip.reminder { background: #fdf1e2; color: var(--warn); }
.chip.overdue { background: #fdeaea; color: var(--danger); }
.card-empty { text-align: center; color: #a5adba; font-size: 12px; padding: 18px 8px; }

/* ---------- drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(10,22,40,.4); }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: 640px; max-width: 94vw; background: #fff; box-shadow: -8px 0 30px rgba(10,22,40,.18); display: flex; flex-direction: column; }
.drawer-content { flex: 1; overflow-y: auto; padding: 0 22px 30px; }
.drawer-head { position: sticky; top: 0; background: #fff; padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; z-index: 5; }
.drawer-title { font-size: 18px; font-weight: 700; color: var(--navy); word-break: break-word; }
.drawer-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.drawer-sub { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }

.section { margin-top: 22px; }
.section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; font-family: inherit; color: var(--text); background: #fff;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field-note { font-size: 11.5px; color: var(--muted); }

/* interactions */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #fafbfd; }
.tl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tl-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 2px 7px; border-radius: 6px; background: #e6f4ee; color: var(--accent-2); }
.tl-type.call { background: #e8eefb; color: #3b6cc0; }
.tl-type.meeting { background: #f3e8fb; color: #7c4cc0; }
.tl-type.note { background: #eef2f6; color: var(--muted); }
.tl-type.other { background: #eef2f6; color: var(--muted); }
.tl-who { font-size: 12px; color: var(--muted); }
.tl-note { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.tl-date { font-size: 11px; color: var(--muted); margin-left: auto; }

/* lists (contacts/reminders/docs) */
.list-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; background: #fff; }
.list-item .li-main { flex: 1; min-width: 0; }
.li-name { font-weight: 600; font-size: 13px; }
.li-sub { font-size: 12px; color: var(--muted); word-break: break-word; }
.li-badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: #e6f4ee; color: var(--accent-2); }
.li-actions { display: flex; gap: 6px; }
.rem-done { text-decoration: line-through; color: var(--muted); }

/* forms inline */
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 10px; background: #f5f7fa; border-radius: 8px; margin-bottom: 8px; }
.inline-form .field { margin: 0; flex: 1; min-width: 120px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(10,22,40,.5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { background: #fff; border-radius: 12px; padding: 22px; width: 460px; max-width: 94vw; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-card h3 { margin: 0 0 14px; color: var(--navy); }

/* toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 300; box-shadow: var(--shadow); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .search { width: 100%; order: 3; }
  .dashboard { padding: 10px 12px 0; }
  .board { padding: 10px 12px 14px; }
  .col { width: 230px; min-width: 230px; }
  .drawer-panel { width: 100vw; max-width: 100vw; }
}
