*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --side: #1e1e2d;
  --side-2: #252536;
  --top: #1e1e2d;
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #3182ce;
  --teal: #14b8a6;
  --green: #22c55e;
  --danger: #ef4444;
  --radius: 10px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* Public */
body.public { background: #0f0f1a; color: #e8e8f0; }
.navbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; background: var(--side); }
.navbar-brand { color: #fff; font-weight: 700; letter-spacing: 0.04em; font-size: 18px; }
.navbar-right { display: flex; gap: 10px; align-items: center; }
.hero { text-align: center; padding: 88px 24px 48px; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: 40px; line-height: 1.15; margin-bottom: 14px; color: #fff; }
.hero p { color: #9aa0b8; font-size: 18px; margin-bottom: 28px; }
.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 980px; margin: 0 auto 72px; padding: 0 20px; }
.price-card { background: #1a1a2e; border: 1px solid #2a2a40; border-radius: 12px; padding: 24px; color: #ddd; }
.price-card h3 { margin-bottom: 8px; color: #fff; }
.price-card .price { font-size: 28px; font-weight: 700; color: #fff; margin: 8px 0 16px; }
.price-card ul { list-style: none; color: #9aa0b8; font-size: 14px; }
.price-card li { margin: 8px 0; }
.price-card.featured { border-color: var(--teal); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; max-width: 980px; margin: 0 auto 64px; padding: 0 20px; }
.feature-card { background: #1a1a2e; border: 1px solid #2a2a40; border-radius: 12px; padding: 20px; color: #9aa0b8; }
.feature-card h3 { color: #fff; margin-bottom: 8px; }
.footer { text-align: center; padding: 24px; color: #6b7280; font-size: 13px; border-top: 1px solid #2a2a40; }
.auth-form { max-width: 400px; margin: 72px auto; padding: 32px; background: #1a1a2e; border-radius: 12px; color: #ddd; }
.auth-form h2 { margin-bottom: 16px; color: #fff; }
.auth-form label { color: #9aa0b8; }
.auth-form input { background: #0f0f1a; border: 1px solid #2a2a40; color: #fff; }

/* LK shell */
body.lk { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar { width: 240px; flex-shrink: 0; background: var(--side); color: #c5c5d6; display: flex; flex-direction: column; padding: 16px 12px; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 18px; padding: 8px 10px 18px; }
.logo-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--teal); display: inline-flex; align-items: center; justify-content: center; color: #052e2b; }
.sidebar-promo { background: var(--side-2); border-radius: 10px; padding: 12px; margin-bottom: 18px; }
.promo-title { color: #fff; font-size: 13px; font-weight: 600; }
.promo-text { font-size: 12px; margin: 4px 0 10px; color: #9aa0b8; }
.nav-section { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #6b7280; padding: 12px 10px 6px; }
.nav-item { display: block; padding: 8px 10px; border-radius: 8px; color: #c5c5d6; font-size: 14px; }
.nav-item:hover { background: #2a2a3d; color: #fff; }
.nav-item.active { background: #32324a; color: #fff; }

.lk-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 64px; background: var(--top); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.topbar-stats { display: flex; gap: 10px; align-items: center; }
.stat-pill { background: #2a2a3d; border: 1px solid #3a3a50; border-radius: 999px; padding: 6px 14px; color: #ddd; font-size: 12px; display: flex; flex-direction: column; line-height: 1.2; }
.stat-pill strong { color: #fff; font-size: 13px; }
.progress-pill { min-width: 140px; }
.mini-progress { height: 4px; background: #3a3a50; border-radius: 4px; margin-bottom: 4px; overflow: hidden; }
.mini-progress-bar { height: 100%; background: var(--teal); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.plan-badge { border: 1px solid var(--teal); color: var(--teal); border-radius: 999px; padding: 4px 12px; font-size: 12px; }
.topbar-user { color: #c5c5d6; font-size: 13px; }
.lk-content { padding: 28px 32px 48px; }

.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.page-icon { width: 48px; height: 48px; border-radius: 10px; background: #111; color: var(--teal); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.page-head h1 { font-size: 26px; }
.page-sub { color: var(--muted); font-size: 13px; }

.section-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 8px 0 12px; font-weight: 700; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 28px; }
.action-card { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text); }
.action-card:hover { border-color: #c7d2fe; }
.action-ico { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.action-ico.blue { background: #e0f2fe; color: #0369a1; }
.action-ico.teal { background: #ccfbf1; color: #0f766e; }
.action-ico.green { background: #dcfce7; color: #15803d; }
.action-card span { color: var(--muted); font-size: 13px; display: block; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; font-size: 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-ghost { background: transparent; border-color: #3a3a50; color: #ddd; }
body.public .btn { color: #fff; background: #2a2a40; border-color: #3a3a50; }
body.public .btn-primary { background: var(--primary); border-color: var(--primary); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { color: var(--muted); font-weight: 500; background: #fafafa; }
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label input, label select, label textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.inline-form { display: flex; gap: 8px; margin: 12px 0; }
.inline-form input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.empty { color: var(--muted); padding: 16px 0; }
.mt-2 { margin-top: 16px; }
.mt-4 { margin-top: 28px; }
.error { color: var(--danger); margin-bottom: 10px; }
.badge { display: inline-block; padding: 2px 8px; font-size: 11px; border-radius: 4px; background: #eef2ff; color: #3730a3; text-transform: uppercase; }
.center-page { text-align: center; padding: 80px 24px; }

.editor-layout { display: grid; grid-template-columns: 1fr 280px 300px; grid-template-rows: auto 1fr; min-height: calc(100vh - 64px); margin: -28px -32px -48px; background: #fff; }
.editor-toolbar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.editor-pane { padding: 16px; overflow: auto; grid-column: 1; grid-row: 2; }
.editor-sidebar { padding: 16px; border-left: 1px solid var(--line); background: #fafafa; grid-column: 2; grid-row: 2; overflow: auto; }
.test-chat { grid-column: 3; grid-row: 2; display: flex; flex-direction: column; border-left: 1px solid var(--line); min-height: 280px; }
.test-chat-header { padding: 8px 12px; font-weight: 600; border-bottom: 1px solid var(--line); }
.test-messages { flex: 1; overflow: auto; padding: 12px; font-size: 13px; }
.test-input { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.test-input input { flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.inbox-layout { display: grid; grid-template-columns: 280px 1fr; gap: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; min-height: 520px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--line); overflow: auto; }
.inbox-item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.inbox-item.active { background: #eef2ff; }
.inbox-thread { display: flex; flex-direction: column; }
.inbox-msgs { flex: 1; padding: 16px; overflow: auto; }
.msg { max-width: 70%; margin-bottom: 8px; padding: 8px 12px; border-radius: 10px; font-size: 14px; }
.msg.in { background: #f3f4f6; }
.msg.out { background: #dbeafe; margin-left: auto; }

@media (max-width: 900px) {
  .action-grid, .pricing { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  body.lk { display: block; }
}
