/* Layout: marketing site on a 1200px column; signed-in app = sidebar + work area. Brand from rpulse-web/styles.css, dark only by design. */
:root {
  --pulse-red: #FF3D5A;
  --pulse-soft: rgba(255, 61, 90, .14);
  --night: #0E0F13;
  --panel: #16181E;
  --panel-2: #1C1F27;
  --border: #22252E;
  --border-2: #2E323D;
  --ink: #F4F5F7;
  --muted: #A3A8B4;
  --faint: #6E7383;
  --link: #C9CDD6;
  --success: #4ADE80;
  --success-soft: rgba(74, 222, 128, .12);
  --warn: #FBBF24;
  --warn-soft: rgba(251, 191, 36, .13);
  --info: #FF8A9C;
  --info-soft: rgba(255, 138, 156, .13);
  --discord: #FF3D5A;                       /* Discord buttons use Pulse Red, not Discord blue */
  --discord-soft: rgba(255, 61, 90, .14);
  --av1: #FF3D5A; --av2: #F97316; --av3: #22C55E; --av4: #DC2626; --av5: #A855F7; --av6: #14B8A6;
  --radius: 12px;
  --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body {
  margin: 0; background: var(--night); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--ink); }
a:hover { color: var(--pulse-red); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--pulse-red); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
.container { max-width: 1200px; margin: 0 auto; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.example-flag { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--warn); }

/* Nav */
.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-block: 24px; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo svg { width: 36px; height: 36px; flex: none; }
.logo-text { font-size: 26px; font-weight: 700; letter-spacing: -1px; color: var(--ink); }
.logo-text .rp { color: var(--pulse-red); }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; font-weight: 500; }
.nav-links button.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--link); font-weight: 500; }
.nav-links button.link:hover { color: var(--pulse-red); }
.nav-links a:not(.btn) { color: var(--link); text-decoration: none; font-weight: 500; }
.nav-links a:not(.btn):hover { color: var(--pulse-red); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; text-decoration: none; font-weight: 700; border: 1px solid transparent; cursor: pointer; background: none; white-space: nowrap; }
.btn-primary { background: var(--pulse-red); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
.btn-ghost { border-color: var(--border-2); color: var(--ink); font-weight: 500; }
.btn-ghost:hover { border-color: var(--muted); color: var(--ink); }
.btn-discord { background: var(--discord); color: #fff; }
.btn-discord:hover { color: #fff; filter: brightness(1.1); }
.btn-lg { min-height: 52px; padding: 0 24px; border-radius: var(--radius); font-size: 17px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-warn { border-color: rgba(251,191,36,.4); color: var(--warn); font-weight: 500; }
.btn-warn:hover { background: var(--warn-soft); color: var(--warn); }
.btn-good { border-color: rgba(74,222,128,.4); color: var(--success); font-weight: 500; }
.btn-good:hover { background: var(--success-soft); color: var(--success); }
.btn-bad { border-color: rgba(255,61,90,.45); color: var(--pulse-red); font-weight: 500; }
.btn-bad:hover { background: var(--pulse-soft); color: var(--pulse-red); }

/* Hero */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 48px; padding-block: 72px 64px; }
.hero-copy { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.eyebrow { font-size: 15px; font-weight: 700; letter-spacing: 2px; color: var(--pulse-red); text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(40px, 6vw, 72px); font-weight: 700; letter-spacing: -2px; line-height: 1.02; }
.hero p { margin: 0; font-size: 20px; line-height: 1.5; color: var(--muted); max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.roster-card { flex: 1 1 360px; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.roster-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.roster-title { font-size: 18px; font-weight: 700; }
.live { font-size: 14px; font-weight: 700; color: var(--pulse-red); }
.live .dot { display: inline-block; animation: beat 1.4s ease-in-out infinite; }
@keyframes beat { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
.roster-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.roster-list li { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--night); }
.status { font-size: 14px; font-weight: 700; white-space: nowrap; }
.status.on { color: var(--success); }
.status.off { color: var(--muted); font-weight: 500; }
.pulse-line { width: 100%; height: 36px; }
.pulse-line polyline { stroke-dasharray: 420; stroke-dashoffset: 420; animation: draw 2.4s ease-out .2s forwards; }
@keyframes draw { to { stroke-dashoffset: 0 } }

.platforms { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; padding-block: 22px; border-block: 1px solid var(--border); color: var(--muted); font-weight: 500; }
.platforms strong { color: var(--ink); }

/* Sections */
.section { padding-block: 88px 0; display: flex; flex-direction: column; gap: 40px; }
.section-head { display: flex; flex-direction: column; gap: 14px; max-width: 44rem; }
.section-head h2 { margin: 0; font-size: clamp(30px, 4vw, 46px); letter-spacing: -1.2px; line-height: 1.08; }
.section-head p { margin: 0; color: var(--muted); font-size: 18px; }

.feature-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.feature-group { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 22px; }
.feature-group h3 { margin: 0; font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: var(--pulse-red); }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature svg { flex: none; width: 22px; height: 22px; margin-top: 2px; stroke: var(--ink); }
.feature b { display: block; font-size: 17px; }
.feature span { color: var(--muted); font-size: 15px; }

/* Clock-in demo */
.demo { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.console { background: #08090C; border: 1px solid var(--border); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.console-bar { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--faint); font-family: var(--mono); }
.console-out { padding: 16px; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; min-height: 210px; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; }
.console-out .c-cmd { color: var(--ink); }
.console-out .c-ok { color: var(--success); }
.console-out .c-info { color: var(--muted); }
.console-out .c-err { color: var(--warn); }
.console-out .c-tag { color: var(--pulse-red); font-weight: 600; }
.console-in { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.console-in input { flex: 1 1 160px; min-width: 0; background: var(--panel); border: 1px solid var(--border-2); border-radius: 8px; padding: 0 12px; min-height: 38px; font-family: var(--mono); font-size: 14px; }
.web-mirror { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.web-mirror .url { font-family: var(--mono); font-size: 12.5px; color: var(--faint); }
.shiftlog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.shiftlog li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); padding-block: 6px; border-bottom: 1px dashed var(--border); }
.shiftlog li b { color: var(--ink); font-weight: 500; }
.code { background: #08090C; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: var(--link); margin: 0; }
.code .k { color: var(--pulse-red); } .code .s { color: var(--success); } .code .c { color: var(--faint); }

/* Role sync */
.sync { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.ladder { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.ladder-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; transition: background .25s, border-color .25s; }
.ladder-row.current { background: var(--pulse-soft); border-color: rgba(255,61,90,.4); }
.ladder-row .lvl { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.role-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--discord-soft); color: #FFC2CC; font-size: 13px; font-weight: 500; white-space: nowrap; }
.role-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--discord); }
.discord-card { background: #1E1F22; border: 1px solid var(--border); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.discord-card .dc-user { display: flex; gap: 12px; align-items: center; }
.dc-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.sync-log { font-family: var(--mono); font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

/* Servers / docs */
.server-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.server-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.server-card .top { display: flex; align-items: center; gap: 12px; }
.server-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--panel-2); border: 1px dashed var(--border-2); display: grid; place-items: center; color: var(--faint); font-weight: 700; flex: none; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: .5px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border-2); white-space: nowrap; }
.tag.red { background: var(--pulse-soft); color: var(--pulse-red); border-color: transparent; }
.tag.green { background: var(--success-soft); color: var(--success); border-color: transparent; }
.tag.yellow { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.blue { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tag.discord { background: var(--discord-soft); color: #FFC2CC; border-color: transparent; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.step { border-top: 2px solid var(--pulse-red); padding-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.step .n { font-family: var(--mono); color: var(--pulse-red); font-size: 14px; }
.step h3 { margin: 0; font-size: 20px; }
.step p { margin: 0; color: var(--muted); }
.faq { display: flex; flex-direction: column; border-top: 1px solid var(--border); max-width: 820px; }
.faq details { border-bottom: 1px solid var(--border); padding-block: 18px; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 17px; }
.faq p { margin: 10px 0 0; color: var(--muted); }
/* Setup guide: a real sequence, so the steps are numbered */
.guide { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.g-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.g-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--pulse-soft); color: var(--pulse-red); font-family: var(--mono); font-weight: 600; font-size: 13px; }
.g-step h3 { margin: 2px 0 4px; font-size: 15.5px; letter-spacing: -.2px; }
.g-step p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.g-step p b { color: var(--ink); font-weight: 500; }
.g-step p a { color: var(--pulse-red); font-weight: 500; text-decoration: none; white-space: nowrap; }
.g-step p a:hover { text-decoration: underline; }
.g-where { display: block; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.g-where.red { color: var(--pulse-red); }
.g-path { font-family: var(--mono); font-size: 12px; color: var(--link); background: var(--night); padding: 1px 5px; border-radius: 5px; }
.try { display: flex; flex-direction: column; gap: 12px; }
.try-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--muted); font-size: 14px; }
.try-head b { color: var(--ink); font-size: 15px; }
.try .demo { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.try .console, .try .web-mirror { border-radius: 14px; }
.try .console-out { min-height: 112px; max-height: 140px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6; }
.try .console-in { padding: 10px; }
.try .web-mirror { padding: 14px 16px; gap: 10px; }
.try .roster-list li { padding: 10px 12px; font-size: 14px; }
.try .shiftlog { font-size: 13px; }
.support-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; max-width: 820px; padding: 22px 24px; border-radius: 16px; background: var(--discord-soft); border: 1px solid rgba(255, 61, 90, .35); }
.support-box h3 { margin: 0 0 4px; font-size: 19px; }
.support-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.support-box p { margin: 0; color: var(--link); max-width: 46ch; }
.cta-band { margin-top: 96px; background: var(--panel); border: 1px solid var(--border); border-radius: 22px; padding: 44px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.cta-band h2 { margin: 0; font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -1px; }
footer.site { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding-block: 40px; margin-top: 56px; border-top: 1px solid var(--border); color: var(--faint); font-size: 14px; }

/* App shell */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 0; min-height: 100vh; max-width: 1400px; margin: 0 auto; }
.side { border-right: 1px solid var(--border); padding: 20px 16px 20px 0; display: flex; flex-direction: column; gap: 20px; }
.server-switch { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); }
.server-switch .sv-ic { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--pulse-red), #8A1B2E); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.server-switch b { display: block; font-size: 14px; line-height: 1.2; }
.server-switch small { color: var(--faint); font-size: 12px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav .label { font-size: 11.5px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; font-weight: 700; }
.side-nav a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: var(--link); font-weight: 500; font-size: 15px; }
.side-nav a:hover { background: var(--panel); color: var(--ink); }
.side-nav a.active { background: var(--panel-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--pulse-red); }
.side-nav .count { font-size: 12px; font-family: var(--mono); color: var(--faint); }
.side-nav .count.live { color: var(--success); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); text-decoration: none; }
.me-chip b { display: block; font-size: 14px; line-height: 1.2; }
.me-chip small { color: var(--faint); font-size: 12px; }
.main { padding: 24px 0 64px 28px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { margin: 0; font-size: 32px; letter-spacing: -1px; line-height: 1.1; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: 14px; color: var(--faint); }
.crumbs a { color: var(--muted); text-decoration: none; }
.example-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.example-bar button { background: none; border: 0; color: var(--warn); text-decoration: underline; cursor: pointer; padding: 0; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-2); background: none; cursor: pointer; color: var(--link); font-weight: 500; font-size: 14px; display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { border-color: var(--muted); }
.tab.active { background: var(--ink); color: var(--night); border-color: var(--ink); }
.tab .k { font-size: 11px; font-weight: 700; opacity: .7; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .l { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 28px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .v.green { color: var(--success); }
.stat .v.yellow { color: var(--warn); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-body { padding: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
.rank-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.role-chip.sm { padding: 1px 8px; font-size: 12px; }
.role-chip.sm::before { width: 6px; height: 6px; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--panel-2); }
.who { display: flex; align-items: center; gap: 12px; }
.who b { display: block; font-weight: 500; }
.who small { color: var(--faint); font-size: 12.5px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; background: var(--av4); background-size: cover; background-position: center; position: relative; }
.avatar.lg { width: 88px; height: 88px; font-size: 30px; border: 4px solid var(--panel); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar .presence { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--panel); background: var(--faint); }
.avatar .presence.online { background: var(--success); }
.avatar .presence.ingame { background: var(--pulse-red); }
.av1 { background-color: var(--av1); } .av2 { background-color: var(--av2); } .av3 { background-color: var(--av3); } .av4 { background-color: var(--av4); } .av5 { background-color: var(--av5); } .av6 { background-color: var(--av6); }
.duty { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.duty::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.duty.on { color: var(--success); }
.duty.on::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.duty.off { color: var(--muted); font-weight: 500; }
.strike-pips { display: inline-flex; gap: 4px; }
.strike-pips i { width: 10px; height: 10px; border-radius: 3px; background: var(--border-2); }
.strike-pips i.w { background: var(--warn); }
.strike-pips i.s { background: var(--pulse-red); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-2); background: none; display: inline-grid; place-items: center; cursor: pointer; color: var(--link); }
.icon-btn:hover { border-color: var(--muted); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.warn:hover { color: var(--warn); border-color: var(--warn); }
.icon-btn.good:hover { color: var(--success); border-color: var(--success); }
.icon-btn.bad:hover { color: var(--pulse-red); border-color: var(--pulse-red); }

/* Member page */
.profile-hero { border-radius: 18px; overflow: hidden; background: var(--panel); border: 1px solid var(--border); }
.profile-hero .banner { height: 110px; background: linear-gradient(120deg, #3A0E18, var(--pulse-red) 70%, #FF8A9C); }
.profile-hero .banner.b-blue { background: linear-gradient(120deg, #0B1C3A, #3B82F6 70%, #9CC3FF); }
.profile-hero .banner.b-green { background: linear-gradient(120deg, #072B18, #22C55E 70%, #A7F3C4); }
.profile-hero .banner.b-violet { background: linear-gradient(120deg, #22093A, #A855F7 70%, #DDB8FF); }
.profile-hero .ph-body { padding: 0 22px 22px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.profile-hero .ph-id { display: flex; align-items: flex-end; gap: 16px; margin-top: -40px; min-width: 0; }
.profile-hero h1 { margin: 0; font-size: 28px; letter-spacing: -.6px; line-height: 1.1; }
.profile-hero .sub { color: var(--muted); font-size: 14.5px; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 18px; font-size: 14.5px; margin: 0; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; text-align: right; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; position: relative; }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .node { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 2px solid var(--border-2); font-size: 11px; font-weight: 700; }
.timeline .node.up { border-color: var(--success); color: var(--success); }
.timeline .node.down { border-color: var(--pulse-red); color: var(--pulse-red); }
.timeline .node.hire { border-color: var(--info); color: var(--info); }
.timeline b { font-weight: 500; }
.timeline small { display: block; color: var(--faint); font-size: 13px; }
.record { display: flex; flex-direction: column; gap: 10px; }
.record-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px; border-radius: 10px; background: var(--night); }
.record-item p { margin: 0; font-size: 14.5px; white-space: normal; }
.record-item small { color: var(--faint); font-size: 13px; }
.record-item.expired { opacity: .55; }
.empty { color: var(--faint); font-size: 14.5px; padding: 6px 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--pulse-red); }
.chart .bar.today { fill: var(--success); }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .future { fill: none; stroke: var(--border-2); stroke-dasharray: 3 3; }
.chart text { fill: var(--faint); font-family: var(--mono); font-size: 11px; }
.chart text.val { fill: var(--link); }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Activity */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); align-items: center; }
.feed li:last-child { border-bottom: 0; }
.feed .ev-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.feed .ev-ic svg { width: 18px; height: 18px; }
.ev-clock { background: var(--success-soft); color: var(--success); }
.ev-out { background: var(--panel-2); color: var(--muted); }
.ev-warn { background: var(--warn-soft); color: var(--warn); }
.ev-strike { background: var(--pulse-soft); color: var(--pulse-red); }
.ev-up { background: var(--success-soft); color: var(--success); }
.ev-down { background: var(--pulse-soft); color: var(--pulse-red); }
.ev-doc { background: var(--info-soft); color: var(--info); }
.feed p { margin: 0; font-size: 15px; }
.feed small { color: var(--faint); font-size: 13px; }
.feed time { color: var(--faint); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Documents */
.doc-row .doc-ic { width: 36px; height: 44px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--border-2); display: grid; place-items: center; font-size: 10px; font-weight: 700; font-family: var(--mono); color: var(--muted); flex: none; }
.dropzone { border: 1.5px dashed var(--border-2); border-radius: 14px; padding: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); }
.dropzone.over { border-color: var(--pulse-red); background: var(--pulse-soft); }

/* Chat */
.chat { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: min(680px, calc(100vh - 170px)); min-height: 460px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.chat-list .label { font-size: 11.5px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--faint); padding: 10px 8px 6px; font-weight: 700; }
.chat-list button { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--link); width: 100%; }
.chat-list button:hover { background: var(--panel-2); }
.chat-list button.active { background: var(--panel-2); color: var(--ink); }
.chat-list .hash { width: 28px; text-align: center; color: var(--faint); font-weight: 700; }
.chat-list .unread { margin-left: auto; background: var(--pulse-red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-top { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.chat-top b { font-size: 16px; }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
.msg .meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.msg .meta b { font-weight: 700; font-size: 15px; }
.msg .meta time { color: var(--faint); font-size: 12px; }
.msg p { margin: 2px 0 0; color: var(--link); overflow-wrap: anywhere; }
.msg.system { grid-template-columns: 1fr; }
.msg.system p { font-size: 13.5px; color: var(--muted); text-align: center; }
.composer { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.composer input { flex: 1; min-width: 0; background: var(--night); border: 1px solid var(--border-2); border-radius: 10px; padding: 0 14px; min-height: 44px; }
.typing { font-size: 13px; color: var(--faint); padding: 0 18px 6px; min-height: 20px; }

/* Friends */
.friend-list { display: flex; flex-direction: column; }
.friend { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.friend:last-child { border-bottom: 0; }
.friend b { display: block; font-weight: 500; }
.friend small { color: var(--faint); font-size: 13px; }
.friend small.ingame { color: var(--pulse-red); }
.friend small.online { color: var(--success); }
.friend .acts { display: flex; gap: 6px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select { background: var(--night); border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
.field textarea { min-height: 96px; resize: vertical; }
.field .hint { font-size: 12.5px; color: var(--faint); }
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 40px; height: 28px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatches button[aria-pressed="true"] { border-color: var(--ink); }
.sw-red { background: linear-gradient(120deg, #3A0E18, var(--pulse-red)); }
.sw-blue { background: linear-gradient(120deg, #0B1C3A, #3B82F6); }
.sw-green { background: linear-gradient(120deg, #072B18, #22C55E); }
.sw-violet { background: linear-gradient(120deg, #22093A, #A855F7); }
.char-list { display: flex; flex-direction: column; gap: 10px; }
.char { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px; border-radius: 10px; background: var(--night); flex-wrap: wrap; }

/* Modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(5, 6, 9, .72); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--border-2); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.modal h2 { margin: 0; font-size: 21px; }
.modal .m-sub { margin: -10px 0 0; color: var(--muted); font-size: 14.5px; }
.modal .m-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { min-height: 44px; border-radius: 10px; border: 1px solid var(--border-2); background: none; cursor: pointer; font-weight: 500; }
.seg button[aria-pressed="true"].w { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.seg button[aria-pressed="true"].s { border-color: var(--pulse-red); background: var(--pulse-soft); color: var(--pulse-red); }
.role-change { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border-radius: 10px; background: var(--night); font-size: 14px; }
.toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: var(--panel-2); border: 1px solid var(--border-2); border-left: 3px solid var(--success); border-radius: 10px; padding: 12px 16px; font-size: 14.5px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: rise .25s ease-out; }
@keyframes rise { from { transform: translateY(8px); opacity: 0 } }

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .sync { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { border-right: 0; border-bottom: 1px solid var(--border); padding: 14px 0; gap: 12px; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .side-nav .label { display: none; }
  .side-nav a { white-space: nowrap; }
  .side-nav a.active { box-shadow: inset 0 -2px 0 var(--pulse-red); }
  .side-foot { display: none; }
  .main { padding: 20px 0 48px; }
  .chat { grid-template-columns: minmax(0, 1fr); height: auto; }
  .chat-list { border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row; overflow-x: auto; max-height: none; }
  .chat-list .label { display: none; }
  .chat-list button { width: auto; white-space: nowrap; }
  .msgs { max-height: 420px; min-height: 300px; }
  .cta-band { padding: 28px; }
}
@media (max-width: 480px) {
  .stat .v { font-size: 24px; }
  .hero { padding-block: 48px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .pulse-line polyline { stroke-dashoffset: 0; }
}

/* ---------- language picker + Arabic (right-to-left) ---------- */
.lang-pick { display: inline-flex; }
.lang-select {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--link); background: transparent;
  border: 1px solid var(--border-2, #2E323D); border-radius: 8px; padding: 6px 8px; min-height: 36px; cursor: pointer;
}
.lang-select:hover { color: var(--ink); border-color: var(--muted); }
.lang-select option { background: var(--night); color: var(--ink); }
html[lang="ar"] body { font-family: 'IBM Plex Sans Arabic', 'Space Grotesk', system-ui, sans-serif; }
html[lang="ar"] * { letter-spacing: 0 !important; }
html[dir="rtl"] .mono, html[dir="rtl"] .console-in input, html[dir="rtl"] .web-mirror .url { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .console-out > div, html[dir="rtl"] .sync-log span { unicode-bidi: plaintext; text-align: start; }
html[dir="rtl"] .toasts { right: auto; left: max(16px, env(safe-area-inset-left, 0px)); }
html[dir="rtl"] .toast { border-left: 1px solid var(--border-2); border-right: 3px solid var(--success); }