:root {
  color-scheme: light dark;
  --bg: #0f1419;
  --card: #1a222c;
  --text: #e7edf3;
  --muted: #9aa7b2;
  --accent: #25d366;
  --border: #2a3542;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1a1a1a;
    --muted: #5c6b7a;
    --border: #dfe6ee;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.mobile-flow-card {
  border-color: var(--accent);
}

.mobile-flow-note {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}

.mobile-flow-actions .btn.primary {
  min-height: 44px;
  padding: 0.55rem 1rem;
}

.mobile-flow-steps li {
  margin: 0.5rem 0;
}

.head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

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

.admin-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  margin-top: 0.85rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  font-size: 0.88rem;
}

.admin-toc a {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.admin-toc a:hover {
  text-decoration: underline;
}

.admin-toc-sep {
  color: var(--muted);
  user-select: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-top: 1rem;
}

.card h2 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.steps {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.steps li {
  margin: 0.35rem 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.grid {
  display: grid;
  gap: 0.5rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"] {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  min-width: 220px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn.primary {
  background: var(--accent);
  border-color: #1ebe57;
  color: #062d14;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.ghost {
  background: transparent;
}

.hint {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ticket {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  display: grid;
  gap: 0.35rem;
}

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

.ticket .title {
  font-weight: 600;
}

.ticket-actions {
  margin-top: 0.5rem;
}

.status-select {
  max-width: 220px;
}

.err {
  color: #f87171;
  font-size: 0.88rem;
}

.foot {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.foot a {
  color: inherit;
}

.wa-link-risk {
  border-left: 3px solid #c9a227;
  padding-left: 0.75rem;
}

.wa-link-actions {
  margin-top: 0.65rem;
}

.wa-link-log {
  margin-top: 0.75rem;
  max-height: 240px;
  overflow: auto;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border);
}

/* --- Landing (mobile-first, English UI) --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.landing-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #050b14;
  color: #e8f0f8;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

.landing-body.landing-modal-open {
  overflow: hidden;
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.85rem 1.1rem;
  max-width: 420px;
  margin: 0 auto;
}

.landing-brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: conic-gradient(from 140deg, #25d366 0deg 55deg, transparent 55deg 305deg, #25d366 305deg);
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.35);
}

.landing-brand-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: #25d366;
  letter-spacing: -0.02em;
}

.landing-hero {
  position: relative;
  width: 100%;
  min-height: min(28vh, 200px);
  max-height: min(38vh, 280px);
  overflow: hidden;
  background: radial-gradient(ellipse 100% 80% at 50% 0%, rgba(45, 212, 191, 0.12), transparent 55%);
}

.landing-hero-img {
  display: block;
  width: 100%;
  height: min(38vh, 280px);
  object-fit: cover;
  opacity: 0.85;
}

.landing-hero-img--missing {
  display: none;
}

.landing-hero-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 20%, #050b14 100%);
  pointer-events: none;
}

.landing-main {
  max-width: 420px;
  margin: 0 auto;
  padding: 0 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0));
  text-align: center;
}

.landing-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.landing-lead {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
  color: #8b9cb0;
  line-height: 1.45;
}

.landing-flow-note {
  margin: -0.75rem auto 1.25rem;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.5;
  text-align: center;
  max-width: 26rem;
}

.landing-card {
  text-align: left;
  background: linear-gradient(145deg, rgba(22, 36, 62, 0.95), rgba(12, 22, 40, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 16px;
  padding: 1.25rem 1.1rem 1.35rem;
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.45);
}

.landing-field-heading {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: -0.01em;
}

.dial-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #e8f0f8;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.65rem 0.5rem 0.65rem 0.75rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dial-display {
  min-width: 2.75rem;
  text-align: left;
}

.dial-display--pending {
  color: #64748b;
  letter-spacing: 0.12em;
  font-weight: 500;
}

.dial-chevron {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #64748b;
  margin-right: 0.15rem;
}

.phone-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(5, 11, 20, 0.6);
  margin-bottom: 1rem;
}

.phone-sep {
  width: 1px;
  align-self: stretch;
  min-height: 2.75rem;
  background: rgba(148, 163, 184, 0.35);
  flex-shrink: 0;
}

.phone-local {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #e8f0f8;
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  outline: none;
}

.landing-cta {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: #042f2e;
  background: linear-gradient(180deg, #5eead4, #2dd4bf);
  box-shadow: 0 4px 20px rgba(45, 212, 191, 0.35);
}

.landing-cta:active {
  transform: scale(0.99);
}

.landing-cta:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.landing-hint {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: #f87171;
  min-height: 1.25em;
}

/* Country picker (sheet) */
.country-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

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

.country-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.country-modal-panel {
  position: relative;
  max-height: min(78vh, 560px);
  background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.country-modal-head {
  padding: 0.65rem 0.85rem 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  position: relative;
}

.country-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.country-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 2.5rem 0.35rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.country-search-icon {
  width: 18px;
  height: 18px;
  border: 2px solid #64748b;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.country-search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  background: #64748b;
  border-radius: 1px;
  right: -4px;
  bottom: -1px;
  transform: rotate(45deg);
}

.country-search {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #f1f5f9;
  font-size: 0.95rem;
  outline: none;
}

.country-search::placeholder {
  color: #64748b;
}

.country-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0 0.75rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.country-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(51, 65, 85, 0.35);
}

.country-item:active {
  background: rgba(56, 189, 248, 0.08);
}

.country-item-name {
  font-size: 0.95rem;
  color: #f1f5f9;
  text-align: left;
}

.country-item-dial {
  font-size: 0.95rem;
  font-weight: 600;
  color: #38bdf8;
  flex-shrink: 0;
}

.admin-upload-label input[type="file"] {
  max-width: 100%;
  font-size: 0.88rem;
}

.admin-hero-preview-wrap {
  margin-top: 0.5rem;
}

.admin-hero-preview {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  max-height: 140px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.admin-hero-actions {
  margin-top: 0.35rem;
}

.capture-card .capture-line {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0.2rem 0;
  word-break: break-word;
}

.capture-card .capture-line strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 0.25rem;
}

.capture-card .capture-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.capture-card .capture-ua {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}

.capture-card textarea.capture-notes {
  width: 100%;
  max-width: 100%;
  margin-top: 0.25rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  resize: vertical;
  min-height: 3rem;
  box-sizing: border-box;
}
