/* AutoFlow Pro client portal — "Violet Issue" design system (see DESIGN.md).
   Dark layered surfaces, violet strictly as accent, compact 28–36px controls, 150ms max motion. */
:root {
  --primary: #5E6AD2; --primary-hover: #4E5BBF; --secondary: #6E79D6;
  --bg: #101014; --neutral: #1B1B25; --surface: #1F1F2E; --surface-3: #252536;
  --text: #F1F1F4; --muted: #8A8F98; --border: #2C2C3A;
  --success: #3DD68C; --warning: #F0C000; --error: #EB5757;
  --glow: 0 0 24px rgba(94, 106, 210, .15);
  --ring: 0 0 0 2px rgba(94, 106, 210, .15);
  --font: Inter, "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: dark;
  font-family: var(--font);
  font-size: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
code, kbd {
  font-family: var(--mono); font-size: 12px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px;
}
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; font-size: 11px; color: var(--muted); border-radius: 9999px; }
:focus-visible { outline: 1px solid var(--primary); outline-offset: 2px; }

/* Top bar */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 52px; padding: 0 24px; position: sticky; top: 0; z-index: 5;
  background: var(--neutral); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.brand img { width: 24px; height: 24px; }
.brand b { font-weight: 600; color: var(--primary); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.hello { color: var(--muted); font-size: 13px; }
.chip {
  height: 28px; min-width: 32px; padding: 0 12px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: border-color 100ms, background 100ms;
}
.chip:hover { border-color: var(--muted); }

main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 32px 24px; }

/* Cards */
.card { background: var(--neutral); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.card-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--text);
}
.muted { color: var(--muted); margin: 0 0 12px; font-size: 14px; }
.hint { color: var(--muted); font-size: 12px; margin: 0; text-align: center; }

/* Login */
.login { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; min-height: 62vh; }
.kicker {
  display: inline-block; margin-bottom: 16px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
html[dir="rtl"] .kicker { text-transform: none; letter-spacing: 0; font-size: 12px; }
.hero h1 { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; margin: 0 0 12px; }
html[dir="rtl"] .hero h1 { letter-spacing: 0; line-height: 1.35; }
.hero p { color: var(--muted); font-size: 16px; margin: 0 0 24px; max-width: 520px; }
.mini-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 420px; }
.mini-steps li { display: flex; align-items: center; gap: 12px; height: 36px; font-size: 14px; font-weight: 500; }
.mini-steps b, .steps .n {
  flex: 0 0 20px; width: 20px; height: 20px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted);
  border: 1.5px solid var(--muted); border-radius: 9999px;
}
.login-card { display: grid; gap: 12px; padding: 24px; }
.login-card h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -.03em; }
html[dir="rtl"] .login-card h2, html[dir="rtl"] .card-title, html[dir="rtl"] .brand { letter-spacing: 0; }
label { display: grid; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
input {
  height: 32px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--neutral); color: var(--text); font: inherit; font-size: 14px; outline: none;
  transition: border-color 100ms, box-shadow 100ms;
}
input::placeholder { color: var(--muted); }
input:focus { border-color: var(--primary); box-shadow: var(--ring); }
.login-card input { background: var(--bg); }

/* Primary button */
.cta {
  height: 32px; padding: 4px 12px; border: 0; border-radius: 6px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 500; color: #fff; background: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 100ms;
}
.cta:hover:not(:disabled) { background: var(--primary-hover); }
.cta:focus-visible { box-shadow: var(--ring), var(--glow); outline: none; }
.cta:disabled { opacity: .45; cursor: not-allowed; }
.cta.big { width: 100%; }
.cta .ic { font-size: 14px; line-height: 1; }
.cta kbd { background: transparent; border-color: rgba(255, 255, 255, .25); color: rgba(255, 255, 255, .8); }
.msg { min-height: 1.5em; margin: 8px 0 0; font-size: 13px; color: var(--success); }
.msg.bad { color: var(--error); }

/* Dashboard */
.dash { display: grid; gap: 32px; }
.grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; }
.status-line { margin-bottom: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 2px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 500;
}
.badge.ok { background: rgba(61, 214, 140, .2); color: var(--success); }
.badge.warn { background: rgba(240, 192, 0, .2); color: var(--warning); }
.badge.bad { background: rgba(235, 87, 87, .2); color: var(--error); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0 16px; margin: 0; font-size: 14px; }
.facts dt, .facts dd { height: 36px; display: flex; align-items: center; border-top: 1px solid var(--border); }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-weight: 500; }
.facts .num, #factExpires, #factUser { font-family: var(--mono); font-size: 12px; color: var(--text); }
#factUser { color: var(--muted); }

/* Status circle (Checkboxes spec): 14px, 1.5px muted outline; Done = filled emerald with a check */
.dot { position: relative; flex: 0 0 14px; width: 14px; height: 14px; border-radius: 9999px; border: 1.5px dotted var(--muted); display: inline-block; }
.dot.ok { background: var(--success); border: 1.5px solid var(--success); }
.dot.ok::after { content: ""; position: absolute; left: 3.5px; top: 1px; width: 3px; height: 6px; border: solid var(--bg); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.dot.bad { background: var(--error); border: 1.5px solid var(--error); }
.dot.bad::after { content: ""; position: absolute; left: 2px; right: 2px; top: 4.5px; height: 1.5px; background: var(--bg); }
.pw { margin-bottom: 12px; }

/* Tutorial */
.tutorial video {
  width: 100%; max-height: 560px; display: block; margin-bottom: 16px;
  border-radius: 8px; background: #000; border: 1px solid var(--border);
}
.no-video { padding: 24px; margin-bottom: 16px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg); }
.steps-head { margin: 0 0 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
html[dir="rtl"] .steps-head { text-transform: none; letter-spacing: 0; font-size: 12px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li {
  display: grid; grid-template-columns: 20px 1fr; column-gap: 12px; align-items: start;
  padding: 8px 16px; min-height: 36px; font-size: 14px; border-inline-start: 2px solid transparent;
  transition: background 100ms;
}
.steps li:hover { background: var(--surface); }
.steps .n { margin-top: 1px; }
.steps b:not(.n) { font-weight: 600; color: var(--text); }
.steps code { font-size: 11.5px; }

/* Step screenshots + zoom */
.shots { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.shot {
  padding: 0; width: 160px; height: 96px; border-radius: 6px; overflow: hidden; cursor: zoom-in;
  background: var(--bg); border: 1px solid var(--border); transition: border-color 100ms, box-shadow 100ms;
}
.shot:hover, .shot:focus-visible { border-color: var(--primary); box-shadow: var(--glow); outline: none; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: rgba(16, 16, 20, .72); backdrop-filter: blur(4px); animation: fade 100ms ease-out;
}
.lightbox-frame {
  max-width: min(1200px, 100%); display: grid; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, .4);
}
.lightbox-viewport { overflow: auto; max-height: calc(100vh - 120px); border-radius: 8px; background: var(--bg); }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); display: block; margin: 0 auto; cursor: zoom-in; }
.lightbox img.zoomed { max-width: none; max-height: none; width: 180%; cursor: zoom-out; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.lightbox-bar .keys { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lightbox-bar button {
  height: 28px; padding: 0 12px; border-radius: 6px; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: color 100ms, background 100ms;
}
.lightbox-bar button:hover { color: var(--text); background: var(--surface-3); }
@keyframes fade { from { opacity: 0; } }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; border-top: 1px solid var(--border); }

@media (max-width: 860px) {
  .login, .grid { grid-template-columns: 1fr; }
  .login { min-height: 0; gap: 32px; }
  .hero h1 { font-size: 32px; }
  .top { padding: 0 16px; }
  main { padding: 24px 16px; }
  .shot { width: 120px; height: 72px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* activation code */
.linkish { justify-self: center; height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--secondary); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background 50ms; }
.linkish:hover { background: var(--surface); }
.small-text { font-size: 13px; margin: 0; }
.mono-input { font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }
