/* Enterprise dashboard (org.html): navy sidebar, light content with rounded
   white cards, pill badges and a round "+" button. The organisation's
   colours are set by org.js (--org-primary, --org-sidebar). */

:root {
  --org-primary: #3b82f6;
  --org-primary-rgb: 59, 130, 246;
  --org-sidebar: #0b2a63;
  --org-bg: #f4f7fc;
  --org-card: #ffffff;
  --org-line: #e6ebf3;
  --org-muted: #8a94a6;
  --org-text: #1f2a3d;
  --org-radius: 14px;
}
[data-bs-theme="dark"] {
  --org-bg: #0f1521;
  --org-card: #172033;
  --org-line: #263149;
  --org-muted: #8f9bb3;
  --org-text: #e3e8f2;
}

.org-body { background: var(--org-bg); color: var(--org-text); min-height: 100vh; }
.org-body .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.org-boot { min-height: 100vh; display: grid; place-items: center; }

.btn-org { background: var(--org-primary); border-color: var(--org-primary); color: #fff; }
.btn-org:hover, .btn-org:focus { background: var(--org-primary); border-color: var(--org-primary); color: #fff; filter: brightness(.93); }
.btn-org-soft { background: rgba(var(--org-primary-rgb), .1); color: var(--org-primary); border: 0; }
.btn-org-soft:hover { background: rgba(var(--org-primary-rgb), .18); color: var(--org-primary); }
.text-org { color: var(--org-primary) !important; }
.org-body .form-check-input:checked { background-color: var(--org-primary); border-color: var(--org-primary); }
.org-body a { color: var(--org-primary); }

/* ---- logo / initials mark */
.org-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--org-primary); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 1.05rem; flex: none; }
.org-mark-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.5rem; }
.org-logo { max-height: 36px; max-width: 140px; object-fit: contain; }
.org-logo-lg { max-height: 64px; max-width: 220px; object-fit: contain; }

/* ---- sign in */
.org-auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--org-sidebar) 0 38%, var(--org-bg) 38%); }
.org-auth-card { width: 100%; max-width: 420px; background: var(--org-card); border-radius: 20px; box-shadow: 0 20px 50px rgba(10, 30, 70, .18); padding: 32px; }
.org-auth-brand { text-align: center; margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.org-powered { text-align: center; font-size: .8rem; color: var(--org-muted); margin: 22px 0 0; }

/* ---- layout */
.org-shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.org-sidebar { background: var(--org-sidebar); color: #fff; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; border-radius: 0 22px 22px 0; z-index: 1040; }
.org-side-head { padding: 26px 22px 18px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.org-side-name { font-weight: 700; font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.org-userbtn { background: none; border: 0; color: #fff; padding: 0; text-align: left; display: flex; flex-direction: column; align-items: flex-start; max-width: 100%; }
.org-userbtn::after { position: absolute; margin-left: 0; right: 22px; top: auto; }
.org-userbtn-name { font-size: 1.05rem; font-weight: 500; }
.org-userbtn-mail { font-size: .8rem; color: rgba(255, 255, 255, .55); overflow-wrap: anywhere; }
.org-nav { padding: 18px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.org-nav-label { color: rgba(255, 255, 255, .45); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 14px 14px 6px; border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 10px; }
.org-nav-link { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, .86) !important; text-decoration: none; padding: 11px 14px; border-radius: 10px; background: none; border: 0; font-size: .97rem; text-align: left; }
.org-nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff !important; }
.org-nav-link.active { background: var(--org-primary); color: #fff !important; box-shadow: 0 6px 16px rgba(var(--org-primary-rgb), .35); }
.org-nav-link .badge { margin-left: auto; }
.org-side-foot { padding: 14px 16px 22px; border-top: 1px solid rgba(255, 255, 255, .12); }
.org-logout { color: rgba(255, 255, 255, .55) !important; }

.org-main { padding: 30px 40px 48px; min-width: 0; }
.org-topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.org-title { font-size: 1.65rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.org-title .ico { width: 26px; height: 26px; color: var(--org-muted); }
.org-tools { display: flex; align-items: center; gap: 14px; }
.org-search { display: flex; align-items: center; gap: 10px; background: var(--org-card); border: 1px solid var(--org-line); border-radius: 999px; padding: 0 18px; height: 50px; width: min(420px, 60vw); color: var(--org-muted); margin: 0; }
.org-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--org-text); }
.org-add { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--org-primary); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(var(--org-primary-rgb), .35); flex: none; }
.org-add .ico { width: 26px; height: 26px; }
.org-burger { display: none; background: none; border: 0; color: var(--org-text); padding: 6px; }
.org-subline { color: var(--org-muted); font-size: .9rem; min-height: 1.2em; margin: 6px 0 18px; }
.org-scrim { display: none; }

/* ---- tabs like the screenshot: folder tab + segmented filter bar */
.org-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--org-line); margin-bottom: 18px; overflow-x: auto; }
.org-tab { background: none; border: 1px solid transparent; border-bottom: 0; padding: 12px 22px; border-radius: 12px 12px 0 0; color: var(--org-text); white-space: nowrap; margin-bottom: -1px; }
.org-tab.active { background: var(--org-card); border-color: var(--org-line); color: var(--org-primary); }
.org-tab .count { color: var(--org-muted); margin-left: 4px; font-size: .85em; }

/* ---- cards & tables */
.org-card { background: var(--org-card); border: 1px solid var(--org-line); border-radius: var(--org-radius); box-shadow: 0 2px 10px rgba(16, 35, 80, .04); }
.org-card-pad { padding: 22px 24px; }
.org-card-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
.org-grid { display: grid; gap: 18px; }
.org-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.org-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.org-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.org-table { margin: 0; color: var(--org-text); --bs-table-bg: transparent; --bs-table-color: var(--org-text); }
.org-table thead th { font-weight: 600; padding: 20px 22px; border-bottom: 1px solid var(--org-line); white-space: nowrap; background: transparent; }
.org-table tbody td { padding: 18px 22px; vertical-align: middle; border-color: var(--org-line); }
.org-table tbody tr:hover td { background: rgba(var(--org-primary-rgb), .035); }
.org-table tbody tr:last-child td { border-bottom: 0; }
.org-table th:first-child, .org-table td:first-child { border-right: 1px solid var(--org-line); }
.org-table .muted, .org-muted { color: var(--org-muted); }
.org-table-wrap { overflow-x: auto; }
.org-empty { text-align: center; color: var(--org-muted); padding: 40px 16px !important; }
.org-gear { background: none; border: 0; color: var(--org-muted); padding: 6px; border-radius: 8px; }
.org-gear:hover { color: var(--org-primary); background: rgba(var(--org-primary-rgb), .08); }
.org-link { background: none; border: 0; padding: 0; color: var(--org-muted); display: inline-flex; align-items: center; gap: 6px; }
.org-link:hover { color: var(--org-primary); }

/* Pills (roles, groups, states) */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 7px; font-size: .82rem; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.pill-blue { background: #e9f1ff; color: #3768d8; }
.pill-green { background: #ddf6ec; color: #1a9a6a; }
.pill-red { background: #fde7ea; color: #d6455c; }
.pill-amber { background: #fff2d9; color: #b7791f; }
.pill-purple { background: #efe8ff; color: #6d4ad8; }
.pill-gray { background: #eef1f6; color: #66728a; }
[data-bs-theme="dark"] .pill-blue { background: rgba(59, 130, 246, .18); color: #8db5ff; }
[data-bs-theme="dark"] .pill-green { background: rgba(26, 154, 106, .2); color: #6ee0b2; }
[data-bs-theme="dark"] .pill-red { background: rgba(214, 69, 92, .2); color: #ff9aaa; }
[data-bs-theme="dark"] .pill-amber { background: rgba(183, 121, 31, .22); color: #f5c876; }
[data-bs-theme="dark"] .pill-purple { background: rgba(109, 74, 216, .25); color: #c2b0ff; }
[data-bs-theme="dark"] .pill-gray { background: rgba(140, 150, 170, .18); color: #b4bdcd; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: #b7c0cf; }
.dot-online { background: #1fbf7a; }
.dot-busy { background: #e5484d; }
.dot-dnd { background: #f59e0b; }

/* Stat cards (overview) */
.org-stat { display: flex; flex-direction: column; gap: 6px; }
.org-stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(var(--org-primary-rgb), .12); color: var(--org-primary); margin-bottom: 6px; }
.org-stat-icon.green { background: rgba(31, 191, 122, .14); color: #1a9a6a; }
.org-stat-icon.amber { background: rgba(245, 158, 11, .15); color: #c07a07; }
.org-stat-icon.red { background: rgba(229, 72, 77, .13); color: #d6455c; }
.org-stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.org-stat-label { color: var(--org-muted); font-size: .88rem; }
.org-stat-sub { font-size: .8rem; color: var(--org-muted); }

.org-bigext { font-size: 2.6rem; font-weight: 700; letter-spacing: .03em; line-height: 1; }
.org-kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.org-kv dt { color: var(--org-muted); font-weight: 500; }
.org-kv dd { margin: 0; overflow-wrap: anywhere; }

/* Queue cards */
.org-queue { display: flex; flex-direction: column; gap: 12px; }
.org-queue-num { font-family: var(--bs-font-monospace); color: var(--org-muted); }
.org-agents { display: flex; flex-wrap: wrap; gap: 6px; }

/* Member pickers inside dialogs */
.org-pick { max-height: 260px; overflow-y: auto; border: 1px solid var(--org-line); border-radius: 10px; padding: 6px 10px; }
.org-pick .form-check { padding: 6px 0 6px 1.8em; margin: 0; border-bottom: 1px solid var(--org-line); }
.org-pick .form-check:last-child { border-bottom: 0; }
.org-pick-row { display: flex; align-items: center; gap: 10px; }
.org-pick-row .form-control { width: 76px; }
.org-perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--org-line); }
.org-perm-row:last-child { border-bottom: 0; }
.org-perm-row .form-select { width: auto; min-width: 150px; }
.org-hours-row { display: grid; grid-template-columns: 70px auto 1fr 1fr; gap: 10px; align-items: center; margin-bottom: 6px; }

/* Branding preview */
.org-preview { display: grid; grid-template-columns: 120px 1fr; border-radius: 12px; overflow: hidden; border: 1px solid var(--org-line); min-height: 170px; }
.org-preview-side { background: var(--org-sidebar); padding: 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.org-preview-item { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .25); }
.org-preview-item.active { background: var(--org-primary); height: 22px; }
.org-preview-main { background: var(--org-bg); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.org-preview-bar { height: 14px; width: 60%; border-radius: 7px; background: var(--org-line); }
.org-preview-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--org-primary); align-self: flex-end; }
.org-color { width: 56px; min-width: 56px; height: 40px; padding: 4px; flex: none; }
.org-bg-color { flex: none; }
.org-bg-sliders { max-width: 520px; }

.org-live-dot { width: 9px; height: 9px; }

/* Custom background (Branding): fixed behind the content; the header gets a
   glass panel so the title stays readable on any image */
.org-has-bg { position: relative; isolation: isolate; }
.org-has-bg::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  /* Reaches past the edges, so a blurred image has no faded border */
  inset: calc(var(--org-bg-blur, 0px) * -2);
  background-color: var(--org-bg-color, transparent); background-image: var(--org-bg-image, none);
  background-size: var(--org-bg-size, cover); background-repeat: var(--org-bg-repeat, no-repeat); background-position: center;
  filter: blur(var(--org-bg-blur, 0px));
}
.org-shell.org-has-bg .org-topbar { background: color-mix(in srgb, var(--org-card) 88%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--org-line); border-radius: var(--org-radius); padding: 12px 16px; }
.org-shell.org-has-bg .org-topbar { margin-bottom: 18px; }
.org-shell.org-has-bg .org-subline { display: inline-block; background: color-mix(in srgb, var(--org-card) 88%, transparent); backdrop-filter: blur(10px); border-radius: 8px; padding: 3px 10px; margin: -6px 0 18px; }
.org-shell.org-has-bg .org-subline:empty { display: none; }
.org-shell.org-has-bg .org-tabs { background: color-mix(in srgb, var(--org-card) 80%, transparent); border-radius: 12px 12px 0 0; }
.org-shell.org-has-bg > .org-main > .org-view > p.org-muted { background: color-mix(in srgb, var(--org-card) 88%, transparent); border-radius: 10px; padding: 8px 12px; }
.org-auth.org-has-bg { background-position: center; }
.org-preview-main.org-has-bg { background-attachment: scroll; }
.org-role-card .form-check-input:disabled { opacity: .8; }

@media (max-width: 1200px) {
  .org-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .org-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .org-shell { grid-template-columns: minmax(0, 1fr); }
  .org-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease; }
  .org-shell.nav-open .org-sidebar { transform: none; }
  .org-shell.nav-open .org-scrim { display: block; position: fixed; inset: 0; background: rgba(5, 15, 35, .45); z-index: 1030; }
  .org-burger { display: inline-flex; }
  .org-main { padding: 18px 16px 40px; }
  .org-title { font-size: 1.3rem; }
  .org-tools { width: 100%; }
  .org-search { flex: 1; width: auto; height: 44px; }
  .org-add { width: 44px; height: 44px; }
  .org-grid-2, .org-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .org-table thead th, .org-table tbody td { padding: 14px 14px; }
}
@media (max-width: 575.98px) {
  .org-grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .org-card-pad { padding: 16px; }
  .org-stat-value { font-size: 1.5rem; }
  .org-auth-card { padding: 24px 18px; }
  .org-hours-row { grid-template-columns: 52px auto 1fr 1fr; gap: 6px; }
}
