/* MacroCRM — dark technical CRM theme aligned with macroops.tech */
:root {
  --bg: #05080f;
  --bg-grid: rgba(56, 189, 248, 0.05);
  --surface: #0b1220;
  --surface-2: #0f1a2c;
  --surface-3: #142238;
  --border: #1c2b44;
  --border-soft: rgba(56, 189, 248, 0.14);
  --text: #e6eefc;
  --muted: #8aa0c0;
  --accent: #22d3ee;
  --accent-2: #3b82f6;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) 0 0 / 44px 44px,
    radial-gradient(1100px 560px at 50% -12%, #0d2438 0%, var(--bg) 70%);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { border-radius: 50%; box-shadow: 0 0 18px rgba(34, 211, 238, 0.35); }
.brand-mark {
  width: 16px; height: 16px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.55);
}
.brand-text { letter-spacing: 0.22em; font-size: 13px; color: var(--muted); }
.brand-text strong { color: var(--text); font-weight: 700; }

/* ---------- auth ---------- */
.auth-body { display: grid; place-items: center; padding: 24px; }
.auth-shell { width: 100%; max-width: 430px; }
.auth-card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px 30px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.auth-logo { display: block; margin: 0 auto 14px; border-radius: 50%; box-shadow: 0 0 32px rgba(34, 211, 238, .35); }
.auth-title { margin: 20px 0 6px; font-size: 24px; letter-spacing: -0.01em; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.auth-foot { margin: 20px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- form ---------- */
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block; margin-bottom: 6px;
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px;
  background: #060c17; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 15px; outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: filter .15s ease, background .15s ease;
}
.btn-primary {
  color: #04121a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.auth-card .btn-primary { width: 100%; margin-top: 6px; padding: 12px 18px; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }

/* ---------- alerts ---------- */
.alert {
  padding: 10px 12px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px; border: 1px solid;
}
.alert-error { color: var(--danger); border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .08); }
.alert-info  { color: var(--accent); border-color: rgba(34, 211, 238, .35); background: rgba(34, 211, 238, .08); }

/* ---------- app shell ---------- */
.app-shell { display: grid; grid-template-columns: 254px 1fr; min-height: 100vh; }

.sidebar {
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(15, 26, 44, .92), rgba(5, 8, 15, .92));
  position: sticky; top: 0; height: 100vh;
}
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-group {
  margin: 4px 8px 6px; font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted); opacity: .8;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-size: 14px; border: 1px solid transparent;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-item.is-active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(34, 211, 238, .16), rgba(59, 130, 246, .05));
  border-color: var(--border-soft);
}
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-item.is-soon { opacity: .55; pointer-events: none; }
.nav-icon { width: 18px; height: 18px; flex: none; }
.tag {
  margin-left: auto; font-style: normal; font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px;
}
.sidebar-foot {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--border); padding-top: 14px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

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

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--border);
  background: rgba(6, 12, 23, 0.72); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.logout-form { margin: 0; }
.role-chip {
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--border); color: var(--muted);
}
.role-admin  { color: var(--accent); border-color: rgba(34, 211, 238, .4); }
.role-seller { color: #a5b4fc; border-color: rgba(165, 180, 252, .35); }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #04121a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.user-meta small { font-size: 11px; color: var(--muted); }

.content { padding: 28px; max-width: 1240px; width: 100%; }
.page-title { margin: 0; font-size: 20px; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.app-foot {
  margin-top: auto; padding: 16px 28px;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 12px;
}
.app-foot a { color: var(--accent); }

/* ---------- cards / grids ---------- */
.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-top: 20px; }

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .32);
}
.card-title { margin: 0 0 4px; font-size: 15px; }
.card-sub { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }

.stat-label { margin: 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat-value { margin: 8px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.stat-accent .stat-value { color: var(--accent); }
.stat-warn .stat-value { color: var(--warn); }
.stat-ok .stat-value { color: var(--ok); }

/* ---------- pipeline ---------- */
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stage {
  border: 1px dashed var(--border); border-radius: 10px; padding: 12px;
  background: rgba(20, 34, 56, .5);
}
.stage h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stage p { margin: 0; font-size: 20px; font-weight: 700; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 12px; border-bottom: 1px solid rgba(28, 43, 68, .6); }
.table tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); font-size: 13px; padding: 18px 0; text-align: center; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px;
  border: 1px solid var(--border); color: var(--muted);
}
.badge-ok { color: var(--ok); border-color: rgba(52, 211, 153, .4); }
.badge-warn { color: var(--warn); border-color: rgba(251, 191, 36, .4); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: column; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .topbar { flex-wrap: wrap; }
  .user-meta { display: none; }
}

/* ---------- Task 2: seller management, audit, account ---------- */
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.card + .card, .grid + .card, .card + .grid { margin-top: 20px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input[type="search"], .filters select, .field input, .field select {
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font: inherit; font-size: 13.5px; outline: none;
}
.filters input[type="search"]:focus, .field input:focus, .filters select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, .15);
}

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block; margin-bottom: 6px; font-size: 11.5px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.field-label em { font-style: normal; text-transform: none; letter-spacing: 0; }
.field input { width: 100%; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

.btn-tiny { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-danger { color: var(--danger); border-color: rgba(248, 113, 113, .45); }
.btn-danger:hover { background: rgba(248, 113, 113, .12); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions form { display: inline; margin: 0; }

.table-wrap { overflow-x: auto; }
.table td small.muted { display: block; margin-top: 2px; }
.muted { color: var(--muted); }
.ta-r { text-align: right; }

.badge-off { color: var(--danger); border-color: rgba(248, 113, 113, .4); }
.badge-info { color: var(--accent); border-color: var(--border-soft); }
.badge + .badge { margin-left: 4px; }

.bullets { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.bullets code { color: var(--accent); }

.alert {
  border-radius: 10px; padding: 11px 13px; font-size: 13px; margin-bottom: 14px;
  border: 1px solid var(--border);
}
.alert-success { color: var(--ok); border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .08); }
.alert-error { color: var(--danger); border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .08); }
.alert-info { color: var(--accent); border-color: var(--border-soft); background: rgba(34, 211, 238, .07); }

.card-secret { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(34, 211, 238, .18), 0 16px 40px rgba(0,0,0,.35); }
.secret { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; }
.secret dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.secret dd { margin: 0; }
.secret code {
  background: var(--surface-3); border: 1px solid var(--border);
  padding: 5px 9px; border-radius: 8px; font-size: 13.5px; word-break: break-all;
}
.secret-value { color: var(--accent); font-weight: 700; letter-spacing: .04em; }

.pager { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }

/* --- client registry ---------------------------------------------------- */
.field textarea {
  width: 100%;
  resize: vertical;
  font: inherit;
}
.row-actions select {
  max-width: 160px;
}

/* --- deals -------------------------------------------------------------- */
.field-check {
  flex-direction: row;
  align-items: center;
  gap: .55rem;
}
.field-check input { width: auto; }
.row-actions input[type="text"] { max-width: 170px; }

/* Licensing: compact numeric input inside a row of actions. */
.row-actions .input-tiny {
  width: 68px;
  max-width: 68px;
  padding: .3rem .4rem;
  font-size: .82rem;
}

/* Reports: horizontal bar list. */
.barlist { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .5rem; }
.barlist-row { display: grid; grid-template-columns: 5.5rem 1fr auto; align-items: center; gap: .7rem; }
.barlist-label { font-size: .82rem; color: var(--muted); }
.barlist-track { height: 8px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.barlist-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.barlist-value { font-size: .82rem; font-variant-numeric: tabular-nums; }

/* ---------- Task 8: notifications & reminders ---------- */
.badge-muted { color: var(--muted); }
.badge-danger { color: var(--danger); border-color: rgba(248, 113, 113, .4); }

.bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface-3);
  text-decoration: none;
}
.bell:hover { color: var(--text); border-color: var(--accent); }
.bell .nav-icon { width: 18px; height: 18px; }
.bell-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: var(--danger);
  color: #0b1220; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif {
  display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
  padding: 14px 16px; border: 1px solid var(--border);
  border-left: 3px solid var(--border-soft);
  border-radius: 12px; background: var(--surface-3); margin-bottom: 10px;
}
.notif.is-unread { border-left-color: var(--accent); }
.notif-warn.is-unread { border-left-color: var(--warn); }
.notif-danger.is-unread { border-left-color: var(--danger); }
.notif-body { min-width: 0; }
.notif-title { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.notif-text { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.notif-meta { margin: 0; display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
