/* ==========================================================================
   KirnetLog - Modern SaaS Design System & UI Styling
   ========================================================================== */

/* --- 1. Root & Theme Design Tokens --- */
:root {
  --top-h: 62px;
  --side-w: 260px;
  --tl-radius-sm: 6px;
  --tl-radius-md: 10px;
  --tl-radius-lg: 14px;
  --tl-radius-xl: 18px;
  
  --tl-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --tl-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --tl-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --tl-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --tl-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);

  /* Default Theme: Indigo (Modern SaaS) */
  --tl-p1: #4f46e5;
  --tl-p2: #6366f1;
  --tl-p1-dk: #4338ca;
  --tl-p2-dk: #3730a3;
  --tl-tr: 79, 70, 229;
  --tl-a2: #0ea5e9;
  --tl-a3: #f59e0b;
  --tl-a4: #10b981;
  --tl-hd: #1e1b4b;
  --tl-lt: #c7d2fe;
  
  --tl-d1: #0f172a;
  --tl-d2: #1e293b;
  --tl-d3: #334155;
  --tl-ok: #10b981;
  --tl-ok-rgb: 16, 185, 129;

  /* Surfaces - Light */
  --tl-bg1: #f1f5f9;
  --tl-bg2: #f8fafc;
  --tl-surface: #ffffff;
  --tl-card-border: #e2e8f0;
  --tl-input-border: #cbd5e1;
  --tl-table-th-bg: #f8fafc;
  --tl-table-hover: #f1f5f9;

  /* Sidebar Tokens - Sleek Deep SaaS Sidebar */
  --tl-side-bg: #0f172a;
  --tl-side-border: #1e293b;
  --tl-side-fg: #94a3b8;
  --tl-side-fg-hover: #ffffff;
  --tl-side-hover: rgba(255, 255, 255, 0.06);
  --tl-side-active-bg: rgba(79, 70, 229, 0.18);
  --tl-side-active-fg: #818cf8;
  --tl-side-head: #64748b;

  /* Dark theme base palette */
  --tl-n1: #090d16;
  --tl-n2: #111827;
  --tl-n3: #1f293d;
  --tl-n4: #374151;
}

/* --- Theme Variants --- */
:root[data-tema="kirnet"] {
  --tl-p1: #dc2626;
  --tl-p2: #ef4444;
  --tl-p1-dk: #b91c1c;
  --tl-p2-dk: #991b1b;
  --tl-tr: 220, 38, 38;
  --tl-a2: #1e293b;
  --tl-a3: #f59e0b;
  --tl-a4: #0284c7;
  --tl-hd: #7f1d1d;
  --tl-lt: #fecaca;
  --tl-d1: #18090b;
  --tl-d2: #2a1114;
  --tl-d3: #3f181c;
  --tl-side-bg: #18090b;
  --tl-side-border: #2e1216;
  --tl-side-active-bg: rgba(220, 38, 38, 0.16);
  --tl-side-active-fg: #f87171;
  --tl-side-head: #8a484e;
  --tl-n1: #0f0708;
  --tl-n2: #190e10;
  --tl-n3: #2d181c;
}

:root[data-tema="okyanus"] {
  --tl-p1: #0284c7;
  --tl-p2: #0ea5e9;
  --tl-p1-dk: #0369a1;
  --tl-p2-dk: #075985;
  --tl-tr: 2, 132, 199;
  --tl-a2: #14b8a6;
  --tl-a3: #f59e0b;
  --tl-a4: #6366f1;
  --tl-hd: #082f49;
  --tl-lt: #bae6fd;
  --tl-d1: #061e2f;
  --tl-d2: #0b2f47;
  --tl-d3: #124363;
  --tl-side-bg: #061e2f;
  --tl-side-border: #0e3752;
  --tl-side-active-bg: rgba(2, 132, 199, 0.18);
  --tl-side-active-fg: #38bdf8;
  --tl-side-head: #577f99;
  --tl-n1: #04121d;
  --tl-n2: #071f2f;
  --tl-n3: #0f3650;
}

:root[data-tema="orman"] {
  --tl-p1: #16a34a;
  --tl-p2: #22c55e;
  --tl-p1-dk: #15803d;
  --tl-p2-dk: #166534;
  --tl-tr: 22, 163, 74;
  --tl-a2: #0d9488;
  --tl-a3: #d97706;
  --tl-a4: #0284c7;
  --tl-hd: #052e16;
  --tl-lt: #bbf7d0;
  --tl-d1: #061f10;
  --tl-d2: #0c331c;
  --tl-d3: #144929;
  --tl-side-bg: #061f10;
  --tl-side-border: #103c21;
  --tl-side-active-bg: rgba(22, 163, 74, 0.18);
  --tl-side-active-fg: #4ade80;
  --tl-side-head: #527c62;
  --tl-n1: #04120a;
  --tl-n2: #092113;
  --tl-n3: #123b23;
}

:root[data-tema="gunbatimi"] {
  --tl-p1: #ea580c;
  --tl-p2: #f97316;
  --tl-p1-dk: #c2410c;
  --tl-p2-dk: #9a3412;
  --tl-tr: 234, 88, 12;
  --tl-a2: #7c3aed;
  --tl-a3: #e11d48;
  --tl-a4: #0284c7;
  --tl-hd: #431407;
  --tl-lt: #fed7aa;
  --tl-d1: #220d06;
  --tl-d2: #38160b;
  --tl-d3: #522212;
  --tl-side-bg: #220d06;
  --tl-side-border: #421b0e;
  --tl-side-active-bg: rgba(234, 88, 12, 0.18);
  --tl-side-active-fg: #fb923c;
  --tl-side-head: #8d5d4d;
  --tl-n1: #150804;
  --tl-n2: #240e07;
  --tl-n3: #3f1a0e;
}

:root[data-tema="grafit"] {
  --tl-p1: #475569;
  --tl-p2: #64748b;
  --tl-p1-dk: #334155;
  --tl-p2-dk: #1e293b;
  --tl-tr: 71, 85, 105;
  --tl-a2: #0d9488;
  --tl-a3: #f59e0b;
  --tl-a4: #0284c7;
  --tl-hd: #0f172a;
  --tl-lt: #cbd5e1;
  --tl-d1: #0b0f17;
  --tl-d2: #131a26;
  --tl-d3: #1f293b;
  --tl-side-bg: #0b0f17;
  --tl-side-border: #1a2233;
  --tl-side-active-bg: rgba(100, 116, 139, 0.2);
  --tl-side-active-fg: #94a3b8;
  --tl-side-head: #576579;
  --tl-n1: #07090e;
  --tl-n2: #0f141f;
  --tl-n3: #1c2436;
}

/* --- Bootstrap Variables Bridge --- */
:root {
  --bs-primary: var(--tl-p1);
  --bs-primary-rgb: var(--tl-tr);
  --bs-info: #0284c7;
  --bs-info-rgb: 2, 132, 199;
  --bs-success: var(--tl-ok);
  --bs-warning: #f59e0b;
  --bs-warning-rgb: 245, 158, 11;
  --bs-danger: #ef4444;
  --bs-danger-rgb: 239, 68, 68;
  --bs-link-color: var(--tl-p1);
  --bs-link-hover-color: var(--tl-p1-dk);
  --bs-border-radius: var(--tl-radius-md);
  --bs-border-radius-lg: var(--tl-radius-lg);
  --bs-border-radius-sm: var(--tl-radius-sm);
  --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-bg: var(--tl-bg2);
}

/* Light Theme Variables */
[data-bs-theme="light"] {
  --bs-body-bg: var(--tl-bg2);
  --bs-tertiary-bg: var(--tl-bg1);
  --bs-card-bg: var(--tl-surface);
  --bs-border-color: var(--tl-card-border);
  --bs-body-color: #1e293b;
  --bs-secondary-color: #64748b;
  --tl-table-th-bg: #f8fafc;
  --tl-table-hover: #f1f5f9;
}
[data-bs-theme="light"] body {
  background-color: var(--tl-bg2);
  color: #1e293b;
}

/* Dark Theme Variables */
[data-bs-theme="dark"] {
  --bs-body-bg: var(--tl-n1);
  --bs-tertiary-bg: var(--tl-n1);
  --bs-secondary-bg: var(--tl-n2);
  --bs-card-bg: var(--tl-n2);
  --bs-border-color: var(--tl-n3);
  --bs-body-color: #f1f5f9;
  --bs-secondary-color: #94a3b8;
  --bs-link-color: var(--tl-lt);
  --bs-link-hover-color: #ffffff;
  --tl-table-th-bg: rgba(255, 255, 255, 0.02);
  --tl-table-hover: rgba(255, 255, 255, 0.04);
}
[data-bs-theme="dark"] body {
  background-color: var(--tl-n1);
  color: #f1f5f9;
}

/* --- 2. Global Resets & Typography --- */
body {
  font-family: var(--bs-body-font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 0.925rem;
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--bs-body-color);
}

h1.h4 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-left: 0;
  border-left: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

code, pre, .font-monospace {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85em;
}

/* --- 3. Topbar & Brand --- */
.topbar {
  height: var(--top-h);
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--tl-side-border) !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  z-index: 1030;
}

.topbar .navbar-brand {
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.2rem;
  color: #ffffff !important;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: opacity 0.15s ease;
}
.topbar .navbar-brand:hover {
  opacity: 0.9;
}
.topbar .navbar-brand img {
  width: auto;
}
.topbar .navbar-brand span {
  color: var(--tl-p2) !important;
}

/* Topbar Buttons & Dropdowns */
.topbar .btn-outline-light {
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  transition: all 0.15s ease;
}
.topbar .btn-outline-light:hover,
.topbar .btn-outline-light:focus,
.topbar .btn-outline-light[aria-expanded="true"] {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.topbar .user-pill {
  padding: 0.35rem 0.75rem 0.35rem 0.4rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.topbar .user-pill .badge {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.notif-menu {
  width: 380px;
  max-width: 92vw;
  max-height: 75vh;
  overflow-y: auto;
  border-radius: var(--tl-radius-lg);
  box-shadow: var(--tl-shadow-xl);
}

/* --- 4. Sidebar Navigation --- */
.sidebar {
  flex: 0 0 var(--side-w);
  width: var(--side-w);
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-x: hidden;
  overflow-y: auto;
  transition: flex-basis 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--tl-side-bg) !important;
  border-right: 1px solid var(--tl-side-border) !important;
  z-index: 1020;
}
.sidebar > nav {
  width: var(--side-w);
  padding: 0.75rem 0.65rem 2rem;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.nav-collapsed .sidebar {
  flex-basis: 0;
  width: 0;
  overflow: hidden;
}

.sidebar .nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tl-side-head) !important;
  padding: 1.1rem 0.85rem 0.35rem;
  user-select: none;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 2px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--tl-side-fg) !important;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar .nav-link svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.sidebar .nav-link:hover {
  background: var(--tl-side-hover) !important;
  color: var(--tl-side-fg-hover) !important;
}
.sidebar .nav-link:hover svg {
  opacity: 1;
}

.sidebar .nav-link.active {
  background: var(--tl-side-active-bg) !important;
  color: var(--tl-side-active-fg) !important;
  border-color: rgba(var(--tl-tr), 0.3);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(var(--tl-tr), 0.2);
}
.sidebar .nav-link.active svg {
  opacity: 1;
  stroke: var(--tl-side-active-fg);
}

@media (max-width: 800px) {
  .sidebar {
    position: fixed;
    top: var(--top-h);
    bottom: 0;
    left: 0;
    z-index: 1040;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    transform: translateX(0);
  }
  .nav-collapsed .sidebar {
    transform: translateX(-100%);
    width: var(--side-w);
    flex-basis: var(--side-w);
  }
}

/* --- 5. Content Layout --- */
.content {
  min-width: 0;
  padding: 1.75rem !important;
}

@media (max-width: 576px) {
  .content {
    padding: 1rem !important;
  }
}

/* --- 6. Modern Cards & Surfaces --- */
.card {
  background-color: var(--bs-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--tl-radius-lg);
  box-shadow: var(--tl-shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: visible;
}
.card > .card-header:first-child {
  border-top-left-radius: calc(var(--tl-radius-lg) - 1px);
  border-top-right-radius: calc(var(--tl-radius-lg) - 1px);
}
.card > .card-footer:last-child {
  border-bottom-left-radius: calc(var(--tl-radius-lg) - 1px);
  border-bottom-right-radius: calc(var(--tl-radius-lg) - 1px);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--bs-border-color);
  padding: 1rem 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 1.25rem;
}

.modal .card, .dropdown-menu .card {
  box-shadow: none;
  border: 1px solid var(--bs-border-color);
}

/* Modern Stat Widget Cards */
.stat-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.stat-card .stat-val {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 0.825rem;
  color: var(--bs-secondary-color);
  font-weight: 500;
  margin-top: 0.25rem;
}
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-primary { background: rgba(var(--tl-tr), 0.1); color: var(--tl-p1); }
.stat-icon-success { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.stat-icon-info { background: rgba(2, 132, 199, 0.1); color: #0284c7; }
.stat-icon-warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

/* --- 7. Modern Buttons --- */
.btn {
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 8px;
  padding: 0.5rem 0.95rem;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.15s ease-in-out;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.32rem 0.65rem;
  border-radius: 6px;
}

.btn-lg {
  font-size: 1rem;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
}

.btn-primary {
  background-color: var(--tl-p1) !important;
  border-color: var(--tl-p1) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 2px 0 rgba(var(--tl-tr), 0.35);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--tl-p1-dk) !important;
  border-color: var(--tl-p1-dk) !important;
  box-shadow: 0 4px 12px -2px rgba(var(--tl-tr), 0.45);
}

.btn-outline-primary {
  color: var(--tl-p1) !important;
  border-color: rgba(var(--tl-tr), 0.4) !important;
  background: transparent;
}
.btn-outline-primary:hover, .btn-outline-primary:focus {
  color: #ffffff !important;
  background-color: var(--tl-p1) !important;
  border-color: var(--tl-p1) !important;
}

.btn-outline-secondary {
  border-color: var(--bs-border-color);
  color: var(--bs-secondary-color);
}
.btn-outline-secondary:hover {
  background-color: var(--tl-table-hover);
  color: var(--bs-body-color);
  border-color: var(--bs-secondary-color);
}

.btn-outline-info {
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.4) !important;
}
.btn-outline-info:hover {
  background-color: #0284c7 !important;
  color: #ffffff !important;
}

.btn-outline-success {
  color: var(--tl-ok) !important;
  border-color: rgba(var(--tl-ok-rgb), 0.4) !important;
}
.btn-outline-success:hover {
  background-color: var(--tl-ok) !important;
  color: #ffffff !important;
}

.btn-outline-warning {
  color: #d97706 !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}
.btn-outline-warning:hover {
  background-color: #f59e0b !important;
  color: #ffffff !important;
}

.btn-outline-danger {
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}
.btn-outline-danger:hover {
  background-color: #ef4444 !important;
  color: #ffffff !important;
}

/* --- 8. Forms & Inputs --- */
.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--bs-body-color);
}

.form-control {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  font-size: 0.875rem;
  padding: 0.55rem 0.85rem;
  background-color: var(--bs-card-bg);
  color: var(--bs-body-color);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-select {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  font-size: 0.875rem;
  padding: 0.55rem 2.25rem 0.55rem 0.85rem;
  background-color: var(--bs-card-bg);
  color: var(--bs-body-color);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-select-sm {
  padding-top: 0.28rem;
  padding-bottom: 0.28rem;
  padding-left: 0.65rem;
  padding-right: 2.25rem !important;
  font-size: 0.825rem;
  border-radius: 6px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--tl-p1) !important;
  box-shadow: 0 0 0 3px rgba(var(--tl-tr), 0.18) !important;
  outline: 0;
}

.form-control:disabled, .form-control[readonly] {
  background-color: var(--tl-table-th-bg);
  opacity: 0.75;
}

.form-text {
  font-size: 0.775rem;
  color: var(--bs-secondary-color);
  margin-top: 0.35rem;
}

.input-group-text {
  background-color: var(--tl-table-th-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
  border-radius: 8px;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

/* Seamless Input Groups (Prefix / Suffix Icons Unified Focus) */
.input-group-seamless,
.input-group:has(.input-group-text) {
  border-radius: 8px;
  transition: box-shadow 0.15s ease-in-out;
}

.input-group-seamless:focus-within,
.input-group:has(.input-group-text):focus-within {
  box-shadow: 0 0 0 3px rgba(var(--tl-tr), 0.18);
  border-radius: 8px;
}

.input-group-seamless:focus-within .input-group-text,
.input-group:has(.input-group-text):focus-within .input-group-text,
.input-group-seamless:focus-within .form-control,
.input-group:has(.input-group-text):focus-within .form-control {
  border-color: var(--tl-p1) !important;
}

.input-group-seamless:focus-within .input-group-text,
.input-group:has(.input-group-text):focus-within .input-group-text {
  background-color: var(--bs-card-bg) !important;
}

.input-group-seamless .form-control:focus,
.input-group:has(.input-group-text) .form-control:focus {
  box-shadow: none !important;
  border-color: var(--tl-p1) !important;
}

.input-group-seamless:focus-within .input-group-text svg,
.input-group:has(.input-group-text):focus-within .input-group-text svg {
  color: var(--tl-p1) !important;
  stroke: var(--tl-p1) !important;
}

.form-check-input {
  border-color: var(--bs-border-color);
  cursor: pointer;
}
.form-check-input:checked {
  background-color: var(--tl-p1) !important;
  border-color: var(--tl-p1) !important;
}
.form-check-input:focus {
  border-color: var(--tl-p1);
  box-shadow: 0 0 0 3px rgba(var(--tl-tr), 0.18);
}
.form-switch .form-check-input {
  width: 2.25em;
  height: 1.25em;
  border-radius: 2em;
}

/* --- 9. Tables & DataTables --- */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--bs-body-color);
  margin-bottom: 0;
  font-size: 0.875rem;
}

.table > thead {
  background-color: var(--tl-table-th-bg) !important;
}

.table > thead th {
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary-color) !important;
  border-bottom: 1px solid var(--bs-border-color) !important;
  padding: 0.75rem 1rem;
  white-space: nowrap;
}

.table > tbody > tr > td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
  vertical-align: middle;
}

.table-hover > tbody > tr:hover > * {
  background-color: var(--tl-table-hover) !important;
}

/* DataTables 2 & DataTables 1 Overrides */
div.dt-container,
div.dataTables_wrapper {
  padding: 0;
  position: relative;
}

div.dt-container .row,
div.dataTables_wrapper .row {
  margin-left: 0;
  margin-right: 0;
  padding: 0.65rem 0.85rem;
}

div.dt-container div.dt-length,
div.dataTables_wrapper div.dataTables_length {
  display: inline-flex;
  align-items: center;
}

div.dt-container div.dt-length label,
div.dataTables_wrapper div.dataTables_length label {
  font-size: 0.825rem;
  color: var(--bs-secondary-color);
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

div.dt-container div.dt-length select.form-select,
div.dt-container div.dt-length select,
div.dataTables_wrapper div.dataTables_length select {
  width: auto !important;
  min-width: 4.85rem !important;
  padding: 0.28rem 2.25rem 0.28rem 0.75rem !important;
  font-size: 0.825rem;
  line-height: 1.4;
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  background-color: var(--bs-card-bg);
  background-position: right 0.65rem center !important;
  background-size: 14px 10px !important;
  color: var(--bs-body-color);
  cursor: pointer;
  margin: 0 0.35rem;
}

div.dt-container div.dt-search,
div.dataTables_wrapper div.dataTables_filter {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

div.dt-container div.dt-search label,
div.dataTables_wrapper div.dataTables_filter label {
  font-size: 0.825rem;
  color: var(--bs-secondary-color);
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

div.dt-container div.dt-search input.form-control,
div.dt-container div.dt-search input,
div.dataTables_wrapper div.dataTables_filter input {
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  padding: 0.32rem 0.75rem;
  font-size: 0.825rem;
  margin-left: 0.5rem;
  background-color: var(--bs-card-bg);
  color: var(--bs-body-color);
  width: auto;
  display: inline-block;
}

div.dt-container div.dt-search input:focus,
div.dt-container div.dt-length select:focus,
div.dataTables_wrapper div.dataTables_filter input:focus,
div.dataTables_wrapper div.dataTables_length select:focus {
  border-color: var(--tl-p1) !important;
  box-shadow: 0 0 0 3px rgba(var(--tl-tr), 0.15) !important;
  outline: 0;
}

div.dt-container div.dt-info,
div.dataTables_wrapper div.dataTables_info {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
  padding: 0.5rem 0;
  margin: 0;
}

div.dt-container div.dt-paging,
div.dataTables_wrapper div.dataTables_paginate {
  padding: 0.5rem 0;
  margin: 0;
}

/* Pagination container & buttons */
div.dt-container div.dt-paging ul.pagination,
div.dataTables_wrapper ul.pagination {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}

div.dt-container div.dt-paging .pagination .page-item,
div.dataTables_wrapper .pagination .page-item {
  display: inline-block;
  margin: 0;
}

div.dt-container div.dt-paging .pagination .page-link,
div.dataTables_wrapper .pagination .page-link,
.dt-paging-button .page-link,
.page-item .page-link {
  border-radius: 6px !important;
  padding: 0.32rem 0.75rem;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  background-color: var(--bs-card-bg);
  background-image: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  line-height: 1;
  text-decoration: none;
  box-shadow: none;
  transition: all 0.15s ease;
  user-select: none;
}

/* Strip any pseudo element arrow on pagination buttons */
div.dt-container div.dt-paging .pagination .page-link::before,
div.dt-container div.dt-paging .pagination .page-link::after,
div.dataTables_wrapper .pagination .page-link::before,
div.dataTables_wrapper .pagination .page-link::after,
.dt-paging-button .page-link::before,
.dt-paging-button .page-link::after,
.dt-paging-button::before,
.dt-paging-button::after,
.page-item .page-link::before,
.page-item .page-link::after {
  display: none !important;
  content: none !important;
}

div.dt-container div.dt-paging .pagination .page-item:not(.active):not(.disabled) .page-link:hover,
div.dataTables_wrapper .pagination .page-item:not(.active):not(.disabled) .page-link:hover,
.page-item:not(.active):not(.disabled) .page-link:hover {
  background-color: var(--tl-table-hover);
  border-color: var(--bs-border-color);
  color: var(--tl-p1);
}

div.dt-container div.dt-paging .pagination .page-item.active .page-link,
div.dataTables_wrapper .pagination .page-item.active .page-link,
.page-item.active .page-link {
  background-color: var(--tl-p1) !important;
  border-color: var(--tl-p1) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(var(--tl-tr), 0.35);
}

div.dt-container div.dt-paging .pagination .page-item.disabled .page-link,
div.dataTables_wrapper .pagination .page-item.disabled .page-link,
.page-item.disabled .page-link {
  opacity: 0.45;
  background-color: transparent;
  border-color: var(--bs-border-color);
  color: var(--bs-secondary-color);
  cursor: not-allowed;
  pointer-events: none;
}

/* User management dropdown & avatar styles */
.user-avatar-badge {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.775rem;
  font-weight: 600;
  flex-shrink: 0;
}

.user-dropdown-form {
  min-width: 290px;
  max-width: 320px;
  z-index: 1060 !important;
  border-radius: var(--tl-radius) !important;
  box-shadow: var(--tl-shadow-lg) !important;
}

.table-dropdown-container {
  overflow: visible !important;
  position: relative;
}

.user-management-card {
  overflow: visible !important;
}

/* Common code and modal helpers without inline styles */
.code-preview-140 { max-height: 140px; overflow-y: auto; }
.code-preview-250 { max-height: 250px; overflow-y: auto; }
.code-preview-400 { max-height: 400px; overflow-y: auto; }
.spinner-12 { width: 12px; height: 12px; }
.profile-avatar-badge {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sms-verify-input {
  letter-spacing: 0.35em;
  font-size: 1.5rem;
}
.select-multi-devices { min-height: 140px; }
.th-w-90 { width: 90px; }
.th-w-100 { width: 100px; }
.th-w-140 { width: 140px; }
.th-w-150 { width: 150px; }
.pct-badge { min-width: 32px; display: inline-block; }

/* --- 10. Badges & Status Indicators --- */
.badge {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.32em 0.65em;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.text-bg-primary {
  background-color: rgba(var(--tl-tr), 0.15) !important;
  color: var(--tl-p1) !important;
  border: 1px solid rgba(var(--tl-tr), 0.3);
}

.text-bg-success {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #059669 !important;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
[data-bs-theme="dark"] .text-bg-success {
  color: #34d399 !important;
}

.text-bg-warning {
  background-color: rgba(245, 158, 11, 0.15) !important;
  color: #d97706 !important;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
[data-bs-theme="dark"] .text-bg-warning {
  color: #fbbf24 !important;
}

.text-bg-danger {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
[data-bs-theme="dark"] .text-bg-danger {
  color: #f87171 !important;
}

.text-bg-secondary {
  background-color: rgba(100, 116, 139, 0.15) !important;
  color: #475569 !important;
  border: 1px solid rgba(100, 116, 139, 0.3);
}
[data-bs-theme="dark"] .text-bg-secondary {
  color: #94a3b8 !important;
}

/* --- 11. Tabs, Navs & Breadcrumbs --- */
.nav-tabs {
  border-bottom: 1px solid var(--bs-border-color);
  gap: 0.25rem;
}
.nav-tabs .nav-link {
  color: var(--bs-secondary-color);
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.65rem 1rem;
  background: transparent;
  border-radius: 0;
  transition: all 0.15s ease;
}
.nav-tabs .nav-link:hover {
  color: var(--bs-body-color);
  border-bottom-color: var(--bs-border-color);
}
.nav-tabs .nav-link.active {
  color: var(--tl-p1) !important;
  border-bottom: 2px solid var(--tl-p1) !important;
  background: transparent !important;
  font-weight: 600;
}

.nav-pills .nav-link {
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
  padding: 0.5rem 0.85rem;
}
.nav-pills .nav-link.active {
  background-color: var(--tl-p1) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(var(--tl-tr), 0.3);
}

/* --- 12. Modals & Dialogs --- */
.modal-backdrop {
  --bs-backdrop-bg: #090d16;
  --bs-backdrop-opacity: 0.6;
}
.modal-content {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--tl-radius-lg);
  box-shadow: var(--tl-shadow-xl);
  background-color: var(--bs-card-bg);
  overflow: hidden;
}
.modal-header {
  border-bottom: 1px solid var(--bs-border-color);
  padding: 1.15rem 1.4rem;
}
.modal-header .modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}
.modal-body {
  padding: 1.4rem;
}
.modal-footer {
  border-top: 1px solid var(--bs-border-color);
  padding: 1rem 1.4rem;
  background-color: var(--tl-table-th-bg);
}

/* Dropdown Menus */
.dropdown-menu {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--tl-radius-md);
  box-shadow: var(--tl-shadow-lg);
  background-color: var(--bs-card-bg);
  padding: 0.4rem;
  font-size: 0.875rem;
  z-index: 1060;
}
.dropdown-item {
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  color: var(--bs-body-color);
  transition: background 0.15s ease, color 0.15s ease;
}
.dropdown-item:hover, .dropdown-item:focus {
  background-color: var(--tl-table-hover);
  color: var(--tl-p1);
}
.dropdown-item:active {
  background-color: var(--tl-p1);
  color: #ffffff;
}
.dropdown-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary-color);
  padding: 0.5rem 0.75rem 0.25rem;
}
.dropdown-divider {
  border-color: var(--bs-border-color);
  margin: 0.35rem 0;
}

/* --- 13. Alerts & Toasts --- */
.alert {
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: var(--tl-radius-md);
  padding: 0.85rem 1.15rem;
  font-size: 0.875rem;
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  border-left-color: #10b981;
  color: #065f46;
}
[data-bs-theme="dark"] .alert-success {
  color: #6ee7b7;
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  border-left-color: #ef4444;
  color: #991b1b;
}
[data-bs-theme="dark"] .alert-danger {
  color: #fca5a5;
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
  border-left-color: #f59e0b;
  color: #92400e;
}
[data-bs-theme="dark"] .alert-warning {
  color: #fde68a;
}

.alert-info {
  background-color: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.25);
  border-left-color: #0284c7;
  color: #075985;
}
[data-bs-theme="dark"] .alert-info {
  color: #7dd3fc;
}

.alert-secondary {
  background-color: rgba(100, 116, 139, 0.1);
  border-color: rgba(100, 116, 139, 0.25);
  border-left-color: #64748b;
  color: var(--bs-body-color);
}

/* Toast */
.toast {
  border-radius: var(--tl-radius-md);
  box-shadow: var(--tl-shadow-lg);
  font-size: 0.875rem;
}

/* --- 14. Meters & Progress Bars --- */
meter {
  -webkit-appearance: none;
  appearance: none;
  height: 9px;
  border-radius: 9999px;
  background: var(--tl-table-th-bg);
  border: 1px solid var(--bs-border-color);
  overflow: hidden;
  display: block;
}
meter::-webkit-meter-bar {
  background: var(--tl-table-th-bg);
  border: none;
  border-radius: 9999px;
}
meter::-webkit-meter-optimum-value {
  background: #10b981;
  border-radius: 9999px;
  transition: width 0.3s ease;
}
meter::-webkit-meter-suboptimum-value {
  background: #f59e0b;
  border-radius: 9999px;
  transition: width 0.3s ease;
}
meter::-webkit-meter-even-less-good-value {
  background: #ef4444;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

progress {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 9999px;
  background: var(--tl-table-th-bg);
  border: 1px solid var(--bs-border-color);
  overflow: hidden;
  display: block;
}
progress::-webkit-progress-bar {
  background: var(--tl-table-th-bg);
  border-radius: 9999px;
}
progress::-webkit-progress-value {
  background: var(--tl-p1);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* --- 15. Authentication Screens (Login & Verify) --- */
body:not(:has(.sidebar)) {
  background: radial-gradient(circle at 10% 20%, rgba(var(--tl-tr), 0.12) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(var(--tl-tr), 0.08) 0%, transparent 40%),
              var(--bs-body-bg) fixed !important;
}

body:not(:has(.sidebar)) .card {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--tl-radius-xl);
  box-shadow: var(--tl-shadow-xl);
}

/* --- 16. Theme & Mode Selectors (Profile Page) --- */
.tema-sec {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}
.tema-sec .tema {
  width: 125px;
  padding: 0.6rem;
  border: 2px solid var(--bs-border-color);
  border-radius: var(--tl-radius-md);
  background: var(--bs-card-bg);
  color: var(--bs-body-color);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.tema-sec .tema:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--tl-tr), 0.5);
}
.tema-sec .tema[aria-pressed="true"] {
  border-color: var(--tl-p1);
  box-shadow: 0 0 0 3px rgba(var(--tl-tr), 0.25);
}
.tema-sec .renk {
  display: block;
  height: 38px;
  border-radius: 6px;
  margin-bottom: 0.45rem;
}

.tema-sec [data-tema-ad="indigo"] .renk {
  background: linear-gradient(135deg, #1e1b4b 0 40%, #4f46e5 40% 70%, #6366f1 70%);
}
.tema-sec [data-tema-ad="kirnet"] .renk {
  background: linear-gradient(135deg, #18090b 0 35%, #dc2626 35% 70%, #ef4444 70%);
}
.tema-sec [data-tema-ad="okyanus"] .renk {
  background: linear-gradient(135deg, #061e2f 0 40%, #0284c7 40% 70%, #0ea5e9 70%);
}
.tema-sec [data-tema-ad="orman"] .renk {
  background: linear-gradient(135deg, #061f10 0 40%, #16a34a 40% 70%, #22c55e 70%);
}
.tema-sec [data-tema-ad="gunbatimi"] .renk {
  background: linear-gradient(135deg, #220d06 0 40%, #ea580c 40% 70%, #f97316 70%);
}
.tema-sec [data-tema-ad="grafit"] .renk {
  background: linear-gradient(135deg, #0b0f17 0 40%, #475569 40% 70%, #64748b 70%);
}

.mod-sec {
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
}
.mod-sec .btn {
  border-radius: 0;
}

/* --- 17. Live Streaming Syslog Box --- */
.live-box {
  max-height: 65vh;
  overflow-y: auto;
  background-color: var(--bs-card-bg);
  border-radius: var(--tl-radius-md);
}

.live-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- 18. Micro-details & Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
