:root {
  --bg: #f3f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe4ef;
  --primary: #0f766e;
  --accent: #c2410c;
  --danger: #b91c1c;
  --ok: #0b8f47;
  --radius: 16px;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Cairo', sans-serif;
  color: var(--text);
  background: var(--bg);
}

.bg {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.26;
  z-index: 0;
}

.bg-a {
  width: 380px;
  height: 380px;
  background: #22d3ee;
  top: -120px;
  right: -110px;
}

.bg-b {
  width: 460px;
  height: 460px;
  background: #fb923c;
  bottom: -200px;
  left: -140px;
}

.container {
  position: relative;
  z-index: 1;
  width: min(1240px, 96vw);
  margin: 28px auto;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(520px, 95vw);
  margin: 8vh auto 0;
  padding: 28px;
}

.brand h1 {
  margin: 2px 0 10px;
  font-size: 1.6rem;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.4px;
  font-size: 0.85rem;
}

.hint {
  color: var(--muted);
  margin: 0 0 8px;
}

.grid {
  display: grid;
}

.gap-12 {
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.86rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
}

.btn-muted {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-accent {
  background: linear-gradient(135deg, #f97316, #c2410c);
  color: #fff;
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
}

.panel {
  display: grid;
  gap: 16px;
}

.topbar {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h2 {
  margin: 4px 0;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.kpis {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi {
  padding: 18px;
}

.kpi p {
  margin: 0;
  color: var(--muted);
}

.kpi strong {
  font-size: 2rem;
  margin-top: 8px;
  display: inline-block;
}

.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.content-grid > .card {
  padding: 16px;
}

.card-title h3 {
  margin: 0 0 14px;
}

.signal-grid {
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  text-align: right;
  padding: 11px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

th {
  background: #f8fafc;
  color: #334155;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.status.active {
  background: #dcfce7;
  color: var(--ok);
}

.status.tp {
  background: #dbeafe;
  color: #1d4ed8;
}

.status.sl {
  background: #fee2e2;
  color: var(--danger);
}

.status.closed,
.status.cancelled {
  background: #e2e8f0;
  color: #334155;
}

.inline-action {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-action select {
  min-width: 126px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.18s ease;
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1060px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .container {
    width: 94vw;
  }

  .kpis {
    grid-template-columns: 1fr;
  }

  .signal-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
