/* Rally web — Instagram-style chrome, light and dark.
   Palette mirrors lib/core/theme.dart. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --fg: #000000;
  --muted: #737373;
  --divider: #dbdbdb;
  --blue: #0095f6;
  --blue-press: #1877f2;
  --like: #ed4956;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  --story: linear-gradient(45deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
  --radius: 10px;
  --sidebar: 280px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #000000;
  --surface: #000000;
  --surface-2: #121212;
  --fg: #ffffff;
  --muted: #a8a8a8;
  --divider: #262626;
  --shadow: none;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 8px; letter-spacing: -.3px; }
small { color: var(--muted); }
.muted { color: var(--muted); }
.spacer { flex: 1; }
hr { border: 0; border-top: 1px solid var(--divider); margin: 18px 0; }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--fg); color: var(--bg);
  padding: 10px 14px; z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

.wordmark {
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: 21px; font-weight: 600; letter-spacing: .2px; white-space: nowrap;
}

/* ---------- buttons & inputs ---------- */

.btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: none; cursor: pointer; border-radius: 8px;
}
.btn {
  padding: 7px 16px; font-weight: 600; font-size: 14px; min-height: 32px;
  transition: filter .15s ease, background .15s ease;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(.93); }
.btn.ghost { background: var(--surface-2); color: var(--fg); border: 1px solid var(--divider); }
[data-theme="dark"] .btn.ghost { background: #1a1a1a; border-color: #333; }
.btn.ghost:hover { filter: brightness(.96); }
.btn.danger { color: var(--like); background: var(--surface-2); border: 1px solid var(--divider); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.small { padding: 4px 12px; min-height: 28px; font-size: 13px; }

.icon-btn { padding: 6px; position: relative; border-radius: 50%; }
.icon-btn:hover { opacity: .6; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.linkish:hover { color: var(--fg); }
form.inline { display: inline; }

input, textarea, select {
  font: inherit; color: var(--fg); background: var(--surface-2);
  border: 1px solid var(--divider); border-radius: 8px; padding: 11px 12px; width: 100%;
}
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { background: #121212; }
input:focus, textarea:focus { outline: none; border-color: var(--muted); }
input::placeholder, textarea::placeholder { color: var(--muted); }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch input { width: auto; }

.av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.av.lg { width: 56px; height: 56px; }
.av.xl { width: 150px; height: 150px; }

/* ---------- app chrome ---------- */

.sidebar {
  position: fixed; 
  inset: 0 auto 0 0; 
  width: var(--sidebar); 
  z-index: 40;
  border-right: 1px solid var(--divider); 
  background: var(--bg);
  padding: 12px 8px; 
  display: flex; 
  flex-direction: column;
}

.sidebar .wordmark { 
  padding: 8px 12px 16px; 
  display: block; 
  font-weight: 700; 
  font-size: 24px; 
  color: var(--blue); 
}

.sidebar ul { 
  list-style: none; 
  margin: 0; 
  padding: 0; 
  flex: 1; 
  overflow-y: auto; 
}

/* Facebook style nav links: Rounded pill on hover instead of Instagram style */
.sidebar a, .sidebar .nav-link {
  display: flex; 
  align-items: center; 
  gap: 16px; 
  padding: 8px 12px; 
  margin-bottom: 2px;
  border-radius: 8px; /* Facebook uses softer 8px rounded corners */
  font-size: 15px; 
  width: 100%; 
  border: 0; 
  background: none;
  cursor: pointer; 
  text-align: left; 
  position: relative;
  color: var(--fg);
  text-decoration: none;
  transition: background 0.2s ease;
}

.sidebar a:hover, .sidebar .nav-link:hover { 
  background: var(--surface-2); 
}

[data-theme="dark"] .sidebar a:hover, [data-theme="dark"] .sidebar .nav-link:hover { 
  background: #30363d; 
}

.sidebar a.on { 
  font-weight: 600; 
  color: var(--blue);
}

.sidebar a.on .ic { 
  stroke-width: 2.5; 
  stroke: var(--blue);
}

.sidebar-foot { 
  border-top: 1px solid var(--divider); 
  padding-top: 12px; 
  margin-top: auto; 
}

.nav-avatar { 
  width: 28px; 
  height: 28px; 
  border-radius: 50%; 
  object-fit: cover; 
}

.pill {
  margin-left: auto; 
  background: var(--like); 
  color: #fff; 
  font-style: normal;
  font-size: 11px; 
  font-weight: 700; 
  padding: 2px 8px; 
  border-radius: 12px;
}

.dot {
  position: absolute; 
  top: 6px; 
  right: 12px; 
  background: var(--like); 
  color: #fff;
  font-style: normal; 
  font-size: 10px; 
  font-weight: 700; 
  padding: 0 5px;
  border-radius: 10px; 
  line-height: 16px;
}

.topbar, .tabbar { display: none; }

/* Main layout shifts according to Facebook's wider sidebar */
main {
  margin-left: var(--sidebar);
  padding: 24px 24px 40px;
  min-height: 100vh;
}
main.bare-main { margin-left: 0; padding: 0; }
body.bare main { margin-left: 0; }

.page { max-width: 935px; margin: 0 auto; }
.narrow { max-width: 630px; margin: 0 auto; }

/* Facebook style Feed wrap (Feed on left, Widgets/Contacts on right sidebar) */
.feed-wrap { 
  display: grid; 
  grid-template-columns: minmax(0, 680px) 360px; 
  gap: 24px; 
  max-width: 1060px; 
  margin: 0 auto; 
}

.aside { padding-top: 0; position: sticky; top: 24px; align-self: start; }

.card {
  background: var(--surface); 
  border: 1px solid var(--divider);
  border-radius: var(--radius); 
  margin-bottom: 16px; 
  overflow: hidden;
  box-shadow: var(--shadow);
}
.pad { padding: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #303030; color: #fff; padding: 12px 18px; border-radius: 8px;
  z-index: 90; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: 90vw;
  animation: toast-in .2s ease;
}
.toast.err { background: var(--like); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.section-head h2 { font-size: 16px; margin: 0; }
.section-head a { color: var(--blue); font-size: 12px; font-weight: 600; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { color: var(--fg); font-size: 20px; }
.empty p { margin: 0 auto 18px; max-width: 380px; }
/* ---------- stories ---------- */

.stories {
  display: flex; gap: 16px; overflow-x: auto; padding: 14px 16px;
  border: 1px solid var(--divider); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 22px; scrollbar-width: thin;
}
.stories::-webkit-scrollbar { height: 6px; }
.stories::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 3px; }
.story {
  border: 0; background: none; cursor: pointer; padding: 0; flex: 0 0 auto;
  width: 74px; text-align: center;
}
.story small {
  display: block; margin-top: 6px; font-size: 12px; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ring {
  display: block; width: 66px; height: 66px; border-radius: 50%; padding: 3px;
  background: var(--story); position: relative;
}
.ring.seen { background: var(--divider); }
.ring.none { background: var(--divider); }
.ring img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--bg); background: var(--surface-2);
}
.add-dot {
  position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--blue); color: #fff; font-size: 15px;
  line-height: 20px; border: 2px solid var(--bg); font-style: normal;
}

/* ---------- post card ---------- */

.post-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { font-size: 14px; font-weight: 600; display: block; }
.who small { display: block; font-size: 12px; line-height: 1.2; }
.who span { min-width: 0; }

.post-media { position: relative; background: #000; display: flex; justify-content: center; }
.post-media img, .post-media video { width: 100%; max-height: 78vh; object-fit: contain; }
.burst {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; opacity: 0; pointer-events: none;
}
.burst.pop { animation: burst .9s ease; }
@keyframes burst {
  0% { opacity: 0; transform: scale(.4); }
  15% { opacity: .95; transform: scale(1.15); }
  35% { transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

.post-actions { display: flex; align-items: center; gap: 4px; padding: 8px 8px 2px; }
.like-btn.liked { color: var(--like); }
.like-btn.liked .ic { animation: like-pop .3s ease; }
@keyframes like-pop { 50% { transform: scale(1.25); } }

.post-body { padding: 2px 14px 14px; }
.post-body .likes { font-weight: 600; display: inline-block; margin-bottom: 4px; }
.post-body .caption { margin: 2px 0 4px; word-break: break-word; }
.post-body .caption .u, .comment .u { font-weight: 600; margin-right: 4px; }
.post-body time { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .2px; }
.muted-link { color: var(--muted); display: inline-block; margin-top: 2px; }
.mention { color: var(--blue); }

.inline-comment { display: flex; align-items: center; gap: 8px; margin-top: 10px; border-top: 1px solid var(--divider); padding-top: 10px; }
.inline-comment input { border: 0; background: none; padding: 0; }
.inline-comment button { border: 0; background: none; color: var(--blue); font-weight: 600; cursor: pointer; }

/* dropdown menus */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 32px; min-width: 190px; z-index: 30;
  background: var(--surface); border: 1px solid var(--divider); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .18); overflow: hidden; padding: 4px 0;
}
[data-theme="dark"] .menu { background: #1c1c1c; }
.menu a, .menu button {
  display: block; width: 100%; text-align: left; padding: 11px 16px; border: 0;
  background: none; cursor: pointer; font-size: 14px;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); }
[data-theme="dark"] .menu a:hover, [data-theme="dark"] .menu button:hover { background: #262626; }
.menu .danger { color: var(--like); font-weight: 600; }

/* ---------- grids ---------- */

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tile { position: relative; display: block; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; }
.tile-kind { position: absolute; top: 8px; right: 8px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.tile-stats {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 22px; background: rgba(0, 0, 0, .35); color: #fff; opacity: 0; transition: opacity .15s ease;
  font-weight: 700;
}
.tile-stats b { display: flex; align-items: center; gap: 6px; }
.tile:hover .tile-stats { opacity: 1; }

/* ---------- people lists ---------- */

.user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.user-row .who b { font-size: 14px; }
.row-actions { display: flex; gap: 8px; align-items: center; }
.list { display: flex; flex-direction: column; }
.list .user-row + .user-row { border-top: 1px solid var(--divider); }

/* ---------- profile ---------- */

.profile-head { display: flex; gap: 60px; padding: 12px 0 30px; align-items: flex-start; }
.profile-head .av.xl { flex: 0 0 auto; }
.profile-meta { flex: 1; min-width: 0; }
.profile-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.profile-top h1 { font-size: 20px; font-weight: 400; margin: 0; }
.stats { display: flex; gap: 34px; margin-bottom: 16px; }
.stats a, .stats span { font-size: 15px; }
.stats b { font-weight: 600; }
.bio { max-width: 480px; white-space: pre-wrap; word-break: break-word; }
.bio .name { font-weight: 600; }
.website { color: #00376b; font-weight: 600; }
[data-theme="dark"] .website { color: #e0f1ff; }

.tabs { display: flex; justify-content: center; gap: 60px; border-top: 1px solid var(--divider); margin-bottom: 16px; }
.tabs a {
  display: flex; align-items: center; gap: 6px; padding: 16px 0; font-size: 12px;
  font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted);
  border-top: 1px solid transparent; margin-top: -1px;
}
.tabs a.on { color: var(--fg); border-top-color: var(--fg); }

.locked { text-align: center; padding: 60px 20px; color: var(--muted); }
.locked .ic { margin-bottom: 12px; }

/* ---------- reels ---------- */

.reels {
  height: calc(100vh - 48px); overflow-y: auto; scroll-snap-type: y mandatory;
  border-radius: var(--radius); scrollbar-width: none;
}
.reels::-webkit-scrollbar { display: none; }
.reel {
  height: calc(100vh - 48px); scroll-snap-align: start; position: relative;
  display: flex; align-items: center; justify-content: center; background: #000;
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
}
.reel video { height: 100%; width: 100%; object-fit: contain; }
.reel-overlay {
  position: absolute; inset: auto 0 0 0; padding: 18px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7));
  display: flex; align-items: flex-end; gap: 16px;
}
.reel-overlay .who b, .reel-overlay .who small { color: #fff; }
.reel-info { flex: 1; min-width: 0; }
.reel-info p { margin: 8px 0 4px; }
.reel-rail { display: flex; flex-direction: column; gap: 14px; align-items: center; color: #fff; }
.reel-rail button, .reel-rail a { color: #fff; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; background: none; border: 0; cursor: pointer; }
.reel-rail .liked { color: var(--like); }
.audio { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .9; }

/* ---------- chat ---------- */

.chat-shell {
  display: grid; grid-template-columns: 340px minmax(0, 1fr);
  height: calc(100vh - 48px); border: 1px solid var(--divider);
  border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.inbox { border-right: 1px solid var(--divider); display: flex; flex-direction: column; min-height: 0; }
.inbox-head { padding: 16px; border-bottom: 1px solid var(--divider); display: flex; align-items: center; justify-content: space-between; }
.inbox-head b { font-size: 16px; }
.threads { overflow-y: auto; flex: 1; }
.thread {
  display: flex; gap: 12px; align-items: center; padding: 10px 16px; cursor: pointer;
}
.thread:hover { background: var(--surface-2); }
[data-theme="dark"] .thread:hover { background: #121212; }
.thread.on { background: var(--surface-2); }
[data-theme="dark"] .thread.on { background: #1a1a1a; }
.thread .av { width: 48px; height: 48px; }
.thread-meta { min-width: 0; flex: 1; }
.thread-meta b { display: block; font-size: 14px; font-weight: 600; }
.thread-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread.unread .thread-meta b, .thread.unread .thread-meta small { font-weight: 700; color: var(--fg); }
.thread .blue-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: 0 0 auto; }

.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--divider); }
.msgs { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0 8px; }
.bubble-row { display: flex; gap: 8px; align-items: flex-end; }
.bubble-row.mine { justify-content: flex-end; }
.bubble {
  max-width: min(62%, 460px); padding: 9px 14px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--divider); word-break: break-word;
}
[data-theme="dark"] .bubble { background: #262626; border-color: #262626; }
.bubble-row.mine .bubble { background: var(--blue); border-color: var(--blue); color: #fff; }
.bubble img { border-radius: 14px; margin: -2px 0; max-height: 320px; }
.bubble-meta { font-size: 11px; color: var(--muted); padding: 0 8px 6px; }
.bubble-row.mine + .bubble-meta { text-align: right; }
.unsend { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 11px; opacity: 0; }
.bubble-row:hover .unsend { opacity: 1; }

.composer { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--divider); }
.composer input[type="text"] { border-radius: 22px; }
.composer .icon-btn { flex: 0 0 auto; }
.attach-preview { display: flex; align-items: center; gap: 8px; padding: 0 16px 8px; color: var(--muted); font-size: 12px; }

.only-mobile { display: none; }

/* ---------- notifications ---------- */

.note { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; }
.note.unread { background: var(--surface-2); }
[data-theme="dark"] .note.unread { background: #121212; }
.note p { margin: 0; flex: 1; }
.note .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }

/* ---------- auth ---------- */

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.auth-box { width: 100%; max-width: 380px; }
.auth-card { border: 1px solid var(--divider); border-radius: 10px; padding: 34px 38px 24px; background: var(--surface); margin-bottom: 12px; }
.auth-card .wordmark { display: block; text-align: center; font-size: 30px; margin-bottom: 24px; }
.auth .or { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 13px; font-weight: 600; margin: 18px 0; }
.auth .or::before, .auth .or::after { content: ""; height: 1px; background: var(--divider); flex: 1; }
.auth .alt { border: 1px solid var(--divider); border-radius: 10px; padding: 20px; text-align: center; background: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.chip { border: 1px solid var(--divider); background: var(--surface-2); border-radius: 20px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--muted); }
.error-box { background: rgba(237, 73, 86, .1); border: 1px solid var(--like); color: var(--like); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.ok-box { background: rgba(0, 149, 246, .1); border: 1px solid var(--blue); color: var(--blue); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.availability { font-size: 12px; margin-top: 5px; }
.availability.ok { color: #2e7d32; }
.availability.bad { color: var(--like); }

/* ---------- story viewer ---------- */

.viewer { position: fixed; inset: 0; background: #111; display: flex; align-items: center; justify-content: center; z-index: 80; }
.viewer-stage { position: relative; height: 100%; max-height: 100vh; aspect-ratio: 9 / 16; background: #000; overflow: hidden; }
.viewer-stage img, .viewer-stage video { width: 100%; height: 100%; object-fit: contain; }
.bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 3; }
.bars i { flex: 1; height: 2.5px; background: rgba(255, 255, 255, .35); border-radius: 2px; overflow: hidden; }
.bars i b { display: block; height: 100%; width: 0; background: #fff; }
.viewer-head { position: absolute; top: 24px; left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; color: #fff; z-index: 3; }
.viewer-head b { font-size: 14px; }
.viewer-head small { color: rgba(255, 255, 255, .8); }
.viewer-head .av { border: 1px solid rgba(255, 255, 255, .6); }
.viewer-nav { position: absolute; inset: 0; display: flex; z-index: 2; }
.viewer-nav button { flex: 1; background: none; border: 0; cursor: pointer; }
.viewer-foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 16px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); z-index: 3; }
.viewer-close { position: fixed; top: 18px; right: 22px; color: #fff; z-index: 90; }
.viewer-viewers { display: inline-flex; align-items: center; gap: 6px; color: #fff; background: rgba(0, 0, 0, .35); border: 0; border-radius: 20px; padding: 6px 12px; cursor: pointer; }

/* ---------- modal ---------- */

.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: flex; align-items: center; justify-content: center; z-index: 95; padding: 20px; }
.modal {
  background: var(--surface); border-radius: 12px; width: 100%; max-width: 420px;
  max-height: 80vh; overflow: auto; border: 1px solid var(--divider);
}
[data-theme="dark"] .modal { background: #262626; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--divider); font-weight: 600; }
.modal-body { padding: 12px 16px; }

/* ---------- post detail ---------- */

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 380px; border: 1px solid var(--divider); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.detail-media { background: #000; display: flex; align-items: center; justify-content: center; min-height: 400px; }
.detail-media img, .detail-media video { max-height: 78vh; width: 100%; object-fit: contain; }
.detail-side { display: flex; flex-direction: column; border-left: 1px solid var(--divider); max-height: 78vh; }
.detail-comments { flex: 1; overflow-y: auto; padding: 14px 16px; }
.comment { display: flex; gap: 12px; margin-bottom: 14px; }
.comment p { margin: 0; word-break: break-word; }
.comment small { display: block; margin-top: 2px; font-size: 12px; }
.comment small form { margin-left: 10px; }

/* ---------- create ---------- */

.dropzone {
  border: 2px dashed var(--divider); border-radius: 12px; padding: 40px 20px;
  text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2);
}
[data-theme="dark"] .dropzone { background: #0d0d0d; }
.dropzone.over { border-color: var(--blue); color: var(--blue); }
.dropzone input { display: none; }
.preview { margin-top: 14px; border-radius: 10px; overflow: hidden; background: #000; }
.preview img, .preview video { max-height: 50vh; margin: 0 auto; }
.kind-picker { display: flex; gap: 8px; margin-bottom: 18px; }
.kind-picker a { flex: 1; text-align: center; padding: 10px; border: 1px solid var(--divider); border-radius: 10px; font-weight: 600; }
.kind-picker a.on { border-color: var(--fg); }

/* ---------- responsive ---------- */

@media (max-width: 1160px) {
  .feed-wrap { grid-template-columns: minmax(0, 630px); max-width: 630px; }
  .aside { display: none; }
}

@media (max-width: 1023px) {
  :root { --sidebar: 76px; }
  .sidebar .wordmark { font-size: 0; padding: 18px 0 22px; text-align: center; }
  .sidebar .wordmark::after { content: "iQ"; font-size: 26px; }
  .sidebar a span, .sidebar .nav-link span { display: none; }
  .sidebar a, .sidebar .nav-link { justify-content: center; }
  .pill { position: absolute; top: 4px; right: 8px; margin: 0; }
  .chat-shell { grid-template-columns: 280px minmax(0, 1fr); }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail-side { border-left: 0; border-top: 1px solid var(--divider); max-height: none; }
}

@media (max-width: 767px) {
  .sidebar { display: none; }
  main { margin-left: 0; padding: 60px 0 68px; }
  .page, .narrow { padding: 0 0; }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: fixed; top: 0; left: 0; right: 0;
    height: 54px; padding: 0 14px; background: var(--bg); border-bottom: 1px solid var(--divider); z-index: 40;
  }
  .topbar .wordmark { font-size: 19px; }
  .topsearch { flex: 1; }
  .topsearch input { padding: 8px 12px; border-radius: 8px; }
  .topbar-actions { display: flex; gap: 6px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 52px;
    background: var(--bg); border-top: 1px solid var(--divider); z-index: 40;
    align-items: center; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom);
  }
  .card { border-left: 0; border-right: 0; border-radius: 0; }
  .stories { border-left: 0; border-right: 0; border-radius: 0; }
  .profile-head { flex-direction: column; gap: 20px; padding: 16px; }
  .profile-head .av.xl { width: 90px; height: 90px; }
  .stats { gap: 24px; }
  .tabs { gap: 40px; }
  .chat-shell { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 112px); border: 0; }
  .chat-shell.has-thread .inbox { display: none; }
  .chat-shell:not(.has-thread) .chat { display: none; }
  .reels, .reel { height: calc(100vh - 106px); border-radius: 0; }
  .topsearch { display: block; }
  .grid { gap: 2px; }
  .only-mobile { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- groups, system lines, call banner ---------- */

.group-av {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--divider);
}
[data-theme="dark"] .group-av { background: #1a1a1a; border-color: #2a2a2a; }
.thread .group-av { width: 48px; height: 48px; border-radius: 50%; }
.chat-head .group-av { width: 32px; height: 32px; border-radius: 50%; }
.thread-meta .tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 9px;
  background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600;
}
[data-theme="dark"] .thread-meta .tag { background: #1c1c1c; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; flex: 0 0 auto;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

button.who { border: 0; background: none; cursor: pointer; text-align: left; }

.event-line {
  align-self: center; display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 12px; margin: 10px auto; padding: 4px 12px;
  background: var(--surface-2); border-radius: 12px; max-width: 80%;
}
[data-theme="dark"] .event-line { background: #161616; }

.bubble-av { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; align-self: flex-end; }
.bubble-who { display: block; font-size: 11.5px; color: var(--blue); margin-bottom: 2px; }

.call-banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: rgba(0, 149, 246, .1); border-bottom: 1px solid var(--divider);
  color: var(--blue); font-weight: 600; font-size: 13px;
}
.call-banner .btn { margin-left: auto; }

.member-panel .rename-row { display: flex; gap: 8px; }
.member-panel .rename-row input { flex: 1; }

/* ---------- incoming call sheet ---------- */

.ring-sheet {
  position: fixed; right: 20px; bottom: 20px; z-index: 96;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--divider); border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .28); max-width: min(92vw, 380px);
  animation: ring-in .25s ease;
}
[data-theme="dark"] .ring-sheet { background: #1c1c1c; }
@keyframes ring-in { from { opacity: 0; transform: translateY(14px); } }
.ring-meta { flex: 1; min-width: 0; }
.ring-meta b { display: block; font-size: 15px; }
.ring-meta small { color: var(--muted); }
.round {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  background: var(--surface-2); color: var(--fg); transition: filter .15s ease;
}
[data-theme="dark"] .round { background: #2a2a2a; }
.round:hover { filter: brightness(.92); }
.round.accept { background: #2ecc71; color: #fff; animation: pulse 1.4s ease-in-out infinite; }
.round.decline, .round.hangup { background: var(--like); color: #fff; }
.round.off { background: var(--like); color: #fff; }

/* ---------- call screen ---------- */

body.call-body { background: #0b0b0b; color: #fff; overflow: hidden; }
.call-page {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  background: #0b0b0b; color: #fff;
}
.call-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; color: #fff;
}
.call-head b { display: block; font-size: 16px; }
.call-head small { color: rgba(255, 255, 255, .65); }
.call-head .icon-btn { color: #fff; }

/* Who is on the line. Calls are voice only, so a tile is a face and a name -
   the <audio> element inside it is what actually plays them, and is never
   shown. */
.call-grid {
  flex: 1; min-height: 0; display: grid; gap: 10px; padding: 0 14px;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  align-content: center;
}
.call-tile {
  position: relative; background: #161616; border-radius: 16px;
  aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center;
}
.call-grid.solo .call-tile { aspect-ratio: auto; height: 100%; }
.call-tile audio { display: none; }
.call-tile .tile-face {
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .5);
}
.tile-avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; }
.tile-name {
  position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, .55); color: #fff; padding: 4px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600;
}
/* Still connecting: the face sits back until their audio arrives. */
.call-tile:not(.live) .tile-face { opacity: .45; }
.call-tile.live .tile-avatar { box-shadow: 0 0 0 3px rgba(46, 204, 113, .55); }

.ringing-strip { text-align: center; padding: 10px; color: rgba(255, 255, 255, .7); font-size: 13px; }
.ringing-strip .muted { color: rgba(255, 255, 255, .7); }

.call-controls {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}
.call-controls .round { width: 56px; height: 56px; background: rgba(255, 255, 255, .12); color: #fff; }
.call-controls .round:hover { background: rgba(255, 255, 255, .2); }
.call-controls .round.hangup { background: var(--like); }
.call-controls .round.off { background: #fff; color: #111; }

@media (max-width: 767px) {
  .call-grid { padding: 0 8px; gap: 6px; }
  .call-controls { gap: 12px; }
  .call-controls .round { width: 50px; height: 50px; }
  .ring-sheet { left: 12px; right: 12px; bottom: 68px; max-width: none; }
}

/* ---------- doctors, bookings, fees ---------- */

.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.role-picker a {
  border: 1px solid var(--divider); border-radius: 12px; padding: 14px 12px; text-align: center;
  display: block; background: var(--surface-2);
}
[data-theme="dark"] .role-picker a { background: #121212; }
.role-picker a.on { border-color: var(--blue); background: rgba(0, 149, 246, .08); }
.role-picker b { display: block; margin: 6px 0 2px; font-size: 14px; }
.role-picker small { color: var(--muted); font-size: 11.5px; line-height: 1.3; display: block; }
.auth-box.wide { max-width: 520px; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.role-tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--divider);
}
.role-tag.doctor { background: rgba(0, 149, 246, .12); color: var(--blue); border-color: transparent; }
.verified { color: var(--blue); font-style: normal; font-weight: 700; }

.stars { display: inline-flex; align-items: center; gap: 1px; font-size: 13px; }
.stars i { color: var(--divider); font-style: normal; }
.stars i.on { color: #f5a623; }
.stars b { margin-left: 5px; font-size: 13px; }
.stars small { margin-left: 3px; color: var(--muted); }
.stars.empty { color: var(--muted); font-size: 12.5px; }

/* doctor cards */
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px;
  border: 1px solid var(--divider); border-radius: 12px; background: var(--surface);
}
.doc-card .doc-avatar img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.doc-body { flex: 1; min-width: 0; }
.doc-name { display: flex; align-items: center; gap: 6px; }
.doc-name b { font-size: 15px; }
.doc-meta { font-size: 13px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.doc-facts { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.fact { font-size: 12px; color: var(--muted); }
.fact.fee, .fee { color: var(--fg); font-weight: 700; }
.doc-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 96px; }
.doc-list.compact .doc-card { padding: 10px; gap: 10px; }
.doc-list.compact .doc-avatar img { width: 44px; height: 44px; }
.doc-list.compact .doc-actions { min-width: 74px; }

.doc-filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; }

/* the clinic panel on a doctor profile */
.clinic-panel {
  border: 1px solid var(--divider); border-radius: 12px; padding: 16px;
  background: var(--surface); margin-bottom: 18px;
}
.clinic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.clinic-grid small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.clinic-grid b { display: block; font-size: 14.5px; margin-top: 3px; }
.clinic-grid span { display: block; color: var(--muted); font-size: 12.5px; }
.clinic-about { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--divider); }

/* the pay-to-unlock panel */
.gate-panel {
  border: 1px solid var(--blue); border-radius: 12px; overflow: hidden;
  background: rgba(0, 149, 246, .06); margin-bottom: 18px;
}
.gate-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; color: var(--blue); }
.gate-head b { display: block; font-size: 14.5px; }
.gate-head small { color: var(--muted); display: block; margin-top: 2px; }
.gate-body { display: flex; align-items: center; gap: 16px; padding: 0 16px 14px; flex-wrap: wrap; }
.gate-price b { font-size: 22px; }
.gate-price small { display: block; color: var(--muted); }
.gate-body .btn { margin-left: auto; }
.gate-note { margin: 0; padding: 10px 16px; border-top: 1px solid var(--divider); font-size: 11.5px; color: var(--muted); }
.composer.locked { display: block; padding: 12px 16px; }
.composer.locked .gate-panel { margin: 0; }

/* booking */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 12px; }
.book-head { display: flex; align-items: center; gap: 14px; }
.book-head b { font-size: 16px; }
.book-fee { margin-left: auto; text-align: right; }
.book-fee b { font-size: 20px; }
.book-fee small { display: block; color: var(--muted); }

.day-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.day-strip a {
  flex: 0 0 auto; width: 62px; text-align: center; padding: 8px 0; border-radius: 10px;
  border: 1px solid var(--divider); background: var(--surface-2);
}
[data-theme="dark"] .day-strip a { background: #121212; }
.day-strip a.on { border-color: var(--blue); background: rgba(0, 149, 246, .1); color: var(--blue); }
.day-strip b { display: block; font-size: 17px; }
.day-strip small { display: block; font-size: 11px; color: var(--muted); }
.day-strip a.on small { color: var(--blue); }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.slot {
  padding: 9px 6px; border-radius: 8px; border: 1px solid var(--divider);
  background: var(--surface-2); cursor: pointer; font-size: 13px; font-weight: 600;
}
[data-theme="dark"] .slot { background: #121212; }
.slot:hover { border-color: var(--muted); }
.slot.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.slot.taken { opacity: .35; cursor: not-allowed; text-decoration: line-through; }

.day-check { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check input { display: none; }
.chip-check span {
  display: inline-block; padding: 6px 14px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--divider); background: var(--surface-2); font-size: 13px; font-weight: 600;
}
[data-theme="dark"] .chip-check span { background: #121212; }
.chip-check input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }

/* appointments */
.appt-list { display: flex; flex-direction: column; gap: 10px; }
.appt {
  display: flex; gap: 14px; padding: 14px; border: 1px solid var(--divider);
  border-radius: 12px; background: var(--surface);
}
.appt-when {
  flex: 0 0 62px; text-align: center; padding: 8px 0; border-radius: 10px;
  background: var(--surface-2); align-self: flex-start;
}
[data-theme="dark"] .appt-when { background: #121212; }
.appt-when b { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.appt-when span { display: block; font-size: 16px; font-weight: 700; }
.appt-when small { display: block; font-size: 11.5px; color: var(--muted); }
.appt-body { flex: 1; min-width: 0; }
.appt-reason { margin: 8px 0 0; font-size: 13.5px; }
.appt-notes { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; font-size: 13px; background: var(--surface-2); }
[data-theme="dark"] .appt-notes { background: #121212; }
.appt-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.appt-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.status {
  font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .3px;
}
.status.requested { background: rgba(245, 166, 35, .15); color: #b8770a; }
.status.confirmed { background: rgba(46, 204, 113, .15); color: #1e8449; }
.status.completed { background: rgba(0, 149, 246, .14); color: var(--blue); }
.status.cancelled, .status.declined { background: rgba(237, 73, 86, .13); color: var(--like); }
[data-theme="dark"] .status.requested { color: #f5a623; }
[data-theme="dark"] .status.confirmed { color: #2ecc71; }
.flash-in { animation: flash-in 1.6s ease; }
@keyframes flash-in { 0%, 40% { background: rgba(0, 149, 246, .12); } 100% { background: transparent; } }

/* reviews */
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review { border: 1px solid var(--divider); border-radius: 12px; padding: 14px; background: var(--surface); }
.review-stars { margin: 8px 0 6px; }
.review p { margin: 0 0 10px; }
.review-media img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; }

.star-picker { display: flex; align-items: center; gap: 4px; }
.star-picker button {
  background: none; border: 0; font-size: 30px; line-height: 1; cursor: pointer;
  color: var(--divider); padding: 0 2px;
}
.star-picker button.on { color: #f5a623; }
.star-picker span { margin-left: 10px; font-size: 13px; }

.aside-cta { margin-top: 18px; padding: 14px; border-radius: 12px; border: 1px dashed var(--divider); }
.aside-cta b { display: flex; align-items: center; gap: 6px; }
.aside-cta p { margin: 6px 0 10px; font-size: 12.5px; }

@media (max-width: 767px) {
  .two-up, .role-picker { grid-template-columns: 1fr; }
  .doc-filters { grid-template-columns: 1fr; }
  .doc-card { flex-wrap: wrap; }
  .doc-actions { flex-direction: row; width: 100%; }
  .appt { flex-wrap: wrap; }
  .appt-side { align-items: stretch; width: 100%; }
  .appt-actions { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- the queue ---------- */

.queue-card {
  display: flex; gap: 14px; align-items: center; padding: 14px;
  border: 1px solid var(--blue); border-radius: 14px; margin-bottom: 18px;
  background: rgba(0, 149, 246, .06);
}
.queue-card.live { border-color: #2ecc71; background: rgba(46, 204, 113, .09); }
.queue-token {
  flex: 0 0 74px; text-align: center; padding: 8px 0; border-radius: 12px;
  background: var(--blue); color: #fff;
}
.queue-card.live .queue-token { background: #2ecc71; }
.queue-token b { display: block; font-size: 30px; line-height: 1.1; }
.queue-token small { display: block; font-size: 10.5px; opacity: .9; }
.queue-body { flex: 1; min-width: 0; }
.queue-line { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.pill-now {
  background: var(--blue); color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}
.pill-now.idle { background: var(--surface-2); color: var(--muted); }
[data-theme="dark"] .pill-now.idle { background: #1c1c1c; }
.queue-line .ahead { font-size: 12.5px; color: var(--muted); }
.queue-wait {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 13.5px; font-weight: 600;
}
.queue-side { display: flex; flex-direction: column; gap: 6px; }

.queue-panel {
  border: 1px solid var(--divider); border-radius: 14px; overflow: hidden;
  background: var(--surface); margin-bottom: 18px;
}
.queue-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--divider);
}
.queue-head b { display: block; font-size: 15px; }
.queue-head small { color: var(--muted); }
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-row {
  display: grid; grid-template-columns: 44px 74px minmax(0, 1fr) auto auto;
  gap: 10px; align-items: center; padding: 10px 16px;
  border-bottom: 1px solid var(--divider);
}
.queue-row:last-child { border-bottom: 0; }
.queue-row.in_progress { background: rgba(46, 204, 113, .1); }
.queue-row.completed { opacity: .55; }
.queue-row .tok { font-weight: 700; font-size: 15px; }
.queue-row .tim { color: var(--muted); font-size: 12.5px; }
.queue-row .row-actions { display: flex; gap: 6px; }
.status.in_progress { background: rgba(46, 204, 113, .18); color: #1e8449; }
[data-theme="dark"] .status.in_progress { color: #2ecc71; }

/* ---------- prescriptions ---------- */

.rx-list { display: flex; flex-direction: column; gap: 14px; }
.rx {
  border: 1px solid var(--divider); border-radius: 12px; background: var(--surface);
  overflow: hidden;
}
.rx-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--divider);
}
.rx-head b { display: block; font-size: 14.5px; }
.rx-head small { color: var(--muted); }
.rx-items { width: 100%; border-collapse: collapse; font-size: 13px; }
.rx-items th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .3px;
  color: var(--muted); padding: 8px 14px; border-bottom: 1px solid var(--divider); font-weight: 600;
}
.rx-items td { padding: 9px 14px; border-bottom: 1px solid var(--divider); vertical-align: top; }
.rx-items tr:last-child td { border-bottom: 0; }
.rx-items td small { display: block; color: var(--muted); font-size: 11.5px; }
.rx-items.big td { padding: 11px 14px; font-size: 14px; }
.rx-advice { margin: 0; padding: 12px 14px; font-size: 13px; border-top: 1px solid var(--divider); }
.rx-wrap { margin-bottom: 6px; }
.rx-meta { font-size: 12px; margin-bottom: 4px; }

.rx-page {
  border: 1px solid var(--divider); border-radius: 14px; padding: 20px;
  background: var(--surface);
}
.rx-page header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.rx-page header b { display: block; font-size: 17px; }
.rx-page header small { display: block; color: var(--muted); font-size: 12.5px; }
.rx-mark {
  font-family: Georgia, serif; font-size: 34px; font-weight: 700; color: var(--blue);
  line-height: 1;
}
.rx-patient {
  display: flex; flex-wrap: wrap; gap: 18px; margin: 16px 0; padding: 12px 0;
  border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider);
  font-size: 13px;
}
.rx-diagnosis { font-size: 14px; margin: 0 0 14px; }
.rx-advice-box {
  margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2);
}
[data-theme="dark"] .rx-advice-box { background: #121212; }
.rx-advice-box p { margin: 6px 0 0; font-size: 13.5px; }
.rx-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--divider); font-size: 12px;
}
/* What is left to do with a prescription: the tests on it, and the one button
   that sends the medicines to a counter. Shared by the patient's copy, the
   doctor's list and the printable sheet, where it is marked no-print. */

.rx-tests { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.rx-tests li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--divider); border-radius: 10px;
  background: var(--surface-2);
}
.rx-tests li > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rx-tests li > span > svg { flex: none; color: var(--blue); }
.rx-tests b { font-size: 13.5px; font-weight: 600; }
.rx-tests small { display: block; font-size: 11.5px; }

.rx-order { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rx-order input {
  flex: 1; min-width: 180px; padding: 9px 12px; font: inherit; font-size: 13.5px;
  border-radius: 10px; border: 1px solid var(--divider);
  background: var(--surface-2); color: var(--fg);
}
.rx-order input:focus { outline: none; border-color: var(--blue); }
.rx-order .btn { white-space: nowrap; }
.rx-order .btn svg { vertical-align: -2px; margin-right: 4px; }

/* Already at the counter: the same line for whoever is looking. */
.rx-ordered {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(46, 204, 113, .12); border: 1px solid rgba(46, 204, 113, .35);
}
.rx-ordered > svg { flex: none; color: #1e8449; }
.rx-ordered > span { flex: 1; min-width: 160px; }
[data-theme="dark"] .rx-ordered { background: rgba(46, 204, 113, .1); }

/* The medicine lines, summarised under a card in a list rather than laid out
   as the full printed table. */
.rx-lines { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.rx-lines li {
  display: flex; align-items: baseline; gap: 8px; font-size: 13px;
  padding: 7px 10px; border-radius: 8px; background: var(--surface-2);
}
.rx-lines .n {
  flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--blue);
  color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
  align-self: center;
}
.rx-lines .nm { font-weight: 600; }
.rx-lines .qty { flex: none; margin-left: auto; color: var(--muted); font-size: 12px; }
.rx-lines .how { color: var(--muted); font-size: 12px; }
.rx-lines .off { color: var(--muted); font-style: italic; }

.rx-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 6px; margin-bottom: 8px; }
.rx-row input { padding: 8px 10px; font-size: 13px; }

@media print {
  .sidebar, .tabbar, .topbar, .back-link, .rx-foot .btn { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; }
  .rx-page { border: 0; }
}

/* ---------- ambulance ---------- */

.emergency-bar {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  border-radius: 12px; background: rgba(237, 73, 86, .1); color: var(--like);
  margin-bottom: 16px;
}
.emergency-bar b { display: block; }
.emergency-bar small { color: var(--muted); }

.amb-list { display: flex; flex-direction: column; gap: 10px; }
.amb-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px;
  border: 1px solid var(--divider); border-radius: 12px; background: var(--surface);
}
.amb-card.off { opacity: .55; }
.amb-icon { color: var(--like); flex: 0 0 auto; }
.amb-body { flex: 1; min-width: 0; }
.amb-body b { font-size: 14.5px; }
.amb-body .small { font-size: 12px; }
.amb-fare { margin-top: 6px; font-size: 12.5px; }
.amb-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.amb-admin {
  border: 1px solid var(--divider); border-radius: 12px; padding: 10px; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.amb-admin .amb-card { border: 0; padding: 0; }
.amb-edit { display: flex; gap: 6px; flex-wrap: wrap; }
.amb-edit input { flex: 1; min-width: 110px; padding: 7px 10px; font-size: 13px; }
.amb-edit input.mini, input.mini { max-width: 92px; }
.assign-row {
  display: flex; gap: 8px; align-items: center; margin: -6px 0 10px; padding: 0 14px 10px;
}
.assign-row select { flex: 1; }

/* ---------- admin ---------- */

.admin-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding-bottom: 10px; margin-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}
.admin-head b { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.admin-head small { color: var(--muted); }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-tabs a {
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--divider); color: var(--muted);
}
.admin-tabs a.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat-tile {
  border: 1px solid var(--divider); border-radius: 12px; padding: 12px 14px;
  background: var(--surface);
}
.stat-tile.wide { grid-column: span 2; }
.stat-icon { color: var(--muted); display: block; margin-bottom: 4px; }
.stat-tile b { display: block; font-size: 22px; line-height: 1.2; }
.stat-tile small { color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--divider); border-radius: 12px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); }
.admin-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .3px;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr.attention { background: rgba(245, 166, 35, .08); }
.admin-table .who { gap: 8px; }
.admin-table .who b { font-size: 13.5px; }
.admin-table .who small { font-size: 11.5px; }
.warn-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #f5a623; margin-left: 5px;
}
.muted.warn { color: #f5a623; }
.inline-form { display: flex; gap: 5px; align-items: center; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .stat-tile.wide { grid-column: span 1; }
}
@media (max-width: 767px) {
  .queue-card { flex-wrap: wrap; }
  .queue-side { flex-direction: row; width: 100%; }
  .queue-row { grid-template-columns: 40px minmax(0, 1fr); row-gap: 6px; }
  .queue-row .tim, .queue-row .status { grid-column: 2; }
  .rx-row { grid-template-columns: 1fr 1fr; }
}

/* ---------- hashtags and review attribution ---------- */

.tag-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; }
.tag-strip a {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 20px; font-size: 13px;
  font-weight: 600; border: 1px solid var(--divider); color: var(--muted);
  white-space: nowrap;
}
.tag-strip a.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.reel-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.reel-tags a {
  background: rgba(255, 255, 255, .22); color: #fff; padding: 3px 10px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600;
}

.review-of {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 8px;
  padding: 8px 10px; border-radius: 10px; background: rgba(0, 149, 246, .08);
}
.review-of b { display: block; font-size: 13.5px; }
.review-of small { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.review-of .ic { margin-left: auto; transform: rotate(180deg); color: var(--muted); }
