/* ==========================================================================
   Nexklik Cloud - Design System
   Light theme, mobile-first, app shell layout
   ========================================================================== */

:root {
  /* Color - client-specified accent palette (2026 refresh) */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-sunken: #F5F5F5;
  --border: #F5F5F5;
  --border-strong: #D3D3D3;

  --text: #12141C;
  --text-secondary: #5B5F70;
  --text-muted: #8D91A3;
  --text-on-primary: #12141C;

  --primary: #D3D3D3;
  --primary-dark: #BFBFBF;
  --primary-soft: #F5F5F5;
  --primary-soft-strong: #EDEDED;

  /* CTA accent - main action buttons only (client-supplied sage green) */
  --cta: #B3C1B0;
  --cta-dark: #9DAD99;
  --cta-text: #12141C;

  --success: #04966B;
  --success-soft: #E1F6EE;
  --warning: #A8660A;
  --warning-soft: #FCF1DE;
  --danger: #D23B3B;
  --danger-soft: #FBEAEA;

  --node-active: #D3D3D3;
  --node-done: #04966B;
  --node-pending: #F5F5F5;

  /* Type */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;

  /* Radius / shadow */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(18, 20, 28, 0.04), 0 1px 1px rgba(18, 20, 28, 0.03);
  --shadow-md: 0 8px 24px rgba(18, 20, 28, 0.08);
  --shadow-lg: 0 20px 48px rgba(18, 20, 28, 0.12);

  /* Layout */
  --header-h: 64px;
  --bottomnav-h: 68px;
  --sidebar-w: 248px;
  --max-w: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; line-height: 1.15; color: var(--text); }
h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: 24px; font-weight: 700; line-height: 1.25; }
h3 { font-size: 18px; font-weight: 700; line-height: 1.3; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

.mono { font-family: var(--font-mono); }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-sm { height: 38px; padding: 0 14px; font-size: 13.5px; border-radius: var(--radius-sm); }

.btn-primary { background: var(--cta); color: var(--cta-text); }
.btn-primary:hover { background: var(--cta-dark); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-sunken); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }

.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 24px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12.5px; color: var(--text-muted); }
.field .error-text { font-size: 12.5px; color: var(--danger); display: none; }
.field.has-error .error-text { display: block; }
.field.has-error input, .field.has-error select { border-color: var(--danger); }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], select {
  height: 48px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  width: 100%;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235B5F70' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

.input-otp {
  display: flex;
  gap: 10px;
}
.input-otp input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 0;
}

.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text-secondary); }
.checkbox-row input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- Badges / Status ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-neutral { background: var(--surface-sunken); color: var(--text-secondary); }

.badge-success .badge-dot { animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(4,150,107,0.35); }
  50% { box-shadow: 0 0 0 4px rgba(4,150,107,0); }
}

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 13.5px;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert-danger { background: var(--danger-soft); border-color: #F3CFCF; color: #8F2A2A; }
.alert-warning { background: var(--warning-soft); border-color: #F1DDB0; color: #7A4E08; }
.alert-info { background: var(--primary-soft); border-color: var(--primary-soft-strong); color: var(--text); }
.alert-success { background: var(--success-soft); border-color: #BFEBDB; color: #04664A; }

/* ---------- Deployment rail (signature stepper) ---------- */
.deploy-rail {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 14px 20px;
  scrollbar-width: none;
  min-width: 0;
  width: 100%;
}
.deploy-rail::-webkit-scrollbar { display: none; }
.rail-node {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.rail-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--node-pending);
  flex-shrink: 0;
}
.rail-node.is-done .rail-dot { background: var(--node-done); }
.rail-node.is-active .rail-dot { background: var(--node-active); box-shadow: 0 0 0 4px var(--primary-soft); }
.rail-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.rail-node.is-active .rail-label { color: var(--text); }
.rail-node.is-done .rail-label { color: var(--text-secondary); }
.rail-line {
  width: 22px;
  height: 1px;
  background: var(--border-strong);
  flex-shrink: 0;
}
.rail-node.is-done + .rail-line { background: var(--node-done); }

.step-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 20px 0;
  width: 100%;
  min-width: 0;
}
.step-meta .step-count { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

/* ---------- Auth / onboarding shell ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.auth-shell > * { min-width: 0; }
.auth-rail-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  min-width: 0;
}
.auth-topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  width: 100%;
  min-width: 0;
}
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 60px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 420px) {
  .hide-xs { display: none; }
}

/* ---------- App shell (dashboard) ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
}
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: none;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 28px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.sidebar-link svg { flex-shrink: 0; }
.sidebar-link.is-active { background: var(--primary-soft); color: var(--text); font-weight: 700; }
.sidebar-link:hover:not(.is-active) { background: var(--surface-sunken); color: var(--text); }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }

.app-main { flex: 1; min-width: 0; }
.app-topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-content { padding: 20px 20px calc(var(--bottomnav-h) + 28px); }

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 14px;
}
.bottom-nav-link.is-active { color: var(--text); }

@media (min-width: 900px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none; }
  .app-content { padding: 28px 32px 40px; }
}

/* ---------- Table ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 14px 10px;
}
.data-table td { padding: 14px; border-top: 1px solid var(--border); }
.data-table tr:first-child td { border-top: none; }

/* ---------- Utility ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.flex-row { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.stack-xs > * + * { margin-top: 6px; }
.stack-sm > * + * { margin-top: 12px; }
.stack-md > * + * { margin-top: 20px; }
.stack-lg > * + * { margin-top: 32px; }

.divider { height: 1px; background: var(--border); border: none; margin: 20px 0; }

/* ---------- Select cards (service/region/plan pickers) ---------- */
.pick-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
  display: block;
}
.pick-card:hover { border-color: var(--border-strong); }
.pick-card.is-selected { border-color: var(--primary); background: var(--primary-soft); }
.pick-card input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; }

/* ---------- Progress bar ---------- */
.progress-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}