:root {
  --bg: #070c12;
  --bg-soft: #0d141d;
  --card: #131c27;
  --card-2: #0f1722;
  --text: #edf3fa;
  --muted: #a9b8ca;
  --line: #2a3a4e;
  --accent: #e2dd49;
  --accent-2: #7cad33;
  --accent-soft: rgba(226, 221, 73, 0.12);
  --danger: #c85a5a;
  --ok: #2ea56b;
  --radius: 16px;
  --radius-lg: 20px;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 6px 22px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg);
  background:
    radial-gradient(1000px 440px at 20% -10%, rgba(226, 221, 73, 0.12), transparent 58%),
    radial-gradient(1200px 520px at 100% 0%, rgba(66, 120, 63, 0.16), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  line-height: 1.4;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("assets/logo-stormo.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
  background-size: min(62vw, 380px);
  opacity: 0.075;
  filter: saturate(0.9) contrast(1.03);
  pointer-events: none;
  z-index: 0;
}

html.zoom-locked,
html.zoom-locked body {
  touch-action: pan-x pan-y;
  overscroll-behavior: none;
}

.app-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px calc(94px + env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  animation: cardIn 0.45s ease both;
}

.card:not(.topbar)::before {
  content: none;
}

.card:not(.topbar) > * {
  position: relative;
  z-index: 1;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.03), transparent 65%);
  pointer-events: none;
}

.topbar {
  display: grid;
  grid-template-columns: 66px 1fr 66px;
  gap: 12px;
  align-items: center;
  margin: 8px 0 14px;
  background: linear-gradient(180deg, rgba(20, 30, 41, 0.92), rgba(14, 22, 32, 0.95));
  backdrop-filter: blur(8px);
}

.logo,
.avatar {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid #334559;
  box-shadow: var(--shadow-soft);
  background: #0c121a;
}

.logo {
  object-fit: contain;
  padding: 2px;
}

.brand-center h1 {
  margin: 0;
  font-size: 1.11rem;
  letter-spacing: 0.2px;
}

.brand-center p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.brand-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.brand-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.menu-toggle-btn {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #3b5269;
  background: #162435;
  color: var(--text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.18s ease, border-color 0.18s ease;
}

.menu-toggle-btn:hover {
  background: #20364c;
  border-color: #5f7fa3;
  transform: translateY(-1px);
}

.menu-toggle-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.mobile-menu-backdrop,
.mobile-menu-drawer {
  display: block;
}

.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(3, 7, 12, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 60;
}

.mobile-menu-drawer {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  top: auto;
  width: min(100vw, 900px);
  max-height: min(82dvh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #2f455d;
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, rgba(22, 34, 48, 0.985), rgba(15, 24, 35, 0.985));
  box-shadow: 0 -20px 44px rgba(0, 0, 0, 0.48);
  padding: 14px 14px calc(env(safe-area-inset-bottom) + 18px);
  z-index: 70;
  opacity: 0;
  transform: translate3d(-50%, 108%, 0);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.28s cubic-bezier(0.2, 0.7, 0, 1);
}

.mobile-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-menu-head h2 {
  margin: 0;
  font-size: 1rem;
}

.mobile-menu-close {
  white-space: nowrap;
  padding: 8px 10px;
}

.mobile-menu-note {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.mobile-menu-links {
  display: grid;
  gap: 8px;
}


.mobile-menu-meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(96, 126, 158, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-menu-version {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.2px;
  color: #b9cde3;
  opacity: 0.92;
  white-space: nowrap;
}

.mobile-menu-admin {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  color: #9fd1ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
  background: transparent;
  white-space: nowrap;
}

.mobile-menu-admin:hover {
  color: #cae8ff;
}

.mobile-menu-admin:focus-visible {
  outline: 2px solid rgba(160, 206, 250, 0.72);
  outline-offset: 3px;
  border-radius: 6px;
}

.mobile-menu-link {
  border-radius: 12px;
  border: 1px solid #34495f;
  background: #162231;
  color: var(--text);
  padding: 11px 12px;
  text-align: left;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
}

.mobile-menu-link:hover {
  transform: translateY(-1px);
  background: #1c3043;
  border-color: #587da2;
}

.mobile-menu-link.active {
  background: linear-gradient(180deg, rgba(47, 71, 96, 0.95), rgba(32, 52, 72, 0.95));
  border-color: #6b91b9;
  box-shadow: inset 0 0 0 1px rgba(125, 162, 202, 0.22);
}

.mobile-menu-group {
  display: grid;
  gap: 6px;
}

.mobile-menu-link-parent {
  position: relative;
}

.mobile-menu-link-parent::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
  transition: transform 0.16s ease;
}

.mobile-menu-link-parent.submenu-open::after {
  transform: translateY(-50%) rotate(180deg);
}

.mobile-submenu {
  display: grid;
  gap: 6px;
  padding: 0 0 0 10px;
}

.mobile-submenu-link {
  border-radius: 10px;
  border: 1px solid #324a63;
  background: #132131;
  color: var(--text);
  padding: 10px 11px;
  text-align: left;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.mobile-submenu-link:hover {
  background: #1a2d40;
  border-color: #5a81a8;
}

.mobile-submenu-link.active {
  background: rgba(46, 68, 91, 0.95);
  border-color: #6c93bc;
}

body.mobile-menu-open {
  overflow: hidden;
}

body.mobile-menu-open .mobile-menu-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.mobile-menu-open .mobile-menu-drawer {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
  pointer-events: auto;
}

body.mobile-menu-open .mobile-menu-bottom-bar {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.mobile-menu-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(8, 13, 19, 0.92);
  border-top: 1px solid #2c4155;
  backdrop-filter: blur(10px);
  z-index: 52;
  display: block;
  transition: opacity 0.2s ease, transform 0.22s ease;
}

.mobile-menu-bottom-btn {
  width: 100%;
  border-radius: 14px;
  border: 1px solid #476585;
  background: linear-gradient(180deg, #1a2d42, #152436);
  color: var(--text);
  min-height: 46px;
  padding: 10px 14px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.18s ease, border-color 0.18s ease;
}

.mobile-menu-bottom-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #223951, #1a2c40);
  border-color: #6e95bf;
}

.mobile-section-hidden {
  display: none !important;
}


.home-section {
  border-color: rgba(85, 124, 165, 0.55);
}


.home-grid {
  display: grid;
  gap: 10px;
}

.home-tile {
  border: 1px solid #30465e;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(17, 27, 39, 0.94), rgba(13, 21, 31, 0.95));
  padding: 12px;
}

.home-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.home-tile-head h3 {
  margin: 0;
  font-size: 0.96rem;
}

.home-inline-btn {
  text-decoration: none;
  padding: 7px 10px;
  min-height: 34px;
  font-size: 0.78rem;
}

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

.home-flag-stats p {
  margin: 0;
  display: grid;
  gap: 3px;
  border: 1px solid #2f465f;
  border-radius: 10px;
  background: rgba(20, 33, 47, 0.86);
  padding: 8px 9px;
}

.home-flag-stats span {
  color: var(--muted);
  font-size: 0.74rem;
}

.home-flag-stats strong {
  font-size: 0.92rem;
  letter-spacing: 0.2px;
}

.home-flag-status-text.is-up {
  color: #82eab6;
}

.home-flag-status-text.is-down {
  color: #ffd28b;
}

.home-odg-status,
.home-odg-hint {
  margin: 0;
  color: #d5e0ec;
  font-size: 0.86rem;
  line-height: 1.4;
}

.home-odg-hint {
  color: var(--muted);
  margin-top: 8px;
  font-size: 0.8rem;
}

.home-odg-link {
  display: inline-flex;
  margin-top: 8px;
  text-decoration: none;
  font-weight: 700;
  color: #d2e8ff;
  border: 1px solid #4a6988;
  border-radius: 10px;
  padding: 7px 10px;
  background: rgba(28, 48, 70, 0.68);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.home-odg-link:hover {
  background: rgba(40, 67, 96, 0.82);
  border-color: #749bc1;
}

.home-install-actions {
  margin-top: 10px;
}

.home-install-actions .install-app-btn {
  width: 100%;
}

.home-install-standalone {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.home-install-standalone .install-app-btn {
  min-width: min(100%, 280px);
}


.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.03rem;
}

.section-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}


.itinerary-tools {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 10px;
}

.itinerary-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.itinerary-full-btn {
  white-space: nowrap;
}


.section-note {
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 0.83rem;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
}

#liveDate {
  display: block;
  margin-top: 2px;
  font-size: 0.95rem;
}

.status-badge {
  padding: 7px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, #1d7e2b, #165f21);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e8fce8;
  font-size: 0.75rem;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.status-badge.offline {
  background: linear-gradient(180deg, #6f7d8f, #5d6777);
  color: #f0f4fb;
}

.install-app-btn {
  min-height: 40px;
  padding: 10px 14px;
  white-space: nowrap;
}

.install-app-btn.ready {
  animation: installGlow 1.8s ease-in-out infinite;
}

.install-app-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  animation: none;
}

.status-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.install-hint {
  margin: 0;
  color: #d9e5f5;
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 7px 10px;
  border: 1px solid #31465e;
  border-radius: 10px;
  background: rgba(16, 25, 36, 0.72);
}

.privacy-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.privacy-note strong {
  color: #dce7f5;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

.primary-btn,
.ghost-btn {
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.16s ease, box-shadow 0.18s ease;
}

.primary-btn {
  color: #121212;
  background: linear-gradient(180deg, #f2ee61, var(--accent));
  border-color: #bcb83f;
  box-shadow: 0 8px 20px rgba(226, 221, 73, 0.22);
}

.primary-btn:hover,
.ghost-btn:hover,
.edit-btn:hover,
.delete-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.primary-btn:active,
.ghost-btn:active,
.edit-btn:active,
.delete-btn:active {
  transform: translateY(1px);
}

.ghost-btn {
  color: var(--text);
  background: #182332;
  border-color: #35485d;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #8da9c8;
  outline-offset: 2px;
}

.chip {
  padding: 6px 10px;
  border: 1px solid #35475b;
  border-radius: 999px;
  font-size: 0.72rem;
  color: #dbe5f2;
  background: rgba(10, 16, 23, 0.62);
  white-space: nowrap;
}

.timeline {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.timeline li:last-child {
  margin-bottom: 0;
}

.timeline .dot {
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8a6, var(--accent));
  box-shadow: 0 0 0 4px rgba(226, 221, 73, 0.16);
  animation: dotPulse 2.4s ease-in-out infinite;
}

.timeline .content {
  border-left: 1px dashed #3c5169;
  padding-left: 10px;
}

.timeline h3 {
  margin: 0;
  font-size: 0.92rem;
}

.timeline p {
  margin: 3px 0;
  color: #d8e1ee;
  font-size: 0.88rem;
}

.timeline-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.stage-note-text {
  color: #cfdced;
}

.stage-note-wrap {
  display: block;
  margin-top: 7px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.stage-note-input {
  width: 100%;
  border: 1px solid #3b5066;
  background: #0d151f;
  color: var(--text);
  border-radius: 11px;
  padding: 8px 10px;
  font-size: 0.86rem;
  resize: vertical;
  min-height: 68px;
  transition: border-color 0.18s ease, box-shadow 0.2s ease;
}

.stage-note-input:focus {
  border-color: #4f6d8e;
  box-shadow: 0 0 0 3px rgba(141, 169, 200, 0.16);
}

.map-btn {
  padding: 7px 10px;
  font-size: 0.78rem;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

.segmented-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 2px 0 10px;
}

.segmented-btn,
.sub-segmented-btn {
  border-radius: 11px;
  border: 1px solid #34495f;
  background: #162231;
  color: var(--text);
  padding: 9px 10px;
  text-align: center;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
}

.segmented-btn:hover,
.sub-segmented-btn:hover {
  transform: translateY(-1px);
}

.segmented-btn.active,
.sub-segmented-btn.active {
  background: #22364b;
  border-color: #54799f;
}

.sub-segmented-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: -2px 0 10px;
}

.sub-segmented-btn {
  font-size: 0.8rem;
  padding: 8px 10px;
  border-color: #35516a;
  background: #121e2a;
}

.mensa-panel {
  border: 1px solid #314559;
  border-radius: 14px;
  background: linear-gradient(180deg, #101822, #0f1720);
  padding: 10px;
}

.mensa-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.mensa-panel h3 {
  margin: 0;
  font-size: 0.9rem;
}

.mensa-panel-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.mensa-contrast-btn {
  font-size: 0.7rem;
  line-height: 1;
  color: #dce8f7;
  background: #131f2b;
  border: 1px solid #3b5066;
  border-radius: 999px;
  padding: 6px 9px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
}

.mensa-contrast-btn:hover {
  transform: translateY(-1px);
}

.mensa-contrast-btn[aria-pressed="true"] {
  background: #203548;
  border-color: #648bb3;
  color: #f1f7ff;
}

.mini-chip {
  font-size: 0.68rem;
  color: #deebfb;
  background: rgba(84, 121, 159, 0.22);
  border: 1px solid rgba(84, 121, 159, 0.52);
  border-radius: 999px;
  padding: 4px 8px;
}

.shift-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shift-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--shift-row-border, #31475c);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--shift-row-bg, rgba(17, 27, 38, 0.42)), rgba(15, 25, 36, 0.88));
}

.shift-item:last-child {
  margin-bottom: 0;
}

.role-label {
  color: #dbe3ee;
  font-size: 0.88rem;
  line-height: 1.2;
  flex: 1;
}

.shift-time {
  min-width: 154px;
  text-align: center;
  border: 1px solid var(--shift-time-border, #3b5066);
  background: var(--shift-time-bg, #0d151f);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.mensa-legend {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #2a3d51;
}

.mensa-legend-title {
  margin: 0 0 7px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}


.mensa-legend-scroll {
  position: relative;
  overflow: hidden;
}

.mensa-legend-scroll::before,
.mensa-legend-scroll::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.mensa-legend-scroll::before {
  left: 0;
  background: linear-gradient(90deg, rgba(15, 25, 37, 0.95), rgba(15, 25, 37, 0));
}

.mensa-legend-scroll::after {
  right: 0;
  background: linear-gradient(270deg, rgba(15, 25, 37, 0.95), rgba(15, 25, 37, 0));
}

.mensa-legend-scroll[data-fade-left="true"]::before {
  opacity: 1;
}

.mensa-legend-scroll[data-fade-right="true"]::after {
  opacity: 1;
}

.mensa-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow: visible;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.mensa-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid #36506a;
  background: rgba(13, 22, 33, 0.82);
  color: #d8e4f4;
  font-size: 0.73rem;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.mensa-legend-item-clone {
  pointer-events: none;
}

.mensa-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--mensa-swatch-border, #45617e);
  background: var(--mensa-swatch-bg, rgba(84, 121, 159, 0.2));
  flex: 0 0 auto;
}

#mensaSection.mensa-high-contrast .shift-item {
  box-shadow: inset 0 0 0 1px rgba(183, 208, 235, 0.2);
}

#mensaSection.mensa-high-contrast .shift-time {
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, var(--shift-time-bg), rgba(11, 18, 28, 0.9));
}

#mensaSection.mensa-high-contrast .mensa-legend {
  border-top-color: #486785;
}

#mensaSection.mensa-high-contrast .mensa-legend-item {
  border-color: #4e6d8c;
  background: rgba(10, 16, 24, 0.92);
  color: #e6f0ff;
}


#mensaSection.mensa-high-contrast .mensa-legend-scroll::before {
  background: linear-gradient(90deg, rgba(8, 13, 20, 0.98), rgba(8, 13, 20, 0));
}

#mensaSection.mensa-high-contrast .mensa-legend-scroll::after {
  background: linear-gradient(270deg, rgba(8, 13, 20, 0.98), rgba(8, 13, 20, 0));
}


#mensaSection.mensa-high-contrast .mensa-legend-swatch {
  box-shadow: 0 0 0 1px rgba(8, 13, 20, 0.55), 0 0 0 3px rgba(177, 201, 226, 0.15);
}

#mensaSection.mensa-high-contrast .mensa-contrast-btn[aria-pressed="true"] {
  background: #29425a;
  border-color: #7ea6ce;
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid #304257;
  border-radius: 12px;
  background: linear-gradient(180deg, #111b26, #0e1823);
  box-shadow: var(--shadow-soft);
}

.contact-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-name {
  color: #e5eefb;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
}

.contact-role {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.contact-call {
  text-decoration: none;
  color: #121212;
  background: linear-gradient(180deg, #f2ee61, var(--accent));
  border: 1px solid #bcb83f;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(226, 221, 73, 0.22);
  transition: transform 0.14s ease, filter 0.16s ease, box-shadow 0.18s ease;
}

.contact-call:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.contact-call:active {
  transform: translateY(1px);
}


.contacts-compact {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contacts-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.contact-mini {
  text-decoration: none;
  color: #121212;
  background: linear-gradient(180deg, #f2ee61, var(--accent));
  border: 1px solid #bcb83f;
  border-radius: 10px;
  padding: 9px 10px;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(226, 221, 73, 0.18);
  transition: transform 0.14s ease, filter 0.16s ease;
}

.contact-mini:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.contact-mini:active {
  transform: translateY(1px);
}

.contacts-open-btn {
  align-self: flex-start;
}

.contacts-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.contacts-dialog-head h3 {
  margin: 0;
}

.contact-list-dialog {
  max-height: min(62vh, 460px);
  overflow: auto;
  padding-right: 2px;
}

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

.stat-card {
  border: 1px solid #304357;
  background: linear-gradient(180deg, #101823, #0f1620);
  border-radius: 12px;
  padding: 9px 10px;
  box-shadow: var(--shadow-soft);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.stat-card strong {
  display: inline-block;
  margin-top: 2px;
  font-size: 1.06rem;
}

.flag-time-card {
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.flag-time-card .stat-label,
.flag-time-card strong {
  width: 100%;
  text-align: center;
}

.flag-time-card strong {
  display: block;
  margin-top: 4px;
}

.flag-centered-card {
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.flag-centered-card .stat-label,
.flag-centered-card strong {
  width: 100%;
  text-align: center;
}

.flag-centered-card strong {
  display: block;
  margin-top: 4px;
}

.flag-widget {
  border: 1px solid #304257;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(16, 24, 35, 0.9), rgba(13, 21, 31, 0.92));
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flag-widget-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.flag-widget-head h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.15px;
}

.flag-source-badge {
  font-size: 0.72rem;
  text-transform: none;
}

.flag-source-badge.is-fallback {
  border-color: rgba(200, 90, 90, 0.58);
  background: rgba(200, 90, 90, 0.16);
  color: #f5c1c1;
}

.flag-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}

.flag-stats #liveDate {
  margin-top: 2px;
  font-size: 0.92rem;
  line-height: 1.2;
}

.flag-status-text {
  font-size: 1.03rem;
}

.flag-status-text.is-up {
  color: var(--ok);
}

.flag-status-text.is-down {
  color: var(--danger);
}

.flag-widget-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.38;
}

.flag-pdf-warning {
  margin: -2px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(226, 221, 73, 0.48);
  background: rgba(226, 221, 73, 0.11);
  color: #f7f19d;
  font-size: 0.78rem;
  line-height: 1.35;
}

.flag-pdf-warning.is-expired {
  border-color: rgba(200, 90, 90, 0.62);
  background: rgba(200, 90, 90, 0.16);
  color: #ffd3d3;
}

.progress-wrap {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  border: 1px solid #304257;
  background: #0b141e;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e1dd4e, #7fb836);
  transition: width 0.3s ease;
  position: relative;
}

.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.28), transparent 65%);
  animation: shimmer 2.2s linear infinite;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #304257;
  border-radius: 12px;
  background: linear-gradient(180deg, #111b26, #0e1823);
  margin-bottom: 8px;
  position: relative;
  transition: transform 0.16s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: itemIn 0.28s ease both;
}

.task-item:hover {
  transform: translateY(-1px);
  border-color: #3a5572;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.task-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  background: #486886;
}

.task-item[data-category="h12-morning"]::before {
  background: #7fb836;
}

.task-item[data-category="h12-evening"]::before {
  background: #6da1d8;
}

.task-item[data-category="h24"]::before {
  background: #b788dd;
}

.task-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-2);
}

.task-body {
  min-width: 0;
}

.task-text {
  font-size: 0.9rem;
  line-height: 1.3;
}

.task-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
}

.task-item.done .task-text {
  text-decoration: line-through;
  opacity: 0.72;
}

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

.edit-btn,
.delete-btn {
  border: 1px solid #3f5268;
  background: #192535;
  color: #d6e2f0;
  border-radius: 10px;
  padding: 7px 9px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.delete-btn {
  color: #f0cbcb;
  border-color: #6b4b56;
}

.empty-state {
  border: 1px dashed #425b75;
  border-radius: 12px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}

#taskDialog,
#editTaskDialog,
#iosInstallDialog,
#installFallbackDialog,
#appMessageDialog,
#contactsDialog {
  border: 1px solid #34506b;
  border-radius: 14px;
  background: #111a25;
  color: var(--text);
  width: min(94vw, 460px);
  padding: 0;
  box-shadow: var(--shadow);
}

#taskDialog::backdrop,
#editTaskDialog::backdrop,
#iosInstallDialog::backdrop,
#installFallbackDialog::backdrop,
#appMessageDialog::backdrop,
#contactsDialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

#taskForm,
#editTaskForm,
#iosInstallForm,
#installFallbackForm,
#appMessageForm,
#contactsForm {
  padding: 14px;
}

#taskForm h3,
#editTaskForm h3,
#iosInstallForm h3,
#installFallbackForm h3,
#appMessageForm h3,
#contactsForm h3 {
  margin: 0 0 12px;
}

#taskForm label,
#editTaskForm label {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 8px;
}

#taskForm input,
#taskForm select,
#editTaskForm textarea,
#editTaskForm select {
  width: 100%;
  margin-top: 5px;
  background: #0c141e;
  border: 1px solid #35516b;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 0.9rem;
}

#editTaskForm textarea {
  resize: vertical;
  min-height: 90px;
}

.ios-steps {
  margin: 0;
  padding-left: 18px;
  color: #d6e2f0;
  line-height: 1.4;
  font-size: 0.9rem;
}

.ios-steps li + li {
  margin-top: 6px;
}

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

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(8, 13, 19, 0.92);
  border-top: 1px solid #2c4155;
  backdrop-filter: blur(10px);
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.bottom-nav button {
  border-radius: 12px;
  border: 1px solid #34495f;
  background: #162231;
  color: var(--text);
  padding: 10px 12px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
}

.bottom-nav button.active {
  background: #22364b;
  border-color: #54799f;
}

.bottom-nav button:hover {
  transform: translateY(-1px);
}

/* ---- ODG page ---- */
.odg-page .app-shell {
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

.odg-topbar {
  grid-template-columns: 66px minmax(0, 1fr) 66px;
}

.odg-note {
  margin-bottom: 10px;
}

.odg-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.odg-filter-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.odg-filter-field select {
  width: 100%;
  background: #0c141e;
  border: 1px solid #35516b;
  color: var(--text);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.86rem;
}

.odg-filter-field select:disabled {
  opacity: 0.65;
}

.odg-reset-btn {
  align-self: end;
  min-height: 38px;
  padding: 8px 10px;
}

.odg-sort-note {
  margin: 0 0 10px;
  color: #cad9e8;
  font-size: 0.8rem;
}

.odg-tree {
  display: grid;
  gap: 10px;
}

.odg-year-box {
  border: 1px solid #2d4054;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(17, 27, 39, 0.95), rgba(13, 21, 31, 0.95));
  overflow: hidden;
}

.odg-year-details,
.odg-month-details {
  width: 100%;
}

.odg-year-summary,
.odg-month-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.odg-year-summary {
  padding: 12px 14px;
  background: rgba(28, 42, 58, 0.72);
  border-bottom: 1px solid rgba(61, 85, 110, 0.55);
}

.odg-year-summary::after,
.odg-month-summary::after {
  content: "▸";
  color: var(--muted);
  font-size: 0.92rem;
  transition: transform 0.16s ease;
}

.odg-year-details[open] > .odg-year-summary::after,
.odg-month-details[open] > .odg-month-summary::after {
  transform: rotate(90deg);
}

.odg-year-summary::-webkit-details-marker,
.odg-month-summary::-webkit-details-marker {
  display: none;
}

.odg-year-title,
.odg-month-title {
  font-weight: 700;
  letter-spacing: 0.1px;
}

.odg-year-meta,
.odg-month-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.odg-months-wrap {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.odg-month-details {
  border: 1px solid #2f4459;
  border-radius: 12px;
  background: rgba(16, 26, 38, 0.9);
  overflow: hidden;
}

.odg-month-summary {
  padding: 10px 12px;
}

.odg-pdf-list {
  margin: 0;
  padding: 0 10px 10px;
  list-style: none;
  display: grid;
  gap: 8px;
}

.odg-pdf-item {
  border-radius: 10px;
  border: 1px solid #334c64;
  background: #142334;
}

.odg-pdf-link {
  display: block;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  padding: 10px 12px;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.odg-pdf-link:hover {
  background: #1d3247;
}

.odg-flat-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.odg-flat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
}

.odg-flat-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.odg-pdf-title {
  margin: 0;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
  line-height: 1.28;
}

.odg-pdf-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.odg-save-btn {
  text-decoration: none;
  white-space: nowrap;
  min-width: 110px;
  text-align: center;
}

.odg-save-btn.is-loading {
  opacity: 0.78;
  pointer-events: none;
}


.odg-pdf-empty {
  border-radius: 10px;
  border: 1px dashed #3c556f;
  color: var(--muted);
  background: rgba(16, 24, 35, 0.7);
  padding: 10px 12px;
  font-size: 0.84rem;
}

.odg-muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.odg-alert,
.odg-empty-state {
  border-radius: 12px;
  border: 1px solid #3f576f;
  background: rgba(20, 30, 44, 0.82);
  padding: 12px;
}

.odg-alert h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.odg-alert p,
.odg-empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.odg-alert p + p,
.odg-empty-state p + p {
  margin-top: 8px;
}


.odg-viewer-meta {
  margin: 0 0 10px;
  color: #d1deec;
  font-size: 0.86rem;
}

.odg-viewer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  justify-content: space-between;
}

.odg-viewer-actions .ghost-btn {
  text-decoration: none;
}

.odg-viewer-actions .primary-btn {
  text-decoration: none;
}

.odg-viewer-file {
  color: var(--muted);
  font-size: 0.82rem;
  flex: 1 1 100%;
}

.odg-viewer-tip {
  margin: 0 0 10px;
  color: #c0d2e4;
  font-size: 0.82rem;
}

.odg-pdf-frame-wrap {
  border: 1px solid #35506b;
  border-radius: 14px;
  overflow: hidden;
  background: #0f1722;
  min-height: 66dvh;
  height: clamp(520px, 75dvh, 980px);
  display: block;
  padding: 0;
}

.odg-pdf-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #0f1722;
  display: block;
  margin: 0;
  overflow: auto;
  pointer-events: auto;
}

.odg-viewer-error {
  border-radius: 12px;
  border: 1px solid #526a84;
  background: rgba(20, 31, 45, 0.9);
  padding: 12px;
}

.odg-viewer-error h3 {
  margin: 0 0 8px;
}

.odg-viewer-error p {
  margin: 0;
  color: var(--muted);
}

.odg-viewer-error p + p {
  margin-top: 8px;
}


@media (max-width: 759px) {
  .odg-pdf-frame-wrap {
    min-height: 64dvh;
    height: clamp(460px, 72dvh, 900px);
  }

  .odg-pdf-frame {
    width: 100%;
    height: 100%;
  }
}

@media (min-width: 760px) {
  .odg-pdf-frame-wrap {
    height: clamp(560px, 76dvh, 1040px);
  }
}
@media (max-width: 759px) {
  body::before {
    background-size: min(74vw, 310px);
    opacity: 0.08;
  }
}

@media (min-width: 760px) {
  .topbar {
    margin-top: 12px;
  }
}

@media (max-width: 759px) {
  .app-shell {
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) 66px;
  }

  .bottom-nav {
    display: none;
  }

  .odg-toolbar {
    grid-template-columns: 1fr;
  }

  .odg-flat-item {
    flex-direction: column;
    align-items: stretch;
  }

  .odg-save-btn {
    width: 100%;
  }
}


@media (max-width: 600px) {
  .timeline-head-row {
    gap: 8px;
  }

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

  .map-btn {
    padding: 6px 8px;
    font-size: 0.74rem;
  }

  .contact-item {
    flex-direction: column;
    align-items: stretch;
  }

  .contact-call {
    text-align: center;
  }

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

  .home-tile-head {
    flex-wrap: wrap;
  }

  .contacts-preview {
    grid-template-columns: 1fr;
  }

  .contacts-open-btn {
    width: 100%;
  }

  .home-install-standalone {
    justify-content: stretch;
  }

  .home-install-standalone .install-app-btn {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .task-actions {
    flex-direction: column;
  }

  .edit-btn,
  .delete-btn {
    width: 100%;
  }

  .status-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .status-row > div:first-child {
    min-width: 0;
  }

  #liveDate {
    font-size: 0.82rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.22;
  }

  .status-badge {
    padding: 6px 9px;
    font-size: 0.68rem;
  }

  .status-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .itinerary-tools {
    margin-top: -4px;
  }

  .install-hint {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes itemIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dotPulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(226, 221, 73, 0.16);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(226, 221, 73, 0.25);
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-140%);
  }
  to {
    transform: translateX(140%);
  }
}


.primary-btn:disabled,
.ghost-btn:disabled,
.edit-btn:disabled,
.delete-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.12);
}

.fallback-intro {
  margin: 0 0 8px;
  color: #d6e2f0;
  font-size: 0.9rem;
  line-height: 1.35;
}


@keyframes installGlow {
  0%,
  100% {
    box-shadow: 0 8px 20px rgba(226, 221, 73, 0.24);
  }
  50% {
    box-shadow: 0 10px 24px rgba(226, 221, 73, 0.44);
  }
}

[hidden] {
  display: none !important;
}


.app-message-text {
  margin: 0;
  color: #d6e2f0;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-line;
}

.primary-btn.destructive {
  color: #fff0f0;
  background: linear-gradient(180deg, #b24646, #913737);
  border-color: #8a3232;
  box-shadow: 0 8px 20px rgba(181, 70, 70, 0.24);
}

/* ---- Admin ODG page ---- */
.admin-page .app-shell {
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.admin-card {
  margin-top: 14px;
}

.admin-topbar {
  grid-template-columns: 66px minmax(0, 1fr) 66px;
}

.admin-topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  min-width: 0;
}

.admin-topbar-link {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 0.78rem;
  border-color: #4a6787;
  background: #192a3d;
  white-space: nowrap;
}

.admin-panel {
  margin-top: 12px;
  border: 1px solid #2f445a;
  border-radius: 14px;
  background: rgba(17, 27, 39, 0.8);
  padding: 12px;
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-panel-head h3 {
  margin: 0;
  font-size: 1.02rem;
}

.admin-user-box {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #37516c;
  border-radius: 10px;
  background: rgba(15, 24, 35, 0.8);
  color: #d5e4f2;
  font-size: 0.84rem;
}

.admin-form {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.admin-form-grid {
  display: grid;
  gap: 10px;
}

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

.admin-upload-grid {
  grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
}

.admin-effemeridi-grid {
  grid-template-columns: minmax(0, 1fr);
}

.admin-effemeridi-status-wrap {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #334a61;
  background: rgba(12, 20, 30, 0.62);
  display: grid;
  gap: 6px;
}

.admin-effemeridi-status-wrap[data-state="ok"] {
  border-color: rgba(91, 163, 108, 0.8);
  background: rgba(32, 61, 41, 0.28);
}

.admin-effemeridi-status-wrap[data-state="warning"] {
  border-color: rgba(198, 155, 71, 0.78);
  background: rgba(71, 57, 25, 0.28);
}

.admin-effemeridi-status-wrap[data-state="missing"],
.admin-effemeridi-status-wrap[data-state="error"] {
  border-color: rgba(180, 78, 78, 0.72);
  background: rgba(74, 36, 36, 0.28);
}

.admin-effemeridi-status-line {
  margin: 0;
  color: #dce9f6;
  font-size: 0.84rem;
  line-height: 1.36;
  word-break: break-word;
}

.admin-effemeridi-status-line strong {
  color: #f4f8fd;
  font-weight: 700;
}


.admin-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.admin-field-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.admin-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 42px;
  padding: 10px 11px;
  border-radius: 11px;
  border: 1px solid #3b546c;
  background: #0f1722;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.25;
}

.admin-input[type="file"] {
  padding: 8px 9px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-input[type="date"] {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  display: block;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.admin-date-field {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.admin-upload-form,
.admin-upload-grid,
.admin-upload-grid .admin-field {
  min-width: 0;
}

.admin-input[type="date"]::-webkit-datetime-edit {
  padding-right: 2px;
}

.admin-input::file-selector-button {
  margin-right: 10px;
  border: 1px solid #45617d;
  border-radius: 8px;
  background: #17273a;
  color: #e4eef8;
  padding: 6px 10px;
  cursor: pointer;
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-actions .primary-btn,
.admin-actions .ghost-btn {
  min-height: 40px;
}

.admin-feedback {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #334b62;
  border-radius: 10px;
  background: rgba(12, 20, 30, 0.66);
  color: #d6e5f3;
  font-size: 0.84rem;
  line-height: 1.35;
}

.admin-feedback:empty {
  display: none;
}

.admin-manage-actions {
  margin-top: 8px;
}

.admin-records-wrap {
  margin-top: 10px;
  border: 1px solid #2d4156;
  border-radius: 12px;
  background: rgba(11, 18, 27, 0.66);
  overflow: hidden;
}

.admin-records-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(61, 82, 104, 0.5);
}

.admin-record-item:last-child {
  border-bottom: 0;
}

.admin-record-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.admin-record-title {
  margin: 0;
  color: #e5f0fa;
  font-weight: 700;
  font-size: 0.9rem;
}

.admin-record-meta {
  margin: 0;
  color: #a7bfd6;
  font-size: 0.79rem;
  line-height: 1.35;
  word-break: break-word;
}

.admin-record-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-mini-btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.78rem;
}

.admin-record-empty {
  margin: 0;
  padding: 12px;
  color: #b9cbde;
  font-size: 0.86rem;
}

@media (max-width: 759px) {
  .admin-topbar {
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    gap: 10px;
  }

  .admin-topbar .logo {
    width: 54px;
    height: 54px;
  }

  .admin-topbar .avatar {
    width: 50px;
    height: 50px;
    border-radius: 12px;
  }

  .admin-topbar-right {
    grid-column: auto;
    justify-content: flex-end;
  }

  .admin-topbar-link {
    flex: 0 0 auto;
    text-align: center;
    min-height: 40px;
  }

  .admin-auth-grid,
  .admin-upload-grid {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-actions .primary-btn,
  .admin-actions .ghost-btn {
    width: 100%;
  }

  .admin-panel {
    padding: 10px;
  }

  .admin-upload-grid {
    gap: 8px;
  }

  .admin-effemeridi-grid {
    gap: 8px;
  }

  .admin-effemeridi-status-wrap {
    padding: 10px;
    gap: 5px;
  }

  .admin-effemeridi-status-line {
    font-size: 0.82rem;
  }

  .admin-input[type="date"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 42px;
    inline-size: 100%;
    max-inline-size: 100%;
    font-size: 16px;
    padding-right: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .admin-upload-form,
  .admin-effemeridi-form {
    overflow-x: hidden;
  }

  .admin-upload-grid .admin-field:first-child,
  .admin-effemeridi-grid .admin-field,
  .admin-date-field {
    max-width: 100%;
    width: 100%;
    min-width: 0;
  }

  .admin-record-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-record-actions {
    justify-content: stretch;
  }

  .admin-record-actions .admin-mini-btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 390px) {
  .admin-upload-grid {
    gap: 7px;
  }

  .admin-input[type="date"] {
    font-size: 15px;
    min-height: 40px;
    padding-right: 4px;
  }
}

/* ---- Admin quick access modal ---- */
body.admin-access-modal-open {
  overflow: hidden;
}

.admin-access-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  background: rgba(4, 9, 14, 0.72);
  backdrop-filter: blur(4px);
}

.admin-access-dialog {
  width: min(100%, 420px);
  border: 1px solid #36506a;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18, 28, 40, 0.98), rgba(12, 20, 30, 0.99));
  box-shadow: 0 26px 54px rgba(0, 0, 0, 0.5);
  padding: 14px;
}

.admin-access-header h3 {
  margin: 0;
  font-size: 1rem;
  color: #eef6ff;
}

.admin-access-header p {
  margin: 6px 0 0;
  color: #b5c7da;
  font-size: 0.85rem;
}

.admin-access-form {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.admin-access-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.admin-access-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border-radius: 11px;
  border: 1px solid #3f5a75;
  background: #0f1722;
  color: var(--text);
}

.admin-access-error {
  min-height: 1.25em;
  margin: 0;
  color: #ffb7b7;
  font-size: 0.82rem;
}

.admin-access-actions {
  margin-top: 2px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.admin-access-actions .ghost-btn,
.admin-access-actions .primary-btn {
  min-height: 38px;
  min-width: 110px;
}

@media (max-width: 480px) {
  .admin-access-dialog {
    width: min(100%, 360px);
    padding: 12px;
  }

  .admin-access-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .admin-access-actions .ghost-btn,
  .admin-access-actions .primary-btn {
    width: 100%;
    min-width: 0;
  }
}
