* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* Unity Surge navy/cyan brand palette */
  --bg: #050d18;
  --panel: #0c1b2d;
  --panel2: #112436;
  --border: #1c3149;
  --fg: #e7f1fb;
  --muted: #9ab0c6;
  --accent: #03aafb;
  --accent2: #0166a8;
  --green: #22d07a;
  --red: #ff5a6e;
}
html, body { min-height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(3,170,251,.14), transparent 60%),
    radial-gradient(760px 460px at 96% 2%, rgba(3,170,251,.14), transparent 55%);
  background-attachment: fixed;
  color: var(--fg);
  display: flex; flex-direction: column;
}

header.topnav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; border-bottom: 1px solid var(--border); background: var(--panel);
  position: relative; z-index: 2;
}
header.topnav .brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
header.topnav nav { display: flex; gap: 10px; align-items: center; }

.logo-mark {
  display: inline-block; width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 2px 0 #0166a8, 0 5px 10px -2px rgba(3,170,251,.55);
  transform: rotate(45deg);
}

a { color: inherit; text-decoration: none; }

.btn {
  display: inline-block; background: var(--panel2); color: var(--fg); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 8px; cursor: pointer; font-size: 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 6px 14px -8px rgba(0,0,0,.6);
  transform: translateY(0);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}
.btn:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 22px -10px rgba(0,0,0,.65); }
.btn:active { transform: translateY(0); box-shadow: 0 2px 6px -2px rgba(0,0,0,.5); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent2)); border-color: var(--accent2); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 12px 26px -10px rgba(3,170,251,.65);
}
.btn.primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 16px 32px -10px rgba(3,170,251,.75); }

main { flex: 1; width: 100%; }

.hero-3d {
  position: relative; overflow: hidden;
  padding: 100px 24px 60px;
}
.hero-grid-floor {
  position: absolute; left: -20%; right: -20%; bottom: 0; height: 420px;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(600px) rotateX(62deg);
  transform-origin: bottom;
  opacity: .4;
  -webkit-mask-image: linear-gradient(to top, black, transparent 75%);
          mask-image: linear-gradient(to top, black, transparent 75%);
  pointer-events: none;
}
.hero-glow {
  position: absolute; top: -220px; left: 50%; transform: translateX(-50%);
  width: 680px; height: 680px; border-radius: 50%;
  background: radial-gradient(circle, rgba(3,170,251,.32), transparent 65%);
  pointer-events: none;
}

.hero {
  position: relative; z-index: 1;
  max-width: 720px; margin: 0 auto; text-align: center;
}
.hero h1 { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 42px; margin-bottom: 12px; }
.hero p { color: var(--muted); font-size: 16px; margin-bottom: 32px; line-height: 1.6; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .hint { margin-top: 14px; font-size: 12px; color: var(--muted); }

.hero-mockup-wrap {
  position: relative; z-index: 1;
  margin: 70px auto 0; perspective: 2000px;
  width: 300px;
  animation: mockup-float 6s ease-in-out infinite;
}
@keyframes mockup-float {
  0%, 100% { transform: translateY(0) rotateX(6deg) rotateY(-9deg); }
  50% { transform: translateY(-16px) rotateX(6deg) rotateY(-9deg); }
}

/* Phone frame: sells "runs on a real phone-like feed" better than an abstract browser card */
.phone-frame {
  position: relative; width: 300px; height: 612px; margin: 0 auto;
  border-radius: 46px; padding: 14px;
  transform-style: preserve-3d;
  background: linear-gradient(155deg, #30364a, #0e1017);
  box-shadow:
    0 60px 100px -24px rgba(0,0,0,.7),
    -26px 46px 80px -34px rgba(3,170,251,.35),
    inset 0 0 0 2px rgba(255,255,255,.05);
}
.phone-frame::before {
  content: ''; position: absolute; right: -3px; top: 130px; width: 3px; height: 64px;
  background: #0a0b10; border-radius: 2px 0 0 2px;
}
.phone-frame::after {
  content: ''; position: absolute; left: -3px; top: 96px; width: 3px; height: 40px;
  background: #0a0b10; border-radius: 0 2px 2px 0;
}
.phone-notch {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 92px; height: 22px; background: #0e1017; border-radius: 0 0 16px 16px; z-index: 4;
}
.phone-notch::after {
  content: ''; position: absolute; right: 15px; top: 7px; width: 8px; height: 8px; border-radius: 50%;
  background: #232735; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.08);
}
.phone-screen {
  position: relative; width: 100%; height: 100%; border-radius: 34px; overflow: hidden;
  background: #e9ebef; display: flex; flex-direction: column;
}
.phone-statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 22px 6px; font: 600 12px system-ui, sans-serif; color: #1c1e21; flex-shrink: 0;
}
.phone-statusbar .ps-icons { letter-spacing: 1px; font-size: 10px; }

.fb-feed {
  position: relative; flex: 1; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 4%, black 94%, transparent);
          mask-image: linear-gradient(to bottom, transparent, black 4%, black 94%, transparent);
}
.fb-feed-track {
  display: flex; flex-direction: column; gap: 8px;
  animation: feed-scroll 18s linear infinite;
}
@keyframes feed-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}
.fb-post { background: #fff; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.fb-post-head { display: flex; align-items: center; gap: 9px; }
.fb-avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.fb-who { flex: 1; min-width: 0; }
.fb-name { font: 600 13px system-ui, sans-serif; color: #1c1e21; }
.fb-meta { font-size: 11px; color: #65676b; }
.fb-caption { font-size: 12.5px; color: #1c1e21; line-height: 1.4; }
.fb-photo {
  height: 130px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent2), #7c3aed);
}

.fb-video { position: relative; height: 190px; border-radius: 8px; overflow: hidden; background: #10121a; }
.fb-video-motion {
  position: absolute; inset: -30%; opacity: .8;
  background:
    radial-gradient(circle at 30% 30%, rgba(3,170,251,.55), transparent 55%),
    radial-gradient(circle at 70% 65%, rgba(124,58,237,.5), transparent 55%),
    radial-gradient(circle at 50% 90%, rgba(34,197,94,.35), transparent 50%);
  filter: blur(6px);
  animation: video-motion 7s ease-in-out infinite;
}
@keyframes video-motion {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(4%, -3%) scale(1.08); }
  66% { transform: translate(-3%, 4%) scale(1.05); }
}
.fb-video-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.18);
  color: #fff; font-size: 16px; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px); animation: video-play-pulse 3.5s ease-in-out infinite;
}
@keyframes video-play-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.fb-video-bar {
  position: absolute; left: 10px; right: 10px; bottom: 10px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.25); overflow: hidden;
}
.fb-video-fill {
  height: 100%; width: 0%; background: #fff; border-radius: 2px;
  animation: video-progress 3.5s linear infinite;
}
@keyframes video-progress { 0% { width: 0%; } 100% { width: 100%; } }
.fb-video-time {
  position: absolute; right: 10px; top: 8px; font-size: 10px; color: #fff;
  background: rgba(0,0,0,.4); padding: 1px 6px; border-radius: 4px;
}

.fb-actions { display: flex; align-items: center; gap: 16px; font: 600 11.5px system-ui, sans-serif; color: #65676b; }
.fb-actions .like-icon { display: inline-block; margin-right: 3px; filter: grayscale(1); opacity: .6; transform: scale(1); animation: like-pulse 3.6s ease-in-out infinite; }
@keyframes like-pulse {
  0%, 60%, 100% { filter: grayscale(1); opacity: .6; transform: scale(1); }
  70% { filter: grayscale(0); opacity: 1; transform: scale(1.35); }
  82% { filter: grayscale(0); opacity: 1; transform: scale(1); }
}

.mockup-addfriend {
  position: relative; font-size: 11px; padding: 4px 10px; border-radius: 6px; white-space: nowrap;
  border: 1px solid var(--accent); color: var(--accent); background: transparent; overflow: hidden;
  margin-left: auto; flex-shrink: 0;
}
.mockup-addfriend .af-default, .mockup-addfriend .af-done { animation-duration: 4s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.mockup-addfriend .af-default { animation-name: af-default-fade; }
.mockup-addfriend .af-done {
  position: absolute; inset: -1px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; background: rgba(34,197,94,.15); color: var(--green); opacity: 0;
  animation-name: af-done-fade;
}
@keyframes af-default-fade { 0%, 55%, 100% { opacity: 1; } 65%, 90% { opacity: 0; } }
@keyframes af-done-fade { 0%, 55%, 100% { opacity: 0; } 65%, 90% { opacity: 1; } }

.fb-post:nth-child(3n+1) .like-icon { animation-delay: 0s; }
.fb-post:nth-child(3n+2) .like-icon { animation-delay: 1.1s; }
.fb-post:nth-child(3n+3) .like-icon { animation-delay: 2.2s; }
.fb-post:nth-child(3n+1) .af-default, .fb-post:nth-child(3n+1) .af-done { animation-delay: .3s; }
.fb-post:nth-child(3n+2) .af-default, .fb-post:nth-child(3n+2) .af-done { animation-delay: 1.6s; }
.fb-post:nth-child(3n+3) .af-default, .fb-post:nth-child(3n+3) .af-done { animation-delay: 2.9s; }

/* Fake automation cursor: clicks around the feed on a loop */
.mockup-cursor {
  position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 3px rgba(3,170,251,.4), 0 2px 8px rgba(0,0,0,.5); z-index: 5;
  animation: cursor-move 7s ease-in-out infinite;
}
.cursor-ring {
  position: absolute; inset: -9px; border: 2px solid var(--accent); border-radius: 50%; opacity: 0;
  animation: cursor-click 7s ease-in-out infinite;
}
@keyframes cursor-move {
  0%, 15%   { top: 130px; left: 230px; }
  18%, 22%  { top: 130px; left: 230px; }
  45%       { top: 300px; left: 40px; }
  48%, 52%  { top: 300px; left: 40px; }
  78%       { top: 420px; left: 230px; }
  81%, 85%  { top: 420px; left: 230px; }
  100%      { top: 130px; left: 230px; }
}
@keyframes cursor-click {
  0%, 16%, 26%, 100% { opacity: 0; transform: scale(1); }
  19% { opacity: 1; transform: scale(1.7); }
  24% { opacity: 0; transform: scale(2); }
}

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; margin-bottom: 18px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.auth-wrap { max-width: 380px; margin: 90px auto; padding: 0 24px; }
.auth-wrap h1 { font-size: 22px; margin-bottom: 18px; text-align: center; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.field input {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--fg); font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--accent); }
.error { color: var(--red); font-size: 13px; margin-bottom: 14px; }

.dashboard { max-width: 1000px; margin: 0 auto; padding: 28px 24px 60px; }
.dashboard h1 { font-size: 24px; margin-bottom: 4px; }
.dashboard .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.filter-bar {
  display: flex; align-items: end; gap: 12px; margin-bottom: 22px; flex-wrap: wrap;
}
.filter-bar .field { margin-bottom: 0; }
.filter-bar input[type="date"] {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--fg); font-size: 13px;
}
.quick-ranges { display: flex; gap: 6px; }
.quick-ranges a.btn { padding: 8px 12px; font-size: 13px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.stat-tile {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-tile:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -14px rgba(0,0,0,.6); }
.stat-tile .value { font-size: 30px; font-weight: 700; color: var(--accent); }
.stat-tile .label { font-size: 12px; color: var(--muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--panel2); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---- Mail (mail.php) ------------------------------------------------------ */
body.mail-page main { display: flex; flex-direction: column; }
.mail-wrap { flex: 1; display: flex; flex-direction: column; max-width: 1400px; width: 100%; margin: 0 auto; padding: 22px 24px 28px; min-height: calc(100vh - 70px); }
.mail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.mail-head h1 { font-size: 24px; display: flex; align-items: center; gap: 10px; }
.mail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mail-msg { font-size: 13px; min-height: 18px; margin-bottom: 8px; color: var(--muted); }
.mail-msg.ok { color: var(--green); }
.mail-msg.err { color: var(--red); }
.mail-layout { flex: 1; display: grid; grid-template-columns: 250px 360px 1fr; gap: 12px; min-height: 0; height: calc(100vh - 170px); }
.mail-side, .mail-list, .mail-reader { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; min-height: 0; display: flex; flex-direction: column; }
.mail-side { padding: 10px; overflow: auto; gap: 6px; }
.mail-side-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 8px 2px; }
.mail-count { color: var(--accent); margin-left: 4px; }
.mail-acct { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.mail-acct:hover { background: var(--panel2); }
.mail-acct.active { background: rgba(3,170,251,.12); }
.mail-acct.active .ma-addr { color: var(--accent); }
.ma-main { flex: 1; min-width: 0; }
.ma-addr { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ma-sub { font-size: 11px; color: var(--muted); }
.mail-acct.selected { background: rgba(229,9,20,.10); }
.mail-ck { margin: 0; flex: 0 0 auto; cursor: pointer; accent-color: var(--accent); }
.mail-side-title-row { display: flex; align-items: center; gap: 6px; }
.mail-selall { display: inline-flex; align-items: center; cursor: pointer; }
.mail-selall input { margin: 0; cursor: pointer; accent-color: var(--accent); }
.mail-side-hint { font-size: 11px; color: var(--muted); padding: 0 8px 4px; }
.ma-ok { color: var(--green); font-weight: 600; }
.ma-wait { color: var(--muted); }
.mail-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.mail-x:hover { color: var(--red); background: var(--panel2); }
.mail-key { font-size: 12px; }
.mail-key:hover { color: var(--accent); }
.mail-folders { display: flex; flex-direction: column; gap: 2px; }
.mail-folder { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; background: none; border: 0; color: var(--fg); font: inherit; font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.mail-folder:hover { background: var(--panel2); }
.mail-folder.active { background: rgba(3,170,251,.12); color: var(--accent); }
.mail-pill { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; line-height: 16px; }
.mail-list-bar { padding: 10px; border-bottom: 1px solid var(--border); }
.mail-list-bar input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--fg); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; }
.mail-msg-list { flex: 1; overflow: auto; }
.mail-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.mail-item:hover { background: var(--panel2); }
.mail-item.active { background: rgba(3,170,251,.12); }
.mi-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.mi-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-date { flex-shrink: 0; }
.mi-subject { font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-preview { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.mail-item.unread .mi-subject, .mail-item.unread .mi-from { font-weight: 700; color: var(--fg); }
.mail-reader { padding: 16px; }
.mail-reader-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); }
#readerBody { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#readerBody h2 { font-size: 18px; margin-bottom: 4px; }
.mail-reader-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; word-break: break-all; }
.mail-reader-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.mail-code { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--green); border-radius: 10px; background: rgba(34,208,122,.1); font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mail-code strong { font-family: ui-monospace, Consolas, monospace; font-size: 18px; letter-spacing: .08em; }
.mail-attachments { font-size: 12px; margin-bottom: 8px; }
.mail-muted { color: var(--muted); }
.mail-body-frame { flex: 1; width: 100%; border: 0; background: #fff; border-radius: 8px; min-height: 200px; }
.mail-body-text { flex: 1; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 14px/1.5 'Segoe UI', system-ui, sans-serif; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.mail-empty { padding: 20px 12px; color: var(--muted); font-size: 13px; text-align: center; }
.mail-modal { position: fixed; inset: 0; background: rgba(4,6,10,.62); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.mail-modal-box { width: 440px; max-width: 100%; max-height: 90vh; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.mail-modal-box.wide { width: 620px; }
.mail-modal-box h2 { margin-bottom: 10px; }
.mail-modal-box label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.mail-modal-box input, .mail-modal-box select, .mail-modal-box textarea { width: 100%; margin-top: 4px; background: var(--bg); border: 1px solid var(--border); color: var(--fg); border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 14px; }
.mail-modal-box textarea { resize: vertical; }
.mail-modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.mail-modal-actions .mail-msg { margin: 0 auto 0 0; }
.mail-hint { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.mail-addr-row { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.mail-addr-row input { margin-top: 0; }
.mail-suffix { color: var(--muted); font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }
.mail-done-row { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 8px; }
.mail-done-row code { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; color: var(--fg); font-size: 14px; user-select: all; }
.hidden { display: none !important; }
@media (max-width: 980px) {
  .mail-layout { grid-template-columns: 1fr; height: auto; }
  .mail-side, .mail-list { max-height: 320px; }
  .mail-reader { min-height: 420px; }
}
