/* IMR Admin Panel — minimal, dark, brand-aligned */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

:root {
  --bg: #0a0e17;
  --bg-2: #131929;
  --bg-3: #1a2138;
  --surface: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.10);
  --line-2: rgba(255, 255, 255, 0.18);
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.7);
  --text-3: rgba(255, 255, 255, 0.45);
  --accent: #ff6a13;
  --accent-2: #ffa55a;
  --ok: #22c55e;
  --warn: #f59e0b;
  --info: #3b82f6;
  --err: #ef4444;
  --radius: 10px;
}

body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { letter-spacing: -0.02em; }
h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
h3 { font-size: 17px; font-weight: 600; margin-bottom: 14px; }

.muted { color: var(--text-3); }
.small { font-size: 13px; }
.inline { display: inline; }

/* ====== Login ====== */
.login-bg {
  background:
    radial-gradient(ellipse at top, rgba(255, 106, 19, 0.15), transparent 60%),
    var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%; max-width: 420px;
  margin: 60px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.login-box h1 { margin: 28px 0 22px; font-size: 22px; }
.login-box .logo-block { margin-bottom: 12px; }
.login-box p.muted { text-align: center; margin-top: 24px; }

/* ====== Logo ====== */
.logo-block { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg);
  font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.logo-text { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.logo-text .muted { font-size: 10px; font-weight: 400; letter-spacing: 0.15em; text-transform: uppercase; }

/* ====== Top bar ====== */
.topbar {
  background: rgba(7, 9, 15, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar__inner {
  max-width: 1320px; margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; gap: 32px;
}
.topnav { display: flex; gap: 22px; margin-left: 20px; }
.topnav a { color: var(--text-2); font-weight: 500; font-size: 14px; }
.topnav a:hover { color: var(--text); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

/* ====== Container ====== */
.container { max-width: 1320px; margin: 0 auto; padding: 32px 24px; }
.container-narrow { max-width: 920px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  margin: 18px 0 24px;
}
.page-head .actions { display: flex; gap: 10px; }

/* ====== Forms ====== */
label { display: block; margin-bottom: 16px; }
label > span:first-child {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 8px;
}
input[type="text"], input[type="password"], input[type="email"],
input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border 0.2s, background 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 106, 19, 0.06);
  box-shadow: 0 0 0 3px rgba(255, 106, 19, 0.12);
}
textarea { resize: vertical; min-height: 80px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .grow { flex: 1; }
.checkbox { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.checkbox input { width: auto; }

/* ====== Buttons ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 100px;
  background: transparent;
  color: var(--text);
  font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary {
  background: var(--accent); color: var(--bg);
  box-shadow: 0 8px 24px rgba(255, 106, 19, 0.3);
}
.btn-primary:hover { background: var(--accent-2); transform: translateY(-1px); color: var(--bg); }
.btn-ghost { border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--text); }

/* ====== Alerts ====== */
.alert {
  padding: 14px 18px; border-radius: var(--radius);
  font-size: 14px; margin-bottom: 18px;
  border: 1px solid;
}
.alert-error { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.alert-success { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.4); color: #86efac; }

/* ====== Filters ====== */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.filters input, .filters select { width: auto; flex: 1; min-width: 200px; }
.filters .btn { white-space: nowrap; }

/* ====== Stats row ====== */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 22px;
}
.stat-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.25s;
  text-decoration: none; color: var(--text);
}
.stat-card:hover { background: rgba(255, 255, 255, 0.07); transform: translateY(-2px); }
.stat-num { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ====== Table ====== */
.table-wrap {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}
.leads-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.leads-table th, .leads-table td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.leads-table th {
  font-size: 11px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.02);
}
.leads-table tr:last-child td { border-bottom: none; }
.leads-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.message-cell { color: var(--text-2); max-width: 320px; }

/* ====== Status ====== */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
}
.status-new        { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); }
.status-in_progress{ background: rgba(59, 130, 246, 0.15); color: #93c5fd; border-color: rgba(59, 130, 246, 0.4); }
.status-closed     { background: rgba(34, 197, 94, 0.15); color: #86efac; border-color: rgba(34, 197, 94, 0.4); }
.status-rejected   { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }

/* ====== Card ====== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card h3 { margin-bottom: 16px; }

.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv td { padding: 10px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.kv td:first-child { width: 130px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.kv tr:last-child td { border-bottom: none; }

.message-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  white-space: pre-wrap;
}
.notes-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 14px;
  white-space: pre-wrap;
  margin-bottom: 16px;
  max-height: 320px; overflow-y: auto;
}

.status-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-status { border: 1px solid var(--line-2); }
.btn-status.active { border-color: var(--accent); background: rgba(255, 106, 19, 0.1); }
.btn-status.btn-new.active        { background: rgba(245, 158, 11, 0.15); border-color: #f59e0b; }
.btn-status.btn-in_progress.active{ background: rgba(59, 130, 246, 0.15); border-color: #3b82f6; }
.btn-status.btn-closed.active     { background: rgba(34, 197, 94, 0.15); border-color: #22c55e; }
.btn-status.btn-rejected.active   { background: rgba(239, 68, 68, 0.15); border-color: #ef4444; }

.log { list-style: none; }
.log li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log li:last-child { border-bottom: none; }

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (max-width: 768px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .topnav { display: none; }
  .container { padding: 20px 14px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .leads-table { font-size: 13px; }
  .leads-table th, .leads-table td { padding: 10px 8px; }
  .kv td:first-child { width: 100px; }
}
