/* Shared colors and navigation for Mijozlar boshqaruvi. */
body.catalog-app[data-theme="light"] {
  --bg: #f3f5f4;
  --top: #fff;
  --panel: #fff;
  --panel2: #f8faf9;
  --panel3: #eff3f0;
  --border: #dee6e0;
  --line: #e8eeea;
  --text: #304840;
  --sub: #435a51;
  --muted: #596e65;
  --green: #237b28;
  --greenText: #226e2a;
  --greenWash: #eaf5eb;
  --field: #fafbf9;
  --shadow: 0 1px 3px #152a2010;
}

html:has(.catalog-app #appShell:not([hidden])) {
  overscroll-behavior: none;
}

body.catalog-app:has(#appShell:not([hidden])) {
  height: 100dvh;
  overflow: hidden;
}

.catalog-app #appShell:not([hidden]),
.catalog-app:has(.catalog-workbench) #appShell:not([hidden]) {
  display: grid;
  grid-template-columns: clamp(206px, 17.1vw, 254px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: start;
  width: 100%;
  height: 100dvh;
  overflow: clip;
}

.crm-workspace {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  overflow: clip;
}

.catalog-app .crm-workspace .desk-main {
  flex: 1;
  width: 100%;
  min-height: 0;
}

.crm-workspace > .desk-main:not(:has(.catalog-workbench, #crmAdminView)) {
  overflow: auto;
  overscroll-behavior: contain;
}

.crm-workspace > :is(.call-session, .desk-footer) { flex: none; }
.crm-workspace .desk-footer { width: 100%; }

.crm-sidebar {
  --sidebar-accent: #5cbc61;
  --sidebar-ink: #f2f6f3;
  --sidebar-muted: #b3c0ba;
  --sidebar-border: #2b3b34;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  background: #121d1b;
  color: var(--sidebar-ink);
}

.crm-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 18px 18px 19px;
  color: var(--sidebar-ink);
  outline-offset: -4px;
}

.crm-sidebar-brand .crm-brand-mark { width: 42px; flex: 0 0 42px; }
.crm-sidebar-brand strong {
  display: block;
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.crm-sidebar-brand small {
  display: block;
  margin-top: 3px;
  color: var(--sidebar-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.catalog-app .crm-sidebar #panelNav {
  flex: 1 1 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
  min-height: 0;
  overflow: auto;
  padding: 3px 10px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border) transparent;
}

.crm-nav-group { display: flex; flex-direction: column; gap: 3px; }
.crm-nav-group + .crm-nav-group { margin-top: 13px; }
.crm-nav-caption {
  padding: 3px 11px 5px;
  color: var(--sidebar-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.catalog-app .crm-sidebar #panelNav a {
  position: relative;
  gap: 10px;
  min-height: 39px;
  padding: 8px 10px;
  color: var(--sidebar-muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  outline-offset: -2px;
}

.crm-sidebar svg { width: 17px; height: 17px; flex: 0 0 17px; }
.catalog-app .crm-sidebar #panelNav a:hover { background: #1c2a26; color: var(--sidebar-ink); }
.catalog-app .crm-sidebar #panelNav a[aria-current="page"] { background: #20302a; color: var(--sidebar-ink); }
.crm-sidebar #panelNav a[aria-current="page"] svg { color: var(--sidebar-accent); }
.crm-sidebar #panelNav a[aria-current="page"]::before {
  position: absolute;
  inset: 7px auto 7px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sidebar-accent);
  content: '';
}

.crm-sidebar-account {
  display: grid;
  gap: 10px;
  padding: 12px 15px 15px;
  border-top: 1px solid var(--sidebar-border);
}

.crm-account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crm-account-avatar {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #324d3b;
  border-radius: 50%;
  background: #22352b;
  color: #86db8b;
  font-weight: 800;
}

.crm-account > div { min-width: 0; }
.crm-account #userFullName { display: block; color: var(--sidebar-ink); font-size: 13px; overflow-wrap: anywhere; }
.crm-account small { display: block; color: var(--sidebar-muted); font-size: 11px; }
.crm-account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }

.crm-sidebar .crm-sidebar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 33px;
  min-height: 33px;
  padding: 4px 8px;
  border: 1px solid #34493e;
  border-radius: 7px;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.crm-sidebar .crm-sidebar-button:hover { background: #23352c; color: var(--sidebar-ink); }
.crm-sidebar :is(a, button):focus-visible { outline-color: var(--sidebar-accent); }
.catalog-app .crm-sidebar #consultationButton { border-color: #375943; background: #263e2f; color: #e0f6e3; }
.catalog-app .crm-sidebar #consultationButton:hover { background: #35533d; }

@media (max-width: 900px) {
  .catalog-app #appShell:not([hidden]),
  .catalog-app:has(.catalog-workbench) #appShell:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .crm-workspace { flex: 1; }

  .crm-sidebar {
    z-index: 10;
    display: grid;
    flex: none;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'brand account' 'nav nav';
    height: auto;
  }

  .crm-sidebar-brand { grid-area: brand; gap: 8px; padding: 8px 12px; }
  .crm-sidebar-brand .crm-brand-mark { width: 33px; flex-basis: 33px; }
  .crm-sidebar-brand small { margin-top: 1px; font-size: 8px; }

  .catalog-app .crm-sidebar #panelNav {
    grid-area: nav;
    flex-direction: row;
    gap: 3px;
    margin: 0;
    padding: 0 8px 4px;
    border-top: 1px solid var(--sidebar-border);
    overflow: auto hidden;
  }

  .crm-nav-group { display: contents; }
  .crm-nav-caption { display: none; }

  .catalog-app .crm-sidebar #panelNav a {
    flex: none;
    gap: 6px;
    margin-top: 3px;
    padding: 5px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .crm-sidebar #panelNav a[aria-current="page"]::before { inset: auto 6px 0; width: auto; height: 2px; }

  .crm-sidebar-account {
    grid-area: account;
    grid-auto-flow: column;
    align-items: center;
    gap: 7px;
    padding: 8px 9px 8px 0;
    border: 0;
  }

  .crm-account-avatar { flex-basis: 29px; width: 29px; height: 29px; font-size: 11px; }
  .crm-account > div {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .crm-account-actions { flex-wrap: nowrap; }
  .crm-sidebar .crm-sidebar-button { min-width: 30px; min-height: 30px; padding: 3px 6px; }
  .crm-sidebar #logoutButton span { display: none; }
}

@media (max-width: 760px) {
  .catalog-app .crm-workspace .desk-footer {
    gap: 4px;
    padding-block: 8px;
    font-size: 10px;
  }
}

@media (max-width: 375px) {
  .crm-account-avatar { display: none; }
}
