/* ===== MNB Omni Caller — by MNB Research ===== */

/* -------- Dark theme (default) -------- */
:root {
  --bg: #0b0b0c;
  --bg-grad: radial-gradient(1100px 500px at 70% -10%, rgba(255, 122, 24, 0.07), transparent 60%), #0b0b0c;
  --panel: #141416;
  --panel-2: #1d1d20;
  --border: #2b2b2f;
  --text: #f2f0ec;
  --muted: #97938c;
  --accent: #ff7a18;
  --accent-2: #ffa64d;
  --accent-grad: linear-gradient(135deg, #ff7a18, #ffb347);
  --good: #43b97f;
  --bad: #e05d55;
  --warn: #e0a83f;
  --logo-a: #f5f5f5;
  --logo-b: #3a3a3a;
  --logo-c: #0d0d0d;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  font-size: 15px;
}

/* -------- Light theme -------- */
[data-theme="light"] {
  --bg: #f7f6f3;
  --bg-grad: radial-gradient(1100px 500px at 70% -10%, rgba(255, 122, 24, 0.09), transparent 60%), #f7f6f3;
  --panel: #ffffff;
  --panel-2: #f1efeb;
  --border: #e0ddd6;
  --text: #191817;
  --muted: #7c786f;
  --accent: #ee6c0a;
  --accent-2: #ff8c33;
  --accent-grad: linear-gradient(135deg, #ee6c0a, #ffab5e);
  --good: #1e9e63;
  --bad: #cf4840;
  --warn: #c08a20;
  --logo-a: #1a1a1a;
  --logo-b: #8a8a8a;
  --logo-c: #e8e8e8;
  --shadow: 0 8px 30px rgba(60, 50, 40, 0.10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; font-size: 0.86em; }
.error { color: var(--bad); }
.spacer { height: 14px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.grad-hint { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(255,122,24,0.16), rgba(255,171,94,0.06));
  border: 1px solid rgba(255,122,24,0.4); border-radius: 12px;
  padding: 12px 18px; margin-bottom: 18px; font-size: 0.92em;
}

/* ===== Animated logo mark (grey / black / white shimmer) ===== */
.brand-mark {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: 0.5px; font-size: 13px;
  color: var(--panel);
  background: linear-gradient(120deg, var(--logo-a) 0%, var(--logo-b) 30%, var(--logo-c) 50%, var(--logo-b) 70%, var(--logo-a) 100%);
  background-size: 300% 300%;
  animation: logoShimmer 6s ease-in-out infinite;
  position: relative;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.brand-mark::after {
  content: "";
  position: absolute; inset: -2px;
  border-radius: 13px;
  background: var(--accent-grad);
  opacity: 0.55;
  z-index: -1;
  animation: logoGlow 6s ease-in-out infinite;
}
@keyframes logoShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes logoGlow {
  0%, 100% { opacity: 0.30; filter: blur(4px); }
  50% { opacity: 0.65; filter: blur(7px); }
}

/* ===== Login ===== */
.login-gate {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg-grad);
  z-index: 100;
}
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 42px 48px; text-align: center; width: 360px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 14px 0 4px; }
.login-card input { width: 100%; margin: 18px 0 10px; }

/* ===== Shell ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px; border-bottom: 1px solid var(--border); }
.brand-name { font-weight: 800; letter-spacing: 0.2px; }
.brand-sub {
  font-size: 0.74em; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
nav { padding: 12px 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin: 2px 0; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500;
  border-left: 3px solid transparent;
}
.nav-item .ico { width: 18px; text-align: center; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(255, 122, 24, 0.14), transparent);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.agent-picker label { font-size: 0.75em; color: var(--muted); display: block; margin-bottom: 4px; }
.foot-note { margin-top: 12px; font-size: 0.72em; color: var(--muted); text-align: center; }

.theme-toggle {
  width: 100%; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ===== Main ===== */
.main { flex: 1; padding: 26px 32px; max-width: 1300px; }
.view-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.view-head h2 { margin: 0; }
.filters { display: flex; gap: 10px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 1.02em; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two-col.tight { gap: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-grad); opacity: 0.8;
}
.stat-label { color: var(--muted); font-size: 0.8em; margin-bottom: 6px; }
.stat-value { font-size: 1.55em; font-weight: 700; }
.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.chart-grid .card { margin-bottom: 18px; }
.chart-grid canvas { max-height: 220px; }

/* Forms */
label { display: block; margin: 12px 0 6px; font-weight: 600; font-size: 0.9em; }
input, select, textarea {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }
input[type="file"] { padding: 8px; margin-bottom: 12px; }

.btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 8px; padding: 9px 16px; cursor: pointer; font: inherit; font-weight: 600;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent-grad); border: none; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 0.85em; }
.btn.big { width: 100%; padding: 13px; font-size: 1.05em; margin-top: 6px; }
.btn:disabled { opacity: 0.5; cursor: wait; }

.result { margin-top: 14px; padding: 12px 14px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); font-size: 0.92em; }
.result.ok { border-color: var(--good); }
.result.err { border-color: var(--bad); }

/* Context rows */
.ctx-row { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 8px; margin-bottom: 8px; }
.ctx-row button { padding: 0; }

/* Sections (agent training) */
.section-block {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin: 12px 0;
  background: var(--panel-2);
}
.section-block input { font-weight: 700; margin-bottom: 8px; background: var(--panel); }
.section-block textarea { background: var(--panel); }
.section-head { display: flex; gap: 8px; }
.section-head input { flex: 1; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.4px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--panel-2); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.8em; font-weight: 600; }
.badge.completed { background: rgba(67, 185, 127, 0.15); color: var(--good); }
.badge.failed, .badge.busy { background: rgba(224, 93, 85, 0.15); color: var(--bad); }
.badge.no-answer { background: rgba(224, 168, 63, 0.15); color: var(--warn); }
.badge.neutral { background: rgba(151, 147, 140, 0.15); color: var(--muted); }

.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 14px; color: var(--muted); }

/* Drawer */
.drawer { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 60; display: flex; justify-content: flex-end; }
.drawer-panel {
  width: 620px; max-width: 92vw; height: 100%; overflow-y: auto;
  background: var(--panel); border-left: 1px solid var(--border); padding: 24px;
}
.transcript { margin-top: 14px; }
.msg { margin: 8px 0; padding: 10px 14px; border-radius: 10px; max-width: 85%; font-size: 0.93em; white-space: pre-wrap; }
.msg.user { background: var(--panel-2); border: 1px solid var(--border); }
.msg.agent { background: rgba(255, 122, 24, 0.12); border: 1px solid rgba(255, 122, 24, 0.32); margin-left: auto; }
.msg .who { font-size: 0.75em; color: var(--muted); margin-bottom: 3px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 12px 0; font-size: 0.92em; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Dispatch history */
.dispatch-history .item { border-bottom: 1px solid var(--border); padding: 10px 0; font-size: 0.92em; }

/* Toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--accent); color: var(--text);
  border-radius: 10px; padding: 12px 22px; z-index: 90; font-weight: 600; box-shadow: var(--shadow);
}

@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .chart-grid, .two-col { grid-template-columns: 1fr; }
  .sidebar { width: 200px; }
}
