/* MachineHub design system — shared across marketing, dashboard and admin. */

:root {
  color-scheme: dark;
  --bg: #060d13;
  --bg-2: #0a141d;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #eef6fb;
  --text-2: #9fb4c2;
  --text-3: #6b8296;
  --accent: #38bdf8;
  --accent-ink: #041019;
  --teal: #2dd4bf;
  --purple: #a78bfa;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1100px 600px at 78% -8%, rgba(56, 189, 248, 0.12), transparent 60%),
    radial-gradient(900px 520px at 5% 4%, rgba(167, 139, 250, 0.09), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 12px; }
code, pre { font-family: var(--mono); }
.mono { font-family: var(--mono); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: rgba(6, 13, 19, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: grid; place-items: center; color: var(--accent-ink); font-weight: 900; font-size: 0.9rem;
}
.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a {
  color: var(--text-2); padding: 7px 12px; border-radius: 9px; font-size: 0.92rem; font-weight: 600;
}
.topnav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.topnav a.active { color: var(--text); background: var(--surface-2); }
.topbar .spacer { flex: 1; }
.userchip {
  display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-2);
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px;
}
.userchip .role { color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.05em; }

/* ---------- layout ---------- */
.container { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }
.page { padding: 28px 0 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 820px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card.pad-lg { padding: 26px; }
.card h2 { font-size: 1.15rem; }
.card h3 { margin-bottom: 6px; }
.card + .card { margin-top: 16px; }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px;
}
.stat .num { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.stat .label { color: var(--text-2); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat.accent .num { color: var(--accent); }
.stat.green .num { color: var(--green); }
.stat.teal .num { color: var(--teal); }
.stat.purple .num { color: var(--purple); }

/* ---------- buttons ---------- */
button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border-radius: var(--radius-sm); border: 0; padding: 10px 16px;
  background: var(--accent); color: var(--accent-ink);
  transition: transform 0.05s ease, filter 0.15s ease, background 0.15s ease;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface); filter: none; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red); color: #260707; }
.btn-sm { padding: 6px 11px; font-size: 0.84rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- forms ---------- */
label { display: grid; gap: 6px; margin-bottom: 14px; font-size: 0.9rem; color: var(--text-2); }
input, select, textarea {
  font: inherit; color: var(--text); background: #0b1620;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(56, 189, 248, 0.5); border-color: transparent; }
textarea { resize: vertical; min-height: 64px; }
.check { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; }
.field-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.field-inline label { flex: 1; min-width: 160px; margin-bottom: 0; }

/* ---------- badges / tags / dots ---------- */
.badge {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); text-transform: uppercase;
}
.badge-pc { background: rgba(45, 212, 191, 0.18); color: var(--teal); }
.badge-phone { background: rgba(167, 139, 250, 0.2); color: var(--purple); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--text-3); }
.tag { font-size: 0.72rem; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.tag-running, .tag-planned { background: rgba(56, 189, 248, 0.18); color: var(--accent); }
.tag-completed { background: rgba(52, 211, 153, 0.18); color: var(--green); }
.tag-failed { background: rgba(248, 113, 113, 0.18); color: var(--red); }
.tag-pending { background: var(--surface-2); color: var(--text-2); }
.tag-owner, .tag-admin { background: rgba(56, 189, 248, 0.16); color: var(--accent); }
.tag-operator { background: rgba(45, 212, 191, 0.16); color: var(--teal); }
.tag-viewer { background: var(--surface-2); color: var(--text-2); }
.pill { background: var(--surface-2); border-radius: 999px; padding: 3px 11px; font-size: 0.8rem; }

/* ---------- device grid ---------- */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.device { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 15px; }
.device-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.device-head .status { font-size: 0.8rem; color: var(--text-2); margin-left: auto; }
.device-name { font-weight: 700; }
.device-meta, .device-caps { color: var(--text-2); font-size: 0.82rem; margin-top: 4px; }
.device-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-2); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:last-child td, tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ---------- rollup / dispatch ---------- */
.rollup { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.totals { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.target { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.target-name { font-weight: 600; }
.target-event { color: var(--text-2); font-size: 0.8rem; margin-left: auto; font-family: var(--mono); }

pre.out {
  white-space: pre-wrap; word-break: break-word; background: rgba(0, 0, 0, 0.3);
  padding: 13px; border-radius: var(--radius-sm); font-size: 0.82rem; max-height: 320px; overflow: auto;
  border: 1px solid var(--border);
}
.codeblock {
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-family: var(--mono); font-size: 0.82rem; overflow-x: auto; color: var(--teal);
}

/* ---------- phone control ---------- */
.screen-wrap {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.35);
  min-height: 220px; display: flex; align-items: center; justify-content: center; padding: 10px; overflow: hidden;
}
.screen-img { max-width: 100%; max-height: 560px; border-radius: 8px; cursor: crosshair; display: block; }
.control-pad { display: grid; gap: 12px; align-content: start; }
.control-pad label { display: grid; gap: 6px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn-sm { flex: 1; }
.control-log { min-height: 20px; padding-top: 4px; }
.provision-phone { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.pc-out {
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-family: var(--mono); font-size: 0.8rem; color: var(--teal);
  white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; margin: 0;
}
.pc-sep { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.control-pad textarea { font-family: var(--mono); font-size: 0.82rem; }
.remote-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.remote-bar .check { display: flex; align-items: center; gap: 6px; }
.screen-wrap:fullscreen { background: #000; padding: 0; width: 100vw; height: 100vh; min-height: 0; }
.screen-wrap:fullscreen .screen-img { max-width: 100vw; max-height: 100vh; border-radius: 0; }
.mem-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.mem-row { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; }
.mem-k { color: var(--accent); font-family: var(--mono); white-space: nowrap; }
.mem-v { color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- toast ---------- */
#toast { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; }
.toast {
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 16px;
  box-shadow: var(--shadow); max-width: 340px; animation: slidein 0.2s ease;
}
.toast.err { border-color: var(--red); }
.toast.ok { border-color: var(--green); }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- marketing ---------- */
.hero { padding: 76px 0 40px; text-align: center; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); max-width: 15ch; margin: 0 auto 18px; }
.hero p.lede { font-size: 1.18rem; color: var(--text-2); max-width: 56ch; margin: 0 auto 28px; }
.eyebrow {
  display: inline-block; color: var(--accent); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; font-size: 0.76rem; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px;
}
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.section { padding: 44px 0; }
.section h2 { text-align: center; font-size: clamp(1.5rem, 3vw, 2rem); }
.section .sub { text-align: center; color: var(--text-2); max-width: 60ch; margin: 0 auto 32px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature .ico { font-size: 1.5rem; margin-bottom: 10px; }
.feature h3 { font-size: 1.05rem; }
.feature p { color: var(--text-2); font-size: 0.94rem; margin: 0; }
.layerstack { display: grid; gap: 10px; max-width: 640px; margin: 0 auto; }
.layer { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; background: var(--surface); }
.layer .lt { font-weight: 700; }
.layer .ld { color: var(--text-2); font-size: 0.9rem; }
.layer.out { border-style: dashed; opacity: 0.85; }
.layer.in { border-color: rgba(56, 189, 248, 0.4); }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 820px) { .plans { grid-template-columns: 1fr; } }
.plan { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; background: var(--surface); }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan .price { font-size: 2.1rem; font-weight: 800; }
.plan .price span { font-size: 0.95rem; color: var(--text-2); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.plan li { color: var(--text-2); font-size: 0.92rem; padding-left: 22px; position: relative; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 800; }
footer.site { border-top: 1px solid var(--border); padding: 30px 0; color: var(--text-3); font-size: 0.86rem; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { justify-content: center; margin-bottom: 20px; font-size: 1.3rem; }
