/* ========================================================================= */
/* Vercel & BoardUI Approved Typography: Local Inter & JetBrains Mono        */
/* ========================================================================= */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  color-scheme: dark;
  --bg-page: #08090a;
  --bg-sidebar: #0f1011;
  --bg-card: #141619;
  --bg-card-hover: #1c1f24;
  --bg-input: #121417;
  --bg-table-header: #121417;
  --accent-orange: #ff6200;
  --accent-orange-hover: #e05600;
  --accent-orange-subtle: rgba(255, 98, 0, 0.12);
  --border-line: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 98, 0, 0.6);
  --text-main: #edf2f7;
  --text-muted: #8d9ba8;
  --text-subtle: #5f6f7d;
  --status-green: #38a169;
  --status-green-bg: rgba(56, 161, 105, 0.15);
  --status-yellow: #d69e2e;
  --status-yellow-bg: rgba(214, 158, 46, 0.15);
  --status-red: #e53e3e;
  --status-red-bg: rgba(229, 62, 62, 0.15);
  --font-main: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

th, td, input, button, select, textarea {
  font-family: inherit;
}

body {
  font-family: var(--font-main);
  background: var(--bg-page);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
}

/* Sidebar */
.sidebar {
  width: 208px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand-block {
  padding: 16px;
  border-bottom: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--accent-orange);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  letter-spacing: -0.5px;
}

.brand-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-main);
  text-transform: uppercase;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-list {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--accent-orange-subtle);
  color: var(--accent-orange);
  border-color: rgba(255, 98, 0, 0.25);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.logout-btn:hover {
  color: var(--status-red);
}

/* Main Content Workspace */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
}

.top-bar {
  height: 52px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-sidebar);
}

.top-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.badge-green {
  background: var(--status-green-bg);
  color: var(--status-green);
}

.badge-yellow {
  background: var(--status-yellow-bg);
  color: var(--status-yellow);
}

.content-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Card Container */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: 8px;
  padding: 18px 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.input-text, textarea.input-text, select.input-text {
  background: var(--bg-input);
  border: 1px solid var(--border-line);
  border-radius: 6px;
  color: var(--text-main);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-text:focus {
  border-color: var(--border-focus);
}

textarea.input-text {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 15px; /* +2px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-orange);
  color: #fff;
}

/* Кнопки и инпуты */
.btn-primary:hover {
  background: var(--accent-orange-hover);
}

.btn:disabled, .btn[disabled] {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: auto !important;
}

.btn-secondary {
  background: var(--bg-card-hover);
  border-color: var(--border-line);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 15px; /* +2px */
}

/* Data Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-line);
  border-radius: 6px;
  margin-top: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.data-table th {
  background: var(--bg-table-header);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-line);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-line);
  color: var(--text-main);
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

.mono {
  font-family: var(--font-mono) !important;
  font-variant-numeric: tabular-nums;
}

.text-right {
  text-align: right;
}

/* Quick Search Dropdown */
.search-results-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  margin-top: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-size: 13px;
}

.search-results-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-line);
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

/* Login Page Styling */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  background: var(--bg-page);
}

.login-card {
  width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: 10px;
  padding: 32px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

/* Assortment dashboard; keep the existing panel layout and theme. */
#nav-dashboard { background-color: transparent; font: inherit; font-size: 13px; font-weight: 500; line-height: 1.4; }
#nav-dashboard:hover { background-color: var(--bg-card-hover); }
#nav-dashboard.active { background-color: var(--accent-orange-subtle); }
#dashboard-badge[hidden], #universal-report-badge[hidden], #btn-hotkeys[hidden] { display: none; }
.assortment-card { padding: 0; overflow: hidden; }
.assortment-card h2, #assortment-detail h2 { font-size: 14px; font-weight: 600; margin: 0; }
.assortment-card h2 { padding: 14px 18px; border-bottom: 1px solid var(--border-line); }
.assortment-scroll { overflow-x: auto; }
.assortment-summary, #assortment-detail table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.assortment-summary th, .assortment-summary td {
  padding: 10px 6px; text-align: center; border-right: 1px solid var(--border-line); border-bottom: 1px solid var(--border-line);
}
.assortment-summary th[scope=col] { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .assortment-summary { min-width: var(--assortment-narrow-width, 0px); }
}
.assortment-summary thead tr > * { background: var(--bg-table-header); color: var(--text-muted); }
.assortment-summary tr > :first-child { width: 130px; text-align: left; padding-left: 18px; }
.assortment-summary :is(th, td):last-child { border-right: 0; }
.assortment-summary tbody tr:last-child > * { border-bottom: 0; }
.assortment-summary button {
  display: block; margin-inline: auto; max-width: 100%; overflow-wrap: anywhere;
  background: none; border: 0; color: var(--text-main); cursor: pointer; padding: 6px 0; font: 600 14px var(--font-mono);
}
.assortment-summary button:hover, .assortment-summary button:focus-visible { color: var(--accent-orange); text-decoration: underline; }
.assortment-mom { font: 600 11px var(--font-mono); padding: 2px 4px; border-radius: 4px; color: var(--text-muted); background: var(--bg-card-hover); white-space: nowrap; }
.assortment-mom.up { color: var(--status-green); }
.assortment-mom.down { color: var(--status-red); }
.assortment-partial { color: var(--status-yellow); }
#dashboard-state { margin: 0; padding: 8px 18px; color: var(--text-muted); font-size: 12px; }
#dashboard-state:empty { display: none; }
#assortment-detail {
  color: var(--text-main); background: var(--bg-card); border: 1px solid var(--border-line); border-radius: 8px;
  width: 1100px; max-width: 95vw; height: 85dvh; max-height: 720px; padding: 0; margin: auto; overflow: hidden;
}
#assortment-detail::backdrop { background: rgba(0,0,0,.75); }
.assortment-dialog-body { height: 100%; display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; }
.assortment-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
#assortment-search { flex: 1; min-width: min(240px, 100%); }
#assortment-count { color: var(--text-muted); }
.assortment-detail-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; border: 1px solid var(--border-line); border-radius: 6px; }
.assortment-detail-scroll::-webkit-scrollbar { display: none; }
#assortment-detail table { min-width: 730px; font-size: 12px; }
#assortment-detail th, #assortment-detail td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#assortment-detail th { position: sticky; top: 0; background: var(--bg-table-header); color: var(--text-muted); }
#assortment-detail th:nth-child(1) { width: 95px; }
#assortment-detail th:nth-child(2) { width: 115px; }
#assortment-detail th:nth-child(4) { width: 175px; }
#assortment-detail[data-kind="entered"] td:last-child { color: var(--status-green); }
#assortment-detail[data-kind="withdrawn"] td:last-child { color: #ff6868; }
