:root {
  --ink: #12151c; --ink2: #3a4150; --muted: #6b7280; --bg: #f6f5f1; --panel: #ffffff; --line: #e5e3dc; --line2: #d6d3ca;
  --lime: #c4f042; --blue: #3b5bfd; --blue-soft: #e9edff; --red: #d93a3a; --red-soft: #fdecec; --green: #148a4a; --green-soft: #e3f6ea;
  --amber: #b26b00; --amber-soft: #fff4dd;
  --r: 12px; --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.2; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; }
button, input, select, textarea { font: inherit; color: inherit; }
.inline { display: inline; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--ink); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.mark { width: 18px; height: 26px; border-radius: 5px; background: var(--ink); position: relative; }
.mark::after { content: ""; position: absolute; left: 3px; right: 3px; top: 4px; bottom: 6px; border-radius: 2px; background: var(--lime); }
.topbar nav { display: flex; align-items: center; gap: 20px; }
.topbar nav a { color: var(--ink2); font-weight: 500; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink2); font-weight: 500; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s, background .15s; }
.btn:hover { text-decoration: none; background: #262b36; }
.btn:active { transform: translateY(1px); }
.btn.small { height: 34px; padding: 0 12px; font-size: .88rem; border-radius: 8px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line2); }
.btn.ghost:hover { background: #fff; }
.btn.lime { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.btn.lime:hover { background: #b6e534; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }

.flashes { max-width: 980px; margin: 16px auto 0; padding: 0 20px; }
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 8px; background: var(--blue-soft); }
.flash.err { background: var(--red-soft); color: #9b1c1c; }
.flash.ok { background: var(--green-soft); color: #0d5c31; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 32px 24px 60px; }
.narrow { max-width: 440px; margin: 48px auto; padding: 0 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); margin-top: 5px; font-size: .8rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=tel], input[type=search], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line2); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 91, 253, .15); }
.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 30px 20px; }

/* Landing */
.hero-l { max-width: 1100px; margin: 0 auto; padding: 64px 24px 24px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero-l h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); margin: 0 0 18px; font-weight: 800; letter-spacing: -.035em; }
.hero-l h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--lime) 62%); }
.hero-l p.lead { font-size: 1.15rem; color: var(--ink2); max-width: 34em; margin: 0 0 26px; }
.hero-l .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.phone-art { justify-self: center; width: 250px; height: 500px; border-radius: 38px; background: var(--ink); padding: 12px; box-shadow: 0 30px 60px -20px rgba(18,21,28,.45); transform: rotate(4deg); }
.phone-art .scr { width: 100%; height: 100%; border-radius: 28px; background: #f5f6f8; overflow: hidden; display: flex; flex-direction: column; }
.phone-art .bar { background: #1f4e79; height: 64px; display: flex; align-items: flex-end; padding: 10px 14px; color: #fff; font-weight: 700; }
.phone-art .tl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
.phone-art .tl div { height: 82px; background: #fff; border-radius: 14px; box-shadow: 0 0 0 1px rgba(0,0,0,.06); position: relative; }
.phone-art .tl div::after { content: ""; position: absolute; left: 50%; top: 18px; width: 30px; height: 30px; margin-left: -15px; border-radius: 9px; background: #dfe8f3; }
.phone-art .hero { margin: 14px 14px 0; height: 90px; border-radius: 14px; background: linear-gradient(135deg, #1f4e79, #3a7cc0); }
.phone-art .tabs { margin-top: auto; height: 54px; background: #fff; box-shadow: 0 -1px 0 rgba(0,0,0,.06); display: flex; justify-content: space-around; align-items: center; }
.phone-art .tabs i { width: 22px; height: 22px; border-radius: 6px; background: #d5dbe3; }
.phone-art .tabs i:first-child { background: #1f4e79; }
.feats { max-width: 1100px; margin: 0 auto; padding: 36px 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.feat h3 { margin: 10px 0 6px; font-size: 1.05rem; }
.feat p { margin: 0; color: var(--ink2); font-size: .93rem; }
.feat .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--lime); display: grid; place-items: center; }
.feat .ic svg { width: 20px; height: 20px; }
.steps { max-width: 1100px; margin: 0 auto; padding: 10px 24px 40px; }
.steps ol { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; border-top: 3px solid var(--ink); padding-top: 12px; }
.steps li::before { content: counter(s, decimal-leading-zero); font-family: var(--mono); font-size: .8rem; color: var(--muted); display: block; margin-bottom: 6px; }
.steps b { display: block; margin-bottom: 4px; }

/* Projects */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-size: 2rem; }
.grid-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.appcard { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: border-color .15s, transform .15s; }
.appcard:hover { border-color: var(--line2); transform: translateY(-2px); }
.appcard .top { display: flex; gap: 14px; align-items: center; }
.appicon { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.4rem; flex: none; overflow: hidden; }
.appicon img { width: 100%; height: 100%; object-fit: cover; }
.appcard h3 { margin: 0; font-size: 1.05rem; }
.appcard .meta { color: var(--muted); font-size: .8rem; font-family: var(--mono); word-break: break-all; }
.appcard .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .75rem; padding: 3px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--ink2); }
.menu-dots { position: relative; }
.menu-dots > button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.menu-dots .pop { position: absolute; right: 0; top: 38px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.12); padding: 6px; min-width: 190px; z-index: 10; }
.menu-dots .pop a, .menu-dots .pop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--ink); cursor: pointer; font-size: .9rem; }
.menu-dots .pop a:hover, .menu-dots .pop button:hover { background: var(--bg); text-decoration: none; }
.newapp { border: 2px dashed var(--line2); background: transparent; display: grid; place-items: center; text-align: center; min-height: 160px; cursor: pointer; border-radius: 16px; color: var(--ink2); font-weight: 600; }
.newapp:hover { border-color: var(--ink); color: var(--ink); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(18,21,28,.45); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; width: min(760px, 100%); max-height: 88vh; overflow: auto; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal h2 { margin: 0 0 6px; }
.modal .foot-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.starter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.starter { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; text-align: left; background: #fff; }
.starter:hover { border-color: var(--line2); }
.starter.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--lime); }
.starter b { display: block; margin: 8px 0 3px; }
.starter span { font-size: .82rem; color: var(--muted); }
.starter svg { width: 22px; height: 22px; }

/* Download page */
.dl { max-width: 520px; margin: 40px auto; padding: 0 20px; text-align: center; }
.dl .icon { width: 108px; height: 108px; border-radius: 26px; margin: 0 auto 16px; box-shadow: 0 14px 30px -10px rgba(0,0,0,.35); overflow: hidden; }
.dl .icon img { width: 100%; height: 100%; }
.dl h1 { margin: 0 0 4px; }
.dl .qr { display: inline-block; background: #fff; padding: 14px; border-radius: 16px; border: 1px solid var(--line); margin: 20px 0 10px; }
.dl .how { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; margin-top: 18px; font-size: .92rem; }
.dl .how ol { padding-left: 20px; margin: 8px 0 0; }

/* Admin */
.admin-wrap { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 60px); }
.admin-nav { border-right: 1px solid var(--line); padding: 24px 14px; display: flex; flex-direction: column; gap: 2px; }
.admin-nav a { padding: 9px 12px; border-radius: 9px; color: var(--ink2); font-weight: 500; }
.admin-nav a.on, .admin-nav a:hover { background: #fff; color: var(--ink); text-decoration: none; box-shadow: 0 0 0 1px var(--line); }
.admin-main { padding: 30px 34px 60px; max-width: 1100px; }
.admin-main h1 { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat b { display: block; font-size: 1.7rem; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .85rem; }
table.t { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: .9rem; }
table.t th, table.t td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t th { background: #fbfaf7; font-weight: 600; font-size: .8rem; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; }
table.t tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.badge.done, .badge.ok { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge.failed, .badge.bad { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge.running, .badge.queued { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
pre.box { background: #12151c; color: #e6e8ee; padding: 16px; border-radius: 12px; overflow: auto; max-height: 420px; font-size: .8rem; line-height: 1.55; white-space: pre-wrap; }

@media (max-width: 860px) {
  .hero-l { grid-template-columns: 1fr; padding-top: 36px; }
  .phone-art { display: none; }
  .feats, .steps ol { grid-template-columns: 1fr; }
  .starter-grid { grid-template-columns: 1fr 1fr; }
  .admin-wrap { grid-template-columns: 1fr; }
  .admin-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 12px 16px; }
  .topbar nav { gap: 12px; }
}
