/* ── Kiri design system ─────────────────────────────────── */
:root {
  --ink: #14132e;
  --ink-2: #3a3760;
  --muted: #6d6a86;
  --brand: #5b3df5;
  --brand-2: #7c5cff;
  --brand-ink: #2a1b8a;
  --accent: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --bg: #ffffff;
  --bg-soft: #f6f5fc;
  --bg-softer: #faf9fe;
  --card: #ffffff;
  --line: #e8e6f2;
  --line-2: #d9d6ea;
  --shadow: 0 1px 2px rgba(20,19,46,.04), 0 8px 24px rgba(20,19,46,.06);
  --shadow-lg: 0 20px 60px rgba(43,27,138,.18);
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; }
p { margin: 0; }
img { max-width: 100%; }

.container { width: min(1180px, 92vw); margin: 0 auto; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; border: 0; cursor: pointer;
  font: inherit; font-weight: 650; padding: .7rem 1.1rem; border-radius: 999px; transition: .15s ease;
  background: var(--bg-soft); color: var(--ink); }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 6px 18px rgba(91,61,245,.35); }
.btn-ghost { background: transparent; border: 1px solid var(--line-2); }
.btn-lg { padding: .95rem 1.6rem; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

/* Chips / badges */
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 700;
  padding: .25rem .6rem; border-radius: 999px; background: var(--bg-soft); color: var(--ink-2); text-transform: capitalize; }
.badge.green { background: #dcfce7; color: #047857; }
.badge.amber { background: #fef3c7; color: #b45309; }
.badge.red   { background: #fee2e2; color: #b91c1c; }
.badge.blue  { background: #e0e7ff; color: #3730a3; }
.badge.gray  { background: #eef0f5; color: #475569; }

/* ── Marketing / landing ─────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav .container { display: flex; align-items: center; gap: 1.5rem; height: 66px; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 850; font-size: 1.25rem; letter-spacing: -.03em; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand-2), var(--brand)); display: grid; place-items: center; color: #fff; font-weight: 900; }
.nav-links { display: flex; gap: 1.3rem; margin-left: 1rem; }
.nav-links a { color: var(--ink-2); font-weight: 600; font-size: .95rem; }
.nav-links a:hover { color: var(--brand); }
.nav-spacer { flex: 1; }

.hero { padding: 4.5rem 0 3rem; background:
  radial-gradient(1000px 500px at 80% -10%, #efe9ff 0%, rgba(239,233,255,0) 60%),
  radial-gradient(700px 400px at 0% 10%, #e6fbf3 0%, rgba(230,251,243,0) 55%); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
.eyebrow { font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; color: var(--brand); }
.hero h1 { font-size: clamp(2.4rem, 5vw, 3.9rem); margin: 1rem 0; }
.hero h1 .grad { background: linear-gradient(120deg, var(--brand), #d63f8f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: 1.2rem; color: var(--ink-2); max-width: 34ch; }
.hero-cta { display: flex; gap: .8rem; margin-top: 1.6rem; flex-wrap: wrap; }
.hero-note { margin-top: 1rem; font-size: .9rem; color: var(--muted); display: flex; gap: 1.1rem; flex-wrap: wrap; }
.hero-note span { display: inline-flex; gap: .35rem; align-items: center; }

.signup-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 1.6rem; box-shadow: var(--shadow-lg); }
.signup-card h3 { font-size: 1.3rem; }
.field { margin-top: .85rem; }
.field label { display: block; font-size: .82rem; font-weight: 650; color: var(--ink-2); margin-bottom: .3rem; }
.field input, .field select, .field textarea { width: 100%; padding: .7rem .8rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font: inherit; background: #fff; color: var(--ink); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 0; border-color: transparent; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.form-msg { font-size: .85rem; margin-top: .6rem; min-height: 1.1rem; }
.form-msg.err { color: var(--danger); }

.trust { padding: 1.6rem 0 .5rem; }
.trust .container { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; justify-content: center;
  color: var(--muted); font-size: .92rem; }
.trust b { color: var(--ink-2); }

.section { padding: 4rem 0; }
.section-head { max-width: 60ch; margin-bottom: 2.4rem; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); }
.section-head p { color: var(--ink-2); font-size: 1.12rem; margin-top: .8rem; }

.feature-row { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; padding: 2.2rem 0; }
.feature-row.flip .feat-visual { order: -1; }
.feat-copy h3 { font-size: 1.7rem; }
.feat-copy p { color: var(--ink-2); margin-top: .7rem; font-size: 1.05rem; }
.feat-list { list-style: none; padding: 0; margin: 1.1rem 0 0; display: grid; gap: .55rem; }
.feat-list li { display: flex; gap: .6rem; align-items: flex-start; color: var(--ink-2); }
.feat-list li::before { content: "✓"; color: var(--accent); font-weight: 900; }

.feat-visual { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }

.grid-6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.fcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); }
.fcard .ic { width: 42px; height: 42px; border-radius: 11px; background: #efeaff; color: var(--brand); display: grid; place-items: center; font-size: 1.25rem; margin-bottom: .8rem; }
.fcard h4 { font-size: 1.12rem; }
.fcard p { color: var(--muted); margin-top: .4rem; font-size: .96rem; }

.modes { background: var(--ink); color: #fff; border-radius: 28px; padding: 2.6rem; }
.modes h2 { color: #fff; }
.modes .sub { color: #b8b4d8; margin-top: .6rem; font-size: 1.08rem; }
.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 2rem; }
.mode { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 1.2rem; }
.mode .ic { font-size: 1.5rem; }
.mode h4 { margin-top: .6rem; font-size: 1.08rem; }
.mode p { color: #b8b4d8; margin-top: .35rem; font-size: .9rem; }
.mode code { background: rgba(0,0,0,.35); padding: .15rem .4rem; border-radius: 6px; font-size: .82rem; color: #d7ccff; }

.cta-band { text-align: center; background: linear-gradient(135deg, var(--brand), #b13ea0); color: #fff; border-radius: 28px; padding: 3.2rem 2rem; }
.cta-band h2 { color: #fff; font-size: clamp(1.8rem, 3.6vw, 2.7rem); }
.cta-band p { color: #f0e9ff; margin-top: .7rem; font-size: 1.15rem; }
.cta-band .btn { margin-top: 1.6rem; }
.cta-band .btn-primary { background: #fff; color: var(--brand); box-shadow: none; }

.footer { padding: 3rem 0; color: var(--muted); border-top: 1px solid var(--line); margin-top: 4rem; }
.footer .container { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.footer a { color: var(--ink-2); display: block; margin: .3rem 0; font-size: .93rem; }
.footer h5 { text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; color: var(--muted); margin: 0 0 .6rem; }

/* mini dashboard mock used in hero/feature visuals */
.mini { display: grid; gap: .7rem; }
.mini-row { display: flex; gap: .7rem; }
.stat-mini { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; }
.stat-mini .n { font-size: 1.5rem; font-weight: 800; }
.stat-mini .l { font-size: .78rem; color: var(--muted); }
.bar { height: 8px; border-radius: 6px; background: #eceafc; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,19,46,.5); display: none; place-items: center; z-index: 100; padding: 1rem; }
.modal-backdrop.open { display: grid; }
.modal { background: #fff; border-radius: 20px; padding: 1.6rem; width: min(440px, 94vw); box-shadow: var(--shadow-lg); }
.modal h3 { font-size: 1.4rem; }
.tabs { display: flex; gap: .3rem; background: var(--bg-soft); padding: .3rem; border-radius: 999px; margin: 1rem 0; }
.tabs button { flex: 1; border: 0; background: transparent; padding: .55rem; border-radius: 999px; font: inherit; font-weight: 650; cursor: pointer; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .hero-grid, .feature-row, .feature-row.flip .feat-visual { grid-template-columns: 1fr; }
  .feature-row.flip .feat-visual { order: 0; }
  .grid-6, .mode-grid { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
}
@media (max-width: 560px) { .grid-6, .mode-grid, .form-row { grid-template-columns: 1fr; } }

/* ── App shell ───────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #cfcbe8; padding: 1.1rem .9rem; display: flex; flex-direction: column; gap: .3rem; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: #fff; padding: .3rem .5rem 1rem; font-size: 1.2rem; }
.side-nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 10px; color: #b9b4dd; font-weight: 600; font-size: .95rem; cursor: pointer; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.on { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; }
.side-nav .ic { width: 20px; text-align: center; }
.side-sep { height: 1px; background: rgba(255,255,255,.1); margin: .6rem .4rem; }
.side-foot { margin-top: auto; font-size: .82rem; color: #8f8ab6; padding: .5rem; }
.side-foot .org { color: #fff; font-weight: 700; font-size: .95rem; }

.main { display: flex; flex-direction: column; min-width: 0; background: var(--bg-softer); }
.topbar { height: 62px; border-bottom: 1px solid var(--line); background: #fff; display: flex; align-items: center; gap: 1rem; padding: 0 1.6rem; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 1.25rem; }
.topbar .sp { flex: 1; }
.content { padding: 1.6rem; max-width: 1100px; width: 100%; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.stat-card .l { color: var(--muted); font-size: .82rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .n { font-size: 2rem; font-weight: 850; margin-top: .3rem; }
.stat-card .s { font-size: .85rem; color: var(--muted); margin-top: .2rem; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 1.3rem; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 1.1rem; }
.panel-head .sp { flex: 1; }
.panel-body { padding: 1.2rem; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 650; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: .6rem 1.2rem; border-bottom: 1px solid var(--line); }
table.tbl td { padding: .75rem 1.2rem; border-bottom: 1px solid var(--bg-soft); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: var(--bg-softer); }
.row-actions { display: flex; gap: .4rem; }
.icon-btn { border: 1px solid var(--line-2); background: #fff; border-radius: 8px; padding: .3rem .55rem; cursor: pointer; font-size: .85rem; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.stack { display: grid; gap: .8rem; }

/* Ask Kiri dock */
.kiri-fab { position: fixed; right: 22px; bottom: 22px; z-index: 60; border: 0; cursor: pointer; width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; font-size: 1.5rem; box-shadow: var(--shadow-lg); }
.kiri-panel { position: fixed; right: 22px; bottom: 92px; z-index: 60; width: min(390px, 92vw); height: min(560px, 76vh);
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); display: none; flex-direction: column; overflow: hidden; }
.kiri-panel.open { display: flex; }
.kiri-head { background: var(--ink); color: #fff; padding: .9rem 1.1rem; display: flex; align-items: center; gap: .6rem; }
.kiri-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.kiri-head .sp { flex: 1; }
.kiri-head select { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 8px; padding: .3rem .5rem; font: inherit; font-size: .82rem; }
.kiri-msgs { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; background: var(--bg-softer); }
.msg { max-width: 85%; padding: .65rem .85rem; border-radius: 14px; font-size: .92rem; white-space: pre-wrap; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.bot code { background: var(--bg-soft); padding: .1rem .3rem; border-radius: 5px; }
.kiri-input { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); background: #fff; }
.kiri-input input { flex: 1; border: 1px solid var(--line-2); border-radius: 999px; padding: .6rem .9rem; font: inherit; }
.kiri-input button { border: 0; background: var(--brand); color: #fff; border-radius: 50%; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem; }
.pill-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.pill { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: .35rem .7rem; font-size: .82rem; cursor: pointer; }
.pill:hover { border-color: var(--brand); color: var(--brand); }
.pill.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.wf-out { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; white-space: pre-wrap; font-size: .92rem; line-height: 1.55; margin-top: 1rem; }
.notice { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 12px; padding: .8rem 1rem; font-size: .9rem; }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.nav-toggle { display: none; }
.nav-scrim { display: none; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 260px; height: 100vh; z-index: 80; transform: translateX(-100%); transition: transform .25s ease; }
  .app.nav-open .sidebar { transform: none; }
  .nav-scrim { position: fixed; inset: 0; background: rgba(20,19,46,.45); z-index: 70; }
  .app.nav-open .nav-scrim { display: block; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; line-height: 1; padding: .35rem .6rem; }
  .content { padding: 1.1rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .stat-grid { grid-template-columns: 1fr; } }

