:root {
  --frolgate-blue: #0d3b8c;
  --frolgate-red: #e2231a;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #1c2331;
  --muted: #6b7688;
  --border: #e2e6ee;

  /* Admin shell theme tokens (default = "Purple", matching the reference dashboard) */
  --shell-sidebar-bg: linear-gradient(180deg, #2b2f77 0%, #4527a0 55%, #6a3fc4 100%);
  --shell-sidebar-text: #d9d7f5;
  --shell-sidebar-text-active: #ffffff;
  --shell-sidebar-active-bg: rgba(255, 255, 255, 0.14);
  --shell-sidebar-icon-bg: rgba(255, 255, 255, 0.08);
  --shell-topbar-bg: #ffffff;
  --shell-topbar-text: var(--text);
  --shell-content-bg: #f2f3fb;
  --shell-card-bg: #ffffff;
  --shell-border: #e5e6f2;
  --shell-accent: #6a3fc4;
  --shell-table-header-bg: #f7f7fc;
}

[data-theme="light"] {
  --shell-sidebar-bg: #ffffff;
  --shell-sidebar-text: #4a5170;
  --shell-sidebar-text-active: var(--frolgate-blue);
  --shell-sidebar-active-bg: #eaf0ff;
  --shell-sidebar-icon-bg: #f2f4fa;
  --shell-topbar-bg: #ffffff;
  --shell-topbar-text: var(--text);
  --shell-content-bg: #f4f6fb;
  --shell-card-bg: #ffffff;
  --shell-border: var(--border);
  --shell-accent: var(--frolgate-blue);
  --shell-table-header-bg: #eceff6;
}

[data-theme="dark"] {
  --shell-sidebar-bg: #14151f;
  --shell-sidebar-text: #a6a9c4;
  --shell-sidebar-text-active: #ffffff;
  --shell-sidebar-active-bg: rgba(255, 255, 255, 0.08);
  --shell-sidebar-icon-bg: rgba(255, 255, 255, 0.06);
  --shell-topbar-bg: #1b1c2b;
  --shell-topbar-text: #eceefb;
  --shell-content-bg: #101018;
  --shell-card-bg: #1b1c2b;
  --shell-border: #2b2c40;
  --shell-accent: #8b6ff0;
  --shell-table-header-bg: #22233a;
  --text: #eceefb;
  --muted: #9698b8;
  --card-bg: #1b1c2b;
  --border: #2b2c40;
  --bg: #101018;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(13, 59, 140, 0.12);
}

.login-card h1 {
  font-size: 1.3rem;
  margin: 0 0 4px;
  color: var(--frolgate-blue);
}

.login-card .subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 0.9rem;
}

.login-card input {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.login-card button {
  width: 100%;
  padding: 12px;
  background: var(--frolgate-blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.login-card button:hover { background: #0a2f70; }

.error-msg {
  color: var(--frolgate-red);
  font-size: 0.85rem;
  margin-top: -6px;
  margin-bottom: 12px;
  min-height: 1em;
}

/* ---------- App shell ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--frolgate-blue);
  color: white;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.topbar .brand .accent { width: 6px; height: 20px; background: var(--frolgate-red); border-radius: 2px; }

.topbar .actions { display: flex; gap: 8px; align-items: center; }

.topbar button, .topbar select {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.icon-btn {
  background: transparent !important;
  border: none !important;
  font-size: 1.1rem;
  padding: 4px 6px !important;
}

/* ---------- Layout: sidebar + board ---------- */
.app-layout {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  width: 230px;
  flex: 0 0 230px;
  background: #fff;
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 48px);
  padding: 12px 0;
}

.sidebar-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 4px 16px 8px;
  font-weight: 700;
}

.sidebar-list { list-style: none; margin: 0; padding: 0; }

.sidebar-list li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.86rem;
  border-left: 3px solid transparent;
}

.sidebar-list li a:hover { background: #f2f4fa; }

.sidebar-list li a.active {
  background: #eaf0ff;
  border-left-color: var(--frolgate-blue);
  font-weight: 600;
  color: var(--frolgate-blue);
}

.sidebar-list li a .dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px;
}

.sidebar-list li a .count {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  background: #eef0f6;
  padding: 1px 7px;
  border-radius: 8px;
}

.main-area { flex: 1; min-width: 0; }

.dashboard-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--frolgate-blue);
  margin-left: auto;
  padding: 6px 4px;
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    left: 0; top: 48px; bottom: 0;
    z-index: 50;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }
  .sidebar.open { transform: translateX(0); }
}

.topbar button:hover { background: rgba(255,255,255,0.22); }

/* ---------- Kanban ---------- */
.board {
  display: flex;
  gap: 14px;
  padding: 14px;
  overflow-x: auto;
  align-items: flex-start;
  min-height: calc(100vh - 56px);
}

.column {
  background: #eceff6;
  border-radius: 10px;
  min-width: 270px;
  max-width: 270px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 84px);
}

.column-header {
  padding: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid;
  border-radius: 10px 10px 0 0;
}

.column-count {
  background: rgba(0,0,0,0.08);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.column-body {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
}

.card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(20,30,60,0.08);
  cursor: grab;
  border-left: 4px solid var(--frolgate-blue);
}

.card:active { cursor: grabbing; }

.card .card-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.3;
}

.card .card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: white;
  padding: 2px 7px;
  border-radius: 10px;
  margin-top: 4px;
}

.sortable-ghost { opacity: 0.4; }

.filters {
  display: flex;
  gap: 8px;
  padding: 10px 14px 0;
  flex-wrap: wrap;
}

.filters select, .filters input {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

/* Card detail modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,20,40,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal {
  background: white; border-radius: 10px; width: 100%; max-width: 460px;
  padding: 20px; max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin-top: 0; font-size: 1.05rem; }
.modal label { display: block; font-size: 0.78rem; color: var(--muted); margin: 10px 0 3px; }
.modal input, .modal select, .modal textarea {
  width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem;
}
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal .btn-secondary { background: #eceff6; border: none; padding: 9px 14px; border-radius: 6px; cursor: pointer; }
.modal .btn-primary { background: var(--frolgate-blue); color: white; border: none; padding: 9px 14px; border-radius: 6px; cursor: pointer; }
.modal.modal-wide { max-width: 640px; }

.card-section { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.card-section h3 { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.card-subitem-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; max-height: 160px; overflow-y: auto; }
.card-subitem { background: #f7f8fc; border-radius: 6px; padding: 7px 10px; font-size: 0.82rem; }
.card-subitem .subitem-meta { color: var(--muted); font-size: 0.72rem; margin-top: 2px; }
.card-subitem a { color: var(--frolgate-blue); }
.card-inline-form { display: flex; gap: 6px; flex-wrap: wrap; }
.card-inline-form input[type="text"], .card-inline-form input[type="date"] { flex: 1; min-width: 100px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem; }
.card-inline-form select { padding: 7px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem; }
.card-inline-form input[type="file"] { flex: 1; font-size: 0.78rem; }
.card-inline-form .btn-secondary { background: #eceff6; border: none; padding: 7px 12px; border-radius: 6px; cursor: pointer; font-size: 0.82rem; }
.task-status-DONE { text-decoration: line-through; opacity: 0.6; }

/* ---------- Kanban/List view toggle ---------- */
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.view-toggle-btn { background: var(--card-bg); border: none; padding: 6px 12px; font-size: 0.8rem; cursor: pointer; color: var(--text); }
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--border); }
.view-toggle-btn.active { background: var(--frolgate-blue); color: white; }

.stage-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.stage-row { display: flex; align-items: center; gap: 8px; }
.stage-row input[type="text"] { flex: 1; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem; }
.stage-row input[type="color"] { width: 32px; height: 28px; padding: 1px; border: 1px solid var(--border); border-radius: 4px; }
.stage-row .stage-btn { background: #eceff6; border: none; padding: 5px 8px; border-radius: 5px; cursor: pointer; font-size: 0.78rem; }
.stage-row .stage-btn.danger { color: var(--frolgate-red); }

@media (max-width: 480px) {
  .column { min-width: 82vw; max-width: 82vw; }
}

/* ---------- Sidebar "System" section (Activity Log) ---------- */
.sidebar-list li .sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 16px;
  color: var(--text);
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
}

.sidebar-list li .sidebar-link:hover { background: #f2f4fa; }

.sidebar-list li .sidebar-link.active {
  background: #eaf0ff;
  border-left-color: var(--frolgate-blue);
  font-weight: 600;
  color: var(--frolgate-blue);
}

/* ---------- Activity Log panel ---------- */
.activity-panel {
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 10px;
  min-height: calc(100vh - 56px);
}

.activity-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.activity-live-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--muted);
}

.activity-toolbar select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.activity-list {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 130px);
}

.activity-row {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  font-size: 0.82rem;
}

.activity-row:last-child { border-bottom: none; }

.activity-row.activity-level-warn { border-left-color: #e8a33d; background: #fffaf0; }
.activity-row.activity-level-error { border-left-color: var(--frolgate-red); background: #fff5f4; }

.activity-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.activity-time { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }

.activity-category {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--frolgate-blue);
  background: #eaf0ff;
  padding: 1px 7px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.activity-message { flex: 1; min-width: 160px; }

.activity-user { color: var(--muted); font-size: 0.75rem; }

.activity-duration {
  font-size: 0.72rem;
  color: var(--muted);
  background: #eef0f6;
  padding: 1px 7px;
  border-radius: 8px;
}

.activity-detail {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  word-break: break-word;
}

@media (max-width: 480px) {
  .activity-message { min-width: 100%; order: 1; }
}

/* ---------- Admin panel: Bitrix24-style shell ---------- */
.admin-shell { display: flex; min-height: 100vh; background: var(--shell-content-bg); }

.admin-sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--shell-sidebar-bg);
  color: var(--shell-sidebar-text);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.admin-sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 6px 10px 18px;
}

.admin-sidebar .sidebar-brand .accent { width: 6px; height: 20px; background: var(--frolgate-red); border-radius: 2px; }

.admin-tabs { display: flex; flex-direction: column; gap: 2px; }

.admin-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  text-align: left;
  padding: 10px 12px;
  font-size: 0.86rem;
  cursor: pointer;
  color: var(--shell-sidebar-text);
  font-family: inherit;
}

.admin-tab .tab-icon {
  width: 28px; height: 28px; flex: 0 0 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--shell-sidebar-icon-bg);
  border-radius: 7px;
  font-size: 0.95rem;
}

.admin-tab:hover { background: rgba(255,255,255,0.08); color: var(--shell-sidebar-text-active); }
.admin-tab.active { background: var(--shell-sidebar-active-bg); font-weight: 600; color: var(--shell-sidebar-text-active); }

.admin-sidebar .sidebar-footer-link {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--shell-sidebar-text);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 10px 12px;
  border-radius: 8px;
}
.admin-sidebar .sidebar-footer-link:hover { background: rgba(255,255,255,0.08); color: var(--shell-sidebar-text-active); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--shell-topbar-bg);
  color: var(--shell-topbar-text);
  padding: 12px 20px;
  border-bottom: 1px solid var(--shell-border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.admin-topbar h1 { font-size: 1.05rem; margin: 0; }

.theme-switcher { display: flex; align-items: center; gap: 6px; }
.theme-switcher label { font-size: 0.78rem; color: var(--muted); }
.theme-switcher select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--shell-border);
  background: var(--shell-card-bg);
  color: var(--shell-topbar-text);
  font-size: 0.82rem;
}

.admin-content { flex: 1; min-width: 0; padding: 20px; overflow-x: auto; }

.panel-toolbar { margin-bottom: 12px; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--shell-card-bg); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(20,30,60,0.06); }
.admin-table th, .admin-table td { text-align: left; padding: 11px 14px; font-size: 0.84rem; border-bottom: 1px solid var(--shell-border); color: var(--text); }
.admin-table th { background: var(--shell-table-header-bg); font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.03em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--shell-table-header-bg); }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.stat-tile { background: var(--shell-card-bg); border-radius: 10px; padding: 14px 18px; min-width: 150px; box-shadow: 0 1px 3px rgba(20,30,60,0.08); border-top: 3px solid var(--shell-accent); }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--shell-accent); }
.stat-label { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.stat-sub { font-size: 0.72rem; color: var(--frolgate-red); margin-top: 2px; }

.funnel { margin-bottom: 20px; }
.funnel-row { display: flex; gap: 10px; align-items: flex-end; padding: 10px; background: var(--shell-card-bg); border-radius: 8px; overflow-x: auto; }
.funnel-stage { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.funnel-bar { width: 34px; background: var(--shell-accent); border-radius: 4px 4px 0 0; }
.funnel-count { font-size: 0.8rem; font-weight: 700; margin-top: 4px; }
.funnel-label { font-size: 0.68rem; color: var(--muted); text-align: center; margin-top: 2px; }

/* ---------- Chat ---------- */
.chat-layout { display: flex; gap: 12px; height: calc(100vh - 170px); }
.chat-threads { width: 220px; flex: 0 0 220px; background: var(--shell-card-bg); border-radius: 8px; overflow-y: auto; border: 1px solid var(--shell-border); }
.chat-thread-item { padding: 10px 14px; font-size: 0.84rem; cursor: pointer; border-bottom: 1px solid var(--shell-border); }
.chat-thread-item:hover { background: var(--shell-table-header-bg); }
.chat-thread-item.active { background: var(--shell-table-header-bg); font-weight: 600; color: var(--shell-accent); }
.chat-empty { padding: 14px; color: var(--muted); font-size: 0.82rem; }

.chat-window { flex: 1; display: flex; flex-direction: column; background: var(--shell-card-bg); border-radius: 8px; border: 1px solid var(--shell-border); }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; }
.chat-message { margin-bottom: 10px; font-size: 0.85rem; }
.chat-message-sender { font-weight: 700; margin-right: 6px; color: var(--shell-accent); }
.chat-message-whatsapp .chat-message-sender { color: #198754; }
.chat-message-time { font-size: 0.72rem; color: var(--muted, #888); margin-right: 8px; }
.chat-message-system .chat-message-time { margin-left: 6px; }
.chat-input-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--shell-border); }
.chat-input-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--shell-border); border-radius: 6px; background: var(--shell-content-bg); color: var(--text); }

@media (max-width: 820px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; flex-direction: row; overflow-x: auto; min-height: auto; position: static; padding: 10px; align-items: center; }
  .admin-sidebar .sidebar-brand { padding: 4px 8px; }
  .admin-tabs { flex-direction: row; }
  .admin-sidebar .sidebar-footer-link { margin-top: 0; }
  .chat-layout { flex-direction: column; height: auto; }
  .chat-threads { width: 100%; flex: none; max-height: 140px; }
}

/* =========================================================================
   Bitrix24-style visual refresh
   Global primary/secondary buttons, white top/side bars, pill filters and
   view-switchers, softer card elevation, and avatar chips -- matching the
   look of Frolgate's Bitrix24 partner portal (white surfaces, green primary
   actions, pill-shaped tabs/filters, rounded avatars, soft card shadows).
   ========================================================================= */
:root {
  --bx-green: #59c62e;
  --bx-green-dark: #46a622;
  --bx-sidebar-bg: #ffffff;
  --bx-topbar-bg: #ffffff;
  --bx-chip-bg: #eef1f8;
  --bx-avatar-bg: #dfe6f7;
}

body { background: var(--bx-chip-bg); }

/* ---------- Topbar: white, subtle shadow, dark text (was solid blue) ---------- */
.topbar {
  background: var(--bx-topbar-bg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.05);
  padding: 10px 20px;
}

.topbar .brand { color: var(--text); font-size: 1.02rem; }

.topbar button, .topbar select {
  background: var(--bx-chip-bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.topbar button:hover { background: #e4e9f5; }

.topbar #logoutBtn {
  background: transparent;
  border: 1px solid var(--border);
}

.icon-btn { color: var(--text); }

/* ---------- Sidebar: icon-prefixed workspace links, pill badges ---------- */
.sidebar { background: var(--bx-sidebar-bg); }

.sidebar-list li .sidebar-link,
#workspaceNav li .sidebar-link,
#systemNav li .sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  margin: 2px 8px;
  width: calc(100% - 16px);
}

.sidebar-list li .sidebar-link::before {
  content: attr(data-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bx-chip-bg);
  font-size: 0.85rem;
  flex: 0 0 22px;
}

.sidebar-list li .sidebar-link.active {
  background: #eaf0ff;
  border-left-color: transparent;
}

.sidebar-list li .sidebar-link.active::before {
  background: var(--frolgate-blue);
  filter: brightness(0) invert(1);
}

.sidebar-list li a:not(.sidebar-link) {
  border-radius: 8px;
  margin: 1px 8px;
  width: calc(100% - 16px);
}

.sidebar-list li a.active { border-left-color: transparent; }

/* ---------- Pill-style filters, search, and view toggle ---------- */
.filters {
  gap: 10px;
}

.filters input#searchInput {
  border-radius: 20px;
  padding-left: 14px;
  background: var(--bx-chip-bg);
  border: 1px solid transparent;
}

.filters input#searchInput:focus {
  background: var(--card-bg);
  border-color: var(--frolgate-blue);
  outline: none;
}

.filters select#yearFilter {
  border-radius: 20px;
  background: var(--bx-chip-bg);
  border: 1px solid transparent;
  padding: 6px 12px;
}

.view-toggle {
  border: none;
  border-radius: 20px;
  background: var(--bx-chip-bg);
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  border-radius: 17px;
  padding: 6px 14px;
  font-weight: 600;
  background: transparent;
}

.view-toggle-btn + .view-toggle-btn { border-left: none; }

.view-toggle-btn.active {
  background: var(--card-bg);
  color: var(--frolgate-blue);
  box-shadow: 0 1px 3px rgba(20, 30, 60, 0.15);
}

/* ---------- Buttons: green primary action, neutral pill secondary ---------- */
.btn-primary {
  background: var(--bx-green);
  color: #ffffff;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(70, 166, 34, 0.35);
}

.btn-primary:hover { background: var(--bx-green-dark); }

.btn-secondary {
  background: var(--bx-chip-bg);
  color: var(--text);
  border: 1px solid transparent;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-secondary:hover { background: #e4e9f5; }

.modal .btn-primary { box-shadow: none; }

/* ---------- Cards: rounded, soft elevation, hover lift ---------- */
.card {
  border-radius: 10px;
  border-left: none;
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.08);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
  box-shadow: 0 4px 14px rgba(20, 30, 60, 0.14);
  transform: translateY(-1px);
}

.column {
  background: #f2f4fa;
  border-radius: 12px;
}

.column-header { border-radius: 12px 12px 0 0; }

/* ---------- Avatar chips (assignee initials, Bitrix-style) ---------- */
.avatar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.avatar-chip .avatar-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bx-avatar-bg);
  color: var(--frolgate-blue);
  font-size: 0.62rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
}

.avatar-chip .avatar-name {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- Tables: rounded, avatar-friendly rows ---------- */
.admin-table { border-radius: 12px; }
.admin-table tr:hover td { background: #f5f7fc; }

@media (max-width: 820px) {
  .sidebar { background: var(--bx-sidebar-bg); }
}

/* =========================================================================
   Content-area dark glow backdrop -- literal match to the Bitrix24 partner
   portal: white topbar/sidebar stay as-is, but the main content pane sits on
   a dark navy background with a glowing purple/blue radial-gradient graphic
   behind it (approximated with CSS gradients -- Bitrix's actual artwork is
   their own asset and isn't pulled in, but the visual effect is matched).
   ========================================================================= */
.main-area {
  background:
    radial-gradient(ellipse 620px 520px at 62% 78%, rgba(139, 92, 246, 0.55) 0%, rgba(99, 60, 220, 0.28) 35%, transparent 68%),
    radial-gradient(ellipse 420px 380px at 78% 55%, rgba(56, 189, 248, 0.30) 0%, transparent 62%),
    radial-gradient(ellipse 900px 700px at 30% 20%, rgba(20, 20, 50, 0) 0%, rgba(8, 9, 24, 0.4) 60%),
    #0c0d1f;
  min-height: calc(100vh - 48px);
}

.board { min-height: calc(100vh - 56px); }

/* Cards/columns/tables sit as bright surfaces on the dark backdrop, same as
   Bitrix's white task-list card floating over the dark glow. */
.column {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.card {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.admin-content,
.admin-table,
.activity-panel,
.funnel-row {
  background: rgba(255, 255, 255, 0.97);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.admin-content { padding: 20px; }

.filters {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 14px;
  padding: 10px 14px;
  margin: 14px 14px 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.board { padding-top: 14px; }

.dashboard-label { color: var(--frolgate-blue); }

@media (max-width: 820px) {
  .main-area { background-attachment: scroll; }
}

/* ---------- Chat: unread badges, avatars, system messages ---------- */
.chat-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
}
.chat-thread-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.chat-thread-item.active,
.chat-thread-item:hover {
  background: rgba(89, 198, 46, 0.1);
}
.chat-thread-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bx-avatar-bg, #dfe6f7);
  color: #33415c;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.chat-thread-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}
.chat-message-system {
  text-align: center;
  color: var(--muted, #888);
  font-size: 0.78rem;
  font-style: italic;
  margin: 6px 0;
}

.role-view-access-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 12px;
  margin-bottom: 10px;
}

.category-codes-edit-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
}
.category-codes-edit-btn:hover { opacity: 1; }

/* ---------- Notifications bell dropdown ---------- */
.notif-bell-wrap .chat-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
}
.notif-dropdown {
  position: absolute;
  top: 36px;
  right: 0;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: #fff;
  color: #212529;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 200;
}
.notif-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid #eee;
  background: #fff;
  cursor: pointer;
  font-size: 0.82rem;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #eef4ff; }
.notif-item-title { font-weight: 600; margin-bottom: 2px; }
.notif-item-body { color: #495057; margin-bottom: 4px; }
.notif-item-time { color: #868e96; font-size: 0.72rem; }
.notif-empty { padding: 14px; font-size: 0.82rem; color: #868e96; }

/* ---------- eGP detail block (live tender / APP / award modals) ---------- */
.egp-details { max-height: 340px; overflow: auto; font-size: 0.8rem; }
.egp-kv { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: 4px 12px; margin: 0 0 10px; }
.egp-kv dt { color: var(--muted, #6c757d); font-weight: 600; }
.egp-kv dd { margin: 0; word-break: break-word; }
.egp-items { overflow-x: auto; }
.egp-items .admin-table { font-size: 0.76rem; }

/* =====================================================================================
   OptiPlan 2.0 -- PRAZ Tenders shell
   Odoo-style top bar with sub-menus + list/form views, in Frolgate navy with the Odoo
   PRAZ Tenders layout. Pillar colours come from portfolio_category.color_hex.
   ===================================================================================== */
:root {
  --o-nav-bg: #0d3b8c;
  --o-nav-bg-2: #12479f;
  --o-nav-text: #e8eefc;
  --o-accent: #714b67;          /* Odoo purple, used for primary buttons */
  --o-accent-hover: #5f3f57;
  --o-row-hover: #f3f6fc;
  --o-hit: #fff8e1;
  --o-navbar-h: 46px;
}

body { padding-top: 0; }

/* ---------- Top navbar ---------- */
.o-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--o-navbar-h);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: linear-gradient(90deg, var(--o-nav-bg), var(--o-nav-bg-2));
  color: var(--o-nav-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.o-apps {
  background: transparent; border: 0; color: inherit; cursor: pointer;
  width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center;
}
.o-apps:hover { background: rgba(255, 255, 255, 0.14); }
.o-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.02rem; margin-right: 10px; white-space: nowrap; color: #fff; }
.o-brand .accent { width: 5px; height: 20px; background: var(--frolgate-red); border-radius: 2px; }
.o-brand-sub { font-weight: 400; opacity: 0.85; }

.o-menu { display: flex; align-items: stretch; height: 100%; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.o-menu::-webkit-scrollbar { display: none; }
.o-menu-item { position: relative; display: flex; }
.o-menu-btn {
  background: transparent; border: 0; color: var(--o-nav-text); cursor: pointer;
  padding: 0 12px; font-size: 0.88rem; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.o-menu-btn[aria-haspopup]::after { content: ""; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; opacity: 0.7; }
.o-menu-btn:hover, .o-menu-item.open > .o-menu-btn { background: rgba(255, 255, 255, 0.14); color: #fff; }
.o-menu-item.active > .o-menu-btn { background: rgba(255, 255, 255, 0.2); color: #fff; box-shadow: inset 0 -3px 0 var(--frolgate-red); }

.o-dropdown {
  display: none;
  position: fixed;
  top: var(--o-navbar-h);
  min-width: 260px;
  max-height: calc(100vh - var(--o-navbar-h) - 12px);
  overflow-y: auto;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(20, 30, 60, 0.18);
  padding: 6px 0;
  z-index: 200;
}
.o-dropdown-wide { min-width: 340px; }
.o-menu-item.open > .o-dropdown { display: block; }
.o-dropdown button, .o-dropdown a {
  display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 8px 16px; font-size: 0.87rem; color: var(--text); text-decoration: none;
}
.o-dropdown button small, .o-dropdown a small { display: block; color: var(--muted); font-size: 0.74rem; margin-top: 1px; }
.o-dropdown button:hover, .o-dropdown a:hover { background: var(--o-row-hover); }
.o-dropdown-sep { padding: 8px 16px 4px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; border-top: 1px solid var(--border); margin-top: 4px; }
.o-pillar-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }

.o-right { display: flex; align-items: center; gap: 8px; margin-left: auto; white-space: nowrap; }
.o-icon-btn { background: transparent; border: 0; color: inherit; cursor: pointer; padding: 6px 8px; border-radius: 6px; font-size: 0.86rem; position: relative; }
.o-navbar .o-icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.o-company { font-size: 0.86rem; opacity: 0.95; }
.o-user { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; }
.o-zoom { display: flex; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 6px; overflow: hidden; }
.o-zoom button { background: transparent; border: 0; color: #fff; cursor: pointer; padding: 4px 8px; font-size: 0.82rem; min-width: 28px; }
.o-zoom button:hover { background: rgba(255, 255, 255, 0.16); }
.o-zoom #zoomResetBtn { min-width: 48px; border-left: 1px solid rgba(255, 255, 255, 0.25); border-right: 1px solid rgba(255, 255, 255, 0.25); }
.o-navbar .notif-dropdown { color: var(--text); }

@media (max-width: 900px) {
  .o-company, .o-brand-sub { display: none; }
}
@media (max-width: 640px) {
  .o-zoom, #logoutBtn { display: none; }
  .o-right { gap: 2px; }
  .o-brand { font-size: 0.9rem; margin-right: 4px; }
  .o-menu-btn { padding: 0 9px; font-size: 0.82rem; }
}

/* ---------- Pillar panel (left) ---------- */
.app-layout { min-height: calc((100vh - var(--o-navbar-h)) / var(--o-zoom, 1)); }
.sidebar { position: sticky; top: calc(var(--o-navbar-h) / var(--o-zoom, 1)); height: calc((100vh - var(--o-navbar-h)) / var(--o-zoom, 1)); overflow-y: auto; min-height: 0; }
.sidebar-hint { font-size: 0.74rem; color: var(--muted); padding: 10px 16px; margin: 0; }
body.pillars-collapsed .sidebar { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: var(--o-navbar-h); bottom: 0; height: auto; z-index: 90; transform: translateX(-100%); transition: transform 0.18s ease; box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15); }
  .sidebar.open { transform: translateX(0); }
  body.pillars-collapsed .sidebar { display: block; }
}

/* ---------- Control panel (breadcrumb / search / pager) ---------- */
/* Each view fills the viewport and scrolls inside .o-scroll, so table headers and pillar group rows stay pinned. */
.o-view { background: var(--shell-card-bg, #fff); height: calc((100vh - var(--o-navbar-h)) / var(--o-zoom, 1)); display: flex; flex-direction: column; overflow: hidden; }
.o-nowrap { white-space: nowrap; }
.o-control-panel {
  position: relative; z-index: 20; flex: 0 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 10px 16px; background: var(--shell-card-bg, #fff); border-bottom: 1px solid var(--border);
}
.o-breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; }
.o-bc-title { font-size: 1.05rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.o-bc-sub { font-size: 0.86rem; color: var(--muted); white-space: nowrap; }
.o-bc-link { color: var(--o-accent); text-decoration: none; font-size: 0.86rem; white-space: nowrap; }
.o-bc-link::after { content: " /"; color: var(--muted); }
.o-bc-link:hover { text-decoration: underline; }
.o-cp-search { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 420px; }
.o-cp-note { color: var(--muted); font-size: 0.84rem; }
.o-searchbox { display: flex; align-items: center; gap: 6px; border: 1px solid #c9cfdc; border-radius: 6px; padding: 0 10px; flex: 1 1 260px; max-width: 520px; background: #fff; }
.o-searchbox:focus-within { border-color: var(--o-accent); box-shadow: 0 0 0 2px rgba(113, 75, 103, 0.15); }
.o-searchbox input { border: 0; outline: 0; padding: 7px 0; flex: 1; font-size: 0.86rem; background: transparent; color: var(--text); }
.o-control-panel select, .o-kw-add select, .o-kw-add input { border: 1px solid #c9cfdc; border-radius: 6px; padding: 6px 8px; font-size: 0.84rem; background: #fff; color: var(--text); }
.o-check { font-size: 0.82rem; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.o-pager { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 0.84rem; color: var(--muted); white-space: nowrap; }
.o-pager button { border: 1px solid #c9cfdc; background: #fff; border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--text); }
.o-pager button:hover { background: var(--o-row-hover); }

.o-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #c9cfdc; background: #f1f3f6; color: var(--text); border-radius: 6px; padding: 6px 12px; font-size: 0.85rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.o-btn:hover { background: #e6e9ef; }
.o-btn-primary { background: var(--o-accent); border-color: var(--o-accent); color: #fff; }
.o-btn-primary:hover { background: var(--o-accent-hover); }

/* ---------- Scroll areas ---------- */
.o-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 14px 16px 40px; scroll-behavior: smooth; }
.o-table-wrap { padding: 0 0 40px; }
.o-empty { padding: 24px; color: var(--muted); text-align: center; }
.o-muted { color: var(--muted); font-size: 0.8rem; }
.o-help { color: var(--muted); font-size: 0.8rem; padding: 12px 16px; max-width: 900px; }

/* ---------- List view ---------- */
.o-list { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; table-layout: auto; }
.o-list thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--shell-table-header-bg, #f7f7fc); color: var(--text); text-align: left; font-weight: 600;
  padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none;
}
.o-list td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text); }
.o-list tbody tr[data-id] { cursor: pointer; }
.o-list tbody tr[data-id]:hover td { background: var(--o-row-hover); }
.o-list tr.o-row-hit td:first-child { box-shadow: inset 3px 0 0 #f59f00; }
.o-list tr.o-group td { background: #eef1f7; font-weight: 700; font-size: 0.82rem; padding: 7px 12px; }
.o-group-count { color: var(--muted); font-weight: 400; }
.o-list tr.o-editing td { background: #fffdf2; }
.o-list tr.o-editing input[type="text"], .o-list tr.o-editing select { width: 100%; border: 1px solid #c9cfdc; border-radius: 4px; padding: 5px 7px; font-size: 0.84rem; }
.o-row-actions { white-space: nowrap; text-align: right; }
.o-row-actions .o-btn { padding: 4px 9px; margin-left: 4px; }
.o-list .o-icon-btn:hover { background: #fde8e8; }

th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--o-accent); }
th.sort-asc::after { content: " \25B2"; font-size: 0.65em; color: var(--o-accent); }
th.sort-desc::after { content: " \25BC"; font-size: 0.65em; color: var(--o-accent); }
.admin-table th.sortable { cursor: pointer; user-select: none; }

/* Sticky headers + scroll for the original list views too */
#liveTendersListView, #appPlanListView, #awardsListView, #boardListView, #funnelListView { max-height: calc(100vh - 170px); overflow: auto; }
#liveTendersListView .admin-table thead th, #appPlanListView .admin-table thead th, #awardsListView .admin-table thead th,
#boardListView .admin-table thead th, #funnelListView .admin-table thead th { position: sticky; top: 0; z-index: 3; }
.admin-table { overflow: visible; }

.o-tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.74rem; color: #fff; background: var(--tag, #868e96); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.o-code { display: inline-block; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.78rem; padding: 1px 5px; border-radius: 4px; background: #eef0f6; color: var(--text); }
.o-code-hit { background: #fff3bf; color: #7a5200; font-weight: 700; box-shadow: inset 0 0 0 1px #f59f00; }
.o-days { display: inline-block; font-size: 0.7rem; padding: 1px 6px; border-radius: 8px; font-weight: 700; margin-left: 4px; }
.o-days-ok { background: #e6f4ea; color: #1e6b34; }
.o-days-soon { background: #fff3bf; color: #7a5200; }
.o-days-urgent { background: #ffe3e3; color: #a61e1e; }
.o-days-past { background: #e9ecef; color: #495057; }
.o-outcome { display: inline-block; font-size: 0.74rem; padding: 2px 8px; border-radius: 10px; background: #e9ecef; color: #343a40; }
.o-outcome-failed, .o-outcome-cancelled { background: #ffe3e3; color: #a61e1e; }
.o-outcome-awarded { background: #e6f4ea; color: #1e6b34; }

/* ---------- Form view (sheet) ---------- */
.o-form-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.o-status-pill { margin-left: auto; padding: 4px 12px; border-radius: 14px; font-size: 0.78rem; font-weight: 700; }
.o-status-pill.open { background: #e6f4ea; color: #1e6b34; }
.o-status-pill.closed { background: #e9ecef; color: #495057; }
.o-sheet { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 18px 22px 24px; max-width: 1400px; box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05); }
.o-sheet-title { margin: 0 0 14px; font-size: 1.15rem; font-weight: 600; color: var(--text); }
.o-sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.o-sheet-grid-1 { grid-template-columns: 1fr; }
.o-field { display: grid; grid-template-columns: 190px 1fr; gap: 10px; padding: 6px 0; font-size: 0.86rem; }
.o-field label { font-weight: 600; color: var(--text); }
.o-field-muted label { color: var(--muted); font-weight: 500; }
.o-field sup { color: var(--o-accent); cursor: help; }
.o-field a { color: var(--o-accent); word-break: break-all; }
.o-sub { margin-top: 4px; color: var(--muted); font-size: 0.76rem; }
.o-section { margin: 18px 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.o-checkbox { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 3px; border: 1px solid #adb5bd; font-size: 0.7rem; color: #fff; }
.o-checkbox.on { background: var(--o-accent); border-color: var(--o-accent); }
@media (max-width: 900px) {
  .o-sheet-grid { grid-template-columns: 1fr; }
  .o-field { grid-template-columns: 140px 1fr; }
}

/* ---------- Pillar overview ---------- */
.o-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.o-kpi { text-align: left; border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 14px 16px; cursor: pointer; border-left: 4px solid var(--frolgate-blue); }
.o-kpi:hover { box-shadow: 0 4px 14px rgba(20, 30, 60, 0.1); }
.o-kpi-v { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text); }
.o-kpi-l { font-size: 0.78rem; color: var(--muted); }
.o-kpi-hit { border-left-color: #f59f00; }
.o-kpi-warn { border-left-color: var(--frolgate-red); }
.pillar-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.pillar-card { background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--pillar); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pillar-card header { display: flex; gap: 12px; align-items: flex-start; }
.pillar-no { font-size: 1.4rem; font-weight: 800; color: var(--pillar); line-height: 1; min-width: 34px; }
.pillar-card h3 { margin: 0 0 3px; font-size: 1rem; }
.pillar-card header p { margin: 0; font-size: 0.8rem; color: var(--muted); }
.pillar-subs { display: flex; flex-wrap: wrap; gap: 4px; }
.pillar-subs span { font-size: 0.7rem; background: #f1f3f6; border-radius: 10px; padding: 2px 8px; color: #495057; }
.pillar-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pillar-metrics button { border: 1px solid var(--border); background: #fafbfd; border-radius: 8px; padding: 8px 4px; cursor: pointer; font-size: 0.7rem; color: var(--muted); }
.pillar-metrics button b { display: block; font-size: 1.15rem; color: var(--text); }
.pillar-metrics button:hover { border-color: var(--pillar); background: #fff; }
.pillar-foot { display: flex; justify-content: space-between; align-items: center; }
.pillar-next { list-style: none; margin: 0; padding: 0; border-top: 1px dashed var(--border); }
.pillar-next li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 0.8rem; cursor: pointer; border-bottom: 1px dashed var(--border); }
.pillar-next li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pillar-next li:hover { color: var(--o-accent); }

/* ---------- Keywords add row ---------- */
.o-kw-add { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.o-kw-add input { flex: 1 1 240px; }

/* ---------- Kanban scrolling + sort ---------- */
.main-area { min-height: calc((100vh - var(--o-navbar-h)) / var(--o-zoom, 1)); }
.board { overflow-x: auto; scroll-behavior: smooth; scrollbar-width: thin; }
.board.panning { cursor: grabbing; scroll-behavior: auto; user-select: none; }
.column { max-height: calc((100vh - var(--o-navbar-h)) / var(--o-zoom, 1) - 120px); }
.column-body { overscroll-behavior: contain; scrollbar-width: thin; }
select.kanban-sort { border: 1px solid #c9cfdc; border-radius: 6px; padding: 5px 8px; font-size: 0.8rem; background: #fff; }

/* ---------- Back to top + toast ---------- */
.o-scroll-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 300; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: var(--o-accent); color: #fff; font-size: 1.2rem; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.o-scroll-top.show { opacity: 1; pointer-events: auto; }
.o-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); z-index: 400;
  background: #212529; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 0.86rem;
  opacity: 0; pointer-events: none; transition: all 0.2s; max-width: 90vw;
}
.o-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Dark theme support for the new pieces ---------- */
[data-theme="dark"] .o-dropdown, [data-theme="dark"] .o-sheet, [data-theme="dark"] .o-kpi,
[data-theme="dark"] .pillar-card, [data-theme="dark"] .o-searchbox, [data-theme="dark"] .o-pager button { background: var(--shell-card-bg); color: var(--text); }
[data-theme="dark"] .o-list tr.o-group td { background: #22233a; }

/* ---------- Tender Search ---------- */
.o-quicksearch { margin: 0 8px; flex: 0 1 300px; min-width: 140px; }
.o-quicksearch input { width: 100%; border: 0; border-radius: 6px; padding: 6px 10px; font-size: 0.84rem; background: rgba(255,255,255,0.16); color: #fff; outline: none; }
.o-quicksearch input::placeholder { color: rgba(255,255,255,0.75); }
.o-quicksearch input:focus { background: #fff; color: var(--text); }
.o-search-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--shell-card-bg, #fff); flex: 0 0 auto; }
.o-search-form input, .o-search-form select { border: 1px solid #c9cfdc; border-radius: 6px; padding: 7px 9px; font-size: 0.84rem; background: #fff; color: var(--text); min-width: 0; }
.o-search-form .o-date { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--muted); }
.o-search-form .o-date input { flex: 1; padding: 5px 6px; }
.o-search-actions { display: flex; gap: 6px; align-items: center; }
.o-search-hint { padding: 10px 16px; background: #fff8e1; border-bottom: 1px solid #f5d77b; font-size: 0.85rem; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
@media (max-width: 900px) { .o-quicksearch { display: none; } }

/* ---------- Users ---------- */
.o-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.o-form-grid input, .o-form-grid select { width: 100%; }
@media (max-width: 640px) { .o-form-grid { grid-template-columns: 1fr; } }
.o-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; margin: 4px 0 8px; }
.o-check-grid .o-check { font-weight: 400; white-space: normal; }
.o-inline { display: flex; gap: 8px; align-items: center; }
.o-inline input { flex: 1; }
.o-form-error { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: #ffe3e3; color: #a61e1e; font-size: 0.84rem; }
.o-creds { display: grid; gap: 8px; margin: 10px 0; }
.o-creds div { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 8px; font-size: 0.86rem; }
.o-creds code { background: #f1f3f6; padding: 6px 8px; border-radius: 4px; user-select: all; word-break: break-all; }
.o-btn-danger { color: #c92a2a; }
.o-btn-danger:hover { background: #ffe3e3; }
.o-outcome-pending { background: #fff3bf; color: #7a5200; }
.o-list tr.o-row-muted td { color: var(--muted); }
.o-account .o-user-btn { padding: 0 6px; }
.o-account .o-user-btn::after { display: none; }
.o-dropdown-right { right: 8px; left: auto; min-width: 220px; }
#userManagementPanel { background: var(--shell-card-bg, #fff); }
/* Checkbox rows inside modals (the base .modal styles make every input full width) */
.modal .o-check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 6px 0; }
.modal .o-check input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; }
.modal .o-check-grid .o-check { margin: 2px 0; }

/* ---------- Countdown timers ---------- */
.o-cd-list { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 2px; }
.o-cd-list:not(.o-cd-compact) { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.o-cd { display: inline-flex; align-items: baseline; gap: 6px; padding: 2px 8px; border-radius: 6px; font-size: 0.74rem;
        background: #eef2f8; color: #1c2331; border-left: 3px solid #868e96; white-space: nowrap; line-height: 1.5; }
.o-cd-l { color: #495057; font-weight: 600; }
.o-cd-t { font-variant-numeric: tabular-nums; font-weight: 700; margin-left: auto; }
.o-cd-d { color: var(--muted); font-size: 0.7rem; }
.o-cd-prebid { border-left-color: #6741d9; }
.o-cd-clar { border-left-color: #1971c2; }
.o-cd-closing { border-left-color: #2b8a3e; }
.o-cd-compact .o-cd { display: flex; }
.o-cd.o-cd-soon { background: #fff3bf; }
.o-cd.o-cd-urgent { background: #ffe3e3; color: #a61e1e; }
.o-cd.o-cd-urgent .o-cd-l { color: #a61e1e; }
.o-cd.o-cd-passed { background: #f1f3f5; color: #868e96; text-decoration: line-through; }
.card.o-expired, tr.o-expired td { opacity: 0.45; transition: opacity 0.6s; }
.card.o-expired::after { content: "Closed — moving to Closed Tenders"; display: block; margin-top: 6px; font-size: 0.72rem; color: #a61e1e; font-weight: 600; }
