* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: #f0f2f5; color: #1a1a1a; min-height: 100vh; }

:root {
  --camo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Crect width='40' height='40' fill='%23243320'/%3E%3Crect x='0' y='0' width='8' height='8' fill='%231a2a16'/%3E%3Crect x='16' y='0' width='12' height='4' fill='%231a2a16'/%3E%3Crect x='32' y='8' width='8' height='8' fill='%231a2a16'/%3E%3Crect x='4' y='16' width='12' height='8' fill='%231a2a16'/%3E%3Crect x='24' y='20' width='8' height='12' fill='%231a2a16'/%3E%3Crect x='0' y='32' width='4' height='8' fill='%231a2a16'/%3E%3Crect x='8' y='4' width='4' height='4' fill='%232d3d20'/%3E%3Crect x='28' y='4' width='4' height='8' fill='%232d3d20'/%3E%3Crect x='20' y='12' width='8' height='4' fill='%232d3d20'/%3E%3Crect x='0' y='24' width='4' height='4' fill='%232d3d20'/%3E%3Crect x='36' y='24' width='4' height='8' fill='%232d3d20'/%3E%3Crect x='12' y='32' width='8' height='8' fill='%232d3d20'/%3E%3C/svg%3E");
}

/* SIDEBAR */
.sidebar {
  width: 240px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: #1e2d1a;
  background-image: var(--camo);
  background-size: 40px 40px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 3px solid #c8a000;
  image-rendering: pixelated;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.2rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(200,160,0,0.3);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo-emblem {
  width: 40px;
  height: 40px;
  background: #c8a000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
  color: #1e2d1a;
  font-family: 'Inter', sans-serif;
  image-rendering: pixelated;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-name {
  font-size: 1rem;
  font-weight: 800;
  color: #c8a000;
  letter-spacing: 3px;
  text-transform: uppercase;
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}
.logo-sub {
  font-size: 0.6rem;
  color: rgba(200,210,180,0.6);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-section {
  font-size: 0.62rem;
  letter-spacing: 2px;
  color: rgba(200,160,0,0.6);
  text-transform: uppercase;
  padding: 1rem 1.2rem 0.3rem;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: rgba(200,220,180,0.75);
  text-decoration: none;
  padding: 0.65rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-link:hover {
  color: #fff;
  background: rgba(200,160,0,0.12);
  border-left-color: rgba(200,160,0,0.5);
}

.nav-link.active {
  color: #fff;
  background: rgba(200,160,0,0.2);
  border-left-color: #c8a000;
  font-weight: 600;
}

.nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 1rem 1.2rem;
  border-top: 1px solid rgba(200,160,0,0.2);
}

.sidebar-clock {
  font-size: 0.78rem;
  color: rgba(200,220,180,0.6);
  font-family: 'Inter', monospace;
  letter-spacing: 1px;
}
.sidebar-clock-sub { font-size: 0.65rem; color: rgba(200,220,180,0.4); margin-top: 3px; }

/* MAIN */
.main {
  margin-left: 240px;
  min-height: 100vh;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.9rem 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #6b7280;
  font-weight: 500;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: #1e2d1a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c8a000;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.content { padding: 1.5rem 1.8rem; }

/* CARDS */
.card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 1.3rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1.1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title i { color: #c8a000; }
.card-title .card-link { margin-left: auto; font-size: 0.75rem; color: #a16207; text-decoration: none; text-transform: none; letter-spacing: 0; font-weight: 600; }
.card-title .card-link:hover { text-decoration: underline; }
.card-title .card-meta { margin-left: auto; font-size: 0.75rem; color: #6b7280; font-weight: 400; text-transform: none; letter-spacing: 0; }

/* STAT BOXES */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.3rem; }

.stat-box {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 1.2rem 1.3rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-top: 3px solid #c8a000;
}

.stat-value { font-size: 2rem; font-weight: 800; color: #111827; line-height: 1; }
.stat-label { font-size: 0.72rem; color: #6b7280; margin-top: 0.3rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; color: #c8a000; }

/* GRID */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.grid-3-2 { display: grid; grid-template-columns: 2fr 3fr; gap: 1rem; margin-bottom: 1rem; }
.mb-1 { margin-bottom: 1rem; }

/* TABLES */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th {
  background: #f9fafb;
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.65rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
.table-wrap { overflow-x: auto; }
.muted { color: #9ca3af; }
.dash { color: #d1d5db; }

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
/* Придатний — насичений зелений, ВЧЗ — блідо-зелений: мають чітко відрізнятися */
.badge-green-solid { background: #16a34a; color: #fff; }
.badge-green-pale { background: #ecfdf5; color: #047857; box-shadow: inset 0 0 0 1px #a7f3d0; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-primary { background: #c8a000; color: #fff; }
.btn-primary:hover { background: #a88000; }
.btn-outline { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-outline:hover { background: #f9fafb; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-disabled { opacity: 0.4; cursor: default; }
.btn-sm { font-size: 0.78rem; padding: 0.35rem 0.8rem; }

/* PROGRESS */
.progress { background: #f3f4f6; border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #a88000, #c8a000); border-radius: 4px; }

/* FORM */
input[type=text], input[type=password], input[type=date], input[type=search], select {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: #374151;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: #c8a000; box-shadow: 0 0 0 3px rgba(200,160,0,0.1); }

/* DATE FIELD (дд.мм.рррр) */
.date-field { position: relative; display: block; }
.date-field .date-input { padding-right: 2.2rem; font-variant-numeric: tabular-nums; }
.date-field .date-input:invalid:not(:placeholder-shown) { border-color: #f87171; }
.date-picker-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #9ca3af; cursor: pointer; padding: 0.3rem 0.45rem; border-radius: 4px; font-size: 0.85rem; }
.date-picker-btn:hover { color: #a16207; background: #fef9c3; }
.date-picker-hidden { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

.filter-bar { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.filter-field { flex: 1; min-width: 130px; }
.filter-field.wide { flex: 2; min-width: 200px; }
.filter-field label, .field-label { font-size: 0.72rem; font-weight: 600; color: #6b7280; text-transform: uppercase; display: block; margin-bottom: 0.3rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: #374151; padding-bottom: 0.55rem; white-space: nowrap; cursor: pointer; }

/* RANKING */
.rank-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0; border-bottom: 1px solid #f3f4f6; }
.rank-item:last-child { border-bottom: none; }
.rank-num { width: 24px; height: 24px; border-radius: 50%; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; color: #6b7280; flex-shrink: 0; }
.rank-num.gold { background: #fef9c3; color: #a16207; }
.rank-num.silver { background: #f3f4f6; color: #4b5563; }
.rank-num.bronze { background: #fef0d3; color: #92400e; }
.rank-name { flex: 1; font-size: 0.85rem; font-weight: 500; color: #111827; }
.rank-count { font-size: 0.9rem; font-weight: 700; color: #c8a000; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; height: 6px; }
::-webkit-scrollbar-track { background: #f3f4f6; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,0.55);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.3);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.3rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: #111827; }
.modal-subtitle { font-size: 0.8rem; color: #6b7280; margin-top: 0.2rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}
.modal-close:hover { color: #374151; }

.modal-body { padding: 1.3rem 1.5rem; max-height: 65vh; overflow-y: auto; }

.modal-section { margin-bottom: 1.1rem; }
.modal-section + .modal-section { padding-top: 1.1rem; border-top: 1px solid #f3f4f6; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #f3f4f6;
}
.modal-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.modal-row + .modal-row { margin-top: 0.9rem; }
.modal-field { flex: 1; min-width: 160px; }
.modal-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0.35rem;
}
.modal-field textarea {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: #374151;
  outline: none;
  width: 100%;
  resize: vertical;
  min-height: 60px;
}
input:disabled, input[readonly] { background: #f9fafb; color: #9ca3af; }

.toggle-group { display: flex; gap: 3px; padding: 3px; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 9px; }
.toggle-option { display: none; }
.toggle-label {
  flex: 1;
  text-align: center;
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}
.toggle-label:hover { color: #374151; background: rgba(255,255,255,0.6); }
.toggle-option:checked + .toggle-label { background: #c8a000; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.12); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  padding: 1.1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
}

/* FILTER TABS */
.filter-tabs { display: flex; gap: 0.7rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.filter-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  text-decoration: none;
  transition: all 0.15s;
}
.filter-tab:hover { border-color: #d1d5db; background: #f9fafb; }
.filter-tab .count {
  background: #f3f4f6;
  color: #6b7280;
  padding: 0.1rem 0.55rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
}
.filter-tab.active { border-color: #c8a000; background: rgba(200,160,0,0.1); color: #111827; }
.filter-tab.active .count { background: #c8a000; color: #fff; }
.filter-tab.danger.active { border-color: #dc2626; background: rgba(220,38,38,0.08); color: #dc2626; }
.filter-tab.danger.active .count { background: #dc2626; color: #fff; }
.filter-tab.warn.active { border-color: #a16207; background: rgba(161,98,7,0.08); color: #a16207; }
.filter-tab.warn.active .count { background: #a16207; color: #fff; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #9ca3af;
  font-size: 0.9rem;
}

/* DATE NAV */
.date-nav { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.date-nav form { width: 170px; }
.date-nav .filter-tabs { margin: 0 0 0 auto; }

/* HEATMAP */
.heatmap-wrap { overflow-x: auto; }
.heatmap { width: auto; border-collapse: separate; border-spacing: 2px; font-size: 0.72rem; }
.heatmap th { padding: 0.3rem 0.2rem; text-align: center; font-size: 0.62rem; letter-spacing: 0; white-space: nowrap; border: none; }
.heatmap td { padding: 0; min-width: 34px; height: 26px; text-align: center; border: none; border-radius: 3px; font-weight: 600; }
.heatmap tr:hover td { background: inherit; }
.heatmap .hm-name { position: sticky; left: 0; background: #fff; text-align: left; padding: 0 0.7rem 0 0; min-width: 160px; white-space: nowrap; font-weight: 600; color: #111827; z-index: 1; }
.heatmap th.hm-name { background: #f9fafb; }
.heatmap .hm-zero { background: #f9fafb; color: #d1d5db; }
.heatmap .hm-sum { font-weight: 700; color: #c8a000; padding: 0 0.5rem; }

/* LIVE INDICATOR */
.live-indicator { display: flex; align-items: center; gap: 0.45rem; font-size: 0.76rem; font-weight: 600; padding: 0.3rem 0.7rem; border-radius: 20px; background: #f3f4f6; color: #6b7280; cursor: default; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; flex-shrink: 0; }
.live-indicator[data-status="ok"] { background: #dcfce7; color: #15803d; }
.live-indicator[data-status="ok"] .live-dot { background: #16a34a; animation: live-pulse 2s infinite; }
.live-indicator[data-status="disconnected"] { background: #fef9c3; color: #a16207; }
.live-indicator[data-status="disconnected"] .live-dot { background: #eab308; }
.live-indicator[data-status="down"], .live-indicator[data-status="nodb"] { background: #fee2e2; color: #dc2626; }
.live-indicator[data-status="down"] .live-dot, .live-indicator[data-status="nodb"] .live-dot { background: #dc2626; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

/* FLASH / ACTIONS */
.flash { padding: 0.65rem 0.9rem; border-radius: 6px; font-size: 0.82rem; margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: #dcfce7; border-color: #86efac; color: #15803d; }
.flash-error { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.actions-cell { white-space: nowrap; text-align: right; }
.inline-form { display: inline; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 6px; color: #6b7280; cursor: pointer; padding: 0.3rem 0.45rem; font-size: 0.8rem; }
.icon-btn:hover { background: #f3f4f6; border-color: #e5e7eb; color: #111827; }
.icon-btn.danger:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
select.select-sm { width: auto; padding: 0.3rem 0.5rem; font-size: 0.8rem; }
a.user-badge { text-decoration: none; }
a.user-badge:hover span { color: #111827; }
.user-role { font-size: 0.7rem; color: #9ca3af; margin-left: 0.3rem; }

.notice { background: #fef9c3; border: 1px solid #fde68a; color: #a16207; padding: 0.6rem 0.9rem; border-radius: 6px; font-size: 0.8rem; margin-bottom: 1rem; }
.notice div + div { margin-top: 0.25rem; }
.notice a { color: inherit; font-weight: 700; }
.notice.danger { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.meta-line { font-size: 0.75rem; color: #6b7280; margin-bottom: 1rem; display: flex; gap: 1.2rem; flex-wrap: wrap; }
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }

/* LOGIN */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f0f2f5; padding: 1rem; }
.login-wrap { display: flex; width: 800px; max-width: 100%; border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-left {
  width: 300px;
  background: #1e2d1a;
  background-image: var(--camo);
  background-size: 40px 40px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 3px solid #c8a000;
}
.login-emblem {
  width: 70px; height: 70px;
  background: #c8a000;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 900; color: #1e2d1a;
  clip-path: polygon(50% 0%,100% 25%,100% 75%,50% 100%,0% 75%,0% 25%);
  margin-bottom: 1rem;
}
.login-left h2 { color: #c8a000; font-size: 1.3rem; letter-spacing: 4px; font-weight: 800; }
.login-left p { color: rgba(200,220,180,0.5); font-size: 0.68rem; letter-spacing: 2px; text-transform: uppercase; margin-top: 0.3rem; }
.login-right { flex: 1; background: #fff; padding: 2.5rem; }
.login-right h3 { font-size: 1.1rem; font-weight: 700; color: #111827; margin-bottom: 0.3rem; }
.login-right p { font-size: 0.82rem; color: #6b7280; margin-bottom: 1.8rem; }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 600; color: #374151; margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.5px; }
.login-error { background: #fee2e2; border: 1px solid #fca5a5; color: #dc2626; padding: 0.6rem 0.9rem; border-radius: 6px; font-size: 0.8rem; margin-bottom: 1rem; }
.btn-full { width: 100%; justify-content: center; padding: 0.65rem; font-size: 0.9rem; border-radius: 8px; margin-top: 0.5rem; }

.auth-link { text-align: center; margin-top: 1.1rem; font-size: 0.82rem; }
.auth-link a, .link-btn { color: #a16207; font-weight: 600; text-decoration: none; background: none; border: none; cursor: pointer; font: inherit; }
.auth-link a:hover, .link-btn:hover { text-decoration: underline; }
.auth-help { font-size: 0.85rem; color: #374151; line-height: 1.55; margin-bottom: 1.4rem; }
.login-right .auth-help p { color: #374151; font-size: 0.85rem; margin-bottom: 0.9rem; }
.login-right .auth-help p.muted { color: #6b7280; font-size: 0.78rem; }
.auth-help code { background: #f3f4f6; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.78rem; }

.temp-password { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; background: #fef9c3; border: 1px solid #fde68a; color: #713f12; padding: 0.9rem 1.1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.85rem; }
.temp-password code { font-size: 1.15rem; font-weight: 700; letter-spacing: 1px; background: #fff; padding: 0.3rem 0.7rem; border-radius: 6px; border: 1px solid #fde68a; user-select: all; }
.temp-password .muted { flex-basis: 100%; font-size: 0.75rem; color: #854d0e; }
.temp-password-form { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; background: #fffbeb; border-bottom: 1px solid #fde68a; font-size: 0.82rem; }
.temp-password-form .muted { font-size: 0.75rem; margin-top: 0.2rem; }

@media (max-width: 700px) {
  .login-left { display: none; }
}

@media print {
  .sidebar, .topbar-right, .filter-bar button, .filter-tabs, .date-nav { display: none !important; }
  .main { margin-left: 0; }
  .topbar { position: static; box-shadow: none; }
  body { background: #fff; }
  .card, .stat-box { box-shadow: none; break-inside: avoid; }
}

/* Статистика Signal → Налаштування: команди оповіщення */
.page-tabs { margin-bottom: 1rem; }
.teams-list { display: flex; flex-direction: column; gap: 0.8rem; }
.team-block { display: grid; grid-template-columns: 160px minmax(0, 420px); column-gap: 1rem; row-gap: 0.5rem; padding: 0.9rem 1rem; border: 1px solid #e5e7eb; border-radius: 8px; background: #fafafa; }
.team-head { display: flex; align-items: center; gap: 0.3rem; align-self: start; padding-top: 0.45rem; }
.team-name { font-weight: 700; color: #111827; font-size: 0.88rem; }
.team-members { display: flex; flex-direction: column; gap: 0.45rem; }
.team-member { display: flex; align-items: center; gap: 0.3rem; }
.team-member select, .team-member .dd { flex: 1; min-width: 0; }
.team-foot { grid-column: 2; }
.teams-empty { text-align: center; }
.teams-actions { display: flex; align-items: center; gap: 0.7rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid #f3f4f6; flex-wrap: wrap; }
.teams-dirty { font-size: 0.78rem; color: #a16207; }
[hidden] { display: none !important; }

@media (max-width: 700px) {
  .team-block { grid-template-columns: 1fr; }
  .team-foot { grid-column: 1; }
  .team-head { padding-top: 0; }
}

/* Вікно підтвердження (CrmDialog) */
.confirm-overlay { z-index: 300; align-items: center; }
.confirm-overlay.open .confirm-modal { animation: confirm-in 0.16s ease-out; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.confirm-modal { max-width: 440px; }
.confirm-body { display: flex; gap: 1rem; padding: 1.5rem 1.5rem 1.3rem; }
.confirm-icon { flex: 0 0 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.confirm-icon.danger { background: #fee2e2; color: #dc2626; }
.confirm-icon.info { background: #fef9c3; color: #a16207; }
.confirm-text { font-size: 0.85rem; color: #4b5563; margin-top: 0.4rem; line-height: 1.5; overflow-wrap: anywhere; }
.confirm-modal .modal-footer { padding: 0.9rem 1.5rem; }

/* Випадаючі списки (CrmSelect) */
.dd { position: relative; display: block; width: 100%; }
.dd.dd-sm { display: inline-block; width: auto; }
.dd-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; }
.dd-toggle {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
  padding: 0.5rem 0.8rem; font-family: 'Inter', sans-serif; font-size: 0.85rem; color: #374151;
  text-align: left; cursor: pointer; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.dd-toggle:hover { border-color: #b8bec8; }
.dd-toggle:focus-visible, .dd-open .dd-toggle { border-color: #c8a000; box-shadow: 0 0 0 3px rgba(200,160,0,0.12); }
.dd-toggle:disabled { background: #f9fafb; color: #9ca3af; cursor: default; }
.dd-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-placeholder .dd-value { color: #9ca3af; }
.dd-chevron { font-size: 0.68rem; color: #9ca3af; transition: transform 0.15s; }
.dd-open .dd-chevron { transform: rotate(180deg); color: #a16207; }
.dd-invalid .dd-toggle { border-color: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,0.12); }
.dd-sm .dd-toggle { padding: 0.3rem 0.55rem; font-size: 0.8rem; gap: 0.45rem; }

.dd-menu {
  position: fixed; z-index: 400; display: flex; flex-direction: column;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(17,24,39,0.16), 0 2px 6px rgba(17,24,39,0.06);
  overflow: hidden; opacity: 0; transform: translateY(-4px); transition: opacity 0.12s, transform 0.12s;
}
.dd-menu.dd-up { transform: translateY(4px); }
.dd-menu.open { opacity: 1; transform: none; }
.dd-search { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.7rem; border-bottom: 1px solid #f3f4f6; color: #9ca3af; font-size: 0.8rem; }
.dd-search input { border: none; padding: 0.2rem 0; box-shadow: none !important; font-size: 0.83rem; }
.dd-list { overflow-y: auto; padding: 0.3rem; flex: 1; min-height: 0; }
.dd-group { font-size: 0.68rem; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.4px; padding: 0.55rem 0.6rem 0.25rem; }
.dd-group:not(:first-child) { margin-top: 0.25rem; border-top: 1px solid #f3f4f6; }
.dd-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 6px; font-size: 0.84rem; color: #374151; cursor: pointer; }
.dd-item-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-item.active { background: #fef9e7; color: #111827; }
.dd-item.selected { font-weight: 600; color: #a16207; }
.dd-item-empty { color: #9ca3af; }
.dd-item.disabled { color: #d1d5db; cursor: default; }
.dd-check { font-size: 0.7rem; color: #c8a000; visibility: hidden; }
.dd-item.selected .dd-check { visibility: visible; }
.dd-none { padding: 0.8rem 0.6rem; text-align: center; font-size: 0.8rem; color: #9ca3af; }
