/* ═══════════════════════════════════════════════════════
   MECHANIC — Base / Foundation
   Палитра: Teal #0891b2 | Teal Dark #0773a0 | Teal Muted #0e7490
            Navy #0c111a | Surface #131b27
            BG #f0f4f8 | White #ffffff | Text #0d1b2a | Muted #4a6278
            Slate-100 #f1f5f9 (navy zone light) | Slate-300 #a0b4c4 (placeholder)
   Шрифты: Clash Grotesk (display) · Satoshi (UI) · JetBrains Mono (коды)
   ═══════════════════════════════════════════════════════ */

:root {
  /* -- Основная палитра -- */
  --teal:          #0891b2;
  --teal-dark:     #0773a0;
  --teal-muted:    #0e7490;
  --teal-alpha:    rgba(8, 145, 178, 0.10);

  --navy:          #0c111a;
  --navy-surface:  #131b27;
  --navy-border:   rgba(255, 255, 255, 0.08);

  /* -- Светлая зона -- */
  --bg:            #f0f4f8;
  --white:         #ffffff;
  --text:          #0d1b2a;
  --muted:         #4a6278;
  --border:        #c8d8e8;
  --light:         #f8fafc;
  --slate-100:     #f1f5f9;
  --slate-300:     #6b7c8d;

  /* -- Радиусы и переход -- */
  --r:             8px;
  --r-lg:          12px;
  --tr:            0.18s cubic-bezier(0.4, 0, 0.2, 1);

  /* -- z-index scale -- */
  --z-base:        1;
  --z-header:      100;
  --z-dropdown:    200;     /* popovers, combobox lists, sticky sub-bars (between header and modal) */
  --z-modal:       300;
  --z-toast:       9999;

  /* -- Шрифты -- */
  --f-display:     'Clash Grotesk', system-ui, sans-serif;
  --f-body:        'Satoshi', system-ui, sans-serif;
  --f-mono:        'JetBrains Mono', monospace;

  /* -- Layout (LK) -- */
  --sidebar:       240px;

  /* -- Adaptive: breakpoints, header, touch, gutters -- */
  --bp-l:          1024px;   /* tablet landscape */
  --bp-m:          768px;    /* tablet / small laptop */
  --bp-s:          480px;    /* small phone */
  --header-h:      52px;     /* sticky header height for sidebar offset */
  --touch:         40px;     /* minimum touch target */
  --gutter-m:      16px;     /* horizontal page gutter ≤768 */
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Root font-size: 100% = 16px browser default; all font-size in rem units scale with this. */
html { font-size: 100%; }


/* Header */
.header {
  background: var(--navy);
  border-bottom: 1px solid var(--navy-border);
  box-shadow: 0 1px 24px rgba(0,0,0,0.4);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}
.header-top {
  background: rgba(10, 16, 26, 0.96);
  border-bottom: 1px solid var(--navy-border);
  padding: 5px 0;
}
.header-top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-links {
  display: flex;
  gap: 2px;
  list-style: none;
}
.nav-links li a {
  font-family: var(--f-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(241,245,249,0.6);
  padding: 5px 10px;
  border-radius: var(--r);
  transition: all var(--tr);
}
.nav-links li a:hover { color: var(--light); background: rgba(8,145,178,0.12); }
.nav-links li a.active { color: var(--teal); background: rgba(8,145,178,0.12); }


.header-bottom { padding: 10px 0; }
.header-bottom-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.header-auth { display: flex; gap: 8px; align-items: center; }
.btn-ghost {
  font-size: 0.8125rem; font-weight: 500;
  color: rgba(241,245,249,0.7);
  border: 1px solid var(--navy-border);
  padding: 5px 14px;
  background: transparent;
}
.btn-ghost:hover { color: var(--teal); border-color: var(--teal); background: rgba(8,145,178,0.1); }
.btn-teal {
  font-size: 0.8125rem; font-weight: 600;
  color: var(--white);
  background: var(--teal);
  border: 1px solid var(--teal);
  padding: 5px 16px;
}
.btn-teal:hover { background: var(--teal-dark); border-color: var(--teal-dark); }

/* Search */
.search-bar {
  flex: 1;
  display: flex; align-items: center;
  max-width: none;
  min-width: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--navy-border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color var(--tr);
}
.search-bar:focus-within { border-color: var(--teal); background: rgba(8,145,178,0.06); }
.search-bar .autocomplete-wrap,
.search-bar .ac-wrap {
  flex: 1; min-width: 0; position: relative;
}
.search-type {
  font-family: var(--f-body);
  font-size: 0.75rem; color: rgba(241,245,249,0.5);
  padding: 0 10px;
  border-right: 1px solid var(--navy-border);
  white-space: nowrap; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.search-bar input {
  flex: 1; min-width: 0; width: 100%;
  background: transparent; border: none; outline: none;
  color: var(--light); font-family: var(--f-body);
  font-size: 0.8125rem; padding: 10px 14px;
}
.search-bar input::placeholder { color: rgba(241,245,249,0.35); }
.search-btn {
  background: var(--teal); border: none; color: var(--white);
  padding: 10px 18px; cursor: pointer;
  font-family: var(--f-body); font-size: 0.8125rem; font-weight: 600;
  transition: background var(--tr); white-space: nowrap;
}
.search-btn:hover { background: var(--teal-dark); }
.header__search__results {
  position: absolute;
  width: 100%;
  max-height: 300px;
  display: none;
  background: var(--bg);
  overflow-y: auto;
  border: 1px solid var(--bg-major-shade);
  border-radius: var(--controls-form-border-radius);
  border-top-right-radius: 0;
  border-top-left-radius: 0;
  z-index: 1050;
  top: 100%;
  border-top: 0;
}


/* Breadcrumbs */
.breadcrumbs {
  display: none;
  padding: 12px 0;
  align-items: center; gap: 6px;
  font-family: var(--f-body); font-size: 0.8125rem; color: var(--muted);
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--teal); }
.breadcrumbs .sep { color: var(--border); }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

/* Body */
body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button { cursor: pointer; font-family: var(--f-body); }

/* Links */
a { color: var(--teal); text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--teal-dark); }

/* Layout containers */
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}
.page-wrap {
  margin-top: 20px;
  padding: 0 16px 48px;
}

/* Utilities */
.hidden        { display: none !important; }
.flex-row      { display: flex; flex-direction: row; }
.flex-column   { display: flex; flex-direction: column; }
.grid          { display: grid; }
.inline-flex   { display: inline-flex; }

/* Visually hidden but accessible to screen readers (for live regions, labels, etc.) */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link — off-screen until keyboard-focused, then revealed as a
   small teal chip at the top-left of the viewport. Lets keyboard users
   jump past header chrome directly into the page content. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  z-index: var(--z-toast);
  background: var(--teal);
  color: var(--white);
  padding: 8px 14px;
  border-radius: var(--r);
  font-family: var(--f-body);
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 8px;
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* Tables */
.tbl-head {
  padding: 9px 14px;
  gap: 8px;
  background: var(--light);
  border-bottom: 1px solid var(--border);
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  align-items: center;
}

/* Pagination */
.pagination {
  display: flex;
  padding: 10px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.pg-info{
  font-size: 0.75rem;
  color: var(--muted);
}
.pg-btns{
  display: flex;
  gap: 3px;
}
.pg-btn{
  width: 30px;
  height: 30px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 0.75rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tr);
}
.pg-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.pg-btn.on {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}
/* Buttons */
/* Shared base for every .btn-* variant. */
.btn-primary, .btn-outline, .btn-ghost, .btn-teal, .btn-ghost-sm,
.btn-confirm, .btn-reject, .btn-modal-confirm, .btn-modal-reject,
.btn-filter-apply, .btn-filter-reset, .btn-order, .btn-order-login,
.btn-open, .btn-chat {
  font-family: var(--f-body);
  cursor: pointer;
  border-radius: var(--r);
  transition: all var(--tr);
}
.btn-primary {
  background: var(--teal);
  color: var(--white);
  border: none;
  font-size: 0.9375rem;
  font-weight: 700;
  padding: 13px;
  transition: background var(--tr);
}
.btn-primary:hover {
  background: var(--teal-dark);
}
.btn-primary:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

.btn-outline {
  width: 100%; background: transparent; color: var(--teal);
  border: 1.5px solid var(--teal);
  font-size: 0.875rem; font-weight: 600;
  padding: 11px;
}
.btn-outline:hover { background: var(--teal); color: var(--white); }

/* Footer */
.footer {
  background: var(--navy); border-top: 1px solid var(--navy-border);
  padding: 16px 0;
}
.footer-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.footer-logo-text {
  font-family: var(--f-display); font-size: 0.875rem; font-weight: 700;
  color: rgba(241,245,249,0.7);
}
.footer-legal { font-size: 0.75rem; color: rgba(241,245,249,0.6); }
a.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

/* Lazily created by _showToast() in account.js. Stacks vertically
   in the bottom-center of the viewport. Each toast fades in/out and
   is announced to SRs via its role="status". */
.toast-host {
  position: fixed;
  left: 0; right: 0;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast {
  background: var(--navy);
  color: var(--slate-100);
  padding: 12px 20px;
  border-radius: var(--r);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  font-family: var(--f-body);
  font-size: 0.8125rem;
  max-width: 460px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ═══ Adaptive: safe-area helper for fixed bars (iPhone home indicator) ═══ */
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0); }

/* ═══ Adaptive: mobile gutters (≤768) ═══ */
@media (max-width: 768px) {
  .header-top { display: none; }
  .breadcrumbs { display: none; }

  .wrap { padding: 0 var(--gutter-m); }
  .page-wrap { padding: 0 12px 32px; }
  /* Touch targets ≥40px on phones */
  .pg-btn { width: var(--touch); height: var(--touch); }

  .header-bottom { padding: 8px 0; }
  .logo-text { font-size: 1.0625rem; }
  .search-type { display: none; }
  .search-bar input { font-size: 0.8125rem; padding: 9px 10px; }
  .search-btn { padding: 9px 12px; font-size: 0.75rem; }
}

  /* Footer */
  .footer { padding: 14px 0; margin-top: 24px; }
  .footer-inner { flex-direction: column; gap: 8px; }
  .footer-legal { font-size: 0.6875rem; max-width: 100%; }
}


/* ═══ Adaptive: respect user motion preference ═══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
