:root {
  --blue: #2f6bff;
  --blue-2: #5b8cff;
  --blue-soft: #e8efff;
  --ink: #0b1220;
  --muted: #667085;
  --line: #e6ebf2;
  --bg: #f3f6fb;
  --white: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --soft: #f1f5f9;
  --label: #334155;
  --card-line: #edf1f7;
  --topbar: rgba(255,255,255,.92);
  --sidebar: #070b14;
  --danger: #e11d48;
  --ok: #16a34a;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
  --on-blue: #ffffff;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --blue: #4d8dff;
  --blue-2: #7aa6ff;
  --blue-soft: #15233d;
  --ink: #e8eef8;
  --muted: #93a4bb;
  --line: #2a384c;
  --bg: #080d18;
  --white: #121a2b;
  --surface: #121a2b;
  --surface-2: #182234;
  --soft: #1c2738;
  --label: #cbd5e1;
  --card-line: #2a384c;
  --topbar: rgba(10,16,28,.88);
  --shadow: 0 12px 32px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Sora, 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; }
iconify-icon { display: inline-block; vertical-align: middle; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(47,107,255,.4), transparent 55%),
    radial-gradient(700px 380px at 100% 100%, rgba(14,165,233,.18), transparent 50%),
    linear-gradient(180deg, #070b14, #0b1220);
}
.auth-wrap { width: min(420px, 100%); }
.auth-card {
  width: 100%;
  background: var(--surface);
  border-radius: 28px;
  padding: 32px 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  position: relative;
}
.auth-lead { margin: 4px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.field {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface-2); padding: 0 12px;
}
.field iconify-icon { color: var(--blue); font-size: 20px; }
.field input { border: 0; background: transparent; padding: 12px 0; box-shadow: none; }
.field:focus-within {
  border-color: #93c5fd; background: var(--surface);
  box-shadow: 0 0 0 4px rgba(47,107,255,.12);
}
.btn-block { width: 100%; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.sidebar .brand {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px 12px 24px;
  position: relative;
  min-height: 46px;
}
.sidebar-close {
  display: none;
  width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.08); color: #fff; cursor: pointer;
  place-items: center;
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
}
.brand-logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  margin: 0 auto;
}
.sidebar .brand-logo {
  height: 46px;
  filter: drop-shadow(0 6px 16px rgba(47,107,255,.25));
}
.auth-card .brand {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin-bottom: 12px;
}
.auth-card .brand-logo { height: 48px; }
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .04em; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #4d8dff, #1d4ed8);
  color: #fff; font-weight: 700; box-shadow: 0 8px 18px rgba(37,99,235,.35);
}
.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: 12px; font-weight: 600; color: var(--label); }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; background: var(--surface-2); color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: #93c5fd; background: var(--surface);
  box-shadow: 0 0 0 4px rgba(47,107,255,.12);
}
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: 600; display: inline-flex; align-items: center; gap: 8px;
  justify-content: center; transition: transform .12s, filter .12s;
}
.btn:hover { filter: brightness(1.05); }
.btn-primary { background: linear-gradient(180deg, #4d8dff, var(--blue)); color: var(--on-blue); box-shadow: 0 8px 16px rgba(47,107,255,.25); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.btn-danger { background: #fff1f2; color: #be123c; }
.btn-sm { padding: 8px 11px; font-size: 12px; border-radius: 10px; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer;
  display: inline-grid; place-items: center;
}

.app { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; }
.sidebar {
  background:
    radial-gradient(500px 220px at 0% 0%, rgba(47,107,255,.22), transparent 60%),
    linear-gradient(180deg, #0a101c, #070b14);
  color: #fff;
  padding: 18px 14px;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar .brand small { color: #8fb4ff; }
.nav { display: grid; gap: 4px; margin-top: 10px; }
.nav-label {
  display: block;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 600;
  padding: 14px 14px 6px;
}
.nav a {
  color: #b7c3d6;
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.nav a iconify-icon { font-size: 20px; color: #7dd3fc; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active {
  background: linear-gradient(90deg, rgba(47,107,255,.28), rgba(47,107,255,.08));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(47,107,255,.28);
}
.nav a.active::before {
  content: "";
  position: absolute;
  left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 99px;
  background: #60a5fa;
}
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 8px; }
.user-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  padding: 10px;
}
.user-card strong { display: block; font-size: 13px; }
.user-card small { color: #93c5fd; font-size: 11px; word-break: break-all; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(145deg, #4d8dff, #1d4ed8);
  display: grid; place-items: center; font-weight: 700; flex: 0 0 auto;
}
.logout {
  color: #cbd5e1 !important;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 12px; font-size: 13px; font-weight: 600;
}
.logout:hover { background: rgba(255,255,255,.05); color: #fff !important; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px; background: var(--topbar);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 22;
  backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 22px; flex: 1; min-width: 0; letter-spacing: -.03em; }
#menuBtn { display: none; flex: 0 0 auto; z-index: 23; }
#topActions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: 0 1 auto; }
.content { padding: 24px; }
body.nav-open { overflow: hidden; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); 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: var(--surface); 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; display: grid; place-items: center; }
.avatar {
  width: 56px; height: 56px; border-radius: 16px; object-fit: cover; background: var(--blue-soft);
}
.avatar.lg { width: 88px; height: 88px; border-radius: 24px; }

.site-list { display: grid; gap: 12px; }
.site-card {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.site-card:hover {
  transform: translateY(-1px);
  border-color: #dbeafe;
  box-shadow: 0 16px 40px rgba(37, 99, 235, .08);
}
.site-card .handle {
  width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: #94a3b8;
}
.site-fav {
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  display: grid; place-items: center; overflow: hidden;
}
.site-fav img { width: 32px; height: 32px; object-fit: contain; }
.site-info h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.02em; }
.site-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.site-url { color: var(--muted); font-size: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--blue-soft); color: var(--blue);
  border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 600;
}
.site-card .actions { justify-content: flex-end; }

.hero-page {
  background: var(--surface); 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: var(--surface); padding: 10px 14px; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--ink);
}
.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(232px, 1fr)); gap: 14px; }
.file-card, .folder-card {
  background: var(--surface); border-radius: 20px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--card-line);
  display: flex; flex-direction: column;
  min-width: 0;
}
.file-meta { padding: 12px; display: grid; gap: 10px; min-width: 0; }
.folder-card {
  padding: 12px 8px 10px;
  min-height: 0;
  cursor: pointer;
  align-items: center;
  text-align: center;
  position: relative;
  background: transparent;
  box-shadow: none;
  border: 1px solid transparent;
  overflow: visible;
}
.folder-card:hover, .folder-card:focus-within {
  background: #eef4ff;
  border-color: #dbe7ff;
  box-shadow: none;
}
.folder-visual {
  width: 100%; height: 110px;
  display: grid; place-items: center;
  pointer-events: none;
}
.folder-glyph {
  width: min(120px, 94%);
  height: auto;
  filter: drop-shadow(0 10px 14px rgba(180, 120, 10, .28));
}
.folder-handle {
  position: absolute; top: 6px; left: 6px;
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  color: #94a3b8; cursor: grab;
  background: var(--surface);
  opacity: .7;
  z-index: 1;
}
.folder-ico {
  width: auto; height: auto; border-radius: 0;
  background: none; margin: 0 0 8px;
  color: #3b82f6;
  display: grid; place-items: center;
}
.folder-ico iconify-icon { color: #3b82f6; }
.folder-card strong { font-size: 13px; margin: 2px 0 8px; word-break: break-word; max-width: 100%; }
.folder-card .icon-actions { justify-content: center; width: 100%; grid-template-columns: repeat(3, 32px); }
.folders-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.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,.62);
  backdrop-filter: blur(8px);
  display: none !important;
  place-items: center; z-index: 30; padding: 16px;
}
.modal-bg.is-open {
  display: grid !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
.modal {
  width: min(520px, 100%);
  background: var(--surface);
  border-radius: 24px;
  padding: 22px 22px 18px;
  max-height: 90vh; overflow: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
  position: relative;
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal h2 { margin: 0 36px 6px 0; font-size: 20px; letter-spacing: -.03em; }
.modal-lead { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border: 0; border-radius: 12px;
  background: var(--soft); color: var(--label); cursor: pointer;
  display: grid; place-items: center;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.flow-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.phone {
  width: 320px; height: 680px; background: #000; border-radius: 36px; padding: 12px;
  margin: 0 auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); position: sticky; top: 78px;
}
.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;
}
.chat-sys {
  justify-self: center; font-size: 11px; font-weight: 700; color: #93c5fd;
  background: rgba(47,107,255,.16); border-radius: 999px; padding: 4px 10px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chat-pause {
  justify-self: center; color: #94a3b8; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i {
  width: 5px; height: 5px; border-radius: 50%; background: #64748b;
  animation: typing 1s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.bubble.sim-media { padding: 8px; }
.sim-card-link { color: inherit; display: grid; gap: 8px; }
.sim-photo {
  height: 148px; border-radius: 12px;
  background: linear-gradient(160deg, #334155, #0f172a);
  display: grid; place-items: center; color: #93c5fd; position: relative;
}
.sim-photo.has-play { color: #cbd5e1; }
.sim-play {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  background: rgba(7,11,20,.28);
}
.sim-photo-tag {
  position: absolute; left: 8px; bottom: 8px;
  font-size: 10px; font-weight: 700; color: #e2e8f0;
  background: rgba(7,11,20,.55); border-radius: 8px; padding: 3px 7px;
}
.sim-title { display: block; font-size: 13px; margin: 6px 2px 0; }
.sim-cap { font-size: 12px; color: #cbd5e1; margin: 4px 2px 0; }
.sim-audio {
  display: flex; align-items: center; gap: 10px;
  background: #111827; border-radius: 12px; padding: 10px 12px;
}
.sim-audio-play { color: #60a5fa; display: grid; }
.sim-audio-wave {
  flex: 1; height: 22px; border-radius: 6px;
  background: repeating-linear-gradient(90deg, #60a5fa 0 2px, transparent 2px 5px);
  opacity: .7;
}
.sim-audio-time { font-size: 11px; font-weight: 700; color: #93c5fd; }
.flow-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  padding: 8px 16px 24px;
}
.flow-card {
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 12px 12px;
}
.flow-card-body { width: 100%; display: grid; gap: 8px; padding-top: 10px; }
.flow-card-body h3 { margin: 0; font-size: 14px; }
.phone-mini {
  width: 210px; height: 340px; padding: 8px; border-radius: 26px;
  position: static; flex: none; margin: 0;
}
.phone-mini .phone-bar { font-size: 11px; padding: 8px; }
.phone-mini .chat { gap: 6px; padding: 8px; }
.phone-mini .bubble { font-size: 11px; padding: 7px 8px; }
.phone-mini .sim-photo { height: 78px; }
.phone-mini .chat-btns a, .phone-mini .chat-btns span { padding: 5px; font-size: 10px; }
.section-title { margin: 22px 0 10px; font-size: 16px; }
.flow-hit-list { display: grid; gap: 10px; }

.empty {
  background: var(--surface); 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: var(--surface); 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; }

.sidebar-bg {
  display: none;
  position: fixed; inset: 0;
  background: rgba(7,11,20,.5);
  z-index: 18;
  border: 0;
}
.sidebar-bg.open { display: block; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(288px, 88vw); z-index: 30;
    transform: translateX(-105%); transition: transform .22s ease;
    height: 100%; height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: none;
  }
  .sidebar.open { transform: none; pointer-events: auto; }
  #menuBtn { display: inline-grid; }
  .sidebar-close { display: grid; }
  .flow-layout { grid-template-columns: 1fr; }
  .site-card { grid-template-columns: auto 1fr; }
  .site-card .actions { grid-column: 1 / -1; }
  .site-card .handle { display: none; }
  .content { padding: 14px; }
  .topbar { padding: 12px 14px; z-index: 22; }
  .topbar h1 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-photo.hero { width: 84px; flex: 0 0 84px; border-radius: 18px; }
  .ws-id h2 { font-size: 18px; }
  .user-card-ui { grid-template-columns: auto 1fr; }
  .user-card-ui .icon-actions { grid-column: 1 / -1; }
  .phone { width: min(320px, 100%); height: 580px; }
}

@media (max-width: 640px) {
  .file-card .ibtn, .folder-card .ibtn { width: 30px; height: 30px; }
  .file-card .icon-actions, .audio-card .icon-actions {
    grid-template-columns: repeat(4, 30px);
    gap: 4px;
  }
  .folder-card .icon-actions {
    grid-template-columns: repeat(3, 30px);
    gap: 4px;
  }
  .ws-toolbar-row { flex-wrap: wrap; }
  .ws-new-folder { width: 100%; justify-content: center; }
  .page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .file-grid { grid-template-columns: repeat(2, minmax(168px, 1fr)); gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .ws-head { flex-direction: column; align-items: flex-start; }
  .site-card { grid-template-columns: 1fr; }
  .page-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.page-card {
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.page-card:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(37,99,235,.1); }
a.page-card { color: inherit; text-decoration: none; display: flex; flex-direction: column; }
.page-card .icon-actions { flex-wrap: nowrap; }
.page-photo {
  aspect-ratio: 1 / 1;
  width: 100%;
  background: #0b1220;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.page-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.page-photo.hero {
  width: 120px;
  flex: 0 0 120px;
  border-radius: 24px;
}
.page-photo.preview {
  width: 120px;
  border-radius: 18px;
  flex: 0 0 120px;
}
.photo-fallback { color: #64748b; }
.page-card-body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.page-card-body h3 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.page-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flag-ico { display: inline-flex; border-radius: 4px; overflow: hidden; }
.gender-ico { display: inline-flex; color: var(--blue); }
.meta-ico { display: inline-flex; color: var(--blue); }
.site-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--soft); border-radius: 999px; padding: 3px 8px 3px 4px;
  font-size: 12px; font-weight: 600; color: var(--label);
}
.fav-sm { width: 16px; height: 16px; border-radius: 4px; }
.icon-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.file-card .icon-actions, .folder-card .icon-actions {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 6px;
  justify-content: start;
  width: max-content;
  max-width: 100%;
}
.file-card .ibtn, .folder-card .ibtn { width: 34px; height: 34px; flex: none; }
.ibtn {
  width: 36px; height: 36px; border: 0; border-radius: 11px;
  display: inline-grid; place-items: center; cursor: pointer;
  background: var(--soft); color: var(--ink); text-decoration: none;
}
.ibtn:hover { background: var(--line); }
.ibtn-primary { background: var(--blue); color: #fff; }
.ibtn-primary:hover { filter: brightness(1.08); background: var(--blue); color: #fff; }
.ibtn-danger { background: #fff1f2; color: #be123c; }
label.ibtn { margin: 0; font-weight: 500; }
label.ibtn input { display: none; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.photo-field { display: flex; gap: 14px; align-items: center; }
.photo-field input[type=file] { flex: 1; }

.workspace {
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ws-head {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--blue-soft), var(--surface));
  border-bottom: 1px solid var(--line);
}
.ws-id h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.03em; }
.ws-tabs {
  display: flex; gap: 8px; padding: 12px 16px 0;
}
.ws-tab {
  border: 0; background: var(--soft); color: var(--label);
  border-radius: 999px; padding: 8px 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.ws-tab.active { background: var(--blue); color: #fff; }
.ws-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 8px;
  flex-wrap: wrap;
}
.ws-bar .btn { white-space: nowrap; }
.ws-toolbar {
  margin: 12px 16px 12px;
  padding: 12px;
  background: var(--blue-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 10px;
}
.ws-toolbar-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: nowrap;
}
.ws-new-folder {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.ws-path {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  color: var(--muted); font-size: 13px;
}
.ws-path button {
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
  cursor: pointer; font-weight: 600; color: var(--label);
}
.ws-path button:hover { border-color: #93c5fd; color: var(--blue); }
.ws-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 12px; flex: 1; min-width: 0;
  color: var(--blue);
}
.ws-search input { border: 0; background: transparent; padding: 9px 0; box-shadow: none; }
.ws-drop {
  margin: 0 16px 16px;
  border: 1.5px dashed #93c5fd;
  background: var(--blue-soft);
  border-radius: 16px;
  padding: 22px 16px;
  text-align: center;
  color: var(--blue);
  font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
}
.ws-drop.over { background: #dbeafe; border-color: var(--blue); }
.ws-board { padding: 0 16px 16px; display: grid; gap: 14px; }
.ws-empty {
  grid-column: 1 / -1;
  display: grid; place-items: center; gap: 8px;
  color: var(--muted); padding: 28px; background: var(--surface-2); border-radius: 16px;
}
.file-card .page-photo.media { border-radius: 0; background: var(--soft); }
.file-meta strong {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder-card .folder-ico { background: none; width: auto; height: auto; margin-bottom: 6px; }
.audio-tile {
  min-height: 148px;
  padding: 14px 12px 12px;
  display: grid;
  gap: 10px;
  justify-items: stretch;
  background: var(--blue-soft);
  color: var(--blue);
  overflow: hidden;
  min-width: 0;
}
.audio-tile audio { display: none; }
.audio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.audio-mark {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--surface);
  color: var(--blue);
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}
.audio-play {
  width: 40px; height: 40px; border-radius: 12px;
  border: 0; background: var(--blue); color: #fff; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.audio-play:hover { filter: brightness(1.08); }
.audio-wavebars {
  display: flex; align-items: flex-end; gap: 3px;
  height: 36px; width: 100%;
}
.audio-wavebars span {
  flex: 1; min-width: 3px;
  background: var(--blue);
  border-radius: 99px;
  opacity: .38;
  transform-origin: bottom;
}
.audio-tile.playing .audio-wavebars span {
  animation: audioPulse .7s ease-in-out infinite alternate;
}
@keyframes audioPulse {
  from { opacity: .28; transform: scaleY(.45); }
  to { opacity: .9; transform: scaleY(1); }
}
.audio-line {
  display: flex; align-items: center; gap: 8px;
  width: 100%; flex-wrap: nowrap; min-width: 0;
}
.audio-seek {
  flex: 1; min-width: 0; width: auto; height: 6px; padding: 0; margin: 0;
  border: 0; box-shadow: none; background: transparent; accent-color: var(--blue);
}
.audio-time {
  flex: 0 0 auto; font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.audio-card .icon-actions {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 6px;
  width: max-content;
  max-width: 100%;
}
.page-photo.media.zoomable {
  border: 0;
  padding: 0;
  cursor: zoom-in;
  position: relative;
  background: var(--soft);
}
.zoom-hint {
  position: absolute;
  right: 8px; bottom: 8px;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: rgba(7,11,20,.7);
  color: #fff;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity .15s;
}
.page-photo.media.zoomable:hover .zoom-hint { opacity: 1; }
.modal-bg.lightbox-mode {
  padding: 0;
  background: rgba(4, 8, 16, .9);
}
.lightbox {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  position: relative;
}
.lightbox img {
  max-width: min(94vw, 1100px);
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.lightbox-close, .lightbox-nav {
  position: absolute;
  border: 0;
  background: rgba(255,255,255,.12);
  color: #fff;
  width: 44px; height: 44px;
  border-radius: 14px;
  display: grid; place-items: center;
  cursor: pointer;
  z-index: 2;
}
.lightbox-close { top: 16px; right: 16px; }
.lightbox-nav.prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-cap {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(7,11,20,.55);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-card .folder-ico {
  background: none; width: auto; height: auto; color: #3b82f6; margin-bottom: 8px;
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .ws-head { flex-direction: column; align-items: flex-start; }
}

.page-pick-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
}
.page-pick-card.active { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47,107,255,.15); }
.page-pick-card .page-photo { border-radius: 0; }
.page-pick-card .page-photo img { height: 100%; object-fit: contain; }
.page-pick-card strong { padding: 8px 10px 12px; font-size: 13px; }
.voice-status {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; border-radius: 9px;
  background: rgba(15,23,42,.72); color: #fff;
  display: grid; place-items: center;
}
.voice-status.ok { background: #16a34a; }
.voice-studio { display: grid; gap: 16px; }
.voice-panel { padding: 16px; display: grid; gap: 12px; }
#topActions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-grid { display: grid; gap: 12px; }
.user-card-ui {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.user-card-ui h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-avatar-lg {
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(145deg, #4d8dff, #1d4ed8);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.pass-row { display: flex; gap: 8px; align-items: center; }
.pass-row input { flex: 1; }

.theme-btn { flex: 0 0 auto; }
.auth-theme {
  position: fixed; top: 16px; right: 16px; z-index: 5;
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .folder-card:hover,
html[data-theme="dark"] .folder-card:focus-within { background: #18233a; border-color: #2a384c; }
html[data-theme="dark"] .ws-drop.over { background: #15233d; }
html[data-theme="dark"] .ibtn-danger { background: #3a1822; color: #fda4af; }
html[data-theme="dark"] .btn-danger { background: #3a1822; color: #fda4af; }
html[data-theme="dark"] .err { background: #3a1822; color: #fecaca; }
html[data-theme="dark"] .ok { background: #143322; color: #86efac; }
html[data-theme="dark"] .chip { background: var(--soft); color: var(--blue); }
