/* Светлая тема в стиле современной платформы: мягкий фон, чёткий текст, аккуратные акценты */
:root {
  --bg: #f6f8fa;
  --bg-card: #ffffff;
  --bg-secondary: #f3f4f6;
  --text: #24292f;
  --text-light: #57606a;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-light: #e0e7ff;
  --border: #d0d7de;
  --border-light: #eaeef2;
  --row-alt: #f6f8fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-size-sm: 0.85rem;
  --font-size-md: 0.9rem;
  --font-size-lg: 1rem;
}

body.dark {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-secondary: #1e293b;
  --text: #f8fafc;
  --text-light: #94a3b8;
  --accent: #818cf8;
  --accent-dark: #6366f1;
  --border: #334155;
  --border-light: #475569;
  --row-alt: #1e293b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: var(--font-size-md);
}

body {
  background-color: var(--bg);
  color: var(--text);
  padding: 16px;
  transition: var(--transition);
  line-height: 1.4;
}

@keyframes fogReveal {
  from {
    opacity: 0;
    filter: blur(12px);
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

body:not(.page-reveal) .header,
body:not(.page-reveal) .main .panel,
body:not(.page-reveal) .footer {
  opacity: 0;
}

body.page-reveal .header {
  animation: fogReveal 0.7s ease-out forwards;
}

body.page-reveal .main .panel:nth-child(1) {
  animation: fogReveal 0.6s ease-out 0.12s forwards;
}

body.page-reveal .main .panel:nth-child(2) {
  animation: fogReveal 0.6s ease-out 0.24s forwards;
}

body.page-reveal .footer {
  animation: fogReveal 0.5s ease-out 0.36s forwards;
}

.login-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.login-bar input {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text);
}
.login-bar button {
  padding: 6px 12px;
}
.login-bar #loginInfo {
  font-size: 12px;
  color: var(--text-light);
}

.header {
  position: relative;
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
  transition: var(--transition);
}

.management-btn {
  position: relative;
  display: inline-block;
}

.management-btn .btn {
  padding: 8px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.management-btn .btn:hover {
  background-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.management-btn .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 5px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 220px;
  z-index: 100;
  animation: slideInDown 0.2s ease-out;
}

.management-btn.active .dropdown-menu {
  display: block;
}

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

.management-btn .dropdown-menu a {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.management-btn .dropdown-menu a:last-child {
  border-bottom: none;
}

.management-btn .dropdown-menu a:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

.management-btn .dropdown-menu a i,
.management-btn .dropdown-menu .dropdown-menu-btn i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
  font-size: 14px;
}

.management-btn .dropdown-menu .dropdown-menu-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 16px;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: var(--transition);
}
.management-btn .dropdown-menu .dropdown-menu-btn:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

.management-btn .dropdown-menu .menu-divider {
  height: 1px;
  background-color: var(--border);
  margin: 5px 0;
}

.management-btn .dropdown-menu .danger {
  color: #dc2626;
}

.management-btn .dropdown-menu .danger:hover {
  background-color: #fee2e2;
}

.management-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  position: relative;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex-grow: 1;
}

.filter-group {
  position: relative;
}

.filter-group i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  font-size: var(--font-size-sm);
}

select, input[type="date"], input[type="text"], input[type="tel"] {
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
  font-size: var(--font-size-sm);
  height: 36px;
  min-width: 160px;
}

input[type="text"], input[type="tel"] {
  padding-left: 32px;
  width: 200px;
}

select:hover, input[type="date"]:hover, input[type="text"]:hover, input[type="tel"]:hover {
  border-color: var(--accent-light);
}

select:focus, input[type="date"]:focus, input[type="text"]:focus, input[type="tel"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.main {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.panel {
  background-color: var(--bg-card);
  padding: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex: 1;
  min-width: 300px;
  max-height: 65vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.staff-panel {
  max-height: 80vh;
  flex: 0.9 1 300px;
}

.attendance-panel {
  max-height: 80vh;
}

.main > .panel:not(.staff-panel) {
  flex: 1.1 1 300px;
}

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.staff-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.staff-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.staff-actions .btn-outline {
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.panel-header h3 {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text);
}

.panel-header h3 .panel-date {
  font-weight: 500;
  color: var(--text-light);
  margin-left: 0.35em;
}

.select-cell {
  width: 36px;
  text-align: center;
}

.panel-body {
  overflow-y: auto;
  flex-grow: 1;
}

.panel-body,
.table-container {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-light) var(--border-light);
}
.panel-body::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
.panel-body::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: 3px;
}
.panel-body::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 3px;
}

.staff-loading-cell {
  padding: 24px !important;
  text-align: center;
  vertical-align: middle;
}
.staff-loading-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-light);
  font-size: var(--font-size-sm);
}
.staff-loading-state i {
  color: var(--primary, #3b82f6);
}

.badge {
  background-color: var(--accent);
  color: white;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: var(--font-size-sm);
  font-weight: 500;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

th, td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

#staffTable td:nth-child(1) {
  padding-left: 8px;
  line-height: 1.4;
}

.employee-detail {
  font-size: var(--font-size-sm);
  color: var(--text);
  margin-top: 2px;
}

.employee-label {
  color: var(--text-light);
  margin-right: 4px;
}

th {
  font-weight: 600;
  color: var(--text);
  background-color: var(--bg-card);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

th i {
  margin-left: 4px;
  color: var(--text-light);
  font-size: var(--font-size-sm);
}

tr:nth-child(even) {
  background-color: var(--row-alt);
}

tr:hover {
  background-color: rgba(59, 130, 246, 0.05);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  font-size: var(--font-size-sm);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
}

.footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

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

.developer-credit {
  color: var(--text-light);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  align-self: center;
}

button {
  padding: 8px 12px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  font-size: var(--font-size-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

button:hover {
  background-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

button:active {
  transform: translateY(0);
}

.theme-toggle {
  background-color: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.theme-toggle:hover {
  border-color: var(--accent);
  background-color: var(--bg-card);
}

.btn-outline {
  background-color: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.empty-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-light);
  font-size: var(--font-size-sm);
}

.attendance-empty-cell {
  padding: 48px 24px !important;
  vertical-align: middle;
  border: none;
}
.attendance-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  max-width: 320px;
  margin: 0 auto;
}
.attendance-empty-icon {
  font-size: 2.5rem;
  color: var(--text-light);
  opacity: 0.6;
}
.attendance-empty-title {
  margin: 0;
  font-size: var(--font-size);
  font-weight: 600;
  color: var(--text-color);
}
.attendance-empty-hint {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--text-light);
  line-height: 1.5;
}

.attendance-loading-cell {
  padding: 32px 24px !important;
  vertical-align: middle;
  border: none;
}
.attendance-loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-light);
  font-size: var(--font-size-sm);
}
.attendance-loading-icon {
  font-size: 1.25rem;
  color: var(--primary, #3b82f6);
}

.time-cell {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.photo-cell {
  width: 56px;
  text-align: center;
  vertical-align: middle;
}
.photo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
}
.photo-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--text-light);
  font-size: 1.25rem;
}
.photo-loading i {
  opacity: 0.8;
}
.pass-photo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.photo-cell .no-photo {
  color: var(--text-light);
}

.edit-employee-photo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.edit-employee-photo .photo-wrap {
  cursor: pointer;
  width: 110px;
  height: 110px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--border);
}

.edit-employee-photo .pass-photo,
.edit-employee-photo .photo-loading {
  width: 110px;
  height: 110px;
  border-radius: 10px;
}

.edit-employee-photo .photo-placeholder {
  font-size: 12px;
  color: var(--text-light);
}

.edit-employee-photo .no-photo {
  color: var(--text-light);
}

#editEmployeePhoto .photo-wrap {
  cursor: pointer;
}
#editEmployeePhoto .photo-wrap .pass-photo {
  cursor: pointer;
}

.photo-lightbox-modal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.92) !important;
  cursor: pointer;
}
.photo-lightbox-modal.show {
  display: block !important;
  opacity: 1 !important;
  background-color: rgba(0, 0, 0, 0.92) !important;
}
#photoLightboxModal .photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  box-sizing: border-box;
}
#photoLightboxModal .photo-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  z-index: 2;
  opacity: 0.9;
  line-height: 1;
  padding: 4px;
}
#photoLightboxModal .photo-lightbox-close:hover {
  opacity: 1;
}
#photoLightboxModal .photo-lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 96px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  cursor: default;
  pointer-events: auto;
}

.wa-cell {
  width: 40px;
  text-align: center;
  vertical-align: middle;
}
.actions-cell {
  text-align: right;
}

.btn-outline {
  display: inline-flex;
  justify-content: center;
  width: auto;
  min-width: 100px;
}


.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

.modal.show {
  display: block;
  opacity: 1;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  background-color: var(--bg-card);
  margin: 10vh auto;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 950px;
  position: relative;
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  filter: blur(5px);
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Модалка «Добавить сотрудника»: прокрутка тела, кнопки всегда внизу */
#addEmployeeModal .modal-content {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
}
#addEmployeeModal .modal-header {
  flex-shrink: 0;
}
#addEmployeeModal .modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 16px;
  padding-right: 8px;
}
#addEmployeeModal .modal-body::-webkit-scrollbar {
  width: 8px;
}
#addEmployeeModal .modal-body::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: 4px;
}
#addEmployeeModal .modal-body::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 4px;
}
#addEmployeeModal .modal-footer {
  flex-shrink: 0;
  margin-bottom: 0;
}

#confirmModal .modal-content {
  max-width: 1150px;
  max-height: 90vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

#confirmModal .modal-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
  flex-shrink: 0;
}

#confirmModal .modal-title {
  font-size: 1.1rem;
}

#confirmModal .modal-body {
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 12px;
  padding-right: 4px;
}

.edit-employee-layout {
  display: flex;
  gap: 16px;
  max-height: 70vh;
}

.edit-employee-left {
  flex: 0 0 390px;
  overflow-y: auto;
  padding-right: 6px;
}

.edit-employee-right {
  flex: 1 1 520px;
  overflow-y: auto;
  padding-right: 6px;
}

.edit-employee-passes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 10px;
}

.edit-employee-passes-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.edit-employee-passes-refresh {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.edit-employee-passes-count {
  font-size: 0.85rem;
  color: var(--text-light);
}

.edit-employee-passes-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  max-height: 62vh;
  overflow-y: auto;
}

.edit-employee-left,
.edit-employee-right,
.edit-employee-passes-list {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-light) transparent;
}

.edit-employee-left::-webkit-scrollbar,
.edit-employee-right::-webkit-scrollbar,
.edit-employee-passes-list::-webkit-scrollbar {
  width: 6px;
}

.edit-employee-left::-webkit-scrollbar-track,
.edit-employee-right::-webkit-scrollbar-track,
.edit-employee-passes-list::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 6px;
}

.edit-employee-left::-webkit-scrollbar-thumb,
.edit-employee-right::-webkit-scrollbar-thumb,
.edit-employee-passes-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.6);
  border-radius: 6px;
}

.edit-employee-left::-webkit-scrollbar-thumb:hover,
.edit-employee-right::-webkit-scrollbar-thumb:hover,
.edit-employee-passes-list::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.85);
}

.edit-employee-passes-empty {
  color: var(--text-light);
  font-size: 0.85rem;
  text-align: center;
  padding: 12px 6px;
}

.employee-passes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.employee-passes-table th,
.employee-passes-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
}

.employee-passes-table th {
  text-align: left;
  color: var(--text-light);
  font-weight: 600;
}

#confirmModal .modal-body::-webkit-scrollbar {
  width: 6px;
}

#confirmModal .modal-body::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: 3px;
}

#confirmModal .modal-body::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 3px;
}

#confirmModal .modal-footer {
  flex-shrink: 0;
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Единый стиль информационных окон (Готово / Внимание / Ошибка) */
#successMessageModal .modal-content,
#warningMessageModal .modal-content {
  max-width: 440px;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

#successMessageModal .modal-header--success,
#warningMessageModal .modal-header--warning {
  background: var(--bg-card);
  color: var(--text);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

#successMessageModal .modal-header--success .modal-title,
#warningMessageModal .modal-header--warning .modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

#successMessageModal .modal-header--success .modal-title i {
  margin-right: 8px;
  color: var(--accent);
}

#warningMessageModal .modal-header--warning .modal-title i {
  margin-right: 8px;
  color: var(--accent);
}

#successMessageModal .modal-header--success .close,
#warningMessageModal .modal-header--warning .close {
  color: var(--text-light);
  opacity: 0.8;
}

#successMessageModal .modal-header--success .close:hover,
#warningMessageModal .modal-header--warning .close:hover {
  color: var(--text);
  opacity: 1;
}

#successMessageModal .modal-body--success,
#warningMessageModal .modal-body--warning {
  padding: 20px 20px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-card);
}

#successMessageModal .modal-body--success .success-line {
  margin-bottom: 6px;
}

#successMessageModal .modal-body--success .success-note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: 0.9rem;
}

#successMessageModal .modal-footer,
#warningMessageModal .modal-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

#successMessageModal .modal-footer .modal-btn.sms,
#warningMessageModal .modal-footer .modal-btn.sms {
  min-width: 88px;
}


.modal.show .modal-content {
  opacity: 1;
  transform: scale(1) translateY(0);
  filter: blur(0);
}

.modal-content::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 16px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.modal.show .modal-content::before {
  opacity: 1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title i {
  color: var(--accent);
}

.close {
  color: var(--text-light);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
}

.close:hover {
  color: var(--text);
  transform: rotate(90deg);
}

.modal-body {
  margin-bottom: 24px;
  color: var(--text);
  line-height: 1.6;
}

.employee-info {
  background: rgba(59, 130, 246, 0.1);
  border-left: 3px solid var(--accent);
  padding: 12px;
  border-radius: 0 8px 8px 0;
  margin: 16px 0;
}

.employee-info strong {
  color: var(--accent);
}

.modal-footer {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.modal-btn {
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
}

.modal-btn i {
  font-size: 0.85rem;
}

.modal-btn.delete {
  background-color: #fee2e2;
  color: #dc2626;
  grid-column: span 2;
  order: 1;
}

.modal-btn.delete:hover {
  background-color: #fecaca;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.modal-btn.move {
  background-color: #fef3c7;
  color: #d97706;
}

.modal-btn.move:hover {
  background-color: #fde68a;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.2);
}

.modal-btn.sms {
  background-color: #d1fae5;
  color: #059669;
}

.modal-btn.sms:hover {
  background-color: #a7f3d0;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.2);
}

.modal-btn.cancel {
  background-color: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  order: 2;
}

.modal-btn.cancel:hover {
  border-color: var(--accent);
  background-color: rgba(59, 130, 246, 0.05);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--font-size-sm);
  color: var(--text-light);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--text);
  font-size: var(--font-size-sm);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.modal-btn:active {
  animation: pulse 0.3s ease;
}

#createOrgForm {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

#createOrgForm .form-group {
  margin-bottom: 0;
}

#createOrgForm label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

#createOrgForm input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--text);
}

#createOrgForm input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.password-strength {
  margin-top: 5px;
  height: 4px;
  background-color: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  width: 0;
  background-color: #ef4444;
  transition: width 0.3s ease;
}

.password-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 5px;
}

.settings-container {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 20px;
  max-width: 100%;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.settings-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-section {
  margin-bottom: 25px;
}

.settings-section-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
}

.settings-section-title i {
  margin-right: 10px;
  color: var(--accent);
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item-label {
  flex: 1;
  min-width: 200px;
  color: var(--text);
}

.settings-item-description {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 5px;
  line-height: 1.4;
}

.sms-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sms-account-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
}

.sms-account-card .settings-item {
  padding: 8px 0;
}

.sms-account-card .settings-item:first-of-type {
  padding-top: 0;
}

.sms-account-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.sms-account-card-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.sms-account-card-use {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Окно «Подписка» — счётчики, поиск, таблица */
.subscriptions-modal .subs-intro {
  margin: 0 0 16px 0;
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.4;
}
.subs-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.subs-stat-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.subs-stat-card .subs-stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.subs-stat-card .subs-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.subs-stat-card.subs-stat-total .subs-stat-value { color: var(--accent); }
.subs-stat-card.subs-stat-ios .subs-stat-value { color: #007aff; }
.subs-stat-card.subs-stat-android .subs-stat-value { color: #3ddc84; }
.subs-stat-card.subs-stat-other .subs-stat-value { color: var(--text-light); }
.subs-filter-hint {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 12px;
  padding: 6px 0;
}
.subs-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.subs-search-label {
  font-size: 0.9rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.subs-search-label i { color: var(--accent); }
.subs-search-input {
  flex: 1;
  min-width: 180px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text);
}
.subs-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}
.subs-refresh-btn { flex-shrink: 0; }
.subs-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.subscriptions-modal .subs-table {
  width: 100%;
  font-size: 0.9rem;
  border-collapse: collapse;
}
.subscriptions-modal .subs-table thead {
  background: var(--accent);
  color: #fff;
}
.subscriptions-modal .subs-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
.subscriptions-modal .subs-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
}
.subscriptions-modal .subs-table tbody tr:last-child td { border-bottom: none; }
.subscriptions-modal .subs-table tbody tr:nth-child(even) { background: var(--row-alt, rgba(0,0,0,0.02)); }
.subscriptions-modal .subs-table tbody tr:hover { background: rgba(79, 70, 229, 0.06); }
.subs-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-light);
  font-size: 0.9rem;
}

.sms-account-card-use input[type="radio"],
.sms-account-card-use input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.sms-account-card-remove {
  padding: 4px 10px;
  font-size: 0.85rem;
  color: var(--text-light);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
}

.sms-account-card-remove:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.settings-divider {
  height: 1px;
  background-color: var(--border);
  margin: 20px 0;
}

.timezone-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--text);
  font-size: var(--font-size-sm);
  transition: var(--transition);
}

.timezone-select:hover {
  border-color: var(--accent-light);
}

.timezone-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.timezone-select optgroup {
  color: var(--accent);
  font-weight: 500;
}

.timezone-select option {
  padding: 5px 10px;
}

.timezone-info {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.timezone-info i {
  color: var(--accent);
}

.wapi-input {
  width: 300px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--text);
  font-size: var(--font-size-sm);
  transition: var(--transition);
}

.wapi-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

#settingsModal .modal-content.settings-modal {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

#settingsModal .modal-body {
  overflow-y: auto;
  max-height: 70vh;
  padding-right: 8px;
  scroll-behavior: smooth;
}

#settingsModal .modal-body::-webkit-scrollbar {
  width: 8px;
}

#settingsModal .modal-body::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: 4px;
}

#settingsModal .modal-body::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 4px;
}

#settingsModal .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.wappi-org-list {
  margin-top: 4px;
}
.wappi-org-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(140px, 1.5fr) minmax(100px, 1fr) auto minmax(0, max-content);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-page);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.wappi-org-row .wappi-org-name {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wappi-org-row input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
}
.wappi-org-row input::placeholder {
  color: var(--text-light);
  opacity: 0.8;
}
.wappi-org-row .wappi-org-save-btn {
  padding: 5px 10px;
  white-space: nowrap;
  font-size: 0.8rem;
  width: auto;
  min-width: 0;
  justify-self: start;
}
/* Компактные кнопки в модалке WhatsApp шлюза — не растягивать */
#wappiGatewayModal .wappi-btn-compact,
#wappiGatewayModal .modal-footer .modal-btn {
  width: auto;
  min-width: 0;
  padding: 6px 12px;
  font-size: 0.875rem;
}
#wappiGatewayModal .modal-footer.wappi-modal-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
#wappiGatewayModal .modal-footer.wappi-modal-footer .modal-btn {
  flex: 0 0 auto;
}
@media (max-width: 640px) {
  .wappi-org-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .wappi-org-row .wappi-org-enabled-wrap {
    justify-self: start;
  }
  .wappi-org-row .wappi-org-save-btn {
    justify-self: start;
  }
}

.shifts-modal-content {
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.shifts-modal-header {
  flex-shrink: 0;
  padding: 18px 24px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.shifts-modal-header .modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.shifts-modal-header .modal-title i {
  color: var(--accent);
  opacity: 0.95;
}

.shifts-modal-header .close {
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px;
  color: var(--text-light);
}

.shifts-modal-header .close:hover {
  color: var(--text);
}

.shifts-modal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  max-height: none;
}

.shifts-modal-body::-webkit-scrollbar {
  width: 8px;
}

.shifts-modal-body::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: 4px;
}

.shifts-modal-body::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 4px;
}

.shifts-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.shifts-modal-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.shifts-modal-footer .modal-btn.sms {
  order: 1;
}

.shifts-modal-footer .modal-btn.cancel {
  order: 2;
}

.shift-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.shift-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.shift-day:hover {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.shift-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.shift-day-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.shift-day-title i {
  color: var(--accent);
  font-size: 0.9rem;
  opacity: 0.9;
}

.shift-add-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.shift-add-btn:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.shift-add-btn i {
  font-size: 0.8rem;
}

.shift-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shift-list:empty::after {
  content: 'Нет смен';
  display: block;
  font-size: 0.875rem;
  color: var(--text-light);
  padding: 8px 0;
}

.shift-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.shift-time {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.shift-actions {
  display: flex;
  gap: 6px;
}

.shift-actions button {
  padding: 6px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.shift-actions button:hover {
  background: var(--border-light);
  border-color: var(--text-light);
}

.shift-actions button:last-child:hover {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  color: #dc2626;
}

.shift-item.shift-form-container {
  padding: 14px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px dashed var(--border);
  border-left: 3px solid var(--accent);
}

.shift-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.shift-form input[type="time"] {
  padding: 10px 12px;
  font-size: 0.9375rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  min-width: 0;
}

.shift-form input[type="time"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.shift-form-buttons {
  grid-column: span 2;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shift-form-buttons .btn-outline {
  padding: 8px 14px;
  font-size: 0.875rem;
  border-radius: 8px;
  white-space: nowrap;
}

.add-shift-btn {
  margin-top: 0;
  width: auto;
}

#shiftsModal .modal-content {
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

#shiftsModal .modal-body {
  overflow-y: auto;
  max-height: calc(90vh - 140px);
  padding: 20px 24px;
}

.terminal-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--text);
  font-size: var(--font-size-sm);
  transition: var(--transition);
}

.terminal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.terminal-password {
  width: 70px;
  min-width: 70px;
  max-width: 90px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--text);
  font-size: var(--font-size-sm);
  transition: var(--transition);
}

.terminal-password:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-reset {
  background-color: #fef3c7;
  color: #d97706;
  padding: 4px 8px;
  font-size: var(--font-size-sm);
}

.btn-reset:hover {
  background-color: #fde68a;
}

#terminalsTable th {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background-color: var(--bg-card);
  position: sticky;
  top: 0;
}

#terminalsTable td {
  padding: 8px;
  vertical-align: middle;
}

#terminalsTable td:nth-child(3),
#terminalsTable th:nth-child(3) {
  width: 220px;
  min-width: 200px;
}

#terminalsTable td:nth-child(4),
#terminalsTable th:nth-child(4) {
  width: 70px;
  min-width: 70px;
}

#terminalsTable td.actions-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

#terminalsTable td.actions-cell button {
  width: 110px;
  justify-content: center;
}
#terminalsTable tr:nth-child(even) {
  background-color: var(--row-alt);
}

#terminalsTable tr:hover {
  background-color: rgba(59, 130, 246, 0.05);
}

.terminal-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

#terminalsModal .modal-content.terminals-modal-content {
  width: min(1400px, 98vw);
  max-width: 98vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  margin: 3vh auto;
}

#terminalsModal .modal-body.terminals-modal-body {
  overflow-y: auto;
  overflow-x: auto;
  max-height: calc(90vh - 140px);
  padding-right: 8px;
}

#terminalsModal #terminalsTable {
  min-width: 100%;
  table-layout: fixed;
  width: max(100%, 1200px);
}

#terminalsModal #terminalsTable th,
#terminalsModal #terminalsTable td {
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

#terminalsModal #terminalsTable td.actions-cell {
  overflow: visible;
  text-overflow: clip;
}

#terminalsModal #terminalsTable th:nth-child(1),
#terminalsModal #terminalsTable td:nth-child(1) { width: 4%; min-width: 40px; }
#terminalsModal #terminalsTable th:nth-child(2),
#terminalsModal #terminalsTable td:nth-child(2) { width: 12%; }
#terminalsModal #terminalsTable th:nth-child(3),
#terminalsModal #terminalsTable td:nth-child(3) { width: 18%; }
#terminalsModal #terminalsTable th:nth-child(4),
#terminalsModal #terminalsTable td:nth-child(4) { width: 8%; }
#terminalsModal #terminalsTable th:nth-child(5),
#terminalsModal #terminalsTable td:nth-child(5) { width: 8%; }
#terminalsModal #terminalsTable th:nth-child(6),
#terminalsModal #terminalsTable td:nth-child(6) { width: 14%; }
#terminalsModal #terminalsTable th:nth-child(7),
#terminalsModal #terminalsTable td:nth-child(7) { width: 11%; }
#terminalsModal #terminalsTable th:nth-child(8),
#terminalsModal #terminalsTable td:nth-child(8) { width: 13%; }
#terminalsModal #terminalsTable th:nth-child(9),
#terminalsModal #terminalsTable td:nth-child(9) { width: 12%; min-width: 165px; }

#terminalsModal #terminalsTable .terminal-input,
#terminalsModal #terminalsTable .terminal-password,
#terminalsModal #terminalsTable select.terminal-input {
  max-width: 100%;
  box-sizing: border-box;
}

#terminalsModal #terminalsTable .actions-cell {
  white-space: normal;
}

#terminalsModal #terminalsTable .actions-cell .btn-outline {
  margin: 2px;
}

#terminalsModal .modal-body::-webkit-scrollbar {
  width: 8px;
}

#terminalsModal .modal-body::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: 4px;
}

#terminalsModal .modal-body::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 4px;
}

#terminalsModal .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

#exportModal .modal-content {
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
#exportModal .modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 12px;
}
#exportModal .modal-footer {
  grid-template-columns: repeat(3, 1fr);
  flex-shrink: 0;
  margin-top: 0;
}

#exportModal .modal-body::-webkit-scrollbar {
  width: 6px;
}

#exportModal .modal-body::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

#exportModal .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent-light);
}

.export-date {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-card);
  color: var(--text);
  font-size: var(--font-size-sm);
}

.export-date:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.checkbox-group {
  margin-top: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.checkbox-item input[type="checkbox"] {
  margin-right: 10px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.checkbox-item label {
  display: flex;
  align-items: center;
}

@media (max-width: 480px) {
  .modal-content {
    margin: 5vh auto;
    padding: 20px;
  }

  .modal-footer {
    grid-template-columns: 1fr;
  }

  .modal-btn.delete {
    grid-column: span 1;
  }

  .management-btn .dropdown-menu {
    left: 0;
    right: 0;
    min-width: auto;
    width: 100%;
  }

  .settings-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .switch {
    align-self: flex-end;
  }

  .timezone-select {
    width: 100%;
  }

  #settingsModal .modal-content.settings-modal {
    max-height: 85vh;
  }

  #settingsModal .modal-body {
    max-height: 65vh;
  }

  .wapi-input {
    width: 100%;
  }

  #terminalsTable td, #terminalsTable th {
    padding: 6px 4px;
    font-size: 0.8rem;
  }

  .terminal-input, .terminal-password {
    padding: 4px 6px;
    font-size: 0.8rem;
  }

  .management-buttons {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filters {
    flex-direction: column;
  }

  input[type="text"], input[type="tel"] {
    width: 100%;
  }

  .footer {
    flex-direction: column-reverse;
  }

  .footer-actions {
    width: 100%;
    flex-direction: column;
  }

  .developer-credit {
    width: 100%;
    text-align: center;
  }

  button {
    width: 100%;
    justify-content: center;
  }

  .modal-content {
    max-width: 95%;
  }
}

@media (min-width: 992px) {
  .modal-content.settings-modal {
    max-width: 900px;
  }
}

.schedule-modal-content {
  max-width: 480px;
  max-height: 90vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.schedule-modal-content .modal-footer {
  flex-shrink: 0;
  margin-top: 20px;
  padding-top: 16px;
  padding-bottom: 12px;
  border-top: 1px solid var(--border-light);
}
.schedule-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0 8px;
}
.schedule-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.schedule-form-row {
  margin-bottom: 14px;
}
.schedule-form-row:last-child {
  margin-bottom: 0;
}
.schedule-form-name input {
  width: 100%;
}
.schedule-form-section {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--row-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.schedule-section-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.schedule-time-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 14px;
}
.schedule-time-grid .form-group {
  margin: 0;
}
.schedule-time-grid label {
  font-size: 0.8rem;
  margin-bottom: 4px;
}
.schedule-time-grid input {
  padding: 6px 8px;
  font-size: 0.9rem;
}
.schedule-days-block {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: nowrap;
}
.schedule-calendar-wrap {
  flex-shrink: 0;
  margin-bottom: 0;
}
.schedule-weekdays-col {
  flex-shrink: 0;
  min-width: 100px;
}
.schedule-weekdays-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 8px;
}
.schedule-weekdays-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.schedule-weekdays-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  margin: 0;
}
.schedule-form-footer {
  margin-top: 4px;
}
.schedule-default-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0;
}
.schedule-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.schedule-calendar-nav {
  padding: 2px 6px !important;
  font-size: 0.75rem !important;
  min-width: auto;
}
.schedule-calendar-month {
  font-weight: 600;
  font-size: 0.8rem;
}
.schedule-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 26px);
  gap: 1px;
  font-size: 0.7rem;
  text-align: center;
  background: var(--border-light);
  padding: 3px;
  border-radius: var(--radius);
  width: fit-content;
}
.schedule-calendar-hint {
  color: var(--text-light);
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
}
#scheduleCalendarGrid .cal-weekday {
  width: 26px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.6rem;
  color: var(--text-light);
}
#scheduleCalendarGrid .cal-day {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
  background: var(--bg-card);
  transition: var(--transition);
  font-size: 0.7rem;
}
#scheduleCalendarGrid .cal-day:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}
#scheduleCalendarGrid .cal-day.work-day {
  background: var(--accent);
  color: #fff;
}
#scheduleCalendarGrid .cal-day.work-day:hover {
  background: var(--accent-dark);
}
#scheduleCalendarGrid .cal-day.other-month {
  opacity: 0.4;
}

@media (max-width: 420px) {
  .schedule-time-grid {
    grid-template-columns: 1fr 1fr;
  }
  .schedule-days-block {
    flex-direction: column;
  }
}
