@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@600;700&display=swap");

:root {
  --navy: #0b2748;
  --navy2: #123a63;
  --teal: #0ea5a4;
  --teal2: #14b8b0;
  --teal-deep: #0b7c7b;
  --gold: #c4a35a;
  --gold2: #d4b76a;
  --bg: #f3f6fa;
  --bg2: #e8eef5;
  --panel: #ffffff;
  --line: #d7e0ea;
  --text: #0b2748;
  --muted: #5b6f86;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow: 0 14px 40px rgba(11, 39, 72, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Manrope, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(14, 165, 164, 0.12), transparent 55%),
    radial-gradient(800px 400px at 100% 0%, rgba(196, 163, 90, 0.12), transparent 50%),
    linear-gradient(180deg, #f7fafc, #eef3f8 40%, #e8eef5);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
h1, h2, h3, .brand-name { font-family: Sora, Manrope, sans-serif; color: var(--navy); }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.login-card .logo-img {
  width: 160px;
  height: auto;
  display: block;
  margin: 8px auto 20px;
  object-fit: contain;
}
.login-card .badge {
  display: flex;
  justify-content: center;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.login-card h1,
.login-card p {
  text-align: center;
}
.login-card h1 { margin: 0 0 6px; font-size: 1.55rem; }
.login-card p { margin: 0 0 24px; color: var(--muted); line-height: 1.5; }
.login-card label { display: block; font-size: 0.85rem; color: var(--muted); margin: 0 0 6px; }
.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,165,164,0.15); }
.login-card button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  background: linear-gradient(135deg, var(--teal), var(--navy2));
  color: white;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
}
.login-card .error { color: #b91c1c; font-size: 0.9rem; min-height: 1.2em; margin-top: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--navy2); background: rgba(14,165,164,0.12);
  border: 1px solid rgba(14,165,164,0.28);
  border-radius: 999px; padding: 5px 10px; margin-bottom: 14px;
}

.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 24px; padding: 4px 6px 12px; border-bottom: 1px solid var(--line); }
.brand .logo-img {
  width: 58px;
  height: auto;
  display: block;
  object-fit: contain;
}
.brand-name { font-size: 0.95rem; font-weight: 700; }
.brand-sub { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.nav-btn {
  width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--muted); padding: 11px 12px; border-radius: 12px;
  cursor: pointer; margin-bottom: 4px; font-weight: 600;
}
.nav-btn.active, .nav-btn:hover {
  background: rgba(14,165,164,0.12);
  color: var(--navy);
}
.sidebar-foot { position: absolute; bottom: 18px; left: 14px; right: 14px; }
.sidebar-foot button {
  width: 100%; border: 1px solid var(--line); background: #fff;
  color: var(--muted); border-radius: 10px; padding: 10px; cursor: pointer;
}

.main { padding: 22px 26px 40px; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 1.55rem; }
.topbar p { margin: 6px 0 0; color: var(--muted); }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(22,163,74,0.1); color: #15803d;
  border: 1px solid rgba(22,163,74,0.25);
  border-radius: 999px; padding: 8px 12px; font-size: 0.85rem; font-weight: 600;
}
.live-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 rgba(22,163,74,0.55);
  animation: pulse 1.6s infinite;
}
.live-pill.off { background: #eef2f7; color: var(--muted); border-color: var(--line); }
.live-pill.off .dot { background: #94a3b8; animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22,163,74,0.45); }
  70% { box-shadow: 0 0 0 10px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 0.82rem; margin-bottom: 8px; }
.kpi .value { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); }
.kpi .hint { color: var(--muted); font-size: 0.78rem; margin-top: 6px; }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 18px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 0.98rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.chart-legend { display: flex; gap: 14px; font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.chart-foot { margin-top: 8px; font-size: 0.8rem; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 72px 1fr 48px; gap: 10px; align-items: center; font-size: 0.85rem; }
.bar-track { height: 8px; background: #e8eef5; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal), var(--navy2)); }
.chart-line { width: 100%; height: 260px; display: block; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.muted { color: var(--muted); }

.inbox {
  display: grid; grid-template-columns: 340px 1fr 300px; gap: 12px;
  height: calc(100vh - 120px); min-height: 560px;
}
.inbox-list, .inbox-chat, .inbox-side {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.inbox-list .search { padding: 12px; border-bottom: 1px solid var(--line); }
.inbox-list input {
  width: 100%; border: 1px solid var(--line); background: #f8fafc;
  color: var(--text); border-radius: 10px; padding: 10px 12px; outline: none;
}
.conv-item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv-item:hover, .conv-item.active { background: rgba(14,165,164,0.08); }
.conv-item .t1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 0.92rem; }
.conv-item .t2 { color: var(--muted); font-size: 0.8rem; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-scroll { overflow: auto; flex: 1; }
.chat-head {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.chat-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #f7fafc; }
.bubble {
  max-width: 78%; padding: 10px 12px; border-radius: 14px; font-size: 0.9rem; line-height: 1.4;
}
.bubble.in { align-self: flex-start; background: #ffffff; border: 1px solid var(--line); color: var(--text); }
.bubble.out { align-self: flex-end; background: linear-gradient(135deg, var(--navy2), var(--teal-deep)); color: #fff; }
.bubble .meta { font-size: 0.7rem; opacity: 0.75; margin-top: 6px; }
.side-body { padding: 16px; overflow: auto; }
.side-body .field { margin-bottom: 12px; }
.side-body .field span { display: block; color: var(--muted); font-size: 0.75rem; margin-bottom: 3px; }
.side-body .field strong { font-size: 0.92rem; }
.tag {
  display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: rgba(14,165,164,0.12); color: var(--teal-deep); border: 1px solid rgba(14,165,164,0.25);
}
.tag.ok { background: rgba(22,163,74,0.1); color: #15803d; border-color: rgba(22,163,74,0.25); }
.tag.bad { background: rgba(220,38,38,0.1); color: #b91c1c; border-color: rgba(220,38,38,0.25); }
.tag.warn { background: rgba(217,119,6,0.1); color: #b45309; border-color: rgba(217,119,6,0.25); }

.feed { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; }
.feed-item {
  padding: 10px 12px; border-radius: 12px; background: #f8fafc;
  border: 1px solid var(--line); font-size: 0.85rem;
}
.feed-item strong { color: var(--navy2); }

.hidden { display: none !important; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .sidebar-foot { position: static; width: auto; }
  .brand { margin: 0 12px 0 0; border: 0; padding: 0; }
  .kpis, .grid-2, .grid-3, .inbox { grid-template-columns: 1fr; }
  .inbox { height: auto; }
}
