@font-face {
  font-family: 'Vazir';
  src: url('/static/fonts/Vazir.woff') format('woff');
  font-weight: 400;
  font-style: normal;
}

/* =========================
   Theme Tokens
========================= */
:root {
  --bg: #0a1128;
  --bg-2: #101c3a;
  --panel: #0f172a;
  --panel-2: #111c34;
  --surface: rgba(15, 23, 42, 0.76);
  --surface-strong: rgba(15, 23, 42, 0.92);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --card-grad: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  --border: rgba(148, 163, 184, 0.18);
  --border-soft: rgba(148, 163, 184, 0.10);
  --muted: #94a3b8;
  --text: #f8fafc;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 18px;
  --radius-lg: 21px;
  --gap: 16px;
  --shadow-sm: 0 5px 16px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.26);
  --shadow-lg: 0 20px 53px rgba(0, 0, 0, 0.38);
  --shadow-xl: 0 25px 71px rgba(2, 6, 23, 0.42);

  font-family: "Vazir", system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  font-size: 12px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #edf2f7;
  --bg-2: #dde6f1;
  --panel: #ffffff;
  --panel-2: #eef4fb;
  --surface: rgba(255, 255, 255, 0.80);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(37, 99, 235, 0.04);
  --card-grad: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 252, 0.98));
  --border: rgba(15, 23, 42, 0.14);
  --border-soft: rgba(15, 23, 42, 0.10);
  --muted: #64748b;
  --text: #0f172a;
  --accent: #1d4ed8;
  --accent-2: #2563eb;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 7px 16px rgba(15, 23, 42, 0.07);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 21px 53px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 27px 71px rgba(15, 23, 42, 0.14);

  color-scheme: light;
}

/* =========================
   Base
========================= */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 85% 10%, rgba(59, 130, 246, 0.16), transparent 34%),
    radial-gradient(circle at 12% 18%, rgba(96, 165, 250, 0.10), transparent 26%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

body {
  color: var(--text);
  overflow-x: hidden;
  background: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 85% 8%, rgba(96, 165, 250, 0.18), transparent 24%),
    radial-gradient(circle at 12% 18%, rgba(59, 130, 246, 0.16), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(34, 197, 94, 0.06), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-repeat: no-repeat;
}

/* نوار محافظ بالای صفحه: هیچ آیتمی حق نداره از این نوار بالاتر بره،
   همون گرادیانت بکگراند صفحه رو عیناً (بدون پرش رنگی) نشون میده */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  z-index: 5000;
  pointer-events: none;
  background:
    radial-gradient(circle at 85% 8%, rgba(96, 165, 250, 0.18), transparent 24%),
    radial-gradient(circle at 12% 18%, rgba(59, 130, 246, 0.16), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(34, 197, 94, 0.06), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-size: 100vw 100vh;
  background-position: 0 0;
  background-repeat: no-repeat;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font: inherit;
}

.kv {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.small {
  font-size: 11px;
  color: var(--muted);
}

:focus-visible {
  outline: 1.78px solid rgba(59, 130, 246, 0.55);
  outline-offset: 2.67px;
  border-radius: 11px;
}

:root[data-theme="light"] :focus-visible {
  outline: 2.67px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2.67px;
}

/* =========================
   Layout
========================= */
.app {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 267px minmax(0, 1fr);
  gap: 16px;
  min-height: 100vh;
  padding: 11px;
  overflow: visible !important;
  transition: grid-template-columns .26s ease;
}

body.sidebar-collapsed .app,
html.sidebar-collapsed-preload body .app {
  grid-template-columns: 85px minmax(0, 1fr);
}

.main {
  min-width: 0;
  padding: 0px 3.56px 0px 21px;
  overflow: visible !important;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
}

.col-12 { grid-column: span 12; }
.col-9  { grid-column: span 9; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  z-index: 1990;
}

/* =========================
   Sidebar
========================= */
.sidebar {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  max-height: 1335px;
  min-width: 0;
  z-index: 100;
  padding: 14px;
  overflow: auto;
  border-radius: 25px;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  transition: padding .25s ease, width .25s ease;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: linear-gradient(180deg, rgba(8, 15, 30, 0.94) 0%, rgba(8, 15, 30, 0.84) 60%, rgba(8, 15, 30, 0.76) 100%);
  box-shadow: 0 16px 39px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 26%), radial-gradient(circle at bottom right, rgba(96, 165, 250, 0.10), transparent 24%);
}

:root[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(240, 245, 251, 0.96) 100%);
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

/* =========================
   Brand
========================= */
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  transition: transform .20s ease, border-color .20s ease, background .20s ease, padding .22s ease;
}

body.sidebar-collapsed .brand,
html.sidebar-collapsed-preload body .brand {
  padding: 9px;
  justify-content: center;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.brand-main {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  overflow: hidden;
}

.brand-copy {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  transition: opacity .18s ease, max-width .22s ease, transform .18s ease;
}

.brand .title,
.brand .small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .title {
  font-weight: 900;
  font-size: 16px;
  line-height: 1.3;
}

.brand .small {
  margin-top: 3.56px;
  font-size: 11px;
}

.logo {
  flex: 0 0 auto;
}

.logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  transition: width .22s ease, height .22s ease, opacity .18s ease;
}

.brand:hover {
  transform: translateY(-1px);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
}

/* =========================
   Sidebar Navigation
========================= */
.nav {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 22px;
}

.nav a,
.nav button.theme-toggle {
  position: relative;
  min-height: 43px;
  padding: 0 12px;
  border-radius: 14px;
  color: var(--text); /* تغییر یافت: رنگ پیشفرض لینکها روشن شد */
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease, width .22s ease, height .22s ease, padding .22s ease, border-radius .22s ease;
}

.nav a#navResultLink {
  color: var(--muted);
  opacity: 0.6;
  pointer-events: none;
}

.nav a:not(#navResultLink):hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--border-soft);
  transform: translateY(-1px);
}

.nav a.active {
  background: rgba(96, 165, 250, 0.08);
  color: var(--text) !important;
  opacity: 1 !important;
  font-weight: 700;
  border-color: rgba(59, 130, 246, 0.22);
  box-shadow: 0 9px 21px rgba(96, 165, 250, 0.10);
}

.nav a.active::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  right: 5px;
  width: 2.67px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

/* تم روشن ناوبری */
:root[data-theme="light"] .nav a:not(#navResultLink) {
  color: var(--text);
  font-weight: 700;
}

:root[data-theme="light"] .nav a:not(#navResultLink):hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
  border-color: rgba(37, 99, 235, 0.14);
}

:root[data-theme="light"] .nav a.active {
  background: linear-gradient(90deg, rgba(29, 78, 216, 0.16), rgba(37, 99, 235, 0.10));
  color: var(--text) !important;
  border-color: rgba(29, 78, 216, 0.24);
  box-shadow: 0 9px 21px rgba(37, 99, 235, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

/* پررنگ نگه داشتن متن و آیکون در حالت سایدبار جمع‌شده */
body.sidebar-collapsed .nav a:not(#navResultLink) {
  opacity: 1 !important;
}
body.sidebar-collapsed .nav a:not(#navResultLink) span {
  color: var(--text) !important;
}

/* =========================
   Cards
========================= */
.card {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  min-width: 0;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.18);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 252, 0.98));
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 11px 25px rgba(15, 23, 42, 0.08), 0 2.67px 9px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

:root[data-theme="light"] .card:hover {
  border-color: rgba(37, 99, 235, 0.20);
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.10), 0 5px 14px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

/* =========================
   Premium Dashboard Topbar
========================= */
.topbar {
  position: relative;
}
.dashboard-topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  min-height: 75px;
  display: grid;
  grid-template-columns: auto minmax(231px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 21px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: linear-gradient(180deg, rgba(8, 15, 30, 0.94) 0%, rgba(8, 15, 30, 0.84) 60%, rgba(8, 15, 30, 0.76) 100%);
  box-shadow: 0 16px 39px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}


.dashboard-topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.14), transparent 26%), radial-gradient(circle at bottom left, rgba(96, 165, 250, 0.10), transparent 24%);
}

:root[data-theme="light"] .dashboard-topbar {
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(240, 245, 251, 0.96) 100%);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.topbar-section {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.topbar-right  { justify-content: flex-start; }
.topbar-center { justify-content: center; position: static; z-index: auto; }
.topbar-left   { justify-content: flex-end; }

/* =========================
   Page Title Block
========================= */
.topbar-page {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2.67px;
}

.topbar-page-title {
  font-size: 18px;
  font-weight: 950;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 0px;
}

.topbar-page-subtitle {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================
   Search
========================= */
.topbar-search {
  width: min(100%, 409px);
  height: 43px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.topbar-search:focus-within {
  border-color: rgba(59, 130, 246, 0.24);
  box-shadow: 0 0 0 3.56px rgba(59, 130, 246, 0.10);
  background: rgba(255, 255, 255, 0.06);
}

.topbar-search-icon {
  color: var(--muted);
  flex: 0 0 auto;
}

.topbar-search input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.topbar-search input::placeholder {
  color: var(--muted);
}

:root[data-theme="light"] .topbar-search {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* =========================
   Status / Actions
========================= */
.topbar-status-pill {
  min-height: 36px;
  padding: 0 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.18);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.topbar-icon-btn {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.topbar-icon-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(59, 130, 246, 0.18);
  box-shadow: 0 11px 21px rgba(0, 0, 0, 0.16);
}

:root[data-theme="light"] .topbar-icon-btn {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.04);
}

/* =========================
   User / Login
========================= */
.topbar-user {
  min-width: 0;
  max-width: 214px;
  min-height: 43px;
  padding: 5px 7px 5px 9px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.topbar-user:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.18);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 11px 21px rgba(0, 0, 0, 0.16);
}

.topbar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 9px 18px rgba(96, 165, 250, 0.20);
}

.topbar-user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.78px;
}

.topbar-user-name {
  font-size: 12px;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-role {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-login-btn {
  min-height: 41px;
  padding: 0 14px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 25px rgba(96, 165, 250, 0.22);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.topbar-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(96, 165, 250, 0.28);
}

/* =========================
   Scroll State
========================= */
body.scrolled .dashboard-topbar {
  background: linear-gradient(180deg, rgba(8, 15, 30, 0.98) 0%, rgba(8, 15, 30, 0.90) 64%, rgba(8, 15, 30, 0.84) 100%);
}

:root[data-theme="light"] body.scrolled .dashboard-topbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 246, 252, 0.98) 100%);
}

/* =========================
   Theme Toggle / Hamburger
========================= */
.theme-toggle {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-height: 46px;
  padding: 0 11px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  user-select: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .18s ease;
}

.theme-toggle:hover {
  border-color: rgba(59, 130, 246, 0.42);
  box-shadow: 0 0 0 2.67px rgba(59, 130, 246, 0.10);
  transform: translateY(-1px);
}

.theme-toggle .label {
  font-weight: 900;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 7px;
  opacity: .95;
}

.theme-toggle .pill {
  width: 41px;
  height: 23px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  position: relative;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.theme-toggle .dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 2.67px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: right .2s ease, left .2s ease, background .2s ease;
}

:root[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(15, 23, 42, 0.10);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

:root[data-theme="light"] .theme-toggle:hover {
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 9px 18px rgba(37, 99, 235, 0.10), 0 0 0 2.67px rgba(37, 99, 235, 0.08);
}

:root[data-theme="light"] .theme-toggle .label {
  color: #334155;
}

:root[data-theme="light"] .theme-toggle .pill {
  background: rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .theme-toggle .dot {
  right: auto;
  left: 2.67px;
  background: linear-gradient(90deg, #ffb020, #ffd36a);
}

.hamburger {
  display: none;
  width: 39px;
  height: 39px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.hamburger:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.30);
}

.hamburger span {
  display: block;
  width: 18px;
  height: 1.78px;
  background: var(--text);
  border-radius: 1.78px;
}

/* =========================
   Sidebar Footer
========================= */
.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.sidebar-footer-copy {
  color: var(--muted);
  font-size: 11px;
  line-height: 2;
}

.sidebar-brand-link {
  color: var(--text);
  font-weight: 900;
  transition: opacity .2s ease, color .2s ease;
}

.sidebar-brand-link:hover {
  opacity: .9;
  color: var(--accent-2);
}

.sidebar-host {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  color: var(--text);
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease, width .22s ease, height .22s ease, padding .22s ease;
}

.sidebar-host:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 9px 21px rgba(0, 0, 0, 0.18);
}

.sidebar-host-label {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.sidebar-host-name {
  font-weight: 900;
  white-space: nowrap;
}

.sidebar-host img {
  margin-inline-start: auto;
  height: 14px;
  width: auto;
  object-fit: contain;
  opacity: .95;
}

:root[data-theme="light"] .sidebar-footer {
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .sidebar-footer-copy {
  color: #64748b;
}

:root[data-theme="light"] .sidebar-host {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .sidebar-host:hover {
  border-color: rgba(37, 99, 235, 0.18);
  box-shadow: 0 12px 25px rgba(37, 99, 235, 0.08);
}

/* =========================
   Sidebar Collapse Button
========================= */
.sidebar-collapse-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.sidebar-collapse-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(59, 130, 246, 0.18);
  box-shadow: 0 9px 20px rgba(0, 0, 0, 0.16);
}

:root[data-theme="light"] .sidebar-collapse-btn {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(15, 23, 42, 0.08);
}

/* =========================
   Collapsed Sidebar State
========================= */
body.sidebar-collapsed .sidebar,
html.sidebar-collapsed-preload body .sidebar {
  padding: 14px 9px;
}

body.sidebar-collapsed .brand,
html.sidebar-collapsed-preload body .brand {
  padding: 9px;
  justify-content: center;
}

body.sidebar-collapsed .brand-main,
html.sidebar-collapsed-preload body .brand-main {
  width: 0;
  min-width: 0;
  flex: 0 0 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

body.sidebar-collapsed .brand-copy,
html.sidebar-collapsed-preload body .brand-copy {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateX(-8px);
}

body.sidebar-collapsed .logo,
html.sidebar-collapsed-preload body .logo {
  opacity: 0;
  pointer-events: none;
}

body.sidebar-collapsed .logo-img,
html.sidebar-collapsed-preload body .logo-img {
  width: 0;
  height: 0;
  opacity: 0;
}

body.sidebar-collapsed .sidebar-collapse-btn,
html.sidebar-collapsed-preload body .sidebar-collapse-btn {
  width: 43px;
  height: 43px;
  min-width: 43px;
  min-height: 43px;
  border-radius: 14px;
  margin: 0 auto;
}

.sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

body.sidebar-collapsed .nav a,
body.sidebar-collapsed .nav button.theme-toggle,
html.sidebar-collapsed-preload body .nav a,
html.sidebar-collapsed-preload body .nav button.theme-toggle {
  width: 43px;
  height: 43px;
  min-height: 43px;
  padding: 0;
  border-radius: 14px;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin-inline: auto;
}

body.sidebar-collapsed .nav a span,
body.sidebar-collapsed .nav button.theme-toggle .label span:last-child,
body.sidebar-collapsed .theme-toggle .pill,
body.sidebar-collapsed .sidebar-footer-copy,
body.sidebar-collapsed .sidebar-host-label,
body.sidebar-collapsed .sidebar-host-name,
html.sidebar-collapsed-preload body .nav a span,
html.sidebar-collapsed-preload body .nav button.theme-toggle .label span:last-child,
html.sidebar-collapsed-preload body .theme-toggle .pill,
html.sidebar-collapsed-preload body .sidebar-footer-copy,
html.sidebar-collapsed-preload body .sidebar-host-label,
html.sidebar-collapsed-preload body .sidebar-host-name {
  display: none !important;
}

body.sidebar-collapsed .nav a svg,
body.sidebar-collapsed .nav button.theme-toggle .label,
html.sidebar-collapsed-preload body .nav a svg,
html.sidebar-collapsed-preload body .nav button.theme-toggle .label {
  margin: 0;
}

body.sidebar-collapsed .nav a.active::before,
html.sidebar-collapsed-preload body .nav a.active::before {
  right: 3.56px;
  left: auto;
  top: 7px;
  bottom: 7px;
  width: 2.67px;
}

body.sidebar-collapsed .theme-toggle,
html.sidebar-collapsed-preload body .theme-toggle {
  width: 43px;
  height: 43px;
  min-height: 43px;
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .theme-toggle .label,
html.sidebar-collapsed-preload body .theme-toggle .label {
  justify-content: center;
  gap: 0;
}

body.sidebar-collapsed .sidebar-footer,
html.sidebar-collapsed-preload body .sidebar-footer {
  margin-top: auto;
  align-items: center;
  gap: 9px;
}

body.sidebar-collapsed .sidebar-host,
html.sidebar-collapsed-preload body .sidebar-host {
  width: 43px;
  min-height: 43px;
  padding: 0;
  justify-content: center;
  border-radius: 14px;
  margin-inline: auto;
}

body.sidebar-collapsed .sidebar-host img,
html.sidebar-collapsed-preload body .sidebar-host img {
  margin: 0;
  height: 16px;
}

body.sidebar-collapsed .sidebar-collapse-btn,
html.sidebar-collapsed-preload body .sidebar-collapse-btn {
  width: 43px;
  height: 43px;
  padding: 0;
  border-radius: 14px;
  margin-inline: auto;
}

body.sidebar-collapsed .sidebar-collapse-btn svg,
html.sidebar-collapsed-preload body .sidebar-collapse-btn svg {
  transform: rotate(0deg);
}

/* =========================
   Tooltip In Collapsed State
========================= */
body.sidebar-collapsed .nav a,
body.sidebar-collapsed .theme-toggle,
body.sidebar-collapsed .sidebar-host,
html.sidebar-collapsed-preload body .nav a,
html.sidebar-collapsed-preload body .theme-toggle,
html.sidebar-collapsed-preload body .sidebar-host {
  position: relative;
}

/* =========================
   Light Theme Contrast Patch
========================= */
:root[data-theme="light"] .kv,
:root[data-theme="light"] .small {
  color: #475569;
}

:root[data-theme="light"] :focus-visible {
  outline: 2.67px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2.67px;
}

/* =========================
   Responsive
========================= */
@media (max-width: 1180px) {
  .topbar-left { flex-wrap: wrap; gap: 7px;}
}


@media (max-width: 1180px) {
  .dashboard-topbar {
    gap: 12px;
    padding: 12px;
  }
  .topbar-center { justify-content:end}
  .topbar-search { width: 100%; }
  .topbar-left { flex-wrap: wrap; }
  .topbar-page-subtitle { max-width: none; }
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 12px;
    right: 12px;
    width: min(88vw, 285px);
    height: calc(100vh - 25px);
    transform: translateX(110%);
    transition: transform .25s ease;
    z-index: 2000;
  }
  .sidebar { border-radius: 21px; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .overlay { opacity: 1; pointer-events: auto; }
  body.sidebar-collapsed .app { grid-template-columns: 85px 1fr; }

  body.sidebar-collapsed .nav a,
  body.sidebar-collapsed .nav button.theme-toggle,
  body.sidebar-collapsed .sidebar-host,
  body.sidebar-collapsed .sidebar-collapse-btn {
    width: 100%;
    height: auto;
    min-height: 43px;
    padding: 0 12px;
    justify-content: flex-start;
    margin-inline: 0;
  }

  body.sidebar-collapsed .nav a span,
  body.sidebar-collapsed .nav button.theme-toggle .label span:last-child,
  body.sidebar-collapsed .theme-toggle .pill,
  body.sidebar-collapsed .sidebar-host-label,
  body.sidebar-collapsed .sidebar-host-name {
    display: initial !important;
  }

  body.sidebar-collapsed .sidebar-footer-copy { display: block !important; }
  body.sidebar-collapsed .brand-copy {
    width: auto;
    opacity: 1;
    overflow: visible;
    transform: translateX(8px);
  }
  .sidebar-collapse-btn { display: none; }
  .main { padding: 3.56px 0 16px; }
  .hamburger { display: flex; }
}

@media (max-width: 760px) {
  body::after {
    height: 11px;
  }
  .dashboard-topbar {
    top: 11px;
    padding: 11px;
    border-radius: 18px;
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .topbar-page-title { font-size: 15px; }
  .topbar-page-subtitle { font-size: 10px; white-space: normal; }
  .topbar-status-pill { display: none; }
  .topbar-center { display: none; }
  .topbar-left { gap: 7px; }
  .topbar-user { max-width: 151px; }
  .topbar-user-role { display: none; }
  .topbar-icon-btn { width: 36px; height: 36px; }
  .topbar-login-btn { min-height: 37px; padding: 0 12px; }
}

@media (max-width: 640px) {
  .topbar-page-subtitle { display: none; }
}

@media (max-width: 520px) {
  .app { padding: 9px; }
  .card { padding: 12px; }
  .sidebar { width: 249px; }
}

.main-container {
  width: 100%;
  margin: 23px auto;
}