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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  display: flex;
  min-height: 100vh;
  overflow-y: scroll;
}

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: #fff;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px 12px;
  font-weight: 600;
  font-size: 15px;
  color: #1a1a1a;
  border-bottom: 1px solid #f0f0f0;
}

.sidebar-search {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.sidebar-search input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  background: #fafafa;
  outline: none;
}

.sidebar-search input:focus { border-color: #999; background: #fff; }

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-group-label {
  padding: 6px 16px 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.nav-group-label:hover { color: #555; }

.nav-group-arrow { font-size: 10px; transition: transform 0.2s; }
.nav-group-arrow.open { transform: rotate(180deg); }

.nav-item {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  color: #444;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  margin: 1px 8px;
  transition: background 0.15s;
}

.nav-item:hover { background: #f5f5f5; color: #1a1a1a; }
.nav-item.active { background: #f0f0f0; color: #1a1a1a; font-weight: 500; }
.nav-item.sub { padding-left: 28px; font-size: 13px; }

/* ── Main content ── */
.main-login {
  width: 100vw;
  min-height: 100vh;
}

.main-content {
  margin-left: 220px;
  width: calc(100vw - 220px);
  max-width: 972px;
  padding: 32px;
  min-height: 100vh;
  box-sizing: border-box;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 22px; font-weight: 700; color: #1a1a1a; }

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #ebebeb;
  padding: 24px;
  margin-bottom: 16px;
}

/* ── Stats row (dashboard) ── */
.stats-row { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #ebebeb;
  padding: 20px 24px;
}
.stat-label { font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: #1a1a1a; }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #888;
  padding: 10px 12px;
  border-bottom: 1px solid #ebebeb;
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid #f5f5f5;
  font-size: 14px;
  color: #333;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }
.data-table tbody tr { cursor: pointer; }

/* ── Buttons ── */
.btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: #1a1a1a; color: #fff; }
.btn-secondary { background: #f0f0f0; color: #333; }
.btn-danger { background: #d32f2f; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ── Form ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}
.form-control:focus { border-color: #1a1a1a; }
textarea.form-control { resize: vertical; }
select.form-control { cursor: pointer; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #888; line-height: 1; }
.modal-close:hover { color: #333; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid #f0f0f0; }

/* ── Search bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.search-input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
.search-input:focus { border-color: #1a1a1a; }

/* ── Color dot ── */
.color-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.1);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #aaa;
  font-size: 15px;
}

/* ── Loading ── */
.loading { text-align: center; padding: 40px; color: #aaa; font-size: 14px; }

/* ── Tag / badge ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #f0f0f0;
  color: #555;
}

/* ── Settings ── */
.settings-section-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}
.settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.settings-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.settings-tab:hover { color: #2563eb !important; }

/* ── Receipt contact rows ── */
.rcpt-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  color: #444;
  padding-bottom: 2px;
}
.rcpt-ico {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

/* ── Print / PDF ── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: #555;
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: #f5f5f5; color: #1a1a1a; }
.btn-icon svg { width: 18px; height: 18px; }

@media print {
  .sidebar, .no-print { display: none !important; }
  .main-content {
    margin-left: 0 !important;
    padding: 16px !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  body { background: #fff; display: block; }

  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    margin-bottom: 16px !important;
    break-inside: avoid;
  }
  .page-header { margin-bottom: 16px; }

  /* Таблицы */
  .data-table {
    border-collapse: collapse !important;
    width: 100% !important;
  }
  .data-table th,
  .data-table td {
    border: 1px solid #ccc !important;
    padding: 6px 10px !important;
    font-size: 11px !important;
  }
  /* Принудительная печать фона без галочки "Печатать фон" */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .data-table th {
    background: #f0f0f0 !important;
    font-weight: 600;
  }
  .data-table tbody tr:nth-child(even) td {
    background: #f8f8f8 !important;
  }
  .data-table tfoot td {
    border-top: 2px solid #aaa !important;
    background: #f0f0f0 !important;
    font-weight: 700;
  }
}
