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

:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #ef4444;
  --danger-dark: #dc2626;
}

body {
  font-family: 'Open Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
}

h1, h2, h3 {
  font-family: 'Montserrat', sans-serif;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}

h2 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

h3 {
  font-size: 16px;
  font-weight: 600;
}

.topbar {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 28px;
  display: grid;
  grid-template-columns: 320px 1fr auto;
  align-items: center;
  gap: 24px;
}

.topbar-left {
  min-width: 0;
}

.topbar-left h1 {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.topbar-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.menu {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.menu a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: 0.2s ease;
}

.menu a:hover {
  background: #eef2ff;
  color: var(--primary);
}

.menu a.active {
  background: var(--primary);
  color: #ffffff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--danger);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: 0.2s ease;
}

.logout-btn:hover {
  background: var(--danger-dark);
}

@media (max-width: 1200px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .menu {
    justify-content: flex-start;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px;
}

.panel {
  background: var(--card);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.section-subtitle {
  color: var(--muted);
  margin-top: 6px;
  font-size: 14px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: 0.2s ease;
  white-space: nowrap;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.1fr 1.1fr 1fr 0.9fr;
  gap: 14px;
  margin-bottom: 24px;
  align-items: end;
}

.filters input,
.filters select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

.filters input:focus,
.filters select:focus {
  border-color: var(--primary);
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid #edf0f5;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: #ffffff;
}

thead {
  background: #f8fafc;
}

th {
  text-align: left;
  padding: 16px 18px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

td {
  padding: 18px;
  font-size: 14px;
  border-top: 1px solid #eef2f7;
  vertical-align: middle;
}

tbody tr:hover {
  background: #fafcff;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.status.accepted {
  background: #dbeafe;
  color: #1d4ed8;
}

.status.progress {
  background: #fef3c7;
  color: #b45309;
}

.status.assigned {
  background: #ede9fe;
  color: #6d28d9;
}

.status.waiting {
  background: #ffedd5;
  color: #c2410c;
}

.status.done {
  background: #dcfce7;
  color: #15803d;
}

.status.issued {
  background: #ccfbf1;
  color: #0f766e;
}

.table-link {
  color: var(--primary);
  font-weight: 700;
}

.table-link:hover {
  color: var(--primary-dark);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
}

.login-container {
  width: 100%;
  max-width: 430px;
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 12px 35px rgba(37, 99, 235, 0.12);
}

.subtitle {
  color: var(--muted);
  margin: 10px 0 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form label {
  font-size: 14px;
  font-weight: 600;
}

.login-form input,
.login-form select,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
}

.login-form input:focus,
.login-form select:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.login-form button {
  margin-top: 8px;
  border: none;
  background: var(--primary);
  color: #ffffff;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.login-form button:hover {
  background: var(--primary-dark);
}

.form-panel {
  max-width: 1100px;
}

.request-form {
  margin-top: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  color: #111827;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}

.secondary-btn:hover {
  background: #d1d5db;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}

.detail-card {
  background: #f8fafc;
  border-radius: 16px;
  padding: 20px;
}

.detail-card h3 {
  margin-bottom: 14px;
}

.detail-card p {
  margin-bottom: 8px;
}

.full-card {
  margin-bottom: 18px;
}

.comments-list,
.history-list {
  padding-left: 20px;
}

.comments-list li,
.history-list li {
  margin-bottom: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.stat-card h3 {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-number {
  font-size: 30px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  color: #0f172a;
}

@media (max-width: 1200px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .menu {
    justify-content: flex-start;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .details-grid,
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .panel {
    padding: 18px;
  }

  h1 {
    font-size: 20px;
  }

  th,
  td {
    padding: 14px;
  }
}

.large-form-panel {
  max-width: 1500px;
  margin: 0 auto;
  padding: 34px 36px;
}

.form-page-header {
  margin-bottom: 26px;
}

.form-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 22px;
}

.form-group-full {
  margin-top: 4px;
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
  padding-top: 14px;
}

.form-actions-left {
  justify-content: flex-start;
  margin-top: 18px;
}

.form-actions .primary-btn,
.form-actions .secondary-btn {
  min-width: 150px;
}

@media (max-width: 900px) {
  .large-form-panel {
    padding: 24px 20px;
  }

  .form-grid-wide {
    grid-template-columns: 1fr;
  }

  .form-actions .primary-btn,
  .form-actions .secondary-btn {
    width: 100%;
  }
}

.filters-extended {
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
}

.filters input[type="date"] {
  width: 100%;
}

textarea,
input,
select,
button {
  font-family: 'Open Sans', sans-serif;
}

textarea::placeholder,
input::placeholder {
  font-family: 'Open Sans', sans-serif;
  color: #94a3b8;
  font-size: 14px;
}

input[type="date"] {
  font-family: 'Open Sans', sans-serif;
  color: #334155;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  background: #ffffff;
}

input[type="date"]::-webkit-datetime-edit {
  font-family: 'Open Sans', sans-serif;
  color: #334155;
}

input[type="date"]::-webkit-datetime-edit-text {
  color: #94a3b8;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.75;
}

input[type="date"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.date-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.date-field label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  padding-left: 2px;
  line-height: 1;
  min-height: 14px;
}

.form-group textarea {
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  color: #334155;
  line-height: 1.5;
}

.form-group textarea::placeholder {
  font-family: 'Open Sans', sans-serif;
  color: #94a3b8;
  font-size: 14px;
}

.filters input,
.filters select,
.date-field input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

.filters input:focus,
.filters select:focus,
.date-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.filter-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  padding-left: 2px;
  line-height: 1;
  min-height: 14px;
}

.filter-label-hidden {
  visibility: hidden;
}

.filter-reset-btn {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: none;
  cursor: pointer;
}

.filters-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.filter-field label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.filter-field input,
.filter-field select {
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
}

.filter-actions {
  margin-left: auto;
}

.filter-actions button {
  height: 42px;
  padding: 0 18px;
}

.filters-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.search-field {
  flex: 1;
  min-width: 250px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-field input,
.filter-field select {
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
}

/* фиксируем ширину остальных */
.filters-inline .filter-field:not(.search-field) {
  width: 160px;
}

/* кнопка справа */
.filter-actions {
  margin-left: auto;
}

.users-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: start;
}

.users-form-section {
  min-width: 0;
}

.edit-card {
  background: #f8fafc;
  border-radius: 18px;
  padding: 22px;
  border: 1px solid #e5e7eb;
}

.table-action-btn {
  border: none;
  background: #e0e7ff;
  color: #3730a3;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.table-action-btn:hover {
  background: #c7d2fe;
}

@media (max-width: 1100px) {
  .users-layout {
    grid-template-columns: 1fr;
  }
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-delete-btn {
  border: none;
  background: #fee2e2;
  color: #b91c1c;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.table-delete-btn:hover {
  background: #fecaca;
}

.table-link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.table-link-btn:hover {
  color: var(--primary-dark);
}

.request-form button.primary-btn {
  border: none;
  cursor: pointer;
}

.users-table-section,
.users-form-section {
  min-width: 0;
}

@media (max-width: 1200px) {
  .filters-inline {
    flex-wrap: wrap;
  }

  .filter-actions {
    margin-left: 0;
  }
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 240px;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
  animation: toastFadeIn 0.25s ease;
}

.toast.success {
  background: #22c55e;
}

.toast.error {
  background: #ef4444;
}

.toast.info {
  background: #3b82f6;
}

@keyframes toastFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: 0.2s ease;
  white-space: nowrap;
}

.danger-btn:hover {
  background: #dc2626;
}

.comment-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-form textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  resize: vertical;
  outline: none;
}

.comment-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.comment-form button {
  align-self: flex-start;
  border: none;
  cursor: pointer;
}

.form-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.client-field {
  grid-column: span 1;
}

.form-grid-wide .client-field:nth-child(1),
.form-grid-wide .client-field:nth-child(2),
.form-grid-wide .client-field:nth-child(3) {
  grid-column: span 1;
}

@media (min-width: 1100px) {
  .form-grid-wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-group-full {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1099px) {
  .form-grid-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .form-grid-wide {
    grid-template-columns: 1fr;
  }
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: #e5e7eb;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.2s ease;
}

.theme-toggle-btn:hover {
  background: #d1d5db;
}

body.dark-theme {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: #334155;
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --danger: #f87171;
  --danger-dark: #ef4444;

  background: var(--bg);
  color: var(--text);
}

body.dark-theme .topbar,
body.dark-theme .panel,
body.dark-theme .stat-card,
body.dark-theme .login-card {
  background: var(--card);
  color: var(--text);
  border-color: var(--line);
}

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme td,
body.dark-theme th,
body.dark-theme label,
body.dark-theme .detail-card p {
  color: var(--text);
}

body.dark-theme .topbar-left h1,
body.dark-theme .section-subtitle,
body.dark-theme .topbar-subtitle,
body.dark-theme .subtitle,
body.dark-theme .stat-card h3 {
  color: var(--muted);
}

body.dark-theme .menu a {
  color: #cbd5e1;
}

body.dark-theme .menu a:hover {
  background: #1e293b;
  color: #bfdbfe;
}

body.dark-theme .menu a.active {
  background: var(--primary);
  color: #0f172a;
}

body.dark-theme .badge {
  background: #1e3a8a;
  color: #dbeafe;
}

body.dark-theme .detail-card,
body.dark-theme thead {
  background: #1e293b;
}

body.dark-theme tbody tr:hover {
  background: #172033;
}

body.dark-theme table,
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
  background: #0f172a;
  color: var(--text);
  border-color: var(--line);
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
  color: #64748b;
}

body.dark-theme .table-wrapper {
  border-color: var(--line);
}

body.dark-theme td {
  border-top-color: var(--line);
}

body.dark-theme .secondary-btn,
body.dark-theme .theme-toggle-btn {
  background: #334155;
  color: #f8fafc;
}

body.dark-theme .secondary-btn:hover,
body.dark-theme .theme-toggle-btn:hover {
  background: #475569;
}

body.dark-theme .login-page {
  background: linear-gradient(135deg, #020617, #0f172a);
}

/* =========================
   УЛУЧШЕННАЯ ТЁМНАЯ ТЕМА
========================= */

body.dark-theme {
  --bg: #0b1220;
  --card: #111c2e;
  --card-soft: #18243a;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: #334155;
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --danger: #fb7185;
  --danger-dark: #f43f5e;

  background: var(--bg);
  color: var(--text);
}

body.dark-theme .topbar {
  background: #111827;
  border-bottom-color: #263449;
}

body.dark-theme .panel,
body.dark-theme .stat-card,
body.dark-theme .login-card {
  background: var(--card);
  color: var(--text);
  border: 1px solid #263449;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
}

body.dark-theme .detail-card,
body.dark-theme .edit-card {
  background: var(--card-soft);
  color: var(--text);
  border: 1px solid #2f3f59;
}

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme label,
body.dark-theme td,
body.dark-theme th,
body.dark-theme .detail-card p,
body.dark-theme .login-card h1 {
  color: var(--text);
}

body.dark-theme .topbar-left h1 {
  color: #f8fafc;
}

body.dark-theme .topbar-subtitle,
body.dark-theme .section-subtitle,
body.dark-theme .subtitle,
body.dark-theme .stat-card h3,
body.dark-theme .filter-field label {
  color: var(--muted);
}

body.dark-theme .stat-number {
  color: #ffffff;
}

body.dark-theme .stats-grid .stat-card {
  background: #142036;
}

body.dark-theme .table-wrapper {
  border-color: #334155;
  background: #101827;
}

body.dark-theme table {
  background: #101827;
  color: var(--text);
}

body.dark-theme thead {
  background: #1e293b;
}

body.dark-theme th {
  color: #e2e8f0;
}

body.dark-theme td {
  color: #f1f5f9;
  border-top-color: #334155;
}

body.dark-theme tbody tr:hover {
  background: #1b2940;
}

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
  background: #0f172a;
  color: #f8fafc;
  border-color: #475569;
}

body.dark-theme input:focus,
body.dark-theme select:focus,
body.dark-theme textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
  color: #94a3b8;
}

body.dark-theme input[type="date"] {
  color: #f8fafc;
}

body.dark-theme input[type="date"]::-webkit-datetime-edit {
  color: #f8fafc;
}

body.dark-theme input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.8;
}

body.dark-theme .menu a {
  color: #e2e8f0;
}

body.dark-theme .menu a:hover {
  background: #1e293b;
  color: #93c5fd;
}

body.dark-theme .menu a.active {
  background: #60a5fa;
  color: #0f172a;
}

body.dark-theme .badge {
  background: #1d4ed8;
  color: #ffffff;
}

body.dark-theme .logout-btn {
  background: #fb7185;
  color: #ffffff;
}

body.dark-theme .logout-btn:hover {
  background: #f43f5e;
}

body.dark-theme .primary-btn,
body.dark-theme .login-form button {
  background: #60a5fa;
  color: #0f172a;
}

body.dark-theme .primary-btn:hover,
body.dark-theme .login-form button:hover {
  background: #93c5fd;
}

body.dark-theme .secondary-btn,
body.dark-theme .theme-toggle-btn {
  background: #334155;
  color: #f8fafc;
  border: 1px solid #475569;
}

body.dark-theme .secondary-btn:hover,
body.dark-theme .theme-toggle-btn:hover {
  background: #475569;
}

body.dark-theme .table-link-btn,
body.dark-theme .table-action-btn {
  color: #93c5fd;
}

body.dark-theme .login-page,
body.login-page.dark-theme {
  background: linear-gradient(135deg, #020617, #0b1220);
}

/* Кнопка темы в верхнем меню */
.theme-toggle-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: none;
  background: #e5e7eb;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* Кнопка темы на странице входа — в размер кнопки "Войти" */
body.login-page .theme-toggle-btn {
  width: 100%;
  height: 54px;
  margin-top: 14px;
  padding: 0 16px;
  border-radius: 14px;
  font-size: 16px;
  justify-content: center;
}

/* Чтобы кнопка темы на странице входа не прилипала к форме */
body.login-page .login-card .theme-toggle-btn {
  display: flex;
}

/* =========================
   КНОПКИ ДЕЙСТВИЙ В ТАБЛИЦАХ
========================= */

.user-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.table-action-btn,
.table-delete-btn,
.table-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 118px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.2s ease;
}

.table-action-btn {
  background: #dbeafe;
  color: #1d4ed8;
}

.table-action-btn:hover {
  background: #bfdbfe;
  color: #1e40af;
}

.table-delete-btn {
  background: #fee2e2;
  color: #b91c1c;
}

.table-delete-btn:hover {
  background: #fecaca;
  color: #991b1b;
}

.table-link-btn {
  background: #eef2ff;
  color: #2563eb;
}

.table-link-btn:hover {
  background: #dbeafe;
  color: #1d4ed8;
}

/* Чтобы колонка "Действие" не сжимала кнопки */
#usersTableBody td:last-child,
#usersTableBody th:last-child {
  min-width: 260px;
  width: 260px;
}

/* =========================
   КНОПКИ ДЕЙСТВИЙ В ТЁМНОЙ ТЕМЕ
========================= */

body.dark-theme .table-action-btn {
  background: #1d4ed8;
  color: #ffffff;
  border: 1px solid #3b82f6;
}

body.dark-theme .table-action-btn:hover {
  background: #2563eb;
}

body.dark-theme .table-delete-btn {
  background: #be123c;
  color: #ffffff;
  border: 1px solid #fb7185;
}

body.dark-theme .table-delete-btn:hover {
  background: #e11d48;
}

body.dark-theme .table-link-btn {
  background: #1e3a8a;
  color: #dbeafe;
  border: 1px solid #3b82f6;
}

body.dark-theme .table-link-btn:hover {
  background: #2563eb;
  color: #ffffff;
}

/* =========================
   СТАТУСЫ В ТЁМНОЙ ТЕМЕ
========================= */

body.dark-theme .status {
  border: 1px solid transparent;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

body.dark-theme .status.accepted {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #60a5fa;
}

body.dark-theme .status.assigned {
  background: #6d28d9;
  color: #ffffff;
  border-color: #a78bfa;
}

body.dark-theme .status.progress {
  background: #92400e;
  color: #fff7ed;
  border-color: #f59e0b;
}

body.dark-theme .status.waiting {
  background: #c2410c;
  color: #fff7ed;
  border-color: #fb923c;
}

body.dark-theme .status.done {
  background: #15803d;
  color: #ecfdf5;
  border-color: #4ade80;
}

body.dark-theme .status.issued {
  background: #0f766e;
  color: #ecfeff;
  border-color: #2dd4bf;
}

/* =========================
   ТАБЛИЦА ЗАЯВОК В ТЁМНОЙ ТЕМЕ
========================= */

body.dark-theme #requestsTableBody tr {
  background: #101827;
}

body.dark-theme #requestsTableBody tr:nth-child(even) {
  background: #111d30;
}

body.dark-theme #requestsTableBody tr:hover {
  background: #1b2a44;
}

body.dark-theme #requestsTableBody td {
  color: #f8fafc;
}

body.dark-theme #requestsTableBody td:nth-child(1) {
  color: #bfdbfe;
  font-weight: 700;
}

body.dark-theme #requestsTableBody td:nth-child(2),
body.dark-theme #requestsTableBody td:nth-child(3),
body.dark-theme #requestsTableBody td:nth-child(4) {
  color: #e2e8f0;
}

body.dark-theme #requestsTableBody td:nth-child(6),
body.dark-theme #requestsTableBody td:nth-child(7) {
  color: #cbd5e1;
}

/* =========================
   КНОПКА ВЫХОД В ТЁМНОЙ ТЕМЕ
========================= */

body.dark-theme .logout-btn {
  background: linear-gradient(135deg, #ef4444, #be123c);
  color: #ffffff;
  border: 1px solid #fb7185;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.28);
}

body.dark-theme .logout-btn:hover {
  background: linear-gradient(135deg, #f87171, #e11d48);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(248, 113, 113, 0.38);
  transform: translateY(-1px);
}

body.dark-theme .logout-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* =========================
   ПЕЧАТЬ ОТЧЁТА
========================= */

.report-meta-panel {
  margin-bottom: 22px;
}

.report-meta-panel h2 {
  margin-bottom: 8px;
}

.report-meta-panel p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}

.report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .topbar,
  .filters-inline,
  .report-actions,
  .theme-toggle-btn,
  .logout-btn,
  .badge {
    display: none !important;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .panel,
  .stat-card {
    box-shadow: none !important;
    border: 1px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }

  .stat-card h3,
  .stat-number,
  h1,
  h2,
  h3,
  p,
  th,
  td {
    color: #000000 !important;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff !important;
    color: #000000 !important;
  }

  th,
  td {
    border: 1px solid #000000 !important;
    padding: 8px !important;
  }

  thead {
    background: #eeeeee !important;
  }

  .status {
    border: 1px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

body.dark-theme .field-hint {
  color: #94a3b8;
}

/* =========================
   СТРАНИЦА ПОЛЬЗОВАТЕЛЕЙ — УЛУЧШЕННАЯ СЕТКА
========================= */

.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(320px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.users-table-section {
  min-width: 0;
}

.users-form-section {
  max-width: 430px;
  width: 100%;
  justify-self: end;
}

.users-form-section .edit-card {
  padding: 22px;
}

.users-table-section table {
  min-width: 980px;
}

.users-table-section .table-wrapper {
  width: 100%;
}

/* Делаем форму справа визуально компактнее */
.users-form-section .form-group {
  margin-bottom: 14px;
}

.users-form-section .form-group input,
.users-form-section .form-group select {
  height: 42px;
}

.users-form-section .form-actions {
  gap: 10px;
}

.users-form-section .form-actions .primary-btn,
.users-form-section .form-actions .secondary-btn {
  min-width: 130px;
}

/* Чтобы кнопки в таблице не обрезались */
.users-table-section td:last-child,
.users-table-section th:last-child {
  width: 270px;
  min-width: 270px;
}

/* Адаптив */
@media (max-width: 1200px) {
  .users-layout {
    grid-template-columns: 1fr;
  }

  .users-form-section {
    max-width: 100%;
    justify-self: stretch;
  }
}

/* =========================
   АНАЛИТИКА ПО ЗАЯВКАМ
========================= */

.analytics-panel {
  margin-bottom: 22px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.analytics-card {
  background: #f8fafc;
  border: 1px solid #edf0f5;
  border-radius: 16px;
  padding: 20px;
}

.analytics-card h3 {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.analytics-card p {
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  font-family: 'Montserrat', sans-serif;
}

body.dark-theme .analytics-card {
  background: #18243a;
  border-color: #334155;
}

body.dark-theme .analytics-card h3 {
  color: #cbd5e1;
}

body.dark-theme .analytics-card p {
  color: #ffffff;
}

@media (max-width: 1100px) {
  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   ЗАБЛОКИРОВАННЫЕ ПОЛЯ
========================= */

input:disabled,
select:disabled,
textarea:disabled {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border-color: #cbd5e1 !important;
  cursor: not-allowed;
  opacity: 1;
}

input:disabled::placeholder,
textarea:disabled::placeholder {
  color: #94a3b8 !important;
}

body.dark-theme input:disabled,
body.dark-theme select:disabled,
body.dark-theme textarea:disabled {
  background: #1e293b !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
  cursor: not-allowed;
  opacity: 1;
}

body.dark-theme input:disabled::placeholder,
body.dark-theme textarea:disabled::placeholder {
  color: #64748b !important;
}

/* Небольшой визуальный намёк, что поле закрыто для роли */
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
  box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.12);
}

/* =========================
   РОВНЫЕ СТАТУСЫ В ТАБЛИЦЕ
========================= */

.status {
  min-width: 132px;
  max-width: 132px;
  min-height: 36px;
  padding: 7px 10px;
  text-align: center;
  line-height: 1.15;
  white-space: normal;
}

#requestsTableBody .status {
  width: 132px;
}

#requestsTableBody td:nth-child(5) {
  width: 150px;
  min-width: 150px;
}

/* Чуть компактнее для длинных статусов */
.status.waiting,
.status.issued {
  font-size: 12px;
}

.status {
  min-width: 150px;
  max-width: 150px;
  white-space: nowrap;
}

/* =========================
   ФИКСИРОВАННЫЕ БЕЙДЖИ СТАТУСОВ
========================= */

#requestsTableBody td:nth-child(5) {
  width: 160px !important;
  min-width: 160px !important;
  max-width: 160px !important;
}

#requestsTableBody .status {
  width: 136px !important;
  min-width: 136px !important;
  max-width: 136px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 0 10px !important;
  border-radius: 999px !important;

  text-align: center !important;
  line-height: 1.1 !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow: hidden !important;

  font-size: 12px !important;
  font-weight: 800 !important;
}

#requestsTableBody .status.accepted,
#requestsTableBody .status.assigned,
#requestsTableBody .status.progress,
#requestsTableBody .status.waiting,
#requestsTableBody .status.done,
#requestsTableBody .status.issued {
  box-sizing: border-box !important;
}

/* =========================
   ПЕЧАТЬ: ОТЧЁТ ПО МАСТЕРАМ СО ВТОРОЙ СТРАНИЦЫ
========================= */

@media print {
  .report-masters-panel {
    break-before: page !important;
    page-break-before: always !important;
  }
}

/* =========================
   ПРИВЕТСТВИЕ ПОЛЬЗОВАТЕЛЯ
========================= */

.user-greeting {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid #e2e8f0;
}

body.dark-theme .user-greeting {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

/* =========================
   МЯГКИЙ СОВРЕМЕННЫЙ ФОН БЕЗ КАРТИНОК
========================= */

body {
  background-color: #f3f6fb;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(37, 99, 235, 0.10), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.10), transparent 26%),
    radial-gradient(circle at 82% 86%, rgba(99, 102, 241, 0.09), transparent 28%),
    linear-gradient(rgba(255, 255, 255, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.45) 1px, transparent 1px);
  background-size:
    auto,
    auto,
    auto,
    44px 44px,
    44px 44px;
  background-attachment: fixed;
}

body.dark-theme {
  background-color: #0b1220;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(59, 130, 246, 0.16), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.13), transparent 28%),
    radial-gradient(circle at 82% 86%, rgba(99, 102, 241, 0.14), transparent 30%),
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size:
    auto,
    auto,
    auto,
    44px 44px,
    44px 44px;
  background-attachment: fixed;
}

.login-page {
  background-color: #eef4ff;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.16), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(14, 165, 233, 0.14), transparent 28%),
    radial-gradient(circle at 70% 90%, rgba(99, 102, 241, 0.12), transparent 32%),
    linear-gradient(rgba(255, 255, 255, 0.42) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.42) 1px, transparent 1px);
  background-size:
    auto,
    auto,
    auto,
    44px 44px,
    44px 44px;
  background-attachment: fixed;
}

body.dark-theme.login-page {
  background-color: #0b1220;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.18), transparent 32%),
    radial-gradient(circle at 85% 15%, rgba(14, 165, 233, 0.14), transparent 28%),
    radial-gradient(circle at 70% 90%, rgba(99, 102, 241, 0.15), transparent 32%),
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size:
    auto,
    auto,
    auto,
    44px 44px,
    44px 44px;
  background-attachment: fixed;
}

/* =========================
   ОБНОВЛЁННЫЕ КНОПКИ
========================= */

.primary-btn,
.login-form button {
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.primary-btn:hover,
.login-form button:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
  transform: translateY(-1px);
}

.secondary-btn {
  border: 1px solid #d1d5db;
  cursor: pointer;
  background: linear-gradient(135deg, #f8fafc, #e5e7eb);
  color: #1f2937;
}

.secondary-btn:hover {
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
  transform: translateY(-1px);
}

.danger-btn,
.logout-btn {
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.22);
}

.danger-btn:hover,
.logout-btn:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 10px 22px rgba(239, 68, 68, 0.28);
  transform: translateY(-1px);
}

.table-action-btn {
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  color: #3730a3;
}

.table-action-btn:hover {
  background: linear-gradient(135deg, #c7d2fe, #a5b4fc);
  transform: translateY(-1px);
}

.table-delete-btn {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #991b1b;
}

.table-delete-btn:hover {
  background: linear-gradient(135deg, #fecaca, #fca5a5);
  transform: translateY(-1px);
}

.theme-toggle-btn {
  cursor: pointer;
  transition: 0.2s ease;
}

.theme-toggle-btn:hover {
  transform: translateY(-1px);
}

button,
.primary-btn,
.secondary-btn,
.danger-btn,
.logout-btn,
.table-action-btn,
.table-delete-btn,
.theme-toggle-btn {
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

/* =========================
   ВЛОЖЕНИЯ К ЗАЯВКЕ
========================= */

.attachments-list {
  list-style: none;
  padding-left: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.attachment-empty {
  padding: 18px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed #cbd5e1;
  color: var(--muted);
  font-size: 15px;
}

.attachment-item {
  margin: 0;
}

.attachment-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(9, 18, 43, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

.attachment-visual {
  flex-shrink: 0;
}

.attachment-file-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(96, 165, 250, 0.14);
  font-size: 28px;
}

.attachment-preview-trigger {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  display: block;
}

.attachment-thumb {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.attachment-preview-trigger:hover .attachment-thumb {
  transform: scale(1.03);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.24);
}

.attachment-body {
  flex: 1;
  min-width: 0;
}

.attachment-link {
  display: inline-block;
  color: #60a5fa;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  margin-bottom: 6px;
  word-break: break-word;
}

.attachment-link:hover {
  color: #93c5fd;
}

.attachment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.5;
}

.attachment-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
}

.attachment-form input[type="file"] {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  background: rgba(8, 20, 48, 0.52);
  color: #e5e7eb;
  font-family: inherit;
  font-size: 15px;
}

.attachment-form input[type="file"]::file-selector-button {
  margin-right: 14px;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e3a8a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.attachment-form input[type="file"]::file-selector-button:hover {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

/* =========================
   ПОЛНОЭКРАННЫЙ ПРЕДПРОСМОТР ВЛОЖЕНИЙ
========================= */

.attachment-preview-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;

  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;

  display: none !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 32px;
  z-index: 999999 !important;
}

.attachment-preview-modal.active {
  display: flex !important;
}

.attachment-preview-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;

  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;

  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.attachment-preview-content {
  position: relative;
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: center;

  max-width: 92vw;
  max-height: 86vh;
}

.attachment-preview-content img {
  display: block;

  max-width: 92vw;
  max-height: 86vh;

  object-fit: contain;
  border-radius: 18px;

  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.attachment-preview-close {
  position: absolute;
  top: -18px;
  right: -18px;
  z-index: 3;

  width: 44px;
  height: 44px;

  border: none;
  border-radius: 999px;

  background: #ffffff;
  color: #0f172a;

  font-size: 20px;
  font-weight: 800;
  cursor: pointer;

  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.attachment-preview-close:hover {
  transform: scale(1.04);
}

html.modal-open,
body.modal-open {
  overflow: hidden !important;
}

body:not(.dark-theme) .attachment-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(203, 213, 225, 0.8);
}

body:not(.dark-theme) .attachment-meta {
  color: #64748b;
}

body:not(.dark-theme) .attachment-form input[type="file"] {
  background: rgba(255, 255, 255, 0.86);
  color: #1f2937;
  border-color: #cbd5e1;
}

@media (max-width: 768px) {
  .attachment-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .attachment-form {
    grid-template-columns: 1fr;
  }

  .attachment-thumb {
    width: 100%;
    max-width: 220px;
    height: auto;
  }
}

/* Отступ для подсказки под загрузкой файлов */
.attachment-form + .field-hint {
  margin-top: 12px;
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* =========================
   УСИЛЕНИЕ СВЕТЛОЙ ТЕМЫ
========================= */

body:not(.dark-theme) {
  --bg: #eef4ff;
  --card: #ffffff;
  --text: #172033;
  --muted: #5b677a;
  --line: #dbe3ef;
}

body:not(.dark-theme) .panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(203, 213, 225, 0.75);
  box-shadow: 0 18px 45px rgba(37, 99, 235, 0.10);
}

body:not(.dark-theme) .topbar {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #dbe3ef;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

body:not(.dark-theme) .table-wrapper {
  border-color: #dce5f2;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.045);
}

body:not(.dark-theme) table {
  background: #ffffff;
}

body:not(.dark-theme) thead {
  background: #f1f5fb;
}

body:not(.dark-theme) th {
  color: #475569;
}

body:not(.dark-theme) td {
  border-top-color: #e3eaf4;
  color: #253246;
}

body:not(.dark-theme) tbody tr:hover {
  background: #f6f9ff;
}

body:not(.dark-theme) .filters input,
body:not(.dark-theme) .filters select,
body:not(.dark-theme) .form-group input,
body:not(.dark-theme) .form-group select,
body:not(.dark-theme) .form-group textarea,
body:not(.dark-theme) .login-form input {
  background: #ffffff;
  border-color: #d6deea;
  color: #172033;
}

body:not(.dark-theme) .filters input:focus,
body:not(.dark-theme) .filters select:focus,
body:not(.dark-theme) .form-group input:focus,
body:not(.dark-theme) .form-group select:focus,
body:not(.dark-theme) .form-group textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

/* Более выразительные статусы в светлой теме */
body:not(.dark-theme) .status.accepted {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

body:not(.dark-theme) .status.assigned {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

body:not(.dark-theme) .status.progress {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

body:not(.dark-theme) .status.waiting {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

body:not(.dark-theme) .status.done {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

body:not(.dark-theme) .status.issued {
  background: #ccfbf1;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

/* Кнопки в светлой теме чуть насыщеннее */
body:not(.dark-theme) .primary-btn,
body:not(.dark-theme) .login-form button {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

body:not(.dark-theme) .table-link-btn {
  background: #e8efff;
  color: #1d4ed8;
  border: 1px solid #c7d2fe;
}

body:not(.dark-theme) .table-link-btn:hover {
  background: #dbeafe;
  color: #1e40af;
}

body:not(.dark-theme) .secondary-btn,
body:not(.dark-theme) .filter-reset-btn {
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  color: #334155;
  border: 1px solid #cbd5e1;
}

body:not(.dark-theme) .badge {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

body:not(.dark-theme) .user-greeting {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #dbe3ef;
}

/* =========================
   ИНДИКАТОР ПОДКЛЮЧЕНИЯ К СЕРВЕРУ
========================= */

.server-status-dot {
  width: 9px;
  height: 9px;
  margin-left: 8px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}

.server-status-dot.online {
  background: #22c55e;
  box-shadow:
    0 0 0 3px rgba(34, 197, 94, 0.18),
    0 0 12px rgba(34, 197, 94, 0.55);
}

.server-status-dot.offline {
  background: #ef4444;
  box-shadow:
    0 0 0 3px rgba(239, 68, 68, 0.18),
    0 0 12px rgba(239, 68, 68, 0.5);
}

.server-status-dot.checking {
  background: #f59e0b;
  box-shadow:
    0 0 0 3px rgba(245, 158, 11, 0.18),
    0 0 12px rgba(245, 158, 11, 0.45);
}

/* =========================
   ПЛАВНЫЕ ПЕРЕХОДЫ МЕЖДУ СТРАНИЦАМИ
========================= */

body {
  opacity: 0;
  transition: opacity 0.22s ease;
}

body.page-loaded {
  opacity: 1;
}

body.page-leaving {
  opacity: 0;
}

.panel {
  animation: panelAppear 0.28s ease both;
}

@keyframes panelAppear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .panel {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
}

/* =========================
   СООБЩЕНИЕ О ЗАВЕРШЕНИИ СЕАНСА
========================= */

.logout-message-box {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0;
  padding: 16px 18px;
  border-radius: 18px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  box-shadow: 0 12px 28px rgba(251, 146, 60, 0.16);
}

.logout-message-box strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 800;
}

.logout-message-box p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #9a3412;
}

.logout-message-box button {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: rgba(251, 146, 60, 0.18);
  color: #9a3412;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.logout-message-box button:hover {
  background: rgba(251, 146, 60, 0.28);
}

body.dark-theme .logout-message-box {
  background: rgba(251, 146, 60, 0.12);
  border-color: rgba(251, 146, 60, 0.32);
  color: #fed7aa;
}

body.dark-theme .logout-message-box p {
  color: #fdba74;
}

body.dark-theme .logout-message-box button {
  background: rgba(251, 146, 60, 0.18);
  color: #fed7aa;
}

