:root {
  --bg: #071021;
  --panel: #0f1b33;
  --line: #20345d;
  --text: #e7eefc;
  --muted: #8da0c7;
  --warn: #f6c64b;
  --ok: #31d89a;
  --down: #ef6075;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Manrope, Sora, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #11356d 0%, transparent 60%), var(--bg);
  color: var(--text);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.topbar {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(40, 217, 210, 0.08), rgba(20, 47, 91, 0.2));
}

.topbar h1 { margin: 0; font-size: 34px; }
.topbar-tagline {
  margin: 6px 0 2px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #54e1e7;
  text-shadow: 0 0 14px rgba(84, 225, 231, 0.25);
}
.topbar h1 .title-sub {
  font-size: 0.78em;
  font-weight: 700;
}
.topbar-instructions {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.topbar-instructions li + li { margin-top: 4px; }
.topbar-contact {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.topbar-contact a {
  color: #66f0f5;
  text-decoration: none;
}
.topbar-contact a:hover {
  text-decoration: underline;
}

.landing-stats {
  padding: 14px 16px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.stat-card {
  border: 1px solid #27416f;
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  background: linear-gradient(155deg, rgba(40, 217, 210, 0.09), rgba(15, 27, 51, 0.92));
  box-shadow: inset 0 0 0 1px rgba(84, 225, 231, 0.08), 0 6px 20px rgba(6, 20, 44, 0.45);
}
.counter-value {
  font-size: 31px;
  line-height: 1;
  font-weight: 800;
  color: #66f0f5;
  text-shadow: 0 0 14px rgba(102, 240, 245, 0.22);
}
.counter-label {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #a6b9df;
  font-weight: 700;
}
.stat-card.missed .counter-value {
  color: #ef6075;
  text-shadow: 0 0 14px rgba(239, 96, 117, 0.24);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: var(--panel);
}

.hidden { display: none !important; }

h2, h3 { margin-top: 0; }

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

label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

input, select, button {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0a162d;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}

textarea {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0a162d;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  resize: vertical;
  min-height: 110px;
}

button {
  cursor: pointer;
  background: linear-gradient(90deg, #1cc6d8, #28d9d2);
  color: #031021;
  font-weight: 700;
  border: 0;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-tabs {
  display: flex;
  gap: 8px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.active {
  background: linear-gradient(90deg, #1cc6d8, #28d9d2) !important;
  color: #031021 !important;
  border-color: transparent !important;
}

#adminPanel {
  display: grid;
  gap: 16px;
}

.actions { margin-bottom: 10px; }
.checkline { display: flex; align-items: center; gap: 8px; }
.flow-checkline { padding-top: 18px; }
.status { min-height: 22px; color: var(--warn); font-size: 13px; margin-bottom: 8px; }
.span-3 { grid-column: span 3; }
.hint { color: var(--muted); font-size: 12px; }
.telegram-setup {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid #1a2f54;
}
.telegram-setup h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.telegram-note {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.telegram-note a {
  color: #66f0f5;
  text-decoration: none;
}
.telegram-note a:hover {
  text-decoration: underline;
}
.telegram-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.telegram-inline {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 200px) minmax(150px, 200px);
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
}
.panel-divider {
  border: 0;
  border-top: 1px solid #1a2f54;
  margin: 14px 0;
}

.terms-consent {
  display: grid;
  gap: 10px;
  align-content: start;
}
.terms-consent .checkline {
  align-items: flex-start;
}
.terms-consent .checkline span {
  line-height: 1.35;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 20, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  width: min(980px, 100%);
  height: min(85vh, 860px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0a162d;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #1a2f54;
  background: #0f1b33;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

#termsFrame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #091327;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
  font-size: 13px;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid #1a2f54;
  text-align: left;
  vertical-align: top;
}

th { background: #0a162d; color: #9fb2d7; }
tr:last-child td { border-bottom: 0; }

.inline-job-details-row td {
  background: rgba(8, 19, 42, 0.82);
}

.inline-job-details {
  padding: 10px 0 2px;
}

.inline-job-details h3 {
  margin: 0 0 8px;
}

.btn-secondary {
  background: #142748;
  color: #cddaf4;
  border: 1px solid #27416f;
  font-weight: 600;
}

#registerBtn {
  background: linear-gradient(90deg, #ffd54f, #ffbe3d);
  color: #1e1704;
  border: 1px solid #f3b62f;
  box-shadow: 0 0 0 1px rgba(255, 221, 120, 0.18), 0 10px 20px rgba(255, 190, 61, 0.22);
  font-weight: 800;
}

#registerBtn:disabled {
  opacity: 0.82;
  background: linear-gradient(90deg, #c89f39, #b2862e);
  color: #2a220d;
}

.btn-danger {
  background: #3a1a27;
  color: #ffd5dc;
  border: 1px solid #7a3049;
  font-weight: 700;
  margin-left: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 10px;
  font-weight: 700;
}

.badge-up {
  background: rgba(49, 216, 154, 0.16);
  color: var(--ok);
  border: 1px solid rgba(49, 216, 154, 0.3);
}

.badge-down {
  background: rgba(239, 96, 117, 0.14);
  color: var(--down);
  border: 1px solid rgba(239, 96, 117, 0.3);
}

.badge-unknown {
  background: rgba(141, 160, 199, 0.14);
  color: #a7b7d6;
  border: 1px solid rgba(141, 160, 199, 0.28);
}

@media (max-width: 800px) {
  .app { padding: 12px; }
  th, td { font-size: 12px; padding: 7px; }
  .span-3 { grid-column: span 1; }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .telegram-inline {
    grid-template-columns: 1fr;
  }
}
