:root {
  --ink: #152337;
  --muted: #6f7c8d;
  --navy: #101c2c;
  --navy-soft: #1b2b40;
  --teal: #16897b;
  --teal-soft: #e4f3f0;
  --orange: #e98248;
  --orange-soft: #fcede4;
  --paper: #f5f7f8;
  --white: #ffffff;
  --line: #e4e9ec;
  --red: #c94e57;
  --shadow: 0 12px 34px rgba(20, 36, 53, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.5 "DM Sans", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .brand { font-family: "Manrope", sans-serif; }
a { color: inherit; }
.hidden { display: none !important; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: var(--white);
}
.login-art {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  color: white;
  background:
    radial-gradient(circle at 70% 20%, rgba(40, 186, 165, .28), transparent 30%),
    radial-gradient(circle at 20% 80%, rgba(233, 130, 72, .22), transparent 30%),
    var(--navy);
}
.login-art::after {
  content: "";
  position: absolute;
  right: -140px;
  bottom: -180px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018);
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 800 20px "Manrope", sans-serif;
  letter-spacing: -.4px;
  position: relative;
  z-index: 1;
}
.logo-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--teal);
  font-size: 13px;
}
.login-message { max-width: 580px; position: relative; z-index: 1; }
.login-message h1 { font-size: clamp(38px, 5vw, 66px); line-height: 1.05; letter-spacing: -2.5px; margin-bottom: 22px; }
.login-message p { color: #b8c2cf; font-size: 18px; max-width: 480px; }
.login-message strong { color: #64d0c0; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(410px, 100%); }
.login-card h2 { font-size: 30px; margin-bottom: 8px; }
.login-card > p { color: var(--muted); margin-bottom: 32px; }
.captcha-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fafb;
}
.captcha-box label {
  display: block;
  margin-bottom: 4px;
  color: #566476;
  font-size: 12px;
  font-weight: 700;
}
.captcha-box strong { color: var(--ink); font-size: 18px; }
.captcha-refresh {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #e7eef2;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 22px;
  color: #d7dee7;
  background: var(--navy);
  z-index: 10;
}
.sidebar .logo { padding: 0 9px; color: white; margin-bottom: 38px; }
.nav-label { padding: 0 13px; margin: 8px 0 10px; color: #6e8095; font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 5px;
  border: 0;
  border-radius: 11px;
  color: #aebaca;
  background: transparent;
  text-align: left;
  font-weight: 600;
}
.nav-btn:hover, .nav-btn.active { color: white; background: var(--navy-soft); }
.nav-btn.active { box-shadow: inset 3px 0 var(--teal); }
.nav-icon { width: 22px; text-align: center; font-size: 16px; }
.sidebar-user { margin-top: auto; padding: 15px 10px 0; border-top: 1px solid #29384b; }
.user-line { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--navy);
  background: #77d2c5;
  font-weight: 800;
}
.user-line strong { display: block; color: white; font-size: 13px; }
.user-line span { display: block; color: #7f91a5; font-size: 11px; text-transform: capitalize; }
.logout-btn { border: 0; padding: 0; background: none; color: #8fa0b4; font-size: 12px; }
.logout-btn:hover { color: white; }
.account-action { display: block; margin-bottom: 8px; }

.main { grid-column: 2; min-width: 0; padding: 34px 38px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { margin-bottom: 3px; color: var(--teal); font-weight: 800; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 30px; letter-spacing: -1px; }
.top-actions { display: flex; gap: 10px; }
.mobile-menu { display: none; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  color: white;
  background: var(--teal);
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(22,137,123,.15);
}
.btn:hover { filter: brightness(.96); transform: translateY(-1px); }
.btn.secondary { color: var(--ink); background: white; border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: var(--red); }
.btn.small { padding: 7px 11px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card, .panel {
  background: var(--white);
  border: 1px solid rgba(225,231,235,.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-card { padding: 20px; }
.stat-card .stat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.stat-card .stat-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--teal-soft); color: var(--teal); }
.stat-card.orange .stat-icon { background: var(--orange-soft); color: var(--orange); }
.stat-card .stat-value { font: 800 28px "Manrope", sans-serif; letter-spacing: -1px; }
.stat-card .stat-foot { color: #96a1ae; font-size: 11px; margin-top: 2px; }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr .85fr; gap: 20px; }
.panel { padding: 22px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.text-btn { border: 0; background: transparent; color: var(--teal); font-weight: 700; font-size: 13px; }

.stage-bars { display: grid; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 100px 1fr 28px; gap: 10px; align-items: center; }
.bar-label { font-size: 12px; font-weight: 600; text-transform: capitalize; }
.bar-track { height: 8px; overflow: hidden; border-radius: 99px; background: #edf1f2; }
.bar-fill { height: 100%; min-width: 3px; border-radius: 99px; background: var(--teal); }
.bar-count { color: var(--muted); font-size: 12px; text-align: right; }
.activity-list, .follow-list, .timeline { display: grid; gap: 0; }
.activity-row, .follow-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.activity-row:last-child, .follow-row:last-child { border-bottom: 0; }
.activity-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px var(--teal-soft); margin: 0 5px; }
.activity-main { min-width: 0; flex: 1; }
.activity-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.activity-main span { color: var(--muted); font-size: 11px; }
.date-chip { flex: 0 0 auto; padding: 6px 9px; border-radius: 8px; color: var(--orange); background: var(--orange-soft); font-size: 11px; font-weight: 800; }
.date-chip.overdue { color: var(--red); background: #fae8ea; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.search { position: relative; flex: 1; }
.search input { width: 100%; padding-left: 40px; }
.search::before { content: "⌕"; position: absolute; left: 15px; top: 9px; color: var(--muted); font-size: 18px; }
.pipeline { display: grid; grid-template-columns: repeat(7, minmax(235px, 1fr)); gap: 14px; overflow-x: auto; padding: 2px 2px 20px; }
.pipeline.filtered { grid-template-columns: minmax(280px, 520px); overflow-x: visible; }
.pipeline-column { min-height: 430px; padding: 12px; border-radius: 15px; background: #edf1f2; }
.pipeline-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 3px 13px; }
.pipeline-head strong { font-size: 12px; text-transform: uppercase; letter-spacing: .7px; }
.count-pill { min-width: 24px; padding: 2px 7px; border-radius: 99px; color: var(--muted); background: white; text-align: center; font-size: 11px; font-weight: 700; }
.client-card {
  margin-bottom: 10px;
  padding: 15px;
  border: 1px solid #e3e8eb;
  border-radius: 13px;
  background: white;
  box-shadow: 0 5px 14px rgba(19,34,51,.04);
  cursor: pointer;
}
.client-card:hover { border-color: #b9dcd7; transform: translateY(-1px); }
.client-card h3 { margin-bottom: 4px; font-size: 14px; }
.client-card > p { margin-bottom: 13px; color: var(--muted); font-size: 11px; min-height: 17px; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #8995a3; font-size: 10px; }
.payment-progress { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.payment-progress strong { color: var(--teal); font-size: 10px; }
.service-tag, .role-tag, .status-tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
}
.role-tag.admin { color: #9b5b34; background: var(--orange-soft); }
.role-tag.viewer { color: #5d6780; background: #edf0f5; }
.status-tag.pending { color: #9b5b34; background: var(--orange-soft); }
.empty { padding: 35px 10px; color: var(--muted); text-align: center; font-size: 13px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 12px; color: var(--muted); font-size: 10px; letter-spacing: .8px; text-align: left; text-transform: uppercase; background: #f7f9fa; }
td { padding: 13px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.row-actions { min-width: 150px; text-align: right; white-space: nowrap; }
.danger-text { color: var(--red); }
.money { font-weight: 700; font-variant-numeric: tabular-nums; }
.money.positive { color: var(--teal); }
.money.negative { color: var(--red); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9,18,29,.62);
  backdrop-filter: blur(4px);
}
.modal {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 20px;
  background: white;
  box-shadow: 0 24px 80px rgba(5,14,24,.3);
}
.modal.wide { width: min(1000px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 21px 24px; border-bottom: 1px solid var(--line); background: white; }
.modal-head h2 { margin: 0; font-size: 19px; }
.close-btn { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f0f3f4; color: var(--muted); font-size: 18px; }
.modal-body { padding: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px; border-top: 1px solid var(--line); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #566476; font-size: 12px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #dce2e5;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,137,123,.1); }
textarea { min-height: 90px; resize: vertical; }
.field-help { color: var(--muted); font-size: 10px; }

.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.detail-title h2 { margin-bottom: 4px; }
.detail-title p { color: var(--muted); margin: 0; }
.detail-info { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
.info-box { padding: 13px; border-radius: 11px; background: #f6f8f9; }
.info-box span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .6px; }
.info-box strong { display: block; margin-top: 3px; font-size: 13px; word-break: break-word; }
.section-title { margin: 23px 0 10px; font: 700 13px "Manrope", sans-serif; }
.timeline-item { position: relative; padding: 0 0 18px 22px; border-left: 1px solid #dce4e5; }
.timeline-item::before { content: ""; position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.timeline-item:last-child { border-left-color: transparent; }
.timeline-item strong { display: block; font-size: 12px; text-transform: capitalize; }
.timeline-item p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.note-card { padding: 12px; margin-bottom: 9px; border-radius: 10px; background: #f6f8f9; }
.note-card p { margin-bottom: 5px; font-size: 12px; white-space: pre-wrap; }
.note-card span { color: var(--muted); font-size: 10px; }
.side-card { padding: 18px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px; }
.side-card h3 { margin-bottom: 13px; font-size: 14px; }
.quick-form { display: grid; gap: 10px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: 360px;
  padding: 12px 17px;
  border-radius: 10px;
  color: white;
  background: var(--navy);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { min-height: 290px; padding: 30px; }
  .login-message h1 { font-size: 38px; }
  .login-message p { font-size: 15px; }
  .login-panel { padding: 36px 24px; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: .2s ease; box-shadow: 10px 0 30px rgba(0,0,0,.18); }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 24px 18px 50px; }
  .mobile-menu { display: inline-block; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 24px; }
  .stats-grid, .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .detail-info { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal, .modal.wide { width: 100%; max-height: 95vh; border-radius: 20px 20px 0 0; }
}
