:root {
  --blue: #2563eb;
  --blue-2: #3b82f6;
  --blue-soft: #dbeafe;
  --ink: #070b14;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f7fb;
  --white: #ffffff;
  --sidebar: #070b14;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(37,99,235,.35), transparent),
    linear-gradient(180deg, #070b14, #0f172a);
}
.auth-card {
  width: min(440px, calc(100% - 32px));
  background: #fff;
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: #fff; font-weight: 800;
}
.stack { display: grid; gap: 12px; }
.stack h2 { margin: 8px 0 0; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #334155; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
.err { background: #fef2f2; color: #991b1b; padding: 10px 12px; border-radius: 12px; }
.ok { background: #f0fdf4; color: #166534; padding: 10px 12px; border-radius: 12px; }

.btn {
  border: 0; border-radius: 12px; padding: 10px 14px; cursor: pointer;
  font-weight: 700; display: inline-flex; align-items: center; gap: 8px;
  justify-content: center;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-sm { padding: 7px 10px; font-size: 13px; border-radius: 10px; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 12px; background: #fff; cursor: pointer;
}

.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  color: #fff;
  padding: 22px 16px;
  display: flex; flex-direction: column;
}
.sidebar .brand small { color: #93c5fd; }
.nav { display: grid; gap: 6px; margin-top: 28px; }
.nav a {
  color: #cbd5e1; padding: 11px 12px; border-radius: 12px; font-weight: 600;
}
.nav a:hover, .nav a.active { background: rgba(37,99,235,.22); color: #fff; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.user-chip { color: #93c5fd; font-size: 13px; }
.logout { color: #fff !important; opacity: .7; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 8;
}
.topbar h1 { margin: 0; font-size: 20px; flex: 1; }
#menuBtn { display: none; }
.content { padding: 24px; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 28px; color: var(--blue); }
.stat span { color: var(--muted); font-size: 13px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar .grow { flex: 1; min-width: 180px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card, .row-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.row-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.card-body { padding: 14px; display: grid; gap: 8px; }
.card h3, .row-card h3 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.handle { cursor: grab; color: #94a3b8; padding: 6px; user-select: none; }
.avatar {
  width: 56px; height: 56px; border-radius: 16px; object-fit: cover; background: var(--blue-soft);
}
.avatar.lg { width: 88px; height: 88px; border-radius: 24px; }

.hero-page {
  background: #fff; border-radius: 24px; padding: 18px; display: flex; gap: 16px; align-items: center;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  border: 0; background: #fff; padding: 10px 14px; border-radius: 999px; font-weight: 700; cursor: pointer;
}
.tab.active { background: var(--blue); color: #fff; }

.crumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.crumbs button { border: 0; background: transparent; color: var(--blue); cursor: pointer; font-weight: 600; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.file-card, .folder-card {
  background: #fff; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.file-card img { height: 140px; object-fit: cover; width: 100%; }
.file-meta { padding: 10px; display: grid; gap: 8px; }
.folder-card { padding: 16px; min-height: 120px; cursor: pointer; }
.folder-ico {
  width: 42px; height: 34px; border-radius: 8px;
  background: linear-gradient(180deg, #60a5fa, var(--blue));
  margin-bottom: 10px;
}

.dropzone {
  border: 1.5px dashed #93c5fd; background: #eff6ff; border-radius: 16px;
  padding: 22px; text-align: center; color: #1d4ed8; font-weight: 600; margin-bottom: 14px;
}

.modal-bg {
  position: fixed; inset: 0; background: rgba(7,11,20,.55);
  display: grid; place-items: center; z-index: 30; padding: 16px;
}
.modal {
  width: min(560px, 100%); background: #fff; border-radius: 20px; padding: 20px;
  max-height: 90vh; overflow: auto;
}
.modal h2 { margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.flow-layout { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.phone {
  width: 320px; height: 640px; background: #000; border-radius: 36px; padding: 12px;
  margin: 0 auto; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.phone-screen {
  height: 100%; background: #0b1220; border-radius: 28px; overflow: hidden; display: flex; flex-direction: column;
}
.phone-bar { background: #111827; color: #fff; padding: 14px; font-weight: 700; text-align: center; font-size: 14px; }
.chat { flex: 1; overflow: auto; padding: 12px; display: grid; gap: 10px; align-content: start; }
.bubble {
  background: #1f2937; color: #fff; border-radius: 16px 16px 16px 4px; padding: 10px 12px;
  max-width: 92%; font-size: 13px; line-height: 1.4;
}
.bubble img { border-radius: 10px; margin-bottom: 8px; }
.chat-btns { display: grid; gap: 6px; margin-top: 8px; }
.chat-btns a, .chat-btns span {
  display: block; text-align: center; background: #2563eb; color: #fff !important;
  border-radius: 10px; padding: 8px; font-size: 12px; font-weight: 700;
}

.empty {
  background: #fff; border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted);
}

.page-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.page-pick-card {
  background: #fff; border: 2px solid transparent; border-radius: 16px;
  padding: 12px; text-align: left; cursor: pointer; box-shadow: var(--shadow);
  display: grid; gap: 8px; color: inherit;
}
.page-pick-card img, .page-pick-card .avatar {
  width: 100%; height: 110px; object-fit: cover; border-radius: 12px;
}
.page-pick-card small { color: var(--muted); font-weight: 600; }
.page-pick-card.active { border-color: var(--blue); }
.voice-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.voice-row audio { flex: 1; min-width: 220px; }
.dl-btn {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--blue); color: #fff !important; flex: 0 0 auto;
}
.dl-btn:hover { background: #1d4ed8; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20;
    transform: translateX(-105%); transition: .2s ease;
  }
  .sidebar.open { transform: none; }
  #menuBtn { display: inline-flex; }
  .flow-layout { grid-template-columns: 1fr; }
}
