/* PliusC3 web — "glossy black & white" theme, mirroring the Android app
   (ui/theme/{Color,Theme,Type}.kt). Dark scheme is primary: accent is white-on-black. */
:root {
  --bg: #000000;
  --surface: #0a0a0c;
  --surface-2: #121214;
  --carbon: #1e1e20;
  --metal: #2a2a2c;
  --line: #353535;
  --line-soft: #454545;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .6);
  --faint: rgba(255, 255, 255, .38);
  --accent: #ffffff;      /* primary (white on black) */
  --accent-ink: #000000;  /* onPrimary */
  --cyan: #34d6ff;        /* read receipts / save-to-vault */
  --green: #34c759;       /* connected / accept */
  --green-2: #3ddc84;
  --red: #ff3b30;         /* missed / reject / burn */
  --avatar-a: #2a2a2c;
  --avatar-b: #000000;
  --bubble-mine-a: #2a2a2c;
  --bubble-mine-b: #000000;
  --bubble-them-a: #ffffff;
  --bubble-them-b: #f5f5f7;
  font-synthesis: none;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .5px; }

/* ---- screen switching (boot/create/unlock vs main) ---- */
.app { max-width: 480px; margin: 0 auto; height: 100%; position: relative; }
.screen { display: none; height: 100%; }
.screen.active { display: block; }

/* auth screens (create / unlock / boot) */
.screen.pad { padding: max(32px, env(safe-area-inset-top)) 22px 28px; overflow-y: auto; }
.brand { display: flex; align-items: baseline; gap: 10px; margin-bottom: 26px; }
.logo { font-weight: 800; font-size: 30px; letter-spacing: -1px; color: var(--text); }
.sub { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; }
h1 { font-size: 22px; margin: 0 0 8px; font-weight: 800; }
.muted { color: var(--muted); margin: 0 0 22px; }
.small { font-size: 12.5px; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }

form { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 14px; }
input[type=text], input[type=password] {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  padding: 13px 14px; border-radius: 12px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: #6a6a6a; box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--text); }

button { font: inherit; cursor: pointer; border: none; border-radius: 12px; padding: 13px 16px; transition: transform .05s, opacity .15s, background .15s; }
button:active { transform: translateY(1px); }
button[disabled] { opacity: .5; cursor: default; }
button[data-busy="1"]::after { content: " …"; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.danger { background: transparent; color: var(--red); border: 1px solid rgba(255, 59, 48, .38); }
.danger:hover { background: rgba(255, 59, 48, .1); }
.link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 14px 0 0; }
.link.danger { color: var(--red); border: none; }

/* ---- avatars (glossy gradient, like the app) ---- */
.avatar {
  border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--avatar-a), var(--avatar-b));
  color: #fff; font-weight: 700; overflow: hidden;
  border: 0.5px solid rgba(255, 255, 255, .08);
}
.avatar.sm { width: 38px; height: 38px; font-size: 15px; }
.avatar.md { width: 52px; height: 52px; font-size: 20px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.avatar.xl { width: 96px; height: 96px; font-size: 38px; }

/* ================= MAIN APP SHELL ================= */
#main.active { display: flex; flex-direction: column; }
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view::-webkit-scrollbar { width: 0; }

/* big Black-weight screen title, per tab ("Messages", "Constellation" …) */
.screen-title { font-size: 27px; font-weight: 900; letter-spacing: -.5px; padding: 22px 24px 10px; display: flex; align-items: center; justify-content: space-between; }
.screen-title .act { font-size: 13px; font-weight: 700; background: none; border: none; padding: 6px 4px; }
.eyebrow { text-transform: uppercase; font-size: 11px; font-weight: 900; letter-spacing: 1px; color: var(--text); padding: 14px 24px 6px; display: flex; justify-content: space-between; align-items: center; }
.empty { text-align: center; color: var(--muted); padding: 64px 24px; font-size: 14px; }

/* list rows */
.row { display: flex; align-items: center; gap: 16px; padding: 13px 24px; position: relative; cursor: pointer; }
.row:active { background: rgba(255, 255, 255, .03); }
.row .col { flex: 1; min-width: 0; }
.row .r1 { display: flex; align-items: baseline; gap: 8px; }
.row .name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.row .time { font-size: 11px; color: var(--faint); flex: none; }
.row .r2 { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.row .msg { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.row .sub { font-size: 13px; color: var(--muted); }
.row-div { height: 0.5px; background: rgba(255, 255, 255, .08); margin-left: 92px; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 900; display: grid; place-items: center; }
.dot-btn { background: none; border: none; color: var(--muted); padding: 6px; border-radius: 50%; font-size: 18px; }

/* identity header (contacts) */
.id-head { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 24px 20px; }
.id-head .nm { font-size: 18px; font-weight: 800; }
.id-head .id { font-size: 12px; color: var(--muted); }
.id-actions { display: flex; gap: 10px; margin-top: 6px; }
.id-actions button { padding: 9px 16px; font-size: 13px; font-weight: 600; }

/* ---- glass bottom bar (Haze) ---- */
.tabbar {
  position: relative; margin: 6px 16px calc(6px + env(safe-area-inset-bottom)); height: 66px;
  display: flex; border-radius: 34px; overflow: hidden;
  background: rgba(18, 18, 20, .55);
  backdrop-filter: blur(32px) saturate(1.4); -webkit-backdrop-filter: blur(32px) saturate(1.4);
  border: 1px solid transparent;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .18), inset 0 -1px 0 rgba(0, 0, 0, .3);
}
.tabbar::before { /* glossy sheen */
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .12) 0%, rgba(255, 255, 255, .02) 45%, rgba(0, 0, 0, .1) 100%);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: none; color: var(--muted); position: relative; }
.tab.active { color: #fff; }
.tab svg { width: 26px; height: 26px; }
.tab .lbl { font-size: 10px; font-weight: 600; }
.tab.active .lbl { font-weight: 700; }
.tab .tbadge { position: absolute; top: 6px; left: 50%; margin-left: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 9px; font-weight: 800; display: grid; place-items: center; }

/* ================= CHAT DETAIL ================= */
.chat-top { display: flex; align-items: center; gap: 10px; padding: max(12px, env(safe-area-inset-top)) 12px 12px; border-bottom: 0.5px solid rgba(255, 255, 255, .08); }
.chat-top .back { background: none; border: none; color: #fff; font-size: 22px; padding: 4px 6px; }
.chat-top .who { flex: 1; min-width: 0; }
.chat-top .who .n { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-top .who .s { font-size: 11px; color: var(--muted); }
.chat-top .ic { background: none; border: none; color: #fff; padding: 6px; }
.chat-top .ic svg { width: 22px; height: 22px; }
.chat-top .burn { background: none; border: none; color: var(--red); font-size: 12px; font-weight: 900; letter-spacing: .5px; padding: 6px; }

.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 16px; justify-content: flex-end; min-height: 0; }
.msgs::-webkit-scrollbar { width: 0; }
.bwrap { display: flex; flex-direction: column; max-width: 78%; }
.bwrap.me { align-self: flex-end; align-items: flex-end; }
.bwrap.them { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 8px 14px; font-size: 16px; line-height: 1.35; border: 0.5px solid; word-wrap: break-word; }
.bwrap.me .bubble { background: linear-gradient(180deg, var(--bubble-mine-a), var(--bubble-mine-b)); color: #fff; border-color: var(--line-soft); border-radius: 20px 20px 4px 20px; }
.bwrap.them .bubble { background: linear-gradient(180deg, var(--bubble-them-a), var(--bubble-them-b)); color: #000; border-color: #e0e0e0; border-radius: 20px 20px 20px 4px; }
.bfoot { display: flex; align-items: center; gap: 5px; margin-top: 3px; padding: 0 4px; }
.bfoot .t { font-size: 10px; color: var(--faint); }
.sdots { display: inline-flex; gap: 2px; }
.sdots i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.sdots.sending i { background: rgba(255, 255, 255, .3); }
.sdots.sent i { background: rgba(255, 255, 255, .55); }
.sdots.delivered i { background: #fff; }
.sdots.read i { background: var(--cyan); }

.composer { display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 0.5px solid rgba(255, 255, 255, .08); }
.composer .ic { background: none; border: none; color: var(--muted); padding: 6px; }
.composer .ic svg { width: 22px; height: 22px; }
.composer input { flex: 1; background: var(--surface); border: 1px solid var(--line); color: #fff; border-radius: 24px; padding: 11px 16px; font-size: 16px; outline: none; }
.composer .send { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); color: var(--faint); display: grid; place-items: center; border: none; flex: none; }
.composer .send.on { background: var(--accent); color: var(--accent-ink); }
.composer .send svg { width: 20px; height: 20px; }

/* settings/list cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin: 0 20px 14px; overflow: hidden; }
.card .item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 0.5px solid rgba(255, 255, 255, .06); }
.card .item:last-child { border-bottom: none; }
.card .item .k { font-size: 14px; }
.card .item .v { font-size: 13px; color: var(--muted); text-align: right; }
.statline { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 13.5px; }
.sdot { width: 10px; height: 10px; border-radius: 50%; background: #3a4a43; flex: none; }
.sdot.pending { background: var(--cyan); animation: pulse 1s infinite; }
.sdot.ok { background: var(--green); box-shadow: 0 0 10px rgba(52, 199, 89, .5); }
.sdot.warn { background: #f2c14e; }
.sdot.error { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

/* settings controls */
.sw { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw .track { position: absolute; inset: 0; background: var(--carbon); border: 1px solid var(--line); border-radius: 20px; transition: .15s; cursor: pointer; }
.sw .track::before { content: ""; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.sw input:checked + .track { background: var(--green); border-color: var(--green); }
.sw input:checked + .track::before { transform: translateX(18px); }
.sel { background: var(--carbon); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; outline: none; }

.vault-tabs { display: flex; gap: 4px; padding: 0 20px 8px; }
.vault-tabs button { flex: 1; background: none; border: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 10px 0; border-bottom: 2px solid transparent; border-radius: 0; }
.vault-tabs button.on { color: #fff; border-bottom-color: #fff; }

/* modal sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: none; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet-bg.open { display: flex; }
.sheet { width: 100%; max-width: 480px; background: var(--surface); border-radius: 22px 22px 0 0; border: 1px solid var(--line); padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0 0 14px; font-size: 18px; font-weight: 800; }
.sheet .grab { width: 40px; height: 4px; background: var(--line-soft); border-radius: 2px; margin: 0 auto 16px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: 12px 18px; border-radius: 12px; font-size: 13.5px; max-width: 90vw; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; text-align: center; z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(255, 59, 48, .5); }
.toast.warn { border-color: rgba(242, 193, 78, .5); }
.toast.ok { border-color: rgba(52, 199, 89, .5); }

.actions { display: flex; gap: 12px; margin: 4px 20px 0; }
.actions button { flex: 1; }
.pill-note { margin: 2px 20px 16px; padding: 10px 14px; background: rgba(52, 214, 255, .07); border: 1px solid rgba(52, 214, 255, .2); border-radius: 12px; font-size: 12px; color: var(--muted); }
