/* ==========================================================================
   Shinaa JPM — Production Anti-Slop Design System
   Archetype: Precision Daylight B2B / Tactile Clean
   ========================================================================== */

:root {
  /* Surface Tokens */
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-subtle: #f8fafc;

  /* Line & Hairline Tokens */
  --line-subtle: #e2e8f0;
  --line-focus: #2563eb;
  --line-hover: #cbd5e1;

  /* Typography Tokens */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Accent & Telemetry */
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-primary-active: #1e40af;
  --accent-soft: #eff6ff;

  --color-success: #059669;
  --color-success-soft: #ecfdf5;
  --color-warning: #d97706;
  --color-warning-soft: #fffbeb;
  --color-danger: #dc2626;
  --color-danger-soft: #fef2f2;

  /* Elevation & Geometry */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-overlay: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);

  --radius-outer: 14px;
  --radius-card: 12px;
  --radius-element: 8px;
  --radius-pill: 9999px;

  /* Font System */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  font-size: 15px;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 120ms ease-out;
}

a:hover {
  color: var(--accent-primary-hover);
  text-decoration: underline;
}

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

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.ic {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.muted {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease-out, box-shadow 140ms ease-out;
}

/* ---------- Accessible Focus ---------- */
:focus-visible {
  outline: 2px solid var(--line-focus);
  outline-offset: 2px;
}

/* ---------- Typography & Headings ---------- */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
}

.h-page {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.card-title {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

/* ---------- Buttons with 8-State Tactile Response ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-element);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background-color 140ms ease-out, border-color 140ms ease-out, color 140ms ease-out, transform 80ms ease-out;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
  box-shadow: 0 1px 2px 0 rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-primary-hover);
  text-decoration: none;
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-primary-active);
}

.btn-ghost {
  background: var(--bg-surface);
  border-color: var(--line-subtle);
  color: var(--text-primary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
  border-color: var(--line-hover);
  text-decoration: none;
}

.btn-danger {
  background: var(--bg-surface);
  border-color: #fecaca;
  color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-soft);
  border-color: #fca5a5;
  text-decoration: none;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.8125rem;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-element);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 120ms ease-out, border-color 120ms ease-out, background-color 120ms ease-out;
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--line-hover);
  background: var(--bg-surface-elevated);
}

/* ---------- Forms & Inputs ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
}

.form label, .form .label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
}

input[type="text"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-element);
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 0 12px;
  min-height: 42px;
  font-size: 0.875rem;
  transition: border-color 140ms ease-out, box-shadow 140ms ease-out;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

::placeholder {
  color: #94a3b8;
}

.field-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: -4px;
  font-variant-numeric: tabular-nums;
}

.form-error {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border: 1px solid #fecaca;
  border-radius: var(--radius-element);
  padding: 10px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
}

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-element);
  background: var(--accent-primary);
  color: var(--text-inverse);
}

.brand-mark .ic {
  width: 16px;
  height: 16px;
}

.brand-light {
  color: var(--text-inverse);
}

.brand-light .brand-mark {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* ---------- Auth View ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--bg-canvas);
}

.auth-brand {
  position: relative;
  color: var(--text-inverse);
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  background: #0f172a;
  border-right: 1px solid #1e293b;
}

.auth-copy {
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-copy h1 {
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: #f8fafc;
}

.auth-copy p {
  color: #94a3b8;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.auth-points {
  list-style: none;
  display: grid;
  gap: 12px;
  color: #cbd5e1;
  font-size: 0.875rem;
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-points .ic {
  width: 16px;
  height: 16px;
  color: #60a5fa;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-card);
}

.auth-card .form {
  padding: 0;
}

.auth-title {
  font-size: 1.25rem;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}

.brand-mobile {
  display: none;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-element);
  padding: 3px;
}

.tab {
  border: 0;
  background: transparent;
  min-height: 36px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}

.tab.is-active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
  border-top: 1px solid var(--line-subtle);
  padding-top: 16px;
}

.auth-note .ic {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--accent-primary);
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-subtle);
}

.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav a {
  padding: 6px 12px;
  border-radius: var(--radius-element);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  transition: color 120ms ease-out, background-color 120ms ease-out;
}

.nav a:hover {
  color: var(--text-primary);
  text-decoration: none;
  background: var(--bg-surface-elevated);
}

.nav a.is-active {
  color: var(--accent-primary);
  background: var(--accent-soft);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms ease-out;
}

.user-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-primary);
  text-decoration: none;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 0.8125rem;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Status Pill Indicators ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-idle { background: var(--bg-surface-elevated); color: var(--text-muted); }
.pill-run  { background: var(--accent-soft); color: var(--accent-primary); }
.pill-ok   { background: var(--color-success-soft); color: var(--color-success); }
.pill-warn { background: var(--color-warning-soft); color: var(--color-warning); }
.pill-bad  { background: var(--color-danger-soft); color: var(--color-danger); }

/* ---------- Main Dashboard Views ---------- */
.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-bottom: 2px;
}

.section-head h1, .section-head h2 {
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.section-head p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 3px;
}

.link-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.875rem;
}

/* ---------- Hero & Key Telemetry (Anti-AI Slop Clean) ---------- */
.hero {
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  border: 1px solid var(--line-subtle);
  padding: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  box-shadow: var(--shadow-sm);
}

.hero-copy {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-success);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
}

.hero-copy h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.hero-copy p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 12px;
}

.hero-stat {
  background: var(--bg-canvas);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-element);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-stat .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hero-stat b {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ---------- System Guard Strip (Perks) ---------- */
.perks {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-card);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

.perks li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.perk-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-element);
  background: var(--accent-soft);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.perks b {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.perks small {
  color: var(--text-muted);
  font-size: 0.75rem;
  display: block;
}

/* ---------- Mode Selection Grid (Tactile Cards) ---------- */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: var(--bg-surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-card);
  padding: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease-out, box-shadow 140ms ease-out, transform 80ms ease-out;
}

.mode-card:hover {
  border-color: var(--line-hover);
}

.mode-card:active {
  transform: scale(0.985);
}

.mode-card.is-selected {
  border-color: var(--accent-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.mode-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-element);
  background: var(--accent-soft);
  color: var(--accent-primary);
}

.mode-tag {
  align-self: flex-start;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-primary);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.mode-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mode-card p {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
  flex: 1;
}

.mode-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  transition: background-color 120ms ease-out, color 120ms ease-out;
}

.mode-card.is-selected .mode-pick {
  background: var(--accent-primary);
  color: var(--text-inverse);
}

.mode-pick .ic {
  width: 14px;
  height: 14px;
}

/* ---------- Split Content & Summaries ---------- */
.split {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  align-items: start;
}

.summary {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kv {
  margin: 0;
  display: grid;
  gap: 8px;
}

.kv div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}

.kv dt {
  color: var(--text-muted);
  font-weight: 500;
}

.kv dd {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.preview {
  border-top: 1px solid var(--line-subtle);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.bubble {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px 12px 12px 12px;
  padding: 12px 14px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.bubble.is-empty {
  color: var(--text-muted);
  font-style: italic;
}

.steps-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* ---------- Upload Element ---------- */
.upload {
  margin-top: 4px;
}

.upload-drop {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--line-hover);
  border-radius: var(--radius-element);
  background: var(--bg-surface-elevated);
  cursor: pointer;
  transition: border-color 140ms ease-out, background-color 140ms ease-out;
}

.upload-drop:hover {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.upload-drop .ic {
  color: var(--accent-primary);
}

.upload-drop b {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-drop small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.upload input[type="file"] {
  display: none;
}

.upload-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-element);
  background: var(--bg-surface);
}

.upload-file img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

.upload-file div {
  flex: 1;
  min-width: 0;
}

.upload-file b {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ---------- Chips (Auto Interval) ---------- */
.chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chip {
  min-height: 48px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-element);
  background: var(--bg-surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
  transition: border-color 140ms ease-out, background-color 140ms ease-out, color 140ms ease-out;
}

.chip small {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.chip.is-selected {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
  color: var(--accent-primary);
}

/* ---------- Job Card Telemetry & Stepper ---------- */
.job {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.job-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.job-head h3 {
  font-size: 1.0625rem;
  font-weight: 600;
}

.job-head p {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: 2px;
}

.stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.stepper li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.stepper li::before {
  content: "";
  position: absolute;
  top: 13px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--line-subtle);
}

.stepper li:first-child::before {
  display: none;
}

.stepper .dot {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--line-subtle);
  font-size: 0.75rem;
}

.stepper .dot .ic {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

.stepper li.is-done {
  color: var(--text-primary);
}

.stepper li.is-done::before,
.stepper li.is-active::before {
  background: var(--accent-primary);
}

.stepper li.is-done .dot {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-inverse);
}

.stepper li.is-active {
  color: var(--accent-primary);
}

.stepper li.is-active .dot {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent-primary);
  transition: width 300ms ease;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.job-meta span {
  color: var(--text-muted);
}

.job-meta b {
  color: var(--text-primary);
}

.job-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line-subtle);
  padding-top: 12px;
}

.job-foot small {
  color: var(--text-muted);
  font-size: 0.8125rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.idle-card {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.auto-card {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.auto-card .perk-ic {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.auto-card > div:nth-child(2) {
  flex: 1;
  min-width: 180px;
}

.auto-card b {
  display: block;
  font-size: 0.9375rem;
}

.auto-card small {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.auto-card .form-error {
  flex-basis: 100%;
}

/* ---------- Group Directory ---------- */
.search {
  position: relative;
}

.search .ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.search input {
  padding-left: 38px;
}

.group-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.group {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.group-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.group-top h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.group-id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.group-id code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-canvas);
  border: 1px solid var(--line-subtle);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
}

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

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 36px 12px;
  border: 1px dashed var(--line-subtle);
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  font-size: 0.875rem;
}

/* ---------- Profil & Account View ---------- */
.profile-card {
  padding: 24px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 1.4rem;
  border: 1px solid rgba(37, 99, 235, 0.2);
  flex-shrink: 0;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.profile-kv-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.profile-kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  gap: 12px;
}

.profile-kv-label {
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.profile-kv-value {
  font-weight: 600;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.profile-actions {
  padding-top: 20px;
}

/* Action Tiles for Tools */
.action-tiles-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  color: var(--text);
  transition: all 140ms ease-out;
}

.action-tile:hover {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.action-tile-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.action-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.action-tile-icon .ic {
  width: 20px;
  height: 20px;
}

.action-tile-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-tile-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.25;
}

.action-tile-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.action-tile-arrow {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 140ms ease-out, color 140ms ease-out;
}

.action-tile:hover .action-tile-arrow {
  transform: translateX(3px);
  color: var(--accent-primary);
}

/* ---------- Timeline & History ---------- */
.timeline-card {
  padding: 6px 20px;
}

.timeline {
  list-style: none;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-subtle);
  align-items: center;
}

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

.timeline .dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--text-inverse);
}

.timeline .dot.is-bad { background: var(--color-danger); }
.timeline .dot.is-warn { background: var(--color-warning); }

.timeline .dot .ic {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

.timeline b {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
}

.timeline small {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.timeline .empty {
  border: 0;
  background: transparent;
  padding: 24px 0;
}

/* ---------- Dialogs & Toasts ---------- */
.dialog {
  border: 0;
  border-radius: var(--radius-card);
  padding: 0;
  width: min(400px, calc(100vw - 32px));
  box-shadow: var(--shadow-overlay);
  margin: auto;
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.dialog-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dialog-body h3 {
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.dialog-body p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.45;
}

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

.toasts {
  position: fixed;
  z-index: 60;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 14px;
  border-radius: var(--radius-element);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-overlay);
  border: 1px solid #1e293b;
}

.toast.is-bad {
  background: var(--color-danger);
  border-color: #b91c1c;
}

.toast.is-ok {
  background: var(--color-success);
  border-color: #047857;
}

/* ---------- Mobile Tabbar ---------- */
.tabbar {
  display: none;
}

/* ---------- Responsive Breakpoints ---------- */
@media (max-width: 1040px) {
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; padding: 24px; }
  .hero-stats { width: 100%; }
  .perks { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .nav { display: none; }
  .user-name { display: none; }
  .user-chip {
    padding: 0;
    border: none;
    background: transparent;
  }
  .topbar-inner { height: 54px; }
  .page { padding: 16px 14px calc(84px + env(safe-area-inset-bottom)); }

  .tabbar {
    position: fixed;
    z-index: 40;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 4px max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
  }

  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 2px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--r-sm);
    min-height: 48px;
    transition: color 120ms ease-out, background 120ms ease-out;
  }

  .tabbar a:hover {
    text-decoration: none;
    color: var(--text);
  }

  .tabbar a.is-active {
    color: var(--accent-primary);
    background: var(--accent-soft);
  }

  .tabbar a .ic {
    width: 20px;
    height: 20px;
  }

  .toasts {
    bottom: calc(72px + env(safe-area-inset-bottom));
    right: 14px;
  }

  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .brand-mobile { display: inline-flex; }
}

@media (max-width: 600px) {
  .mode-grid, .group-list { grid-template-columns: 1fr; }
  .hero-copy h1 { font-size: 1.375rem; }
  .hero-stat b { font-size: 1.5rem; }
  .h-page { font-size: 1.25rem; }
  .section-head { flex-wrap: wrap; align-items: flex-start; }
  .perks { grid-template-columns: 1fr; }
  .form, .summary, .job { padding: 18px; }
  .timeline li { grid-template-columns: 24px 1fr; }
  .timeline li .pill { grid-column: 2; justify-self: start; }
}

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