:root {
  --ap-navy: #0b2f6b;
  --ap-blue: #164a9e;
  --ap-teal: #1a8f7b;
  --ap-gold: #f7c948;
  --ap-gold-dark: #e0a814;
  --ap-bg: #eef2fa;
  --ap-surface: #ffffff;
  --ap-text: #14213d;
  --ap-text-muted: #62708a;
  --ap-danger: #e5484d;
  --ap-success: #1a8f5a;
  --ap-radius: 16px;
  --ap-radius-sm: 10px;
  --ap-shadow: 0 2px 10px rgba(11, 47, 107, 0.08);
}

[data-theme="dark"] {
  --ap-bg: #0d1526;
  --ap-surface: #16213a;
  --ap-text: #eef2fa;
  --ap-text-muted: #9aa8c7;
  --ap-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--ap-bg);
  color: var(--ap-text);
  min-height: 100vh;
}

a { color: var(--ap-blue); text-decoration: none; }

.ap-gradient-bg {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--ap-navy) 0%, var(--ap-blue) 45%, var(--ap-teal) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.ap-auth-card {
  width: 100%;
  max-width: 420px;
  color: #fff;
  text-align: center;
}

.ap-logo-circle {
  width: 96px; height: 96px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; overflow: hidden; box-shadow: var(--ap-shadow);
}
.ap-logo-circle img { width: 100%; height: 100%; object-fit: cover; }

.ap-auth-title { font-size: 30px; font-weight: 800; margin: 4px 0; }
.ap-auth-subtitle { opacity: 0.85; margin-bottom: 24px; }

.ap-glass-panel {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--ap-radius);
  padding: 24px;
  backdrop-filter: blur(6px);
  text-align: left;
}

.ap-field-label { font-weight: 600; font-size: 14px; margin-bottom: 6px; display: block; }

.ap-input, input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], textarea, select {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--ap-radius-sm);
  border: none;
  font-size: 15px;
  margin-bottom: 14px;
  background: #fff;
  color: var(--ap-text);
}
textarea { resize: vertical; min-height: 70px; }

.ap-btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 13px 16px;
  border-radius: 999px;
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.ap-btn-gold {
  background: linear-gradient(180deg, var(--ap-gold) 0%, var(--ap-gold-dark) 100%);
  color: #24290b;
}
.ap-btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.6);
  color: #fff;
  margin-top: 10px;
}
.ap-btn-primary {
  background: var(--ap-blue);
  color: #fff;
}
.ap-btn-secondary {
  background: var(--ap-surface);
  color: var(--ap-text);
  border: 1px solid #dbe2ef;
}
.ap-btn-danger { background: var(--ap-danger); color: #fff; }
.ap-btn-sm { padding: 8px 14px; font-size: 13px; width: auto; }

.ap-links-row { display: flex; justify-content: center; gap: 18px; margin-top: 16px; font-size: 14px; }
.ap-links-row a { color: #dce8ff; }

.ap-encrypted-note {
  margin-top: 20px; text-align: center; font-size: 13px; opacity: 0.85;
}

/* App shell (post-login) */
.ap-app-shell { max-width: 900px; margin: 0 auto; padding-bottom: 70px; }
.ap-app-shell, .ap-app-shell * { min-width: 0; }
.ap-app-shell img, .ap-app-shell video { max-width: 100%; height: auto; }
.ap-topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--ap-surface); box-shadow: var(--ap-shadow);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
}
.ap-topbar h1 { font-size: 20px; margin: 0; }
.ap-topbar-icons { display: flex; gap: 14px; align-items: center; }
.ap-topbar-icons a, .ap-topbar-icons button { background: none; border: none; cursor: pointer; color: var(--ap-text); font-size: 18px; }

.ap-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--ap-surface); border-top: 1px solid #e3e8f2;
  display: flex; justify-content: space-around; padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.ap-bottom-nav a { display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--ap-text-muted); gap: 2px; }
.ap-bottom-nav a.active { color: var(--ap-blue); font-weight: 700; }
.ap-bottom-nav .badge {
  background: var(--ap-danger); color: #fff; border-radius: 999px; font-size: 10px;
  padding: 1px 5px; position: relative; top: -8px; left: 10px;
}

.ap-card {
  background: var(--ap-surface); border-radius: var(--ap-radius); box-shadow: var(--ap-shadow);
  padding: 16px; margin: 10px 16px;
}
.ap-card form { max-width: 100%; }
.ap-list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--ap-surface); border-radius: var(--ap-radius); margin: 8px 16px; box-shadow: var(--ap-shadow);
}
.ap-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #cdd8ee; flex-shrink: 0; }
.ap-avatar-sm { width: 34px; height: 34px; }
.ap-list-title { font-weight: 700; }
.ap-list-sub { color: var(--ap-text-muted); font-size: 13px; }
.ap-list-meta { text-align: right; font-size: 12px; color: var(--ap-text-muted); }

.ap-messages-wrap { padding: 12px 12px 90px; display: flex; flex-direction: column; gap: 8px; min-height: 60vh;}
.ap-bubble { max-width: 75%; padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.4; word-wrap: break-word; }
.ap-bubble.mine { align-self: flex-end; background: var(--ap-blue); color: #fff; border-bottom-right-radius: 4px; }
.ap-bubble.theirs { align-self: flex-start; background: var(--ap-surface); box-shadow: var(--ap-shadow); border-bottom-left-radius: 4px; }
.ap-bubble-meta { font-size: 10px; opacity: 0.75; margin-top: 4px; text-align: right; }
.ap-bubble audio { width: 220px; }

.ap-composer {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 900px; margin: 0 auto;
  background: var(--ap-surface); padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  display: flex; gap: 8px; align-items: center; box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}
.ap-composer input[type=text] { margin: 0; flex: 1; }
.ap-icon-btn { border: none; background: var(--ap-bg); border-radius: 50%; width: 42px; height: 42px; display:flex; align-items:center; justify-content:center; cursor: pointer; font-size: 18px; flex-shrink: 0; }
.ap-icon-btn.record.recording { background: var(--ap-danger); color: #fff; }

.ap-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.ap-badge-gold { background: #fdf0c8; color: #7a5c05; }
.ap-badge-teal { background: #d7f0eb; color: #0e5c4c; }
.ap-badge-danger { background: #fbdada; color: #92161a; }
.ap-badge-muted { background: #e6eaf3; color: var(--ap-text-muted); }

.ap-toggle { position: relative; display: inline-block; width: 46px; height: 26px; }
.ap-toggle input { opacity: 0; width: 0; height: 0; }
.ap-toggle .slider { position: absolute; inset: 0; background: #cdd6e6; border-radius: 999px; cursor: pointer; transition: .2s; }
.ap-toggle .slider:before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.ap-toggle input:checked + .slider { background: var(--ap-blue); }
.ap-toggle input:checked + .slider:before { transform: translateX(20px); }

.ap-settings-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #eef1f8; }
.ap-settings-row:last-child { border-bottom: none; }
.ap-settings-icon { width: 28px; text-align: center; margin-right: 10px; opacity: 0.75; }

.ap-messages-list { list-style: none; padding: 0; margin: 0; }

.ap-empty-state { text-align: center; padding: 40px 20px; color: var(--ap-text-muted); }

.ap-form-page { max-width: 480px; margin: 0 auto; padding: 20px 16px 90px; }

.ap-site-footer {
  display: flex; justify-content: center; gap: 18px; flex-wrap: wrap;
  padding: 18px 16px 28px; color: var(--ap-text-muted); font-size: 13px;
  text-align: center;
}
.ap-site-footer a { font-weight: 700; }

.ap-executive-page { max-width: 1100px; margin: 0 auto; padding: 28px 16px 40px; }
.ap-executive-hero { text-align: center; padding: 12px 0 30px; }
.ap-executive-hero h1 { margin: 0 0 10px; color: var(--ap-navy); font-size: clamp(28px, 5vw, 48px); }
.ap-executive-hero p { max-width: 720px; margin: 0 auto; color: var(--ap-text-muted); line-height: 1.6; }
.ap-leadership-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 20px 0 42px; }
.ap-leader-card { background: var(--ap-surface); border-radius: var(--ap-radius); box-shadow: var(--ap-shadow); padding: 18px; text-align: center; }
.ap-leader-card img { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; background: var(--ap-bg); margin-bottom: 10px; }
.ap-leader-card h2 { font-size: 16px; margin: 4px 0; }
.ap-leader-card p { color: var(--ap-text-muted); font-size: 13px; margin: 0; }
.ap-feature-heading { text-align: center; margin: 0 0 24px; color: var(--ap-navy); font-size: clamp(24px, 4vw, 38px); }
.ap-feature-section { background: var(--ap-surface); border-left: 4px solid var(--ap-teal); border-radius: var(--ap-radius-sm); box-shadow: var(--ap-shadow); padding: 18px 20px; margin: 14px 0; }
.ap-feature-section h2 { margin: 0 0 8px; color: var(--ap-blue); font-size: 19px; }
.ap-feature-section p { line-height: 1.6; }
.ap-feature-list { columns: 2; column-gap: 34px; margin: 0; padding-left: 20px; }
.ap-feature-list li { break-inside: avoid; margin: 5px 0; line-height: 1.45; }
@media (max-width: 640px) { .ap-feature-list { columns: 1; } }
.ap-status-strip { display: flex; gap: 12px; overflow-x: auto; padding: 0 16px 14px; }
.ap-status-avatar { min-width: 68px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ap-text); font-size: 11px; text-align: center; }
.ap-status-avatar img, .ap-status-avatar > span { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; display: flex; align-items: center; justify-content: center; background: var(--ap-bg); font-size: 25px; }
.ap-status-avatar.has-status img, .ap-status-avatar.has-status > span { border: 3px solid var(--ap-teal); padding: 2px; }
.ap-status-more { align-self: center; white-space: nowrap; font-size: 13px; }
.ap-status-profile-link { width: 48px; height: 48px; border: 3px solid var(--ap-teal); border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.ap-status-profile-link img { width: 100%; height: 100%; object-fit: cover; }
.ap-status-viewer { max-width: 900px; margin: 0 auto; padding-bottom: 80px; }
.ap-status-viewer-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--ap-surface); box-shadow: var(--ap-shadow); }
.ap-status-viewer-head a { font-size: 24px; }
.ap-status-viewer-head span { color: var(--ap-text-muted); font-size: 12px; }
.ap-status-group { position: relative; margin: 16px; background: #0d1526; color: #fff; border-radius: var(--ap-radius); overflow: hidden; min-height: 330px; scroll-margin-top: 70px; }
.ap-status-author { position: absolute; z-index: 2; top: 12px; left: 14px; right: 14px; display: flex; gap: 10px; align-items: center; text-shadow: 0 1px 3px #000; }
.ap-status-author img, .ap-status-author > span { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; display: flex; align-items: center; justify-content: center; background: #53627c; }
.ap-status-author small { display: block; opacity: .75; font-size: 11px; }
.ap-status-slides { min-height: 330px; }
.ap-status-slide { display: none; min-height: 330px; padding: 62px 20px 48px; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.ap-status-slide.active { display: flex; }
.ap-status-slide img, .ap-status-slide video { max-width: 100%; max-height: 430px; object-fit: contain; border-radius: 8px; }
.ap-status-slide audio { width: min(100%, 380px); }
.ap-status-slide p { max-width: 650px; line-height: 1.5; }
.ap-status-slide-meta { align-self: flex-end; opacity: .7; font-size: 11px; margin-bottom: 8px; }
.ap-status-text-only { font-size: 22px; line-height: 1.45; max-width: 620px; }
.ap-status-dots { position: absolute; top: 10px; left: 100px; right: 100px; display: flex; gap: 4px; }
.ap-status-dots button { height: 3px; flex: 1; padding: 0; border: 0; background: rgba(255,255,255,.35); }
.ap-status-dots button.active { background: #fff; }
.ap-status-controls { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.ap-status-controls button { pointer-events: auto; height: 100%; width: 18%; border: 0; background: transparent; color: #fff; font-size: 42px; opacity: .7; cursor: pointer; }
.ap-profile-status-avatar { position: absolute; bottom: -24px; left: 16px; width: 72px; height: 72px; padding: 3px; border: 3px solid var(--ap-teal); border-radius: 50%; background: var(--ap-surface); z-index: 1; }
.ap-profile-status-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ap-profile-status-placeholder { display: flex; align-items: center; justify-content: center; font-size: 34px; }
.ap-post-content { border-radius: 10px; padding: 8px 12px; margin-top: 8px; }
.ap-post-content p { margin: 0; line-height: 1.5; }
.ap-post-reactions { display: flex; flex-wrap: wrap; gap: 2px; }
.ap-post-reactions .ap-icon-btn { width: 34px; height: 34px; padding: 0; font-size: 17px; }
.ap-post-bg-default { background: transparent; }
.ap-post-bg-sunrise { background: #fff0d8; }
.ap-post-bg-ocean { background: #dceefa; }
.ap-post-bg-forest { background: #dff3e8; }
.ap-post-bg-berry { background: #f6e2ef; }
.ap-media-action { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 38px; border-radius: 8px; background: var(--ap-bg); cursor: pointer; }
.ap-media-action input { display: none; }
.ap-post-comment { margin-top: 8px; padding: 8px 10px; background: var(--ap-bg); border-radius: 8px; font-size: 13px; }
.ap-post-comment img { display: block; max-width: 180px; max-height: 140px; margin-top: 6px; border-radius: 8px; object-fit: cover; }
.ap-post-comment audio { display: block; max-width: 100%; margin-top: 6px; }
.ap-comment-thread { margin-top: 10px; }
.ap-comment-thread > img, .ap-comment-reply img { display: block; max-width: 220px; max-height: 160px; margin-top: 8px; border-radius: 8px; object-fit: cover; }
.ap-comment-thread audio, .ap-comment-reply audio { display: block; max-width: 100%; margin-top: 8px; }
.ap-comment-reply { margin: 10px 0 0 20px; padding: 9px; border-left: 3px solid var(--ap-teal); background: var(--ap-bg); border-radius: 6px; }
.ap-comment-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.ap-comment-form input[type="text"] { flex: 1 1 180px; margin: 0; }
.comment-reaction-target { position: relative; cursor: context-menu; }
.ap-reaction-menu { display: none; position: absolute; z-index: 8; left: 8px; bottom: calc(100% + 6px); gap: 3px; padding: 7px; background: var(--ap-surface); border-radius: 999px; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
.ap-reaction-menu.visible { display: flex; }
.ap-reaction-menu form, .ap-comment-reactions form { display: inline; }
.ap-reaction-menu button, .ap-comment-reactions button { border: 0; background: transparent; padding: 4px; font-size: 20px; cursor: pointer; }
.ap-comment-reactions { display: flex; gap: 2px; margin-top: 5px; }

@media (max-width: 640px) {
  .ap-app-shell { width: 100%; padding-bottom: 76px; }
  .ap-topbar { padding: 11px 12px; }
  .ap-topbar h1 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ap-topbar-icons { gap: 9px; }
  .ap-bottom-nav a { font-size: 11px; }
  .ap-card { margin: 8px 10px; padding: 13px; }
  .ap-section-title { padding: 13px 12px 4px; font-size: 18px; }
  .ap-form-page { width: 100%; padding: 14px 12px 80px; }
  .ap-form-page input, .ap-form-page textarea, .ap-form-page select { max-width: 100%; }
  .ap-status-group { margin: 10px; min-height: 300px; }
  .ap-status-slides, .ap-status-slide { min-height: 300px; }
  .ap-status-slide { padding: 58px 12px 42px; }
  .ap-status-slide img, .ap-status-slide video { max-height: 300px; }
  .ap-status-text-only { font-size: 19px; }
  .ap-profile-status-avatar { left: 12px; width: 68px; height: 68px; }
  .ap-post-reactions { gap: 0; }
  .ap-post-reactions .ap-icon-btn { width: 30px; height: 30px; font-size: 15px; }
  .ap-comment-form { align-items: stretch; }
  .ap-comment-form input[type="text"] { flex-basis: 100%; }
  .ap-comment-form .ap-media-action { flex: 0 0 38px; }
  .ap-reaction-menu { left: 0; max-width: calc(100vw - 32px); overflow-x: auto; }
  .ap-post-comment img, .ap-comment-thread > img, .ap-comment-reply img { max-width: min(100%, 180px); max-height: 120px; }
  .ap-site-footer { padding-bottom: 88px; }
}

.ap-alert { padding: 12px 14px; border-radius: var(--ap-radius-sm); margin: 10px 16px; font-size: 14px; }
.ap-alert-success { background: #e2f6ea; color: #146c37; }
.ap-alert-error { background: #fde3e3; color: #971c1c; }
.ap-alert-info { background: #e3edfb; color: #164a9e; }

.ap-admin-header {
  background: linear-gradient(90deg, var(--ap-navy), var(--ap-blue));
  color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
}
.ap-admin-header h1 { font-size: 18px; margin: 0; }
.ap-admin-brand { display: flex; align-items: center; width: 64px; }
.ap-admin-brand img { width: 48px; height: 34px; border-radius: 6px; object-fit: contain; padding: 2px; background: #fff; flex-shrink: 0; }
.ap-admin-actions { display: flex; gap: 12px; align-items: center; }
.ap-admin-actions a { color: #fff; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 18px; min-width: 44px; }
.ap-admin-actions a span { font-size: 11px; font-weight: 700; }
.ap-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; padding: 16px; }
.ap-stat-card { background: var(--ap-surface); border-radius: var(--ap-radius); padding: 16px; box-shadow: var(--ap-shadow); }
.ap-stat-card .num { font-size: 28px; font-weight: 800; }
.ap-tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 0 16px 16px; }
.ap-tool-card { background: var(--ap-surface); border-radius: var(--ap-radius); padding: 18px 14px; box-shadow: var(--ap-shadow); text-align: center; cursor: pointer; border: none; font-family: inherit; }
.ap-tool-card .icon { font-size: 24px; margin-bottom: 6px; }
.ap-tool-card .title { font-weight: 700; font-size: 14px; }
.ap-tool-card .desc { font-size: 12px; color: var(--ap-text-muted); }
.ap-admin-leaders-summary { margin-top: 0; }
.ap-admin-leader-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eef1f8; flex-wrap: wrap; }
.ap-admin-leader-row span:not(.ap-badge) { color: var(--ap-text-muted); font-size: 13px; flex: 1; }
.ap-executive-admin-card { margin-left: 0; margin-right: 0; }
.ap-executive-admin-fields { display: grid; grid-template-columns: 1fr 1.5fr 110px; gap: 12px; }
@media (max-width: 700px) { .ap-executive-admin-fields { grid-template-columns: 1fr; } }

.ap-section-title { padding: 16px 16px 4px; font-size: 20px; font-weight: 800; }

table.ap-table { width: 100%; border-collapse: collapse; background: var(--ap-surface); border-radius: var(--ap-radius); overflow: hidden; }
table.ap-table th, table.ap-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef1f8; font-size: 14px; }
table.ap-table th { background: var(--ap-bg); font-weight: 700; }

.ap-typing-indicator { font-size: 12px; color: var(--ap-text-muted); padding: 4px 16px; }

.ap-call-overlay {
  position: fixed; inset: 0; background: linear-gradient(180deg, var(--ap-navy), var(--ap-teal));
  color: #fff; z-index: 100; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.ap-call-overlay.active { display: flex; }
.ap-call-avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }
.ap-call-controls { display: flex; gap: 20px; margin-top: 30px; }
.ap-call-btn { width: 56px; height: 56px; border-radius: 50%; border: none; font-size: 22px; cursor: pointer; }
.ap-call-btn.end { background: var(--ap-danger); color: #fff; }
.ap-call-btn.toggle { background: rgba(255,255,255,0.2); color: #fff; }
video.ap-call-video { width: 100%; max-width: 480px; border-radius: var(--ap-radius); background: #000; }

/* ==========================================================================
   PREMIUM RESPONSIVE LAYER
   Appended without altering any rules above. Makes the app feel like a
   native mobile app on phones, and like a polished desktop/tablet app
   (WhatsApp Web / Telegram Desktop style: centered frame on a soft backdrop)
   on larger screens — plus standard motion/animation and a shared lightbox.
   ========================================================================== */

:root {
  --ap-ease: cubic-bezier(.22,.9,.32,1);
}

/* Never allow accidental horizontal scroll/zoom-jank on any device */
html, body { overflow-x: hidden; }
* { -webkit-tap-highlight-color: transparent; }

/* ---- Base motion: respect users who've asked for reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---- Standard entrance animations ---- */
@keyframes ap-fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ap-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ap-pop-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes ap-slide-up-sheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes ap-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes ap-shimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }

.ap-card, .ap-list-item { animation: ap-fade-up .32s var(--ap-ease) both; }
.ap-bubble { animation: ap-pop-in .22s var(--ap-ease) both; transform-origin: bottom; }
.ap-bubble.mine { transform-origin: bottom right; }
.ap-bubble.theirs { transform-origin: bottom left; }

/* Buttons/links feel tactile everywhere (native-app press feedback) */
.ap-btn, .ap-icon-btn, .ap-tool-card, .ap-call-btn, button, a.ap-status-avatar, a.ap-list-item {
  transition: transform .12s var(--ap-ease), box-shadow .12s var(--ap-ease), background-color .15s var(--ap-ease), opacity .15s var(--ap-ease);
}
.ap-btn:active, .ap-icon-btn:active, .ap-call-btn:active, .ap-tool-card:active { transform: scale(0.94); }
@media (hover: hover) {
  .ap-tool-card:hover, .ap-card:hover, .ap-list-item:hover { box-shadow: 0 6px 20px rgba(11,47,107,0.12); transform: translateY(-1px); }
  .ap-btn:hover { filter: brightness(1.04); }
}

/* Sticky top bar / bottom nav get subtle depth transitions */
.ap-topbar, .ap-bottom-nav { transition: box-shadow .2s ease; }

/* Loading skeleton shimmer, used by pages that render a placeholder while data streams in */
.ap-skeleton {
  background: linear-gradient(90deg, #e8edf7 25%, #f3f6fb 37%, #e8edf7 63%);
  background-size: 400px 100%;
  animation: ap-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--ap-radius-sm);
}

/* Presence dot pulse (used next to "online") */
.ap-live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ap-success); animation: ap-pulse 1.6s ease-in-out infinite; }

/* ---- Shared lightbox (images from chat / comments / status / posts) ---- */
.ap-lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(6,12,26,0.92);
  display: none; align-items: center; justify-content: center; padding: 24px;
  animation: ap-fade-in .18s ease;
}
.ap-lightbox.active { display: flex; }
.ap-lightbox img { max-width: min(94vw, 900px); max-height: 88vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); animation: ap-pop-in .2s var(--ap-ease); }
.ap-lightbox-close { position: absolute; top: 18px; right: 20px; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255,255,255,0.15); color: #fff; font-size: 20px; cursor: pointer; }

/* ---- Long-press reaction popover, shared styling refinement ---- */
.ap-reaction-menu { animation: ap-pop-in .16s var(--ap-ease); transform-origin: bottom left; }

/* ---- Thumbnail sizing: comment / reply images stay compact, tap to expand ---- */
.ap-post-comment img, .ap-comment-thread > img, .ap-comment-reply img {
  max-width: 120px !important; max-height: 120px !important; cursor: zoom-in;
  border: 1px solid rgba(0,0,0,0.06);
}

/* ---- Feed post media: capped height so a single tall photo can't dominate the screen ---- */
.ap-post-media-frame { position: relative; border-radius: 12px; overflow: hidden; margin-top: 8px; background: var(--ap-bg); }
.ap-post-media-frame img { display: block; width: 100%; max-height: 420px; object-fit: cover; cursor: zoom-in; }
.ap-post-media-frame video { display: block; width: 100%; max-height: 420px; background: #000; }

/* ==========================================================================
   RESPONSIVE FRAME — tablet & desktop
   Mobile (<640px): completely untouched, full-bleed, feels like a native app.
   Tablet (641–1023px): comfortably centered, larger touch targets.
   Desktop (≥1024px): centered "app window" on a soft backdrop, like
   WhatsApp Web / Telegram Desktop, so it never looks like a stretched phone.
   ========================================================================== */

.ap-bottom-nav-inner, .ap-topbar-inner { max-width: 900px; margin: 0 auto; width: 100%; }
.ap-admin-content { max-width: 900px; margin: 0 auto; padding-bottom: 40px; }

/* .ap-bottom-nav already uses left:0;right:0 (full viewport) — add the same
   max-width + auto-margin centering trick .ap-composer already uses, so the
   nav bar lines up with the centered content column on every screen size
   (a no-op on phones, since phones are already narrower than 900px). */
.ap-bottom-nav { max-width: 900px; margin-left: auto; margin-right: auto; }

@media (min-width: 641px) and (max-width: 1023px) {
  .ap-app-shell { max-width: 720px; }
  .ap-bubble { max-width: 65%; }
  .ap-stat-grid { grid-template-columns: repeat(3, 1fr); }
  .ap-bottom-nav, .ap-composer { max-width: 720px; }
}

@media (min-width: 1024px) {
  body { background: radial-gradient(circle at 50% -10%, #dbe6fb 0%, var(--ap-bg) 55%); }

  .ap-app-shell {
    max-width: 760px;
    margin: 28px auto 0;
    background: var(--ap-surface);
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(11,47,107,0.16), 0 2px 8px rgba(11,47,107,0.06);
    min-height: calc(100vh - 56px);
    padding-bottom: 0;
    animation: ap-fade-in .25s ease;
  }
  .ap-topbar { border-radius: 22px 22px 0 0; }
  .ap-bottom-nav, .ap-composer { max-width: 760px; }
  .ap-bottom-nav { border-radius: 0 0 22px 22px; border-top: 1px solid #eef1f8; }
  .ap-messages-wrap { min-height: 50vh; }
  .ap-bubble { max-width: 58%; }

  /* Auth screens: keep the phone-card centered and framed rather than
     stretching edge to edge on a large monitor. */
  .ap-gradient-bg { padding: 48px 16px; }
  .ap-auth-card { max-width: 440px; }
  .ap-glass-panel { box-shadow: 0 24px 70px rgba(0,0,0,0.25); }

  /* Admin portal gets the same centered-window treatment */
  .ap-admin-header { border-radius: 22px 22px 0 0; max-width: 900px; margin: 28px auto 0; }
  .ap-admin-content {
    max-width: 900px; margin: 0 auto 40px; background: var(--ap-surface);
    border-radius: 0 0 22px 22px; box-shadow: 0 24px 70px rgba(11,47,107,0.16);
    padding-bottom: 24px;
  }
}

@media (min-width: 1024px) {
  /* Marketplace / group / chat list columns get breathing room instead of
     stretching a single narrow column across a wide monitor. */
  .ap-status-strip { padding-left: 20px; padding-right: 20px; }
}

/* Prevent the fixed call overlay / lightbox from being clipped by the
   desktop app-frame's overflow:hidden */
.ap-call-overlay, .ap-lightbox { border-radius: 0 !important; }

/* ---- New premium marketplace post card treatment ---- */
.ap-feed-post { padding: 14px; }
.ap-post-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 13px; }
.ap-reaction-trigger {
  border: none; background: var(--ap-bg); color: var(--ap-text); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; cursor: pointer; font-weight: 600;
}
.ap-reaction-trigger-sm { background: none; padding: 2px 8px; font-size: 12px; color: var(--ap-text-muted); margin-top: 4px; }
.ap-reaction-summary { display: inline-flex; align-items: center; gap: 3px; }
.ap-post-comments-link { color: var(--ap-text-muted); font-weight: 600; }
.ap-comment-reactions-summary { font-size: 12px; color: var(--ap-text-muted); margin-top: 4px; }
.post-reaction-target { position: relative; display: inline-block; }
.post-reaction-target .ap-reaction-menu { left: 0; bottom: calc(100% + 8px); }

/* ---- Premium chat list ---- */
.ap-search-wrap { position: relative; padding: 12px 16px 4px; }
.ap-search-box { position: relative; display: flex; align-items: center; }
.ap-search-icon { position: absolute; left: 14px; font-size: 15px; opacity: .55; pointer-events: none; }
.ap-search-box input { padding-left: 38px; margin-bottom: 0; background: var(--ap-bg); border: 1px solid transparent; transition: border-color .15s ease, background .15s ease; }
.ap-search-box input:focus { outline: none; border-color: var(--ap-blue); background: var(--ap-surface); }
.ap-search-results {
  position: absolute; left: 16px; right: 16px; top: 100%; z-index: 25;
  background: var(--ap-surface); border-radius: var(--ap-radius); box-shadow: 0 12px 34px rgba(11,47,107,0.18);
  max-height: 0; overflow: hidden; opacity: 0; transition: max-height .2s var(--ap-ease), opacity .15s ease;
}
.ap-search-results.active { max-height: 360px; opacity: 1; overflow-y: auto; padding: 6px; }

.ap-chat-list { padding-top: 4px; }
.ap-chat-row { position: relative; }
.ap-avatar-wrap { position: relative; flex-shrink: 0; }
.ap-avatar-placeholder { display: flex; align-items: center; justify-content: center; font-size: 20px; }
.ap-presence-dot { position: absolute; bottom: 1px; right: 1px; border: 2px solid var(--ap-surface); }
.ap-mute-icon { font-size: 12px; opacity: .6; }
.ap-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-encrypted-hint { color: var(--ap-text-muted); }
.ap-time-chip { font-size: 11px; color: var(--ap-text-muted); }
.ap-unread-badge { margin-top: 4px; margin-left: auto; min-width: 20px; text-align: center; }
.ap-empty-hero { padding: 60px 24px; }
.ap-empty-icon { font-size: 44px; margin-bottom: 10px; opacity: .7; }

/* ---- AI features ---- */
.ap-ai-card { background: linear-gradient(135deg, #eef2ff, #e7f7f2); border: 1px solid #d9e6ff; }
.ap-ai-avatar { display: flex; align-items: center; justify-content: center; font-size: 20px; background: linear-gradient(135deg, var(--ap-blue), var(--ap-teal)); color: #fff; }
.ap-smart-replies { display: flex; gap: 8px; overflow-x: auto; padding: 6px 12px; scrollbar-width: none; }
.ap-smart-replies::-webkit-scrollbar { display: none; }
.ap-smart-reply-chip {
  flex-shrink: 0; border: 1px solid var(--ap-blue); background: var(--ap-surface); color: var(--ap-blue);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
  animation: ap-pop-in .18s var(--ap-ease) both;
}
.ap-smart-reply-chip:active { transform: scale(0.95); }
.ap-ai-toast {
  position: fixed; bottom: 76px; left: 16px; right: 16px; max-width: 868px; margin: 0 auto;
  background: var(--ap-text); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  z-index: 70; animation: ap-fade-up .2s var(--ap-ease);
}
.ap-ai-summary-box {
  background: linear-gradient(135deg, #eef2ff, #e7f7f2); border: 1px solid #d9e6ff; border-radius: var(--ap-radius);
  padding: 14px; margin: 10px 16px; font-size: 14px; line-height: 1.5;
}
.ap-ai-status-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.ap-ai-status-pill.on { background: #d7f0eb; color: #0e5c4c; }
.ap-ai-status-pill.off { background: #e6eaf3; color: var(--ap-text-muted); }
.ap-field-hint { font-size: 12px; color: var(--ap-text-muted); margin: -8px 0 12px; }
