* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #f5f6fb;
  color: #1b1f2a;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

@media (max-width: 480px) {
  .page {
    padding: 16px 12px 48px;
  }
}

body.login-centered .page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.login-centered main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.login-centered #loginView {
  width: min(420px, 100%);
  margin: 0;
}

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

h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.subtitle {
  margin: 0;
  color: #5a6274;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 6px 24px rgba(28, 33, 44, 0.08);
  margin-bottom: 16px;
}

@media (max-width: 480px) {
  .card {
    padding: 14px;
    margin-bottom: 12px;
  }
}

.hidden {
  display: none;
}

.hint {
  margin: 0 0 16px;
  color: #5a6274;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  min-width: 160px;
}

@media (max-width: 480px) {
  .field {
    min-width: 0;
    flex: 1 1 100%;
  }
}

.field input,
.field select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d6dbe5;
  font-size: 14px;
}

@media (max-width: 480px) {
  .field input,
  .field select {
    min-height: 44px;
    font-size: 16px;
  }
}

.login-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.btn {
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  background: #4a8fbf;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: #3b7aa3;
}

.btn-secondary {
  background: #e8ecf8;
  color: #2f3b52;
}

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

.error {
  color: #c0392b;
  margin-top: 10px;
}

.error-banner {
  background: #fff2f0;
  color: #c0392b;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #f7c9c2;
  margin-bottom: 12px;
  font-size: 14px;
}

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

.logs-mode .controls,
.stats-mode .controls,
.health-mode .controls {
  opacity: 0.2;
  pointer-events: none;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

@media (max-width: 480px) {
  .tabs {
    gap: 6px;
    margin: 0 -12px 12px;
    padding: 0 12px 4px;
  }
}

.tab-button {
  border: 1px solid #d6dbe5;
  background: #ffffff;
  color: #2f3b52;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  min-height: 40px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.tab-button.active {
  background: #4a8fbf;
  color: #ffffff;
  border-color: #4a8fbf;
}



.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.feed {
  padding: 0;
}

.stats {
  padding: 18px 20px;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  border: 1px solid #eef1f7;
  border-radius: 10px;
  padding: 12px 14px;
  background: #f9fafc;
}

.stat-title {
  font-size: 12px;
  color: #5a6274;
  margin-bottom: 6px;
}

.stat-hint {
  font-size: 11px;
  color: #8a94a6;
  margin-top: 6px;
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
  color: #1b1f2a;
}

.dashboard-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.dashboard-section {
  border: 1px solid #eef1f7;
  border-radius: 10px;
  padding: 14px;
  background: #f9fafc;
}

.dashboard-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  margin-bottom: 6px;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.stat-label {
  color: #5a6274;
}

.workers-section .workers-chart {
  margin-top: 10px;
  min-height: 70px;
}

.workers-mini-chart {
  display: block;
  width: 100%;
}

.chart-legend {
  font-size: 11px;
  color: #5a6274;
  margin-top: 4px;
}

.chart-muted {
  color: #8a94a6;
  font-size: 13px;
}

.trace-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 0;
}

.trace-result-item {
  border: 1px solid #eef1f7;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  background: #f9fafc;
}

.trace-result-item div {
  margin-bottom: 4px;
}

.trace-error {
  color: #c0392b;
}

.stats-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stats-block h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.stats-table {
  display: grid;
  grid-template-columns: 1.2fr 0.6fr 0.8fr;
  gap: 8px;
  font-size: 13px;
}

@media (max-width: 480px) {
  .stats-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12px;
  }
}

.stats-table > div {
  display: contents;
}

.stats-table > div > div {
  padding: 4px 0;
  border-bottom: 1px dashed #eef1f7;
}

.stats-table > div:last-child > div {
  border-bottom: none;
}

.stats-table-header {
  font-weight: 600;
  color: #5a6274;
}

.stats-table-header > div {
  border-bottom: none;
}

.stats-sort-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stats-sort-button:disabled {
  cursor: default;
  color: #5a6274;
}

.stats-sort-button.active {
  color: #1b1f2a;
}

.sort-indicator {
  font-size: 11px;
  color: #8a94a6;
}

.logs {
  padding: 18px 20px;
}

.logs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.logs-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logs-date {
  border: 1px solid #d6dbe5;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.logs-select {
  border: 1px solid #d6dbe5;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.logs-content {
  background: #0f1620;
  color: #d7e2f0;
  border-radius: 8px;
  padding: 12px;
  max-height: 60vh;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
  .logs-content {
    font-size: 11px;
    padding: 10px;
  }
}

.logs-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.logs-tab-button {
  border: 1px solid #d6dbe5;
  background: #ffffff;
  color: #2f3b52;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.logs-tab-button.active {
  background: #4a8fbf;
  color: #ffffff;
  border-color: #4a8fbf;
}

.logs-errors {
  max-height: 60vh;
  overflow: auto;
}

.logs-errors-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  color: #5a6274;
}

.logs-errors-meta {
  font-size: 12px;
  color: #8a94a6;
}

.logs-error-card {
  border: 1px solid #eef1f7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #f9fafc;
}

.logs-error-card.is-error {
  border-color: #f2b3b3;
  background: #fff5f5;
}

.logs-error-title {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
}

.logs-error-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #5a6274;
  margin-bottom: 6px;
}

.logs-error-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.logs-error-details {
  background: #0f1620;
  color: #d7e2f0;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 8px;
}

.model-link {
  color: #4a8fbf;
  cursor: pointer;
  text-decoration: underline;
}

.image-modal {
  max-width: 80vw;
  max-height: 80vh;
  width: auto;
}

@media (max-width: 480px) {
  .image-modal {
    max-width: calc(100vw - 24px);
    max-height: 85vh;
  }

  .image-body {
    max-height: 60vh;
  }
}

.image-body {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 55vh;
  overflow: hidden;
}

.image-body img,
.image-body video {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
  border-radius: 8px;
  border: 1px solid #eef1f7;
  object-fit: contain;
}

.image-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #eef1f7;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 480px) {
  .feed-header {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
  }
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: #5a6274;
}

.loading {
  color: #4a8fbf;
  font-weight: 600;
}

.activities {
  display: flex;
  flex-direction: column;
}

.activity {
  display: grid;
  grid-template-columns: 160px 1fr 140px 140px 120px 120px 2fr;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f2f8;
  font-size: 14px;
  align-items: center;
}

@media (max-width: 480px) {
  .activity {
    padding: 12px 14px;
    gap: 8px;
  }
}

.activity-header {
  font-weight: 600;
  background: #f5f6fb;
}

.activity-header > div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity > div {
  white-space: normal;
  overflow: visible;
}

.activity > div .cell-muted {
  white-space: normal;
  overflow: visible;
}

.cell-muted {
  color: #5a6274;
  font-size: 11px;
  line-height: 1.2;
}

.activity:last-child {
  border-bottom: none;
}

.status-success {
  color: #1f8b4c;
  font-weight: 600;
}

.status-error {
  color: #c0392b;
  font-weight: 600;
}

.empty {
  padding: 20px;
  text-align: center;
  color: #5a6274;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px 20px;
  border-top: 1px solid #eef1f7;
  font-size: 14px;
  color: #5a6274;
}

.page-buttons {
  display: flex;
  gap: 6px;
}

.page-button {
  border: 1px solid #d6dbe5;
  background: #ffffff;
  color: #2f3b52;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.page-button.active {
  background: #4a8fbf;
  color: #ffffff;
  border-color: #4a8fbf;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.user-link {
  color: #4a8fbf;
  cursor: pointer;
  text-decoration: underline;
}

.user-link:hover {
  color: #3b7aa3;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
  .modal {
    padding: 12px;
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }
}

.modal.hidden {
  display: none;
}

.modal-split {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: min(1240px, 100%);
  margin: auto;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .modal-split {
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 0 4px;
  }
}

.modal-content {
  background: #ffffff;
  border-radius: 10px;
  padding: 16px 18px;
  width: 100%;
  box-shadow: 0 10px 24px rgba(28, 33, 44, 0.12);
  border: 1px solid #eef1f7;
  max-height: 80vh;
  overflow: hidden;
}

.profile-panel {
  flex: 0 0 320px;
}

@media (max-width: 480px) {
  .profile-panel,
  .activity-panel,
  .payment-panel,
  .partnership-panel {
    flex: 1 1 auto;
    min-width: 0;
  }

  .modal-content {
    padding: 14px;
    max-height: none;
  }

  .profile-activities,
  .profile-payment-body,
  .profile-partnership-body {
    max-height: 45vh;
  }
}

.activity-panel {
  flex: 1;
}

.payment-panel {
  flex: 1;
}

.partnership-panel {
  flex: 1;
  min-width: 260px;
}

.profile-partnership-body {
  max-height: 60vh;
  overflow: auto;
}

.partnership-summary {
  margin-bottom: 16px;
  padding: 12px;
  background: #f8f9fc;
  border-radius: 8px;
  font-size: 13px;
}

.partnership-summary-row {
  margin-bottom: 6px;
}

.partnership-summary-row:last-child {
  margin-bottom: 0;
}

.partnership-summary-row span {
  color: #5a6274;
}

.partnership-withdrawals-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.profile-withdrawal-row {
  display: grid;
  grid-template-columns: 140px 100px 1fr 90px;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #eef1f7;
  font-size: 13px;
}

.profile-withdrawal-row:last-child {
  border-bottom: none;
}

.profile-withdrawal-header {
  font-weight: 600;
  color: #5a6274;
}

.partnership-empty {
  color: #8a909e;
  font-size: 13px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.modal-body dt {
  font-weight: 500;
  color: #5a6274;
}

.modal-body dd {
  margin: 0;
  color: #1b1f2a;
  word-break: break-word;
}

.modal-body .profile-section-label {
  grid-column: 1 / -1;
  font-weight: 600;
  color: #1b1f2a;
  margin-top: 8px;
}

.modal-body .profile-section-label + dd {
  display: none;
}

.profile-section {
  margin-bottom: 0;
}

.profile-activities {
  padding-top: 4px;
  max-height: 60vh;
  overflow: auto;
}

.profile-activities h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.profile-activity-row {
  display: grid;
  grid-template-columns: 140px 90px 110px 90px 90px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #eef1f7;
  font-size: 13px;
}

@media (max-width: 480px) {
  .profile-activities {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .profile-activity-row {
    grid-template-columns: 100px 70px 90px 70px 70px minmax(120px, 1fr);
    min-width: 520px;
    font-size: 12px;
  }

  .profile-payment-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .profile-payment-row {
    grid-template-columns: 100px 80px 60px 80px;
    min-width: 320px;
    font-size: 12px;
  }

  .profile-withdrawal-row {
    grid-template-columns: 100px 80px 1fr 70px;
    min-width: 360px;
    font-size: 12px;
  }

  .profile-partnership-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-body {
    grid-template-columns: 110px 1fr;
    font-size: 12px;
  }
}

.profile-activity-row:last-child {
  border-bottom: none;
}

.profile-activity-header {
  font-weight: 600;
  color: #5a6274;
}

.profile-payment-body {
  max-height: 60vh;
  overflow: auto;
}

.profile-payment-row {
  display: grid;
  grid-template-columns: 140px 100px 80px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #eef1f7;
  font-size: 13px;
}

.profile-payment-row:last-child {
  border-bottom: none;
}

.profile-payment-header {
  font-weight: 600;
  color: #5a6274;
}

@media (max-width: 1100px) {
  .modal-split {
    flex-wrap: wrap;
  }

  .partnership-panel {
    flex: 1 1 100%;
  }
}

@media (max-width: 900px) {
  .modal-split {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .profile-panel {
    flex: 1;
  }

  .partnership-panel {
    flex: 1;
    min-width: auto;
  }
}

@media (max-width: 720px) {
  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header h1 {
    font-size: 20px;
  }

  .control-row {
    flex-direction: column;
    align-items: stretch;
  }

  .control-row .btn {
    width: 100%;
  }

  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

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

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

  .stats-lists {
    grid-template-columns: 1fr;
  }
}

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

  .activity-header {
    display: none;
  }
}

@media (max-width: 480px) {
  .activities {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }

  .activity {
    grid-template-columns: 110px 1fr 80px 80px 70px 70px 1fr;
    min-width: 540px;
  }

  .activity-header {
    display: grid;
  }

  .pagination {
    padding: 12px 14px 16px;
    flex-wrap: wrap;
  }

  .page-button {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 14px;
  }

  .controls .btn,
  .controls .btn-secondary {
    min-height: 44px;
  }
}

.health {
  padding: 18px 20px;
}

.health-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.health-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.health-select {
  border: 1px solid #d6dbe5;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.health-status {
  margin-bottom: 20px;
}

.health-loading {
  text-align: center;
  color: #5a6274;
  padding: 20px;
}

.health-services-section {
  margin-bottom: 24px;
}

.health-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #2f3b52;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #eef1f7;
}

.health-services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.health-proxy-card {
  border-left: 4px solid #9b59b6;
}

.health-service-card {
  border: 1px solid #eef1f7;
  border-radius: 10px;
  padding: 14px;
  background: #f9fafc;
}

.health-service-card.status-ok {
  border-color: #1f8b4c;
  background: #f0f9f4;
}

.health-service-card.status-error {
  border-color: #c0392b;
  background: #fff5f5;
}

.health-service-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.health-service-name {
  font-weight: 600;
  font-size: 15px;
  color: #2f3b52;
  flex: 1;
}

.health-service-delete {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
  opacity: 0.6;
}

.health-service-delete:hover {
  background: rgba(196, 57, 43, 0.1);
  opacity: 1;
}

.health-status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
}

.health-status-indicator.status-ok {
  background: #1f8b4c;
  box-shadow: 0 0 0 0 rgba(31, 139, 76, 0.7);
}

.health-status-indicator.status-error {
  background: #c0392b;
  box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.7);
  animation: pulse-error 2s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 139, 76, 0.7);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(31, 139, 76, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(31, 139, 76, 0);
  }
}

@keyframes pulse-error {
  0% {
    box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.7);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(192, 57, 43, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(192, 57, 43, 0);
  }
}

.health-service-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #5a6274;
}

.health-service-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.health-service-status.status-ok {
  color: #1f8b4c;
}

.health-service-status.status-error {
  color: #c0392b;
}

.health-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.health-tab-button {
  border: 1px solid #d6dbe5;
  background: #ffffff;
  color: #2f3b52;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.health-tab-button:hover {
  background: #f5f6fb;
}

.health-tab-button.active {
  background: #4a8fbf;
  color: #ffffff;
  border-color: #4a8fbf;
}

.health-view {
  margin-top: 0;
}

.health-service-time {
  font-size: 11px;
  color: #8a94a6;
  margin-top: 4px;
}

.health-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.health-stat-card {
  border: 1px solid #eef1f7;
  border-radius: 10px;
  padding: 16px;
  background: #f9fafc;
}

.health-stat-card.status-ok {
  border-color: #1f8b4c;
  background: #f0f9f4;
}

.health-stat-card.status-error {
  border-color: #c0392b;
  background: #fff5f5;
}

.health-stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.health-stat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #2f3b52;
}

.health-stat-badge {
  font-size: 18px;
}

.health-stat-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.health-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #5a6274;
}

.health-stat-row strong {
  color: #2f3b52;
  font-weight: 600;
}

.health-stat-bar {
  flex: 1;
  height: 6px;
  background: #eef1f7;
  border-radius: 3px;
  overflow: hidden;
  max-width: 100px;
}

.health-stat-bar-fill {
  display: block;
  height: 100%;
  background: #4a8fbf;
  border-radius: 3px;
  transition: width 0.3s;
}

.health-chart-content {
  padding: 16px;
  background: #f9fafc;
  border-radius: 8px;
  border: 1px solid #eef1f7;
  overflow-x: auto;
}

.health-chart-container {
  position: relative;
  width: 100%;
}

.health-chart-svg {
  display: block;
  max-width: 100%;
  height: auto;
  background: #ffffff;
  border-radius: 4px;
}

.health-chart-line {
  transition: opacity 0.3s;
}

.health-chart-line:hover {
  opacity: 1;
  stroke-width: 3;
}

.health-chart-point {
  transition: r 0.2s;
}

.health-chart-point:hover {
  r: 6;
}

.health-chart-legend {
  margin-top: 16px;
  padding: 12px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #eef1f7;
}

.health-chart-legend-title {
  font-weight: 600;
  font-size: 13px;
  color: #2f3b52;
  margin-bottom: 8px;
}

.health-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  transition: background 0.2s;
  font-size: 12px;
}

.health-chart-legend-item:hover {
  background: #f5f6fb;
}

.health-chart-legend-item.hidden {
  opacity: 0.4;
  text-decoration: line-through;
}

.health-chart-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-chart-legend-name {
  flex: 1;
  color: #2f3b52;
  font-weight: 500;
}

.health-chart-legend-avg {
  color: #8a94a6;
  font-size: 11px;
}

.health-chart-tooltip {
  position: absolute;
  background: rgba(15, 20, 30, 0.95);
  color: #ffffff;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 200px;
}

.health-tooltip-service {
  font-weight: 600;
  margin-bottom: 4px;
  color: #ffffff;
}

.health-tooltip-time {
  color: #d7e2f0;
  font-size: 11px;
  margin-bottom: 6px;
}

.health-tooltip-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #d7e2f0;
  font-size: 11px;
}

.health-history-table {
  border: 1px solid #eef1f7;
  border-radius: 8px;
  overflow: hidden;
}

.health-history-header {
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 1fr 0.8fr 1fr;
  gap: 12px;
  padding: 12px 16px;
  background: #f5f6fb;
  font-weight: 600;
  font-size: 13px;
  color: #2f3b52;
  border-bottom: 1px solid #eef1f7;
}

.health-history-row {
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 1fr 0.8fr 1fr;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef1f7;
  font-size: 13px;
  transition: background 0.2s;
}

.health-history-row:hover {
  background: #f9fafc;
}

.health-history-row:last-child {
  border-bottom: none;
}

.health-history-row.status-error {
  background: #fff5f5;
}

.health-history-row.status-ok {
  background: #f0f9f4;
}

.health-events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.health-event-card {
  border: 1px solid #eef1f7;
  border-radius: 10px;
  padding: 14px;
  background: #f9fafc;
}

.health-event-card.error {
  border-color: #f2b3b3;
  background: #fff5f5;
}

.health-event-card.recovery {
  border-color: #b3e5b3;
  background: #f0f9f4;
}

.health-event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}

.health-event-icon {
  font-size: 18px;
}

.health-event-type {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #eef1f7;
  color: #5a6274;
}

.health-event-card.error .health-event-type {
  background: #f2b3b3;
  color: #c0392b;
}

.health-event-card.recovery .health-event-type {
  background: #b3e5b3;
  color: #1f8b4c;
}

.health-event-time {
  font-size: 12px;
  color: #8a94a6;
  margin-bottom: 6px;
}

.health-event-details {
  font-size: 12px;
  color: #5a6274;
}

@media (max-width: 600px) {
  .health-header {
    flex-direction: column;
    align-items: stretch;
  }

  .health-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .health-select {
    flex: 1;
    min-width: 120px;
  }

  .health-services {
    grid-template-columns: 1fr;
  }

  .health-stats-grid {
    grid-template-columns: 1fr;
  }

  .health-history-header,
  .health-history-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .health-history-header > div,
  .health-history-row > div {
    padding: 4px 0;
  }

  .health-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
}
