:root {
  color-scheme: dark;
  --bg: #111922;
  --surface: #1a242e;
  --hover: #242f3b;
  --line: #293542;
  --text: #f3f5f8;
  --muted: #98a6b3;
  --accent: #5b55f6;
  --accent-text: #7770ff;
  --selected: #2d2960;
  --danger: #ff8090;
  font-family: system-ui, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}
:root[data-theme="Light"] {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #fff;
  --hover: #f0f1f7;
  --line: #dde1e8;
  --text: #1c2530;
  --muted: #586779;
  --accent-text: #5149df;
  --selected: #ebe8ff;
  --danger: #bf273c;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="System"] {
    color-scheme: light;
    --bg: #f7f8fb;
    --surface: #fff;
    --hover: #f0f1f7;
    --line: #dde1e8;
    --text: #1c2530;
    --muted: #586779;
    --accent-text: #5149df;
    --selected: #ebe8ff;
    --danger: #bf273c;
  }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
a { color: var(--accent-text); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
[hidden] { display: none !important; }
img, video { max-width: 100%; }
svg { flex: none; vertical-align: middle; }
h1, h2, h3, p { margin: 0; }
:where(h1, h2, h3, h4, h5, h6, strong, b, th) { font-weight: inherit; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { line-height: 1.5; }
hr { height: 0; border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.muted { color: var(--muted); }
.danger { color: var(--danger) !important; }
.compact { font-size: 12px; }
.error { color: var(--danger); margin: 0; }
.logo { display: block; object-fit: contain; width: 42px; height: 32px; border-radius: 9px; flex: none; }
.avatar { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; background: var(--accent); color: white; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.large { width: 80px; height: 80px; font-size: 24px; }
.avatar.small { width: 28px; height: 28px; font-size: 10px; }
.primary, .secondary, .text-button, .icon-button, .pill, .menu-link, .file-button { border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: inherit; }
.primary, .secondary, .file-button { border-radius: 10px; padding: 10px 15px; min-height: 40px; }
.primary { background: var(--accent); color: #fff; }
.secondary, .file-button { border: 1px solid var(--line); background: var(--surface); }
.text-button { color: var(--accent-text); min-height: 36px; padding: 7px; }
.icon-button { border-radius: 50%; width: 40px; height: 40px; flex: none; }
.secondary:hover, .icon-button:hover, .menu-link:hover, .item-link:hover { background: var(--hover); }
.pill { border: 1px solid var(--line); padding: 7px 13px; border-radius: 999px; min-height: 33px; font-size: 12px; white-space: nowrap; }
.pill.active { background: var(--selected); border-color: var(--selected); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field>span:empty { display: none; }
input:not([type=checkbox],[type=radio],[type=file]), select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; min-height: 42px; padding: 10px 12px; width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; min-height: 80px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.toggle { display: flex; gap: 8px; align-items: center; line-height: 1.45; min-height: 26px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.flow.between { justify-content: space-between; }
.flow.end { justify-content: flex-end; }
.flow.nowrap { flex-wrap: nowrap; }
.flow.nowrap .field { flex: 1; }
.break { overflow-wrap: anywhere; }
.settings-button { display: block; width: 100%; background: none; color: inherit; border: 0; padding: 0; text-align: left; }
.settings-button:hover { background: var(--hover); border-radius: 8px; }
.qr-box { text-align: center; }
.qr-box img { border-radius: 8px; }
.member-results { max-height: 220px; overflow: auto; }
.box { background: var(--surface); border: 1px solid var(--line); padding: 16px; border-radius: 12px; }
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 14px; }
.empty-icon { color: var(--accent-text); }
.empty p { color: var(--muted); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); min-height: 56px; }
.item:last-child { border-bottom: 0; }
.item-copy { flex: 1; min-width: 0; display: grid; gap: 4px; overflow-wrap: anywhere; }
.item-copy span { color: var(--muted); font-size: 13px; }
.item-actions { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.item-link { display: block; color: inherit; border-radius: 9px; }
.search-field { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding-left: 12px; color: var(--muted); }
.search-field input { background: transparent !important; border: 0 !important; }
.search-field input:focus { outline: none; }
.search-field:focus-within { outline: 2px solid var(--accent-text); }
.shell { display: grid; grid-template-columns: 240px minmax(0,1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; padding: 12px; background: var(--surface); border-right: 1px solid var(--line); overflow: auto; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; line-height: 1.2; color: var(--text); padding: 0 8px 12px; }
.side-link { display: flex; gap: 12px; align-items: center; min-height: 41px; border-radius: 30px; padding: 8px 13px; color: var(--text); }
.side-link:hover { background: var(--hover); }
.side-link.active { background: var(--selected); }
.side-link.active svg { color: var(--accent-text); }
.side-secondary svg, .sidebar-foot svg { color: var(--muted); }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; }
.sidebar-foot a, .sidebar-foot button { display: flex; gap: 8px; align-items: center; color: var(--text); margin-bottom: 9px; }
.sidebar-foot button { background: transparent; border: 0; color: var(--muted); padding: 4px; }
.sidebar-foot button:last-child { margin-bottom: 0; }
.side-link.active[href="/chats"] svg, .mobile-nav a.active[href="/chats"] svg { fill: currentColor; }
.mobile-nav { display: none; }
.page { width: min(100%,740px); margin: 0 auto; padding: 24px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.page-heading .back { color: var(--muted); display: inline-flex; align-items: center; margin-right: 6px; }
.page-content { display: grid; gap: 15px; }
.profile-top { display: grid; justify-items: center; gap: 10px; margin: 12px 0 16px; }
.profile-top button { background: none; border: 0; }
.profile-top p { font-size: 18px; }
.shortcut-list { padding: 0 6px; }
.shortcut-list .item { min-height: 46px; }
.chat-layout { display: grid; grid-template-columns: 380px minmax(0,1fr); height: 100dvh; }
.chat-list { border-right: 1px solid var(--line); position: relative; min-width: 0; display: flex; flex-direction: column; }
.chat-top { background: var(--surface); min-height: 56px; padding: 8px 6px 8px 16px; display: flex; align-items: center; justify-content: space-between; }
.chat-top h1 { font-size: 16px; }
.chat-search { margin: 4px 16px 7px; }
.chat-tabs { display: flex; gap: 4px; padding: 0 16px 3px; overflow: auto; }
.chat-rows { overflow: auto; flex: 1; }
.chat-rows .empty { padding-top: 49px; }
.chat-rows .empty p { color: var(--text); }
.chat-panel { min-width: 0; display: grid; place-items: center; }
.chat-panel .empty { padding: 0 12px; }
.chat-panel .placeholder-icon { display: grid; place-items: center; width: 64px; height: 64px; color: var(--accent-text); background: var(--selected); border-radius: 20px; margin: 0 auto 5px; }
.menu { position: absolute; z-index: 5; right: 4px; top: 51px; min-width: 235px; padding: 4px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 20px #0004; }
.menu-link { display: flex; width: 100%; justify-content: flex-start; padding: 9px 16px; gap: 12px; color: var(--text); }
.menu-link svg { color: var(--muted); }
.menu hr { margin: 4px 0; }
.conversation { display: grid; grid-template-rows: auto minmax(0,1fr) auto; height: 100%; width: 100%; min-height: 0; overflow: hidden; position: relative; isolation: isolate; }
.chat-person { display: flex; gap: 9px; align-items: center; min-width: 0; color: inherit; text-align: left; background: none; border: 0; padding: 0; }
.chat-person>span { min-width: 0; }
.chat-person .avatar { min-width: 38px; }
.chat-person strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-search { display: flex; align-items: center; gap: 8px; width: 100%; }
.thread-search .search-field { flex: 1; }
.thread-menu { max-width: calc(100% - 8px); }
.attachment-menu { bottom: calc(100% + 2px); top: auto; right: auto; left: 9px; }
.chat-wallpaper { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
[data-chat-theme="Sand"] { --chat-tint: #8a664239; }
[data-chat-theme="Sky"] { --chat-tint: #2679b045; }
[data-chat-theme="Mint"] { --chat-tint: #25816b41; }
[data-chat-theme="Blush"] { --chat-tint: #a1426740; }
[data-chat-theme="Lavender"] { --chat-tint: #7051a94b; }
[data-chat-theme="Slate"] { --chat-tint: #57738c44; }
.conversation .messages { background: var(--chat-tint, transparent); }
.emoji-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.emoji-grid .secondary { flex-direction: column; min-height: 58px; gap: 5px; padding: 6px 4px; font-size: 12px; overflow-wrap: anywhere; }
.emoji-grid svg, .reaction-picker svg, .reaction-icon { color: var(--accent-text); }
.reaction-picker { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 3px; }
.reaction-picker .secondary { min-height: 44px; padding: 0; }
.reaction-picker .secondary[aria-pressed=true] { border-color: var(--accent-text); background: var(--hover); }
.message-reactions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-inline-end: 2px; }
.message-reactions .reaction-icon { color: inherit; }
.shared { display: grid; gap: 4px; }
.shared-record { padding: 8px; background: var(--bg); border-radius: 8px; overflow-wrap: anywhere; }
.shared-record img, .shared-record video { display: block; max-height: 180px; }
.messages { padding: 18px; overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.messages .empty { margin: auto; }
.message { width: fit-content; max-width: min(80%,590px); padding: 9px 11px; border-radius: 11px 11px 11px 3px; background: var(--surface); color: var(--text); overflow-wrap: anywhere; }
.message p { white-space: pre-wrap; }
.message img, .message video { display: block; border-radius: 6px; max-height: 260px; }
.message audio { max-width: 100%; }
.message.mine { align-self: end; background: var(--selected); border-radius: 11px 11px 3px 11px; }
.message footer { display: flex; justify-content: end; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.message footer button { width: 26px; height: 26px; }
.quote { border-left: 2px solid var(--accent-text); padding: 4px 8px; color: var(--muted); background: var(--bg); border-radius: 4px; }
.composer { background: var(--surface); padding: 9px; border-top: 1px solid var(--line); position: relative; }
.composer .flow { flex-wrap: nowrap; }
.composer input[name=text] { flex: 1; width: auto; min-width: 56px; }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-panel { width: min(100%,420px); }
.auth-panel .logo { width: 128px; height: auto; border-radius: 14px; margin-bottom: 16px; }
.auth-panel .intro { margin: 5px 0 30px; }
.auth-note { margin-bottom: 14px; }
.auth-panel input:not([type=checkbox],[type=radio]), .auth-panel select { min-height: 48px; }
.auth-panel .primary { width: 100%; min-height: 51px; }
.auth-language { display: flex; justify-content: flex-end; margin: -4px 0 5px; }
.auth-links { display: grid; justify-items: center; gap: 4px; margin-top: 16px; }
.legal { text-align: center; color: var(--muted); margin-top: 24px; font-size: 12px; }
.phone-box { display: flex; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.phone-box input { border: 0 !important; background: transparent !important; width: 100%; min-width: 45px; }
.country { display: inline-flex; align-items: center; gap: 6px; border: 0; border-right: 1px solid var(--line); background: transparent; padding: 0 10px; white-space: nowrap; }
.country-code { display: inline-grid; place-items: center; min-width: 25px; padding: 3px 4px; border: 1px solid var(--line); border-radius: 5px; color: var(--accent-text); font-size: 10px; }
.country-name { display: inline-flex; align-items: center; gap: 8px; text-align: start; }
.country-results { max-height: 260px; overflow: auto; }
.country-results button { display: flex; width: 100%; justify-content: space-between; }
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; width: min(450px,calc(100% - 32px)); max-height: min(90dvh,760px); padding: 18px; }
dialog::backdrop { background: #04060ba0; }
.dialog-header { margin: -4px 0 13px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 10px 14px; color: #fff; background: #252d39; border: 1px solid #495362; border-radius: 10px; box-shadow: 0 7px 18px #0004; z-index: 9; }
.tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { font-size: 12px; background: var(--selected); border-radius: 20px; padding: 3px 8px; white-space: nowrap; }
.unread { color: white; background: var(--accent); }
.story { padding: 22px; border-radius: 13px; background: #263f97; color: #fff; }
.story[data-color="Purple"] { background: #622ba0; }
.story[data-color="Pink"] { background: #a72e62; }
.story[data-color="Green"] { background: #146347; }
.story summary { cursor: pointer; }
.stream-video { width: 100%; aspect-ratio: 16/9; background: #05090f; border-radius: 12px; }
.camera-preview { width: min(220px, 45%); aspect-ratio: 16/9; border-radius: 10px; background: #000; }
.comments { max-height: 260px; overflow: auto; }
.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.balance { display: flex; align-items: center; gap: 6px; font-size: 23px; }
.balance svg { color: var(--accent-text); }
.admin-shell, .admin-auth {
  color-scheme: light;
  --bg: #f0f2f4;
  --surface: #fff;
  --hover: #e7ebf1;
  --line: #e0e4e8;
  --text: #1d2936;
  --muted: #596677;
  --accent: #254d94;
  --accent-text: #244d97;
  --selected: #e4edf9;
  --danger: #b92336;
  background: var(--bg);
  color: var(--text);
}
.admin-shell { display: grid; grid-template-columns: 220px minmax(0,1fr); min-height: 100dvh; font-size: 13px; }
.admin-nav { background: #111827; color: #f5f7fa; min-height: 100dvh; }
.admin-nav h1 { font-size: 16px; padding: 17px 16px; }
.admin-nav p { color: #9aa4b4; font-size: 10px; letter-spacing: .045em; text-transform: uppercase; padding: 15px 16px 5px; }
.admin-nav a { color: #f5f7fa; display: block; padding: 9px 16px; }
.admin-nav a:hover, .admin-nav a.active { background: #1f2937; }
.admin-main { padding: 26px 28px; overflow: hidden; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-heading h2 { font-size: 20px; }
.admin-shell .primary, .admin-shell .secondary { min-height: 34px; padding: 6px 11px; border-radius: 6px; }
.admin-shell .field input, .admin-shell select { min-height: 34px; padding: 7px 9px; border-radius: 6px; }
.admin-filter .field { min-width: 110px; }
.evidence-copy { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 12rem; }
.admin-shell .box { border-radius: 9px; }
.admin-card { display: grid; gap: 10px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(116px,1fr)); gap: 12px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 15px; }
.metric strong { font-size: 24px; display: block; margin-bottom: 4px; }
.metric span { font-size: 12px; color: var(--muted); }
.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { background: #f8f9fb; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap input { min-width: 64px; }
.status { border-radius: 999px; padding: 3px 7px; font-size: 11px; color: #244d97; background: #e6eef9; white-space: nowrap; }
.status[data-status="Active"], .status[data-status="Completed"], .status[data-status="Live"] { color: #14502b; background: #ddf5e4; }
.status[data-status="Banned"], .status[data-status="Suspended"] { color: #922033; background: #fae1e5; }
.admin-auth .auth-panel { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.server-error { display: grid; place-content: center; text-align: center; gap: 4px; min-height: 75vh; }
@media (max-width:1100px) {
  .shell { grid-template-columns: 195px minmax(0,1fr); }
  .chat-layout { grid-template-columns: minmax(260px,34vw) minmax(0,1fr); }
}
@media (max-width:760px) {
  .shell { display: block; }
  .shell>main { padding-bottom: 69px; }
  .sidebar { display: none; }
  .mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 4; background: var(--surface); display: grid; grid-template-columns: repeat(5,1fr); min-height: 64px; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); }
  .mobile-nav a { display: grid; gap: 3px; justify-items: center; align-content: center; color: var(--muted); font-size: 11px; }
  .mobile-nav a.active { color: var(--accent-text); }
  .mobile-nav a>span:first-child { display: grid; place-items: center; width: 62px; height: 31px; border-radius: 22px; }
  .mobile-nav a.active>span:first-child { background: var(--selected); }
  .page { padding: 15px 16px; }
  .chat-layout { display: block; height: calc(100dvh - 64px); }
  .shell>.chat-layout { padding-bottom: 0; }
  .chat-list { height: 100%; border: 0; }
  .chat-panel { display: none; }
  .composer .flow { gap: 3px; }
  .composer .icon-button { width: 34px; }
  .chat-layout.with-chat .chat-list { display: none; }
  .chat-layout.with-chat .chat-panel { display: block; height: 100%; }
  #toast { bottom: 73px; }
  .admin-shell { grid-template-columns: minmax(0,1fr); }
  .admin-nav { min-height: 0; display: flex; flex-wrap: wrap; align-items: center; padding: 4px; }
  .admin-nav h1 { width: 100%; padding: 8px 12px; }
  .admin-nav p { display: none; }
  .admin-nav a { padding: 7px 10px; }
  .admin-main { padding: 14px; }
  .auth { place-items: start center; padding: 14px 20px 24px; }
}
