:root {
  --app-bg: #f4f7fb;
  --app-border: #dbe3ef;
  --badge-stt-bg: #d1ecf1;
  --badge-stt-text: #0c5460;
  --badge-lat-bg: #fde2e2;
  --badge-lat-text: #842029;
  --badge-both-bg: #e2e3e5;
  --badge-both-text: #41464b;
  --badge-camp-bg: #e2f3dc;
  --badge-camp-text: #2b6a2d;
  --badge-show-bg: #ffe9c7;
  --badge-show-text: #7a4e00;
  --badge-other-bg: #ececf5;
  --badge-other-text: #3f3f55;
}

body {
  background:
    radial-gradient(circle at 10% 10%, #ffffff 0%, #eef4ff 30%, transparent 60%),
    radial-gradient(circle at 90% 15%, #ffffff 0%, #ecf8f4 28%, transparent 60%),
    var(--app-bg);
  min-height: 100vh;
}

.app-hero {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.9rem;
}

.app-hero-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.app-hero-icon-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
}

.app-hero-icon {
  display: block;
  height: auto;
  width: auto;
  border-radius: 0.55rem;
}

.card {
  border-color: var(--app-border);
}

.table th {
  white-space: nowrap;
  font-size: 0.85rem;
}

.table td {
  font-size: 0.9rem;
}

#scheduleTable tbody td {
  vertical-align: top;
}

.priority-cell {
  min-width: 6rem;
}

.priority-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
}

.priority-star-btn {
  padding: 0;
  border: none;
  background: transparent;
  color: #b9c2cf;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.priority-star-btn.active {
  color: #f2b01e;
}

.priority-star-btn:hover,
.priority-star-btn:focus-visible {
  color: #f2b01e;
  outline: none;
}

.badge-discipline {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-discipline.stt {
  background: var(--badge-stt-bg);
  color: var(--badge-stt-text);
}

.badge-discipline.lat {
  background: var(--badge-lat-bg);
  color: var(--badge-lat-text);
}

.badge-discipline.both {
  background: var(--badge-both-bg);
  color: var(--badge-both-text);
}

.badge-discipline.camp {
  background: var(--badge-camp-bg);
  color: var(--badge-camp-text);
}

.badge-discipline.show {
  background: var(--badge-show-bg);
  color: var(--badge-show-text);
}

.badge-discipline.other {
  background: var(--badge-other-bg);
  color: var(--badge-other-text);
}

.city-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.map-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  color: #0b5ed7;
}

.map-icon-link svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.map-icon-link:hover {
  color: #084298;
}

.refresh-cooldown-hint {
  min-width: 8.5rem;
  font-size: 0.9rem;
}

.status-toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  width: min(24rem, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.status-toast {
  pointer-events: auto;
  box-shadow: 0 0.6rem 1.2rem rgba(15, 23, 42, 0.18);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.status-toast.hide {
  opacity: 0;
  transform: translateY(-0.4rem);
}

.events-refresh-indicator .spinner-border {
  width: 0.95rem;
  height: 0.95rem;
  border-width: 0.15em;
}

.table-shell {
  position: relative;
}

.events-header-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.events-header-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.events-header-last-update {
  white-space: nowrap;
}

.table-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  z-index: 20;
}

.table-loading-overlay[hidden] {
  display: none;
}

.table-loading-content {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  background: #ffffff;
}

.table-loading-content .spinner-border {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
}

.hide-distance-column th.distance-col,
.hide-distance-column td.distance-col {
  display: none;
}

.distance-cell-loading {
  display: inline-flex;
  align-items: center;
  color: #6c757d;
}

.distance-cell-loading .spinner-border {
  width: 0.95rem;
  height: 0.95rem;
  border-width: 0.15em;
}

.table-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid #c7d0dc;
  border-radius: 0.35rem;
  background: #fff;
  color: #495057;
}

.icon-action-btn svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
}

.icon-action-btn:hover {
  background: #f1f3f5;
}

.icon-action-btn.edit:hover {
  color: #0b5ed7;
}

.icon-action-btn.delete {
  color: #b02a37;
  border-color: #e3b4ba;
}

.icon-action-btn.delete:hover {
  background: #fdf2f3;
}

.comment-cell {
  min-width: 10rem;
  max-width: 22rem;
}

.comment-inline,
.comment-preview,
.comment-rest-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-preview-line {
  display: inline;
}

.comment-preview-ellipsis {
  display: inline;
}

.comment-expandable {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.comment-toggle-btn {
  padding: 0;
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0b5ed7;
  text-decoration: underline;
  text-underline-offset: 0.12rem;
  cursor: pointer;
}

.comment-toggle-btn:hover {
  color: #084298;
}

.comment-rest-wrap {
  width: 100%;
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.48s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.48s ease;
}

.comment-rest {
  overflow: hidden;
  display: block;
}

.comment-toggle-less {
  display: none;
  margin-top: 0.1rem;
}

.comment-expandable.expanded .comment-toggle-more {
  display: none;
}

.comment-expandable.expanded .comment-preview-ellipsis {
  display: none;
}

.comment-expandable.expanded .comment-rest-wrap {
  grid-template-rows: 1fr;
  opacity: 1;
}

.comment-expandable.expanded .comment-toggle-less {
  display: inline-block;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.app-modal[hidden] {
  display: none;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.app-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(46rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.app-modal-dialog-sm {
  width: min(28rem, calc(100vw - 2rem));
}

.app-modal .form-control[readonly] {
  background-color: #eef2f7;
  border-color: #d5dde8;
  color: #6c757d;
}

.app-modal .form-control[readonly]:focus {
  box-shadow: none;
  border-color: #d5dde8;
}

body.modal-open {
  overflow: hidden;
}

.diagnostics {
  background: #0f172a;
  color: #d6e3ff;
  border-radius: 0.5rem;
  padding: 0.75rem;
  max-height: 20rem;
  overflow: auto;
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .app-hero-icon {
    border-radius: 0.45rem;
  }

  .events-header-tools {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .events-header-buttons {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .events-header-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  .events-header-last-update {
    width: 100%;
    text-align: left;
    white-space: normal;
  }

  .table td,
  .table th {
    font-size: 0.8rem;
  }
}
