*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: #1a1a2e;
  background: #f4f6fb;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

header {
  padding: 1rem 0;
  border-bottom: 1px solid #dde3ef;
  margin-bottom: 1.5rem;
}

.header-actions {
  font-size: 0.9rem;
}

.header-actions a {
  color: #2563eb;
  text-decoration: none;
}

.locale-switcher {
  display: inline-flex;
  gap: 0.35rem;
  margin-right: 0.75rem;
}

.locale-switcher a {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #64748b;
  font-weight: 600;
  font-size: 0.8rem;
}

.locale-switcher a.active {
  background: #e0e7ff;
  color: #2563eb;
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
}

header a {
  color: #2563eb;
  text-decoration: none;
  font-size: 0.9rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 1rem;
}

/* Country flag stripe at top of national cards (NL / ES) */
.card-nl,
.card-es {
  overflow: hidden;
}
.card-nl::before,
.card-es::before {
  content: "";
  display: block;
  height: 14px;
  margin: -1.25rem -1.25rem 1rem;
}
/* Netherlands: red · white · blue */
.card-nl::before {
  background: linear-gradient(
    to bottom,
    #ae1c28 0 33.33%,
    #ffffff 33.33% 66.66%,
    #21468b 66.66% 100%
  );
}
/* Spain: red · yellow · red */
.card-es::before {
  background: linear-gradient(
    to bottom,
    #aa151b 0 25%,
    #f1bf00 25% 75%,
    #aa151b 75% 100%
  );
}

.watcher-alerted {
  color: #1d4ed8;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
.watcher-alerted a {
  color: #1d4ed8;
}

h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

label {
  display: block;
  font-weight: 600;
  margin: 0.75rem 0 0.25rem;
  font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1.5;
  min-height: 2.875rem;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
}

.password-toggle:hover,
.password-toggle:focus {
  background: #f1f5f9;
  color: #2563eb;
  outline: none;
}

.password-toggle::before {
  content: "👁";
  font-size: 1rem;
}

.password-toggle.is-visible::before {
  content: "🙈";
}

.command-list {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.9rem;
}

.command-list ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.command-list li {
  margin-bottom: 0.35rem;
}

.command-list code {
  background: #e2e8f0;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.setup-steps {
  margin: 0.75rem 0 1rem;
  padding-left: 1.25rem;
}

.setup-steps li {
  margin-bottom: 0.4rem;
}

.wrap-code {
  display: block;
  margin-top: 0.35rem;
  padding: 0.5rem;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 0.8rem;
  word-break: break-all;
}

.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.7rem 1.2rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary {
  background: #64748b;
  color: #fff;
}

a.btn.btn-dark,
button.btn.btn-dark {
  background: #0a0a0a;
  color: #fff;
}

a.btn.btn-dark:hover,
button.btn.btn-dark:hover {
  background: #000;
  color: #fff;
}

.btn-telegram {
  background: #29a9ea;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

a.btn.btn-telegram:hover {
  background: #1e96d4;
  color: #fff;
}

.btn-telegram-icon {
  display: inline-block;
  font-size: 1.05rem;
  transform: rotate(-32deg);
  line-height: 1;
}

.telegram-affiliation {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.35rem;
}

.btn-dark {
  background: #0a0a0a;
  color: #fff;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-success {
  background: #16a34a;
  color: #fff;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-disabled,
.btn:disabled,
a.btn-disabled {
  background: #cbd5e1;
  color: #64748b;
  pointer-events: none;
  cursor: not-allowed;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

.error {
  color: #dc2626;
  font-size: 0.9rem;
}

.success {
  color: #16a34a;
}

.portal-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0.5rem 0;
}

@media (max-width: 640px) {
  .portal-list-scroll {
    max-height: 55vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.25rem;
  }
}

.portal-item label.portal-enable-label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-weight: normal;
  cursor: pointer;
  margin-bottom: 0.35rem;
}

.portal-item-details {
  padding-left: 1.6rem;
  font-weight: normal;
  cursor: default;
}

.portal-listings-warning {
  color: #b91c1c;
  border: 2px solid #b91c1c;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  font-weight: 600;
  background: #fef2f2;
  line-height: 1.5;
}

.portal-listings-warning p {
  margin: 0 0 0.75rem;
}

.portal-listings-warning p:last-child {
  margin-bottom: 0;
}

.setup-alerts-start-banner {
  font-weight: 600;
  margin: 0 0 0.75rem;
}

/* Finish tip uses the same red rectangle as portals warning */
.portal-listings-warning + form.card,
.portal-listings-warning + .card {
  margin-top: 0;
}

.filters-saving-msg {
  margin-top: 0.75rem;
  text-align: center;
}

.portal-listings-row {
  display: inline;
  line-height: 1.6;
}

.portal-listings-link {
  word-break: break-all;
}

.portal-listings-text {
  display: block;
  word-break: break-all;
  margin: 0.15rem 0;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.85rem;
  color: #334155;
}

.portal-listings-text[hidden] {
  display: none !important;
}

.portal-listings-sep {
  color: #94a3b8;
  margin: 0 0.15rem;
  font-size: 0.85rem;
}

.portal-listings-sep[hidden] {
  display: none !important;
}

.portal-listings-test-result {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.portal-listings-test-result:empty {
  display: none;
  margin: 0;
}

.portal-listings-test-ok {
  color: #16a34a;
}

.portal-listings-test-fail {
  color: #dc2626;
}

.portal-listings-cleared-warn {
  display: block;
  margin-top: 0.35rem;
  color: #b45309;
  font-size: 0.85rem;
  font-weight: 600;
}

.portal-listings-link[hidden] {
  display: none !important;
}

.portal-listings-input {
  width: min(100%, 20rem);
  margin: 0 0.25rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid #2563eb;
  border-radius: 4px;
  font-size: 0.9rem;
  vertical-align: baseline;
}

.portal-listings-actions {
  display: inline;
  white-space: nowrap;
}

.portal-listings-actions .btn-link {
  margin-left: 0.35rem;
}

.portal-listings-actions .btn-link[hidden] {
  display: none !important;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: #2563eb;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.legal-content {
  font-size: 0.9rem;
  line-height: 1.6;
}

.legal-content h1,
.legal-content h2,
.legal-content h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.legal-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

.legal-content th,
.legal-content td {
  border: 1px solid #e2e8f0;
  padding: 0.4rem 0.5rem;
  text-align: left;
}

.legal-content ul {
  padding-left: 1.25rem;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.app-nav-back {
  font-size: 0.9rem;
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
}
.app-nav-back:hover {
  text-decoration: underline;
}

.app-nav-label {
  font-size: 0.9rem;
  color: #475569;
  margin: 0;
  white-space: nowrap;
}

.app-nav-select {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font-size: 0.95rem;
  color: #0f172a;
}

.wizard-progress {
  position: relative;
  background: #e2e8f0;
  border-radius: 999px;
  height: 8px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.wizard-progress-bar {
  background: #2563eb;
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.wizard-progress-label {
  display: block;
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.35rem;
  text-align: center;
}

.checkbox-label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-weight: normal;
  margin-top: 1rem;
  cursor: pointer;
}

.checkbox-label input {
  margin-top: 0.2rem;
}

.filter-models {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1rem 1rem;
  margin: 1.25rem 0 0.5rem;
}

.filter-models legend {
  font-weight: 600;
  padding: 0 0.35rem;
}

.filter-models .hint {
  margin-top: 0.35rem;
  margin-bottom: 0.5rem;
}

.filter-models-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.filter-models .checkbox-label {
  margin-top: 0.55rem;
}

.hint {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.75rem;
}

.hint-center {
  text-align: center;
}

.watcher-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

@media (max-width: 640px) {
  .watcher-list {
    max-height: 55vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.25rem;
  }
}

.watcher-item {
  display: block;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e8ecf4;
}

.watcher-body {
  margin-bottom: 0.5rem;
}

.watcher-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.watcher-inline-form {
  margin: 0;
  display: inline;
}

.watcher-interval {
  margin-top: 0.15rem;
}

.full-width-form input,
.full-width-form select {
  width: 100%;
}

.watcher-url {
  word-break: break-all;
  font-size: 0.85rem;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-top: 0.75rem;
}

@media (min-width: 768px) {
  .snapshot-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.snapshot-label {
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.snapshot-box {
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 18rem;
  padding: 0.75rem;
  background: #0b1220;
  color: #e2e8f0;
  border-radius: 10px;
  border: 1px solid rgba(226, 232, 240, 0.16);
  font-size: 0.85rem;
  line-height: 1.35;
  margin: 0;
}

.snapshot-busy {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.08);
}

.snapshot-busy[hidden] {
  display: none;
}

.snapshot-busy-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.snapshot-busy-detail {
  margin: 0;
}

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

.watcher-history-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid #e8ecf4;
}

.watcher-history-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  align-items: baseline;
}

.watcher-history-details {
  margin-top: 0.65rem;
}

.watcher-history-details summary {
  cursor: pointer;
  color: #2563eb;
  font-weight: 600;
}

.feedback-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

@media (min-width: 480px) {
  .feedback-row {
    grid-template-columns: 1fr 1fr;
  }
}

.watcher-form {
  margin-top: 1rem;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.muted {
  color: #64748b;
}

footer {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
}

body.wizard-busy-active {
  overflow: hidden;
}

.wizard-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.45);
}

.wizard-busy-overlay[hidden] {
  display: none;
}

.wizard-busy-panel {
  width: min(100%, 22rem);
  margin: 0;
  text-align: center;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.wizard-busy-spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 1rem;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: wizard-busy-spin 0.8s linear infinite;
}

@keyframes wizard-busy-spin {
  to {
    transform: rotate(360deg);
  }
}

.wizard-busy-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.wizard-busy-detail {
  margin: 0;
}

footer a {
  color: #64748b;
}
