:root {
  --brand: #203080;
  --brand-2: #2b3ca6;
  --brand-dark: #141d47;
  --accent: #00b0a0;
  --accent-2: #00d0bd;
  --accent-soft: rgba(0, 176, 160, .12);
  --ink: #1b2559;
  --muted: #5b6b7c;
  --line: #e3e8ef;
  --bg: #f4f7f9;
}

* { box-sizing: border-box; }

body { background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, sans-serif; }

/* ---------------- layout ---------------- */
.app-shell { min-height: 100vh; }

.topnav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px;
  background: #fff;
  border-bottom: 2px solid rgba(0, 176, 160, .3);
  box-shadow: 0 2px 12px rgba(32, 48, 128, .06);
  padding: 0 20px; min-height: 64px;
}
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  background: none; border: 0; font-size: 1.35rem; color: var(--brand); padding: 4px 6px;
}
.nav-toggle:hover { color: var(--accent); }

.topnav-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-logo { height: 40px; width: auto; border-radius: 8px; object-fit: contain; }
.brand-text strong { color: var(--brand); font-size: 1.05rem; display: block; line-height: 1.1; }
.brand-text small { color: var(--accent); font-size: .66rem; letter-spacing: .8px; text-transform: uppercase; }

.topnav-menu { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.topnav-menu::-webkit-scrollbar { height: 4px; }
.topnav-menu::-webkit-scrollbar-thumb { background: rgba(0, 176, 160, .3); border-radius: 4px; }

.topnav-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 10px; border: 0; background: transparent;
  color: var(--ink); font-weight: 600; font-size: .9rem; cursor: pointer;
  white-space: nowrap; text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.topnav-link:hover { background: var(--accent-soft); color: var(--brand); }
.topnav-link.active { background: var(--accent-soft); color: var(--accent); }
.topnav .dropdown-toggle::after { display: none; }
.topnav-link .caret { font-size: .72rem; margin-left: 2px; transition: transform .18s ease; color: var(--muted); }
.topnav-link.active .caret { color: var(--accent); }
.topnav-item.show .topnav-link .caret { transform: rotate(180deg); }

.topnav-drop {
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 34px rgba(32, 48, 128, .16);
  padding: 10px; min-width: 320px; max-height: calc(100vh - 90px); overflow-y: auto;
}
.drop-head {
  display: flex; gap: 12px; align-items: center;
  padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.drop-head-icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; font-size: 1.15rem; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  box-shadow: 0 4px 10px rgba(43, 60, 166, .3);
}
.drop-head strong { color: var(--brand); font-size: .95rem; display: block; line-height: 1.15; }
.drop-head small { color: var(--muted); font-size: .72rem; }
.nav-drop-label {
  font-size: .64rem; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted) !important; padding: 10px 12px 4px !important; margin: 0;
}
.topnav-drop .dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px; color: var(--ink); font-size: .88rem;
}
.topnav-drop .dropdown-item i { width: 18px; text-align: center; color: var(--accent); font-size: .95rem; }
.topnav-drop .dropdown-item:hover { background: var(--accent-soft); color: var(--brand); }
.topnav-drop .dropdown-item.active { background: var(--accent); color: #fff; }
.topnav-drop .dropdown-item.active i { color: #fff; }

.search-box { position: relative; width: 260px; flex-shrink: 0; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 34px; border-radius: 20px; background: #f1f5f8; border: 1px solid transparent; }
.search-box input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 176, 160, .15); }

.topnav-tools { display: flex; align-items: center; flex-shrink: 0; margin-left: auto; }
.topnav-user .user-chip-btn {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; padding: 6px 10px; border-radius: 12px;
  cursor: pointer;
}
.topnav-user .user-chip-btn:hover { background: var(--accent-soft); }
.topnav-user .user-chip-btn::after { display: none; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 1.1rem; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
}
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-meta strong { color: var(--brand); font-size: .85rem; }
.user-meta small { color: var(--muted); font-size: .64rem; letter-spacing: 1px; }
.user-menu .dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: .88rem; }
.user-menu .dropdown-item i { width: 16px; text-align: center; }

.content { padding: 24px; }

/* ---------------- mobile ---------------- */
@media (max-width: 991.98px) {
  .topnav { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .nav-toggle { display: inline-flex; }
  .topnav-brand { order: 1; }
  .topnav-tools { order: 2; }
  .topnav-menu {
    order: 3; flex-basis: 100%; display: none;
    flex-direction: column; align-items: stretch; overflow: visible;
    border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px;
  }
  .topnav-menu.open { display: flex; }
  .topnav-menu .topnav-link { justify-content: flex-start; width: 100%; }
  .topnav-drop {
    position: static; transform: none !important; box-shadow: none;
    border: 0; margin: 4px 0 10px;
    border-left: 2px solid var(--accent); border-radius: 0 10px 10px 0;
    max-height: none;
  }
  .search-box { order: 4; flex-basis: 100%; width: 100%; max-width: none; }
  .topnav-item.show .topnav-drop { display: block; }
}

/* ---------------- cards / kpi ---------------- */
.card { border: 1px solid #e6ebf2; border-radius: 14px; box-shadow: 0 1px 3px rgba(18,34,47,.05); margin-bottom: 20px; }
.card-header { background: #fff; font-weight: 600; border-bottom: 1px solid #eef1f6; padding: 14px 20px; }
.card-body { padding: 20px; }

.kpi { border-radius: 14px; padding: 16px 18px; color: #fff; position: relative; overflow: hidden; min-height: 108px; }
.kpi .label { font-size: .74rem; letter-spacing: .6px; text-transform: uppercase; opacity: .85; }
.kpi .value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.kpi .sub { font-size: .78rem; opacity: .85; margin-top: 6px; }
.kpi i.bi { position: absolute; right: 14px; bottom: 10px; font-size: 2.4rem; opacity: .25; }
.kpi.blue   { background: linear-gradient(135deg,#203080,#2b3ca6); }
.kpi.teal   { background: linear-gradient(135deg,#00b0a0,#007469); }
.kpi.amber  { background: linear-gradient(135deg,#f0a500,#b57d00); }
.kpi.red    { background: linear-gradient(135deg,#e05d5d,#a93a3a); }
.kpi.purple { background: linear-gradient(135deg,#8a65d6,#6240b0); }
.kpi.slate  { background: linear-gradient(135deg,#5b6b7c,#37434f); }
.kpi.navy   { background: linear-gradient(135deg,#141d47,#203080); }

/* ---------------- filters bar ---------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filter-bar .f-item { display: flex; flex-direction: column; font-size: .78rem; color: #5b6b7c; }
.filter-bar .f-item label { margin-bottom: 2px; }
.filter-bar select, .filter-bar input { border-radius: 8px; border: 1px solid #d6dde7; padding: 6px 10px; min-width: 130px; font-size: .86rem; }
.filter-bar .btn { border-radius: 8px; }

/* ---------------- tables ---------------- */
.table thead th { background: #f2f5f9; font-size: .74rem; letter-spacing: .4px; text-transform: uppercase; color: #5b6b7c; border-bottom: 1px solid #e3e8ef; white-space: nowrap; }
.table td { vertical-align: middle; }

.table-sticky thead th {
  position: sticky;
  top: 66px;
  z-index: 5;
  background: #f2f5f9;
  box-shadow: 0 1px 0 #e3e8ef;
}

@media (max-width: 991.98px) {
  .table-sticky thead th { top: 0; }
}

.badge-status { font-size: .7rem; font-weight: 600; padding: 5px 9px; border-radius: 20px; }
.status-UPLOADED { background:#eef2fa; color:#42536b; }
.status-QUEUED { background:#fff3d6; color:#8a6d00; }
.status-TRANSCRIBING, .status-ANALYSING { background:#dbeafe; color:#1d4ed8; }
.status-TRANSCRIBED { background:#e0f2fe; color:#0e7490; }
.status-COMPLETED { background:#d9f5e5; color:#147d4a; }
.status-FAILED { background:#fde2e2; color:#b91c1c; }
.status-RETRY { background:#fde8c8; color:#92400e; }

.status-published { background:#d9f5e5; color:#147d4a; }
.status-pending, .status-queued { background:#fff3d6; color:#8a6d00; }
.status-publishing, .status-partial { background:#dbeafe; color:#1d4ed8; }
.status-draft { background:#eef2fa; color:#42536b; }
.status-failed { background:#fde2e2; color:#b91c1c; }
.status-no_account { background:#fde8c8; color:#92400e; }

.progress-thin { height: 6px; }
.insight-card { border-left: 4px solid var(--accent); }
.insight-card.warning { border-left-color: #f0a500; }
.insight-card.critical { border-left-color: #e05d5d; }
.insight-card.info { border-left-color: var(--accent-2); }
.insight-card.dark { border-left-color: #5b6b7c; }

.placeholder-box { background: #f7f9fc; border: 1px dashed #d6dde7; border-radius: 12px; padding: 26px; text-align: center; color: #8a97a5; }

.hub-avatar {
  width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--brand-2)); color: #fff; font-size: 1.5rem;
  flex-shrink: 0;
}
.hub-avatar.success { background: linear-gradient(135deg, #00b0a0, #007469); }

.social-post-content { white-space: pre-wrap; }

.speaker-customer { background: #eef6fd; }
.speaker-executive { background: #eefbf3; }