:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --text: #152019;
  --muted: #77817b;
  --border: #e2e8e4;
  --green: #21c96b;
  --green-dark: #0e9b4b;
  --dark: #122019;
  --shadow: 0 16px 40px rgba(20, 34, 26, .08);
  --radius: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.eyebrow, .panel-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; color: var(--green-dark); }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 70% 20%, rgba(33,201,107,.12), transparent 30%), #101a15; }
.login-card { width: min(440px, 100%); background: var(--surface); border-radius: 28px; padding: 38px; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.brand-mark { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 900; font-size: 28px; margin-bottom: 22px; }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 20px; margin: 0; }
.login-card h1 { margin: 8px 0 8px; font-size: 32px; }
.login-card p { margin: 0 0 26px; line-height: 1.5; }
.login-card form { display: grid; gap: 12px; }
.login-card label { font-size: 13px; font-weight: 700; }
input { border: 1px solid var(--border); background: #fff; border-radius: 14px; padding: 14px 15px; outline: none; color: var(--text); transition: .18s ease; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(33,201,107,.11); }
.primary-btn, .secondary-btn, .ghost-btn, .icon-btn { border: 0; border-radius: 14px; font-weight: 800; }
.primary-btn { background: var(--green); color: #fff; padding: 14px 18px; margin-top: 4px; }
.primary-btn:hover { background: var(--green-dark); }
.secondary-btn { padding: 12px 16px; background: var(--dark); color: #fff; }
.ghost-btn { background: transparent; color: #c7d0cb; padding: 12px; width: 100%; text-align: left; }
.error-text { margin-top: 14px; color: #cf3c3c; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 18px; background: #101a15; color: white; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 26px; }
.sidebar-brand strong { display: block; font-size: 15px; }
.sidebar-brand span { display: block; color: #8f9a94; font-size: 12px; margin-top: 3px; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { border: 0; background: transparent; color: #aeb8b2; text-align: left; padding: 12px 14px; border-radius: 12px; font-weight: 700; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: rgba(33,201,107,.14); color: #69df9c; }
.sidebar-footer { margin-top: auto; }
.content { min-width: 0; padding: 34px clamp(22px, 4vw, 58px) 54px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.topbar h2 { margin: 5px 0 4px; font-size: clamp(28px, 3vw, 38px); }
.topbar p { margin: 0; font-size: 13px; }
.page-section { display: grid; gap: 20px; }
.metric-grid { display: grid; grid-template-columns: repeat(7, minmax(145px, 1fr)); gap: 12px; }
.metric-card { min-height: 142px; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; }
.metric-card.accent { background: var(--dark); border-color: var(--dark); color: white; }
.metric-card span { font-size: 12px; font-weight: 700; color: var(--muted); }
.metric-card.accent span, .metric-card.accent small { color: #9eaaa3; }
.metric-card strong { font-size: 34px; margin-top: auto; line-height: 1; }
.metric-card small { color: var(--muted); font-size: 11px; margin-top: 8px; }
.two-col { display: grid; grid-template-columns: .85fr 1.15fr; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 22px; }
.panel h3 { margin: 4px 0 0; font-size: 20px; }
.retention-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.retention-grid > div { background: var(--surface-2); border-radius: 16px; padding: 17px; }
.retention-grid span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.retention-grid strong { display: block; font-size: 26px; margin-top: 6px; }
.panel-note { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 18px 0 0; }
.bar-list { display: grid; gap: 15px; }
.bar-row { display: grid; grid-template-columns: minmax(145px, 1fr) 2.4fr 52px; align-items: center; gap: 12px; }
.bar-label { font-size: 12px; font-weight: 700; }
.bar-track { height: 10px; border-radius: 999px; background: #edf1ee; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--green); min-width: 2px; }
.bar-value { text-align: right; font-weight: 800; font-size: 13px; }
.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 12px; }
.feature-item { padding: 18px; border-radius: 16px; background: var(--surface-2); border: 1px solid #edf1ee; }
.feature-item span { display: block; color: var(--muted); font-size: 12px; }
.feature-item strong { display: block; font-size: 26px; margin-top: 8px; }
.users-panel { padding: 0; overflow: hidden; }
.users-head { padding: 24px 24px 0; }
.search-wrap { width: min(360px, 45%); }
.search-wrap input { width: 100%; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { padding: 15px 20px; text-align: left; border-top: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; background: #fbfcfb; }
tbody tr { transition: .15s ease; }
tbody tr:hover { background: #f7faf8; }
.user-link { border: 0; background: none; padding: 0; color: var(--text); text-align: left; font-weight: 800; }
.user-link:hover { color: var(--green-dark); }
.user-phone { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.role-pill { display: inline-flex; border-radius: 999px; padding: 5px 9px; background: #edf8f1; color: #18814a; font-size: 11px; font-weight: 800; }
.empty-state { padding: 34px; text-align: center; color: var(--muted); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(7, 15, 10, .55); backdrop-filter: blur(5px); z-index: 20; display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(760px, 100%); max-height: min(820px, 92vh); overflow: auto; background: var(--surface); border-radius: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding: 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 4px 0; font-size: 22px; }
.modal-head p { margin: 0; font-size: 12px; }
.icon-btn { width: 38px; height: 38px; background: #f0f3f1; color: var(--text); font-size: 24px; line-height: 1; }
.timeline { padding: 10px 24px 28px; }
.timeline-day { margin-top: 22px; font-size: 12px; font-weight: 900; color: var(--muted); }
.timeline-item { display: grid; grid-template-columns: 76px 12px 1fr; gap: 12px; padding: 13px 0; }
.timeline-time { font-size: 12px; color: var(--muted); padding-top: 2px; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); margin-top: 4px; box-shadow: 0 0 0 4px rgba(33,201,107,.12); }
.timeline-event strong { display: block; font-size: 14px; }
.timeline-event small { display: block; color: var(--muted); margin-top: 4px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; background: var(--dark); color: white; border-radius: 14px; padding: 13px 16px; box-shadow: var(--shadow); font-size: 13px; }

@media (max-width: 1380px) {
  .metric-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
  .feature-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 18px; padding: 12px 16px; }
  .sidebar-brand { padding: 0; }
  .sidebar nav { display: flex; margin-left: auto; }
  .sidebar-footer { margin: 0; }
  .ghost-btn { width: auto; }
  .two-col { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}
@media (max-width: 680px) {
  .content { padding: 24px 14px 36px; }
  .topbar { align-items: flex-start; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-card { min-height: 126px; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .retention-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 120px 1fr 38px; }
  .users-head { align-items: flex-start; flex-direction: column; }
  .search-wrap { width: 100%; }
  .sidebar-brand div:last-child { display: none; }
  .nav-item { padding: 10px; }
}
