:root {
  --bg: #edf2f7;
  --bg-soft: #f7f9fc;
  --card: #ffffff;
  --card-2: #fbfcfe;
  --text: #0f172a;
  --muted: #66758a;
  --brand: #0f5ea5;
  --brand-strong: #0a4a82;
  --brand-soft: #e7f0fb;
  --danger: #c2414e;
  --ok: #177245;
  --border: #d9e1ea;
  --border-strong: #cbd5e1;
  --shadow-lg: 0 10px 28px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, 0.05);
  --products-visible-rows: 5;
  --products-row-height: 46px;
  --products-head-height: 42px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI Variable", "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 14% 16%, rgba(15, 94, 165, 0.08) 0, transparent 34%),
    radial-gradient(circle at 86% 8%, rgba(15, 94, 165, 0.07) 0, transparent 26%),
    linear-gradient(180deg, #f7f9fc 0%, #edf2f7 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.auth-mode {
  min-height: 100vh;
  background: linear-gradient(180deg, #eef2f7 0%, #e8edf3 100%);
}

body.app-mode {
  background: linear-gradient(180deg, #f5f7fb 0%, #edf2f7 100%);
}

.container {
  max-width: 1248px;
  margin: 0 auto;
  padding: 24px;
}

body.auth-mode .container {
  min-height: 100vh;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transform: translateY(-10px);
}

body.auth-mode .header,
body.auth-mode #statusApp,
body.auth-mode #appBox {
  display: none;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu-wrap {
  position: relative;
  margin-left: auto;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-width: 92px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: #16a34a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(22, 163, 74, 0.2);
}

.user-menu-trigger:hover {
  background: #15803d;
}

.user-menu-trigger-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
}

.user-menu-trigger-icon svg {
  width: 100%;
  height: 100%;
}

.user-menu-trigger-label {
  line-height: 1;
}

.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 202px;
  background: #ffffff;
  border: 1px solid #d9e0e8;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  padding: 10px 0 8px;
  z-index: 30;
}

.user-menu-profile {
  padding: 0 14px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid #e5ebf2;
  display: grid;
  gap: 1px;
}

.user-menu-profile strong {
  font-size: 13px;
  line-height: 1.2;
  color: #1f2937;
}

.user-menu-profile span {
  font-size: 12px;
  line-height: 1.2;
  color: #94a3b8;
}

.user-menu-item {
  width: 100%;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #2f343d;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
  text-decoration: none;
  cursor: pointer;
}

.user-menu-item:hover {
  background: #f4f7fb;
  color: #111827;
}

.user-menu-item.danger {
  color: #334155;
}

.user-menu-item.danger:hover {
  background: #f8fafc;
}

.user-menu-ico {
  width: 16px;
  height: 16px;
  display: inline-flex;
  color: #1f2937;
  flex: 0 0 auto;
}

.user-menu-ico svg {
  width: 100%;
  height: 100%;
}

.user-menu-divider {
  height: 1px;
  margin: 8px 0;
  background: #e5ebf2;
}

body.app-mode .user-menu-wrap {
  min-width: 92px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  color: #2f82c8;
}

.brand-logo svg {
  width: 100%;
  height: 100%;
}

.brand-wordmark {
  font-size: 22px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.brand-main {
  color: #233a8b;
}

.brand-x {
  color: #6dbf4b;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

body.app-mode .container {
  max-width: none;
  padding: 0;
}

body.app-mode .header {
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid #dbe2ea;
  border-radius: 0;
  padding: 12px 28px;
  margin-bottom: 0;
  box-shadow: none;
}

body.app-mode .header-left {
  min-width: 190px;
}

body.app-mode .header-right {
  min-width: 190px;
  justify-content: flex-end;
}

body.app-mode #whoami {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
}

body.app-mode #btnLogout {
  display: flex;
}

.user-icon {
  width: 16px;
  height: 16px;
  color: #2e3a49;
  display: inline-flex;
}

.user-icon svg {
  width: 100%;
  height: 100%;
}

.title {
  margin: 0;
  font-size: 28px;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
}

body.app-mode .title {
  font-size: 20px;
  line-height: 1.1;
  font-weight: 700;
}

body.app-mode .subtitle {
  margin-top: 4px;
  color: #667085;
  font-size: 14px;
}

body.app-mode #appBox {
  max-width: 1188px;
  margin: 0 auto;
  padding: 18px 24px 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 248px minmax(260px, 1fr) minmax(384px, 1.7fr);
  gap: 18px;
  align-items: start;
}

body.app-mode.product-management-mode .dashboard-grid {
  grid-template-columns: minmax(760px, 1fr);
}

body.app-mode.product-management-mode .config-card,
body.app-mode.product-management-mode .items-card {
  display: none;
}

.dashboard-card {
  min-height: 414px;
}

.config-card,
.products-card,
.items-card {
  display: flex;
  flex-direction: column;
}

.dashboard-card h3 {
  margin-top: 2px;
  margin-bottom: 14px;
  font-size: 16px;
}

.section-ico {
  display: inline-block;
  width: 18px;
  color: #0f5ea5;
  margin-right: 6px;
}

.counter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: #edf1f5;
  color: #516173;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}

.config-card label {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: -8px;
  color: #1f2937;
}

.products-card table,
.items-card table {
  margin-top: 10px;
}

.products-card .row {
  margin-bottom: 8px;
  gap: 8px;
}

.products-card .row input:first-child {
  padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2391a1b3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px 50%;
  background-size: 16px 16px;
}

.items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.row-actions button {
  width: auto;
  min-width: 80px;
  padding: 0 12px;
}

.items-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.total-pill {
  background: #e8eef6;
  color: #506173;
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 14px;
}

.app-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.app-hero-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #0f5ea5;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-hero-icon svg {
  width: 19px;
  height: 19px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-lg);
}

body.app-mode .card {
  border-color: #dbe2ea;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.login-card {
  width: 100%;
  max-width: 372px;
  padding: 23px 21px 21px;
  border-radius: 11px;
  border-color: #d1d9e2;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 6px 14px rgba(15, 23, 42, 0.04);
}

.login-icon {
  width: 35px;
  height: 35px;
  margin: 0 auto 16px;
  border-radius: 8px;
  background: #0f5ea5;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-icon svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.login-title {
  margin: 0;
  text-align: center;
  font-size: 42px;
  line-height: 1.02;
  font-weight: 700;
}

.login-subtitle {
  margin: 7px 0 18px;
  text-align: center;
  color: #667085;
  font-size: 16px;
}

.login-form {
  display: grid;
  gap: 7px;
}

.login-label {
  margin-top: 6px;
  font-weight: 700;
  font-size: 18px;
}

.login-submit {
  margin-top: 10px;
  background: #0f5ea5;
  border-radius: 7px;
  padding: 10px 10px;
  font-weight: 700;
}

.login-register {
  margin: 16px 0 0;
  text-align: center;
  color: #667085;
  font-size: 16px;
}

.login-register a {
  color: #0f5ea5;
  text-decoration: none;
  font-weight: 700;
}

#setupWrap {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

body.auth-mode input,
body.auth-mode button {
  font-size: 16px;
  height: 46px;
  padding: 10px 12px;
  border-radius: 7px;
}

body.auth-mode input {
  border-color: #d4dbe3;
  background: #ffffff;
}

@media (max-width: 480px) {
  .login-card {
    max-width: 100%;
    padding: 20px 16px;
  }

  body.auth-mode .container {
    transform: none;
  }

  .login-title {
    font-size: 36px;
  }
}

body.auth-mode input::placeholder {
  color: #99a3b0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-1 {
  display: grid;
  gap: 16px;
}

.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 16px;
}

body.app-mode .tabs {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: center;
}

.tab {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.tab.active {
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}

body.app-mode .tab {
  border-radius: 7px;
  height: 30px;
  padding: 0 8px;
  min-width: 0;
  width: auto;
  border-color: transparent;
  background: transparent;
  color: #1f2937;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: none;
}

body.app-mode .tab.active {
  border-color: #0f5ea5;
  background: #0f5ea5;
  color: #ffffff;
  padding: 0 8px;
  box-shadow: none;
}

body.app-mode .tab.hidden {
  display: none;
}

.tab-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
}

.tab-icon svg {
  width: 100%;
  height: 100%;
}

body.app-mode .panel {
  margin-top: 0;
}

input,
select,
textarea,
button {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

button {
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
}

body.app-mode input,
body.app-mode select,
body.app-mode textarea,
body.app-mode button {
  height: 42px;
  font-size: 15px;
  border-radius: 8px;
}

body.app-mode input,
body.app-mode select,
body.app-mode textarea {
  border-color: #d5dce6;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

body.app-mode button {
  background: #0f5ea5;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(15, 94, 165, 0.16);
}

body.app-mode button.secondary {
  background: #ffffff;
  color: #1f2937;
  box-shadow: none;
}

body.app-mode .user-menu-item {
  height: 36px;
  border-radius: 0;
  background: transparent;
  color: #2f343d;
  font-weight: 500;
  box-shadow: none;
}

body.app-mode .user-menu-item:hover {
  background: #f4f7fb;
  color: #111827;
}

body.app-mode .user-menu-item.danger {
  color: #334155;
}

body.app-mode .user-menu-item.danger:hover {
  background: #f8fafc;
}

body.app-mode th {
  background: #f3f6fa;
  border-top: 1px solid #dbe2ea;
  border-bottom: 1px solid #dbe2ea;
}

body.app-mode th,
body.app-mode td {
  border-bottom-color: #e2e8f0;
}

.products-card table {
  display: block;
  flex: 1;
  min-height: 0;
  max-height: 506px;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

body.app-mode:not(.product-management-mode) .products-card table {
  max-height: calc(var(--products-head-height) + (var(--products-row-height) * var(--products-visible-rows)));
  overflow-y: auto;
  scrollbar-width: auto;
  scrollbar-color: #8ba8c7 #e8eef6;
}

body.app-mode:not(.product-management-mode) .products-card table::-webkit-scrollbar {
  width: 12px;
}

body.app-mode:not(.product-management-mode) .products-card table::-webkit-scrollbar-track {
  background: #e8eef6;
  border-radius: 10px;
}

body.app-mode:not(.product-management-mode) .products-card table::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8ba8c7 0%, #6f93bb 100%);
  border: 2px solid #e8eef6;
  border-radius: 10px;
}

body.app-mode:not(.product-management-mode) .products-card table::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6f93bb 0%, #577ea9 100%);
}

body.app-mode:not(.product-management-mode) .products-card th {
  height: var(--products-head-height);
}

.products-card thead,
.products-card tbody,
.products-card tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.products-card thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.items-card table {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.config-card .recount-inline {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #dde5ee;
}

.config-card .recount-inline h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.recount-request-item {
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f9fbfe;
}

.recount-request-item.is-external {
  border-color: #f2c48d;
  background: linear-gradient(180deg, #fffaf2 0%, #fff4e5 100%);
}

.recount-request-item + .recount-request-item {
  margin-top: 8px;
}

.recount-request-item h4 {
  margin: 0;
  font-size: 14px;
  color: #0f172a;
}

.recount-request-item p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #4a5a6d;
}

.recount-request-item .recount-target-warning {
  color: #9a4b00;
  font-weight: 700;
}

.recount-request-actions {
  margin-top: 10px;
}

.recount-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px solid #cfe0f2;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  color: #163555;
  font-size: 13px;
}

.recount-banner strong {
  color: #0f5ea5;
}

.recount-banner.hidden {
  display: none;
}

.items-card th:last-child,
.items-card td:last-child {
  text-align: center;
  width: 96px;
}

.items-card td strong {
  color: #0f5ea5;
}

.products-card tbody tr:hover,
.items-card tbody tr:hover,
body.app-mode tbody tr:hover {
  background: #f8fbff;
}

.products-card tbody tr.product-click-row {
  cursor: pointer;
}

body.app-mode .products-card td,
body.app-mode .items-card td {
  height: 46px;
}

body.app-mode:not(.product-management-mode) .products-card td {
  height: var(--products-row-height);
}

body.app-mode .products-card td:first-child,
body.app-mode .items-card td:first-child {
  font-weight: 600;
  color: #1f2937;
}

body.app-mode .items-card .row-actions button,
body.app-mode .items-footer .row-actions button {
  min-width: 0;
}

body.app-mode .items-footer .row-actions button:first-child {
  background: #0f5ea5;
}

body.app-mode .items-footer .row-actions button.secondary {
  color: #4b5563;
}

body.app-mode .config-card input {
  background: #ffffff;
}

button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

button.danger {
  background: var(--danger);
}

.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hidden {
  display: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.status {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 8px;
}

body.app-mode .status {
  margin: 0 24px 12px;
}

#statusAuth {
  margin-bottom: 14px;
}

.status.ok {
  background: #d6f5e4;
  color: var(--ok);
}

.status.error {
  background: #ffe1e6;
  color: var(--danger);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}

.modal-card {
  position: relative;
  width: min(460px, calc(100vw - 32px));
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  border: 1px solid #dbe2ea;
  padding: 18px;
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-header p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #dbe2ea;
  background: #ffffff;
  color: #334155;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  box-shadow: none;
}

.modal-form {
  gap: 12px;
}

.modal-actions {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}

body.app-mode .item-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 32px;
  min-width: 98px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #bfd4ea;
  background: linear-gradient(180deg, #f8fbff 0%, #ecf4ff 100%);
  color: #0d4f8b;
  box-shadow: 0 3px 10px rgba(15, 94, 165, 0.12);
  margin: 0 2px;
  line-height: 1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

body.app-mode .item-action-btn.icon-only {
  width: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 10px;
}

body.app-mode .item-action-btn.icon-only svg {
  width: 15px;
  height: 15px;
}

body.app-mode .item-action-btn.danger {
  background: linear-gradient(180deg, #fff7f8 0%, #ffeff1 100%);
  border-color: #f3cad0;
  color: #b42332;
  box-shadow: 0 3px 10px rgba(180, 35, 50, 0.12);
}

body.app-mode .item-action-btn:hover {
  background: linear-gradient(180deg, #eff7ff 0%, #dfefff 100%);
  border-color: #97bbdf;
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(15, 94, 165, 0.16);
}

body.app-mode .item-action-btn.danger:hover {
  background: linear-gradient(180deg, #ffeff1 0%, #ffe4e8 100%);
  border-color: #e9a7b1;
  box-shadow: 0 5px 12px rgba(180, 35, 50, 0.16);
}

body.app-mode .item-action-btn:focus-visible {
  outline: 2px solid #8bb9e8;
  outline-offset: 1px;
}

.items-card td:last-child {
  white-space: nowrap;
}

.modal-form label {
  font-weight: 700;
  font-size: 14px;
  color: #1f2937;
  margin-bottom: -6px;
}

@media (max-width: 900px) {
  body.app-mode .header {
    padding: 10px 12px;
    flex-wrap: wrap;
  }

  .user-menu-wrap {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  .user-menu {
    position: fixed;
    top: 54px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(280px, calc(100vw - 24px));
  }

  .header-center {
    order: 2;
    width: auto;
    flex: 1;
    justify-content: center;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .header-center::-webkit-scrollbar {
    display: none;
  }

  body.app-mode .tabs {
    flex-wrap: nowrap;
    gap: 2px;
  }

  body.app-mode .tab {
    height: 30px;
    min-width: 0;
    padding: 0 8px;
    font-size: 13px;
    gap: 5px;
  }

  body.app-mode .tab-icon {
    width: 12px;
    height: 12px;
  }

  body.app-mode #appBox {
    padding: 12px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  body.app-mode.product-management-mode .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-card {
    min-height: auto;
  }

  .products-card table {
    max-height: none;
    flex: none;
  }

  .items-card table {
    flex: none;
  }

  .grid,
  .row,
  .row-3 {
    grid-template-columns: 1fr;
  }

  .modal-card {
    width: min(100%, calc(100vw - 24px));
  }
}

.analyst-wrap {
  display: grid;
  gap: 16px;
}

.analyst-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.analyst-stat-card {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  border-radius: 12px;
}

.analyst-stat-card strong {
  font-size: 38px;
  line-height: 1;
  font-weight: 800;
  color: #0f172a;
}

.analyst-stat-card:nth-child(3) strong {
  color: #0f5ea5;
}

.analyst-stat-card span {
  font-size: 14px;
  color: #6b7788;
}

.analyst-filter-card h3,
.analyst-list-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.analyst-filters-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.analyst-filters-grid label,
.analyst-search-block label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 700;
  color: #111827;
  font-size: 14px;
}

.analyst-filters-grid input,
.analyst-filters-grid select,
.analyst-search-block input {
  height: 42px;
  border-radius: 9px;
  border: 1px solid #d7dee7;
  font-size: 15px;
}

.analyst-search-block {
  margin-top: 14px;
}

.analyst-toolbar {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.analyst-toolbar button {
  width: auto;
  min-width: 0;
  padding: 0 14px;
  font-size: 14px;
  height: 34px;
  border-radius: 9px;
}

.analyst-toolbar button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.analyst-subtabs {
  display: flex;
  gap: 10px;
}

.analyst-subtab {
  width: auto;
  min-width: 0;
  height: 34px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid #d5deea;
  background: #ffffff;
  color: #1f2937;
  box-shadow: none;
}

.analyst-subtab.active {
  background: #0f5ea5;
  color: #ffffff;
  border-color: #0f5ea5;
}

.analyst-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.analyst-list-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.analyst-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1f2937;
  font-size: 14px;
}

.analyst-select-all input {
  width: 20px;
  height: 20px;
}

.analyst-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #dbe3ed;
  border-radius: 11px;
  background: #f1f5f9;
  padding: 10px 12px;
}

.analyst-count-row + .analyst-count-row {
  margin-top: 10px;
}

.analyst-count-block + .analyst-count-block {
  margin-top: 10px;
}

.analyst-count-head {
  cursor: pointer;
}

.analyst-count-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.analyst-count-main input {
  width: 20px;
  height: 20px;
}

.analyst-row-arrow {
  color: #63758b;
  font-size: 22px;
  line-height: 1;
}

.analyst-count-main h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.1;
  color: #0f172a;
}

.analyst-count-main p {
  margin: 6px 0 0;
  color: #5f6f84;
  font-size: 11px;
}

.analyst-count-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.analyst-items-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid #d2dae5;
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
  color: #334155;
}

.analyst-count-actions .secondary {
  width: auto;
  min-width: 0;
  padding: 0 14px;
  font-size: 14px;
  height: 34px;
  border-radius: 8px;
  box-shadow: none;
}

.analyst-count-details {
  border: 1px solid #dbe3ed;
  border-top: 0;
  border-radius: 0 0 11px 11px;
  background: #ffffff;
  padding: 12px;
}

.analyst-count-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.analyst-count-details-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.analyst-count-details-actions button {
  height: 32px;
  font-size: 13px;
  padding: 0 12px;
}

.analyst-table-wrap {
  overflow-x: auto;
}

.analyst-table-wrap table {
  margin: 0;
}

.analyst-item-actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 1100px) {
  .analyst-stats,
  .analyst-filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analyst-toolbar {
    flex-wrap: wrap;
  }

  .analyst-count-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .analyst-count-details-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .analyst-stats,
  .analyst-filters-grid {
    grid-template-columns: 1fr;
  }

  .analyst-subtabs {
    flex-direction: column;
  }

  .analyst-toolbar button,
  .analyst-subtab,
  .analyst-count-actions .secondary {
    width: 100%;
  }

  .analyst-count-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}
