:root {
  color-scheme: light;
  --bg: #e9eef3;
  --panel: #fbfcfd;
  --panel-soft: #f6f8fb;
  --text: #172334;
  --muted: #667789;
  --line: #dbe3ea;
  --primary: #245b85;
  --primary-hover: #194768;
  --navy: #001a34;
  --navy-soft: #e8eef4;
  --accent: #318278;
  --error: #a63d3d;
  --success: #287a55;
  --shadow: 0 16px 36px rgba(0, 26, 52, 0.10);
  --shadow-soft: 0 7px 20px rgba(0, 26, 52, 0.065);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--navy), var(--accent), var(--primary));
}

.login-page {
  background: #ffffff;
}

.login-page::before {
  display: none;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
  background: #ffffff;
}

.login-brand-panel {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding: clamp(40px, 7vw, 92px);
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 24%, rgba(22, 184, 190, 0.18), transparent 34%),
    linear-gradient(145deg, #001a34 0%, #00284c 62%, #001427 100%);
  color: #ffffff;
}

.login-brand-panel::after {
  content: "";
  position: absolute;
  right: -150px;
  bottom: -150px;
  width: 360px;
  height: 360px;
  border: 44px solid rgba(255, 255, 255, 0.055);
  border-radius: 50%;
}

.login-brand-content {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
}

.login-brand-logo {
  width: clamp(120px, 18vw, 210px);
  height: auto;
  margin-bottom: clamp(32px, 6vw, 64px);
  filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.28));
}

.login-brand-kicker {
  margin: 0 0 12px;
  color: #22bdc4;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.login-brand-panel h1 {
  max-width: 560px;
  margin: 0;
  color: #ffffff;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.03;
}

.login-feature-list {
  display: grid;
  gap: 13px;
  margin: 30px 0 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.02rem;
  list-style: none;
}

.login-feature-list li {
  position: relative;
  padding-left: 24px;
}

.login-feature-list li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22bdc4;
  box-shadow: 0 0 0 5px rgba(34, 189, 196, 0.13);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 560px);
  min-height: 100vh;
  justify-self: center;
  padding: clamp(34px, 6vw, 76px);
  background: #ffffff;
}

.login-panel-header {
  margin-bottom: 28px;
}

.login-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

h1 {
  margin: 0 0 24px;
  font-size: 1.7rem;
  line-height: 1.2;
  color: var(--navy);
}

.login-panel h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: 1.08;
}

.login-form {
  display: grid;
  gap: 13px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 400;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.login-form input,
.login-form select {
  min-height: 50px;
  border-radius: 10px;
  background: #fbfcfd;
}

.login-form select:disabled {
  color: #526476;
  opacity: 1;
}

textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  resize: vertical;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(36, 91, 133, 0.14);
}

.login-form input:focus,
.login-form select:focus {
  border-color: #22aeb6;
  outline: 4px solid rgba(34, 174, 182, 0.14);
}

button {
  min-height: 44px;
  margin-top: 8px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  box-shadow: 0 7px 15px rgba(36, 91, 133, 0.18);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

button:hover,
button:focus {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.login-form button[type="submit"] {
  min-height: 52px;
  margin-top: 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, #12aeb6, #0a8f9c);
  box-shadow: 0 16px 30px rgba(10, 143, 156, 0.22);
  letter-spacing: 0.02em;
}

.login-form button[type="submit"]:hover,
.login-form button[type="submit"]:focus {
  background: linear-gradient(135deg, #0fa0a9, #087f8b);
}

.login-message {
  min-height: 20px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-message.is-error {
  color: var(--error);
}

.login-message.is-success {
  color: var(--success);
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1fr);
  }

  .login-brand-panel {
    padding: 36px;
  }

  .login-brand-panel h1 {
    font-size: 2rem;
  }
}

@media (max-width: 720px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: auto;
    padding: 34px 24px;
  }

  .login-brand-logo {
    width: 104px;
    margin-bottom: 20px;
  }

  .login-feature-list {
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    margin-top: 22px;
    font-size: 0.94rem;
  }

  .login-panel {
    min-height: auto;
    width: 100%;
    padding: 34px 24px 44px;
  }
}

@media (max-width: 460px) {
  .login-feature-list {
    grid-template-columns: 1fr;
  }

  .login-panel h2 {
    font-size: 1.85rem;
  }
}

.admin-shell {
  width: calc(100% - 32px);
  max-width: 1760px;
  margin: 0 16px;
  padding: 28px 0 48px;
}

.admin-layout.admin-shell {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 5px);
  margin: 0;
  padding: 0;
}

.admin-sidebar {
  position: fixed;
  z-index: 40;
  top: 5px;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: 264px;
  padding: 20px 14px;
  overflow-y: auto;
  background: var(--navy);
  color: #ffffff;
  box-shadow: 8px 0 24px rgba(0, 26, 52, 0.14);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 8px 10px 20px;
  color: #ffffff;
  text-decoration: none;
}

.sidebar-brand-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: contain;
  padding: 5px;
  border-radius: 6px;
  background: #ffffff;
}

.sidebar-brand-logo-axitek {
  padding: 0;
  background: transparent;
}

.sidebar-brand strong {
  display: -webkit-box;
  overflow: hidden;
  color: #ffffff;
  font-size: 1.05rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sidebar-navigation {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 20px;
}

.sidebar-section {
  display: grid;
  gap: 4px;
}

.sidebar-section-title {
  padding: 0 10px 6px;
  color: #8fa6ba;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d8e4ee;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  box-shadow: none;
}

.sidebar-link:hover,
.sidebar-link:focus,
.sidebar-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transform: none;
}

.sidebar-link.active {
  box-shadow: inset 3px 0 0 #00a6a6;
}

.sidebar-icon {
  display: grid;
  flex: 0 0 24px;
  place-items: center;
  width: 24px;
  min-height: 24px;
  font-size: 1rem;
}

.sidebar-link-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.sidebar-link-copy strong {
  overflow: hidden;
  color: inherit;
  font-size: inherit;
  text-overflow: ellipsis;
}

.sidebar-link-copy small {
  color: #71889b;
  font-size: 0.65rem;
  font-weight: 600;
}

.sidebar-link.is-disabled {
  color: #71889b;
  cursor: default;
}

.sidebar-link.is-disabled:hover {
  background: transparent;
}

.sidebar-system {
  margin-top: auto;
}

.sidebar-logout {
  cursor: pointer;
}

.admin-main {
  min-width: 0;
  min-height: calc(100vh - 5px);
  margin-left: 264px;
}

.admin-content {
  min-width: 0;
  padding: 0 16px 48px;
}

.admin-layout .admin-header {
  width: auto;
  margin: 16px;
}

.admin-layout.admin-wide .admin-header,
.admin-layout.dashboard-page {
  width: auto;
  max-width: none;
}

.sidebar-toggle,
.admin-sidebar-overlay {
  display: none;
}

.admin-header {
  position: sticky;
  z-index: 30;
  top: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  color: var(--text);
  backdrop-filter: blur(10px);
}

.dashboard-page {
  width: calc(100vw - 24px);
  max-width: none;
  margin-left: 12px;
  margin-right: 12px;
}

.admin-wide {
  width: calc(100vw - 24px);
  max-width: none;
  margin-left: 12px;
  margin-right: 12px;
}

.admin-wide .admin-header,
.admin-wide .panel {
  width: 100%;
}

.admin-wide .panel {
  padding: clamp(16px, 1.35vw, 24px);
}

.admin-wide .panel-header {
  align-items: center;
  flex-wrap: wrap;
}

.admin-wide .panel-header > div {
  min-width: min(100%, 320px);
}

.admin-wide .table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.admin-wide table {
  min-width: 0;
}

.admin-wide th,
.admin-wide td {
  padding: 13px 12px;
}

.admin-wide .inline-form {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-wide .filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  width: min(100%, 560px);
}

.admin-wide .filter-row label,
.admin-wide .panel-header > label {
  min-width: 0;
}

.admin-wide .action-cell {
  min-width: 0;
}

.dashboard-header {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, auto) minmax(240px, 1fr);
  align-items: center;
  gap: 18px;
}

.dashboard-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.dashboard-brand-logo {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  object-fit: contain;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-brand-logo-axitek {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.institution-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
  padding: 8px;
  border-radius: 8px;
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.institution-brand:hover,
.institution-brand:focus {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
  text-decoration: none;
}

.institution-logo {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  object-fit: contain;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #ffffff;
}

.institution-logo-axitek {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.institution-brand strong {
  overflow: hidden;
  color: #ffffff;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.admin-title-block {
  min-width: 0;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.admin-user-actions #logout-button {
  margin-left: 0;
}

.dashboard-brand strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.dashboard-title-block {
  text-align: center;
}

.dashboard-title-block h1 {
  margin: 0;
}

.dashboard-user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.dashboard-user-actions .admin-user {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-user-actions #logout-button {
  margin-left: 0;
}

#logout-button {
  margin-left: auto;
  white-space: nowrap;
}

.admin-header h1 {
  margin: 0;
  color: var(--navy);
  font-size: 1.35rem;
}

.admin-user,
.muted {
  color: var(--muted);
  margin: 0;
}

.admin-header .admin-user {
  color: var(--muted);
}

.admin-header .login-kicker {
  color: #9ee0c8;
}

.link-card,
.photo-list a {
  color: var(--primary);
  text-decoration: none;
}

.panel {
  margin-bottom: 18px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

#detalle-panel:empty,
#edit-panel:empty {
  display: none;
}

.panel h2,
.panel h3 {
  margin: 0 0 14px;
}

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

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.detail-grid > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.detail-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.edit-form {
  margin-bottom: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.nested-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.nested-panel:empty {
  display: none;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
  min-height: 138px;
}

.dashboard-kpi-card {
  display: grid;
  min-height: 138px;
  align-content: space-between;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.dashboard-kpi-card span {
  color: var(--text);
  font-weight: 700;
}

.dashboard-kpi-card strong {
  color: var(--navy);
  font-size: clamp(1.75rem, 2.4vw, 2.6rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.dashboard-kpi-card small {
  color: var(--muted);
}

.kpi-institutions {
  border-left-color: #64748b;
}

.dashboard-section {
  margin-bottom: 24px;
}

.dashboard-section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-section-header h2 {
  margin: 0 0 4px;
  color: var(--navy);
}

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

.dashboard-operation-grid,
.dashboard-recent-panel {
  min-height: 180px;
}

.dashboard-operation-grid .panel {
  min-width: 0;
  margin-bottom: 0;
}

.dashboard-operating-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.dashboard-recent-panel {
  margin-bottom: 24px;
}

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

.dashboard-quick-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--navy);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.dashboard-quick-action:hover,
.dashboard-quick-action:focus {
  border-color: #b7c7d6;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.dashboard-quick-action small {
  color: var(--muted);
}

.dashboard-quick-action.is-disabled {
  color: var(--muted);
  cursor: default;
  box-shadow: none;
  opacity: 0.72;
}

.summary-grid,
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.link-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.dashboard-page .summary-grid {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
}

.dashboard-page .summary-card {
  min-height: 138px;
}

.kpi-card {
  align-content: space-between;
  border-top: 0;
  border-left: 5px solid var(--accent);
}

.kpi-card strong {
  font-size: clamp(1.35rem, 1.8vw, 2rem);
  line-height: 1.1;
}

.kpi-card span {
  color: var(--text);
  font-weight: 700;
}

.kpi-card small {
  color: var(--muted);
}

.kpi-vehicles {
  border-left-color: var(--navy);
}

.kpi-routes {
  border-left-color: var(--success);
}

.kpi-procedures {
  border-left-color: var(--accent);
}

.kpi-update {
  border-left-color: #64748b;
}

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

.dashboard-main-layout {
  margin-top: 4px;
}

.recent-procedures-panel {
  min-width: 0;
}

.active-routes-panel {
  position: sticky;
  top: 16px;
}

.active-route-list {
  display: grid;
  gap: 10px;
}

.active-route-list-wide {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.active-route-card {
  grid-template-columns: 1fr;
  padding: 14px;
}

.dashboard-route-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 86px;
}

.dashboard-route-card div,
.dashboard-route-card a {
  min-width: 0;
}

.dashboard-route-card span,
.dashboard-route-card small {
  display: block;
  color: var(--muted);
}

.dashboard-vehicles-panel {
  margin-bottom: 0;
}

.dashboard-operating-list-compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-table-wrap {
  overflow-x: visible;
}

.dashboard-table {
  min-width: 0;
}

.dashboard-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.dashboard-table a {
  color: var(--navy);
  text-decoration: none;
}

.dashboard-table a:hover,
.dashboard-table a:focus {
  color: var(--primary);
}

.dashboard-module-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.summary-card,
.link-card {
  display: grid;
  gap: 8px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.summary-card {
  border-top: 4px solid var(--accent);
}

.municipality-card {
  min-height: 126px;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.municipality-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 8px;
}

.summary-card strong {
  color: var(--navy);
  font-size: 2rem;
}

.link-card strong {
  color: var(--text);
}

.module-card {
  gap: 12px;
}

.module-title {
  color: var(--text);
  font-weight: 700;
}

.module-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.module-metrics div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.module-metrics strong {
  display: block;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.1;
}

.module-metrics small {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.module-action {
  color: var(--primary);
}

.preview-list {
  display: grid;
  gap: 10px;
}

.preview-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.preview-item:hover,
.preview-item:focus {
  border-color: #b7c7d6;
  background: #ffffff;
}

.preview-item strong {
  color: var(--navy);
}

.preview-item span,
.preview-item small {
  color: var(--muted);
}

.link-card:hover,
.link-card:focus {
  border-color: #b7c7d6;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #3e556a;
  background: #f3f6f9;
  font-size: 0.82rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f6f9fc;
}

.editing-row {
  background: #eef5f8;
  box-shadow: inset 4px 0 0 #318278;
}

.editing-row:hover {
  background: #eef5f8;
}

.inline-edit-row > td {
  padding: 14px 10px 20px;
  border-bottom: 0;
  background: transparent;
}

.inline-edit-row {
  animation: inlineEditRowEnter 180ms ease-out;
}

.inline-edit-row.closing {
  pointer-events: none;
  animation: none;
}

.inline-edit-row.closing > td {
  animation: inlineEditRowExit 180ms ease-in forwards;
}

.inline-edit-row.closing .inline-edit-panel {
  animation: inlineEditPanelExit 180ms ease-in forwards;
}

.inline-edit-row:hover {
  background: transparent;
}

.inline-edit-panel {
  padding: clamp(18px, 2vw, 26px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(0, 26, 52, 0.075);
  animation: inlineEditEnter 0.16s ease-out;
}

.inline-edit-panel .panel-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf1f5;
}

.inline-edit-panel h3 {
  margin: 0;
}

.inline-edit-panel h3,
.inline-edit-panel h4 {
  color: var(--navy);
}

.inline-edit-panel h4 {
  margin: 24px 0 12px;
}

.inline-edit-panel .detail-grid {
  gap: 14px;
  margin-bottom: 24px;
}

.inline-edit-panel .detail-grid > div {
  border-color: var(--line);
  background: var(--panel-soft);
}

.inline-edit-panel .nested-panel {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid #e7edf2;
}

.inline-edit-panel .nested-panel + .nested-panel {
  margin-top: 22px;
}

.inline-edit-panel .table-wrap {
  overflow: hidden;
  border: 1px solid #e0e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.inline-edit-panel table {
  min-width: 0;
  background: transparent;
}

.inline-edit-panel th {
  padding: 11px 12px;
  border-bottom: 1px solid #dfe7ee;
  background: #f3f6f9;
  color: #496075;
}

.inline-edit-panel td {
  padding: 12px;
  border-bottom: 1px solid #edf1f4;
}

.inline-edit-panel tbody tr:last-child td {
  border-bottom: 0;
}

.inline-edit-panel tbody tr:hover {
  background: #f6f9fc;
}

.inline-edit-panel .photo-gallery,
.inline-edit-panel .photo-list {
  margin-top: 14px;
  padding-top: 4px;
}

.inline-edit-panel .inline-edit-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #edf1f5;
}

.inline-edit-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.inline-edit-actions .secondary-button {
  align-self: stretch;
  color: var(--muted);
}

@keyframes inlineEditEnter {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

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

@keyframes inlineEditRowEnter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes inlineEditRowExit {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes inlineEditPanelExit {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.995);
  }
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.filter-row label,
.panel-header > label {
  min-width: 180px;
}

.secondary-button,
.small-button {
  min-height: 36px;
  margin: 0;
  padding: 8px 12px;
  background: #ffffff;
  color: #245b85;
  border: 1px solid #cbd8e3;
  box-shadow: none;
}

.danger-button {
  color: var(--error);
  border-color: #e1c4c4;
}

.danger-button:hover,
.danger-button:focus {
  background: #fdf3f3;
  border-color: #d9abab;
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 320px;
}

.secondary-button:hover,
.secondary-button:focus,
.small-button:hover,
.small-button:focus {
  background: #eef4f8;
  border-color: #aebfce;
  transform: none;
}

.status {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status.ok {
  background: #e8f3ed;
  color: var(--success);
  border: 1px solid #bad7c8;
}

.status.off {
  background: #f0f3f6;
  color: #68798a;
  border: 1px solid #d4dde5;
}

.page-message {
  min-height: 0;
  margin: 0 0 12px;
  color: var(--muted);
}

.page-message:empty {
  display: none;
}

.page-message.is-error {
  color: var(--error);
}

.page-message.is-success {
  color: var(--success);
}

.page-message.is-error,
.page-message.is-success {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.plain-list {
  margin: 0 0 16px;
  padding-left: 18px;
}

.photo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.photo-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.photo-thumb-button {
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: none;
}

.photo-thumb-button img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-meta {
  display: grid;
  gap: 4px;
}

.photo-meta strong {
  overflow: hidden;
  color: var(--navy);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-meta span {
  color: var(--muted);
  font-size: 0.82rem;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  text-decoration: none;
}

.photo-modal[hidden] {
  display: none;
}

.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.photo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 48, 74, 0.72);
}

.photo-modal-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  padding: 16px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

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

.photo-modal-content img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: var(--panel-soft);
  border-radius: 6px;
}

@media (max-width: 720px) {
  .inline-edit-row > td {
    padding: 10px 4px 16px;
  }

  .inline-edit-panel {
    padding: 16px;
    border-radius: 6px;
  }

  .inline-edit-panel .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .inline-edit-panel table {
    min-width: 680px;
  }

  .admin-layout.admin-shell,
  .admin-layout.admin-wide,
  .admin-layout.dashboard-page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .admin-sidebar {
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-sidebar-overlay {
    position: fixed;
    z-index: 35;
    inset: 5px 0 0;
    background: rgba(0, 26, 52, 0.48);
  }

  .sidebar-open .admin-sidebar-overlay {
    display: block;
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-content {
    padding: 0 12px 36px;
  }

  .admin-layout .admin-header {
    margin: 12px;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    margin: 0;
    font-size: 1.2rem;
  }

  .admin-shell {
    width: calc(100% - 24px);
    margin: 0 12px;
    padding: 18px 0 36px;
  }

  .dashboard-page {
    width: calc(100% - 24px);
    margin-left: 12px;
    margin-right: 12px;
  }

  .admin-wide {
    width: calc(100% - 24px);
    margin-left: 12px;
    margin-right: 12px;
  }

  .admin-wide .panel {
    padding: 14px;
  }

  .admin-wide .panel-header {
    display: grid;
  }

  .admin-wide .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-wide table {
    min-width: 760px;
  }

  .admin-wide .inline-form,
  .admin-wide .filter-row {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .admin-wide button,
  .admin-wide .secondary-button,
  .admin-wide .small-button {
    width: 100%;
  }

  .admin-wide .action-cell {
    min-width: 220px;
  }

  .admin-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 12px;
  }

  .admin-title-block {
    min-width: 0;
  }

  .admin-header h1 {
    overflow: hidden;
    font-size: 1.05rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-user-actions {
    min-width: 0;
  }

  .admin-user-actions .admin-user {
    max-width: 110px;
    overflow: hidden;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-header {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .dashboard-title-block {
    text-align: left;
  }

  .dashboard-user-actions {
    justify-content: space-between;
    width: 100%;
  }

  .dashboard-user-actions .admin-user {
    text-align: left;
    white-space: normal;
  }

  .dashboard-page .summary-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-page .summary-card {
    min-height: 112px;
  }

  .dashboard-kpi-grid,
  .dashboard-operation-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-kpi-card {
    min-height: 112px;
  }

  .dashboard-section-header {
    display: grid;
    align-items: start;
  }

  .dashboard-quick-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-quick-action {
    width: 100%;
  }

  .dashboard-table-wrap {
    overflow-x: hidden;
  }

  .dashboard-table,
  .dashboard-table thead,
  .dashboard-table tbody,
  .dashboard-table tr,
  .dashboard-table th,
  .dashboard-table td {
    display: block;
    width: 100%;
  }

  .dashboard-table thead {
    display: none;
  }

  .dashboard-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-table td {
    padding: 6px 0;
    border-bottom: 0;
  }

  .active-routes-panel {
    position: static;
  }

  .dashboard-route-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  #logout-button {
    margin-left: 0;
    justify-self: start;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .photo-modal {
    padding: 12px;
  }
}

@media (min-width: 721px) and (max-width: 1180px) {
  .dashboard-header {
    grid-template-columns: 1fr;
  }

  .dashboard-title-block {
    text-align: left;
  }

  .dashboard-user-actions {
    justify-content: flex-start;
  }

  .dashboard-page .summary-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

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

  .dashboard-operation-grid {
    grid-template-columns: 1fr;
  }

  .admin-wide .table-wrap {
    overflow-x: auto;
  }

  .admin-wide table {
    min-width: 860px;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .active-routes-panel {
    position: static;
  }
}

.multimedia-filters {
  align-items: end;
  margin-top: 20px;
}

.multimedia-browser {
  min-height: 420px;
}

.multimedia-breadcrumbs {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.multimedia-breadcrumbs button {
  background: transparent;
  border: 0;
  color: #007f86;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 4px;
}

.multimedia-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.multimedia-folder {
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  color: #001a34;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 138px;
  padding: 20px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.multimedia-folder:hover {
  border-color: #9fb8c9;
  box-shadow: 0 9px 22px rgba(0, 26, 52, 0.11);
  transform: translateY(-2px);
}

.multimedia-folder-icon {
  font-size: 28px;
}

.multimedia-folder span:last-child {
  color: #667684;
  font-size: 13px;
}

.multimedia-photo {
  min-width: 0;
}

.multimedia-empty {
  grid-column: 1 / -1;
  padding: 42px 12px;
  text-align: center;
}
