/*
@module: SERVER.PHONE.STYLES
@layer: server
@feature: phone
@purpose: How the phone app looks: the dashboard's charcoal and blue, sized for a thumb, clear of the notch and home bar.
@risk: low
@tests: checked by eye on a phone-sized screen
*/
/* Outfit (SIL Open Font License), the same typeface as the dashboard. */
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 200 700; font-display: swap; src: url('/outfit-latin.woff2') format('woff2'); }

:root {
  --bg: #18191c; --bg-2: #1f2024; --panel: #26272b; --panel-2: #2e2f34; --stroke: rgba(255, 255, 255, 0.08); --stroke-strong: rgba(255, 255, 255, 0.16);
  --text-1: #f1f4ff; --text-2: #b0b3bc; --text-3: #80848e;
  --accent: #3b82f6; --accent-bright: #5eaaff; --accent-soft: rgba(59, 130, 246, 0.16);
  --up: #52d6ae; --warn: #f2a35f; --danger: #ff6f87;
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text-1); font: 400 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: left; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
#app { height: 100%; max-width: 560px; margin: 0 auto; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.boot { padding: calc(var(--top) + 40vh) 24px 0; text-align: center; color: var(--text-3); }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--stroke-strong); font-weight: 500; text-align: center; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.danger { color: #ffb3c0; border-color: rgba(255, 111, 135, 0.4); background: rgba(255, 111, 135, 0.08); }
.btn.sm { min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14.5px; }
.btn:disabled { opacity: 0.55; }
.btn:active { transform: scale(0.98); }
.link { color: var(--accent-bright); font-size: 14.5px; padding: 10px 4px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--text-2); }
.icon-btn:active { background: var(--panel); }
.fine { color: var(--text-3); font-size: 13px; line-height: 1.5; }
.fine.pad { padding: 4px 4px 12px; }
.fine b { color: var(--text-2); font-weight: 500; }
.error { color: #ffb3c0; font-size: 14.5px; }
.chip { display: inline-block; font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; margin-right: 7px; vertical-align: 1px; }
.chip.urgent { background: rgba(255, 111, 135, 0.16); color: #ffb3c0; }

/* ---------- Robots ---------- */
.bot { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--tint); }
.bot svg { width: 32px; height: 32px; }
.b-head { fill: #eef1f8; } .b-ant { fill: #c9cedb; } .b-face { fill: #14161d; } .b-eye, .b-tip { fill: var(--glow); }
.c-blue { --glow: #5eaaff; --tint: rgba(59, 130, 246, 0.18); }
.c-green { --glow: #52d6ae; --tint: rgba(82, 214, 174, 0.16); }
.c-violet { --glow: #b79bff; --tint: rgba(150, 120, 255, 0.17); }
.c-amber { --glow: #f7c08f; --tint: rgba(242, 163, 95, 0.16); }
.c-teal { --glow: #6fd8e6; --tint: rgba(80, 200, 220, 0.15); }
.c-pink { --glow: #ff9db0; --tint: rgba(255, 111, 135, 0.15); }

/* ---------- Before you are in: add to Home Screen, then the code ---------- */
.gate { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(var(--top) + 28px) 26px calc(var(--bottom) + 28px); text-align: center; }
.gate .logo { border-radius: 20px; margin-bottom: 6px; }
.gate h1 { font-size: 25px; font-weight: 500; line-height: 1.2; }
.gate > p { color: var(--text-2); max-width: 340px; }
.gate > p b { color: var(--text-1); font-weight: 500; }
.gate form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; margin-top: 8px; }
.gate input { height: 62px; border-radius: 16px; border: 1px solid var(--stroke-strong); background: var(--bg-2); text-align: center; font-size: 28px; font-weight: 500; letter-spacing: 0.14em; font-variant-numeric: tabular-nums; }
.gate input::placeholder { color: #4a4d55; }
.gate input.pin { -webkit-text-security: disc; letter-spacing: 0.35em; }
.gate label { display: flex; flex-direction: column; gap: 6px; color: var(--text-3); font-size: 13.5px; text-align: left; }
.gate input:focus { outline: 0; border-color: var(--accent-bright); box-shadow: 0 0 0 3px var(--accent-soft); }
.steps { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; text-align: left; margin: 6px 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--stroke); border-radius: 14px; padding: 13px 14px; color: var(--text-2); }
.steps li > span { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-bright); font-size: 14px; font-weight: 600; }
.steps b { color: var(--text-1); font-weight: 500; }
.steps .ic { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; color: var(--accent-bright); }

/* ---------- The app ---------- */
.shell { height: 100%; display: flex; flex-direction: column; }
.top { flex: none; display: flex; align-items: center; gap: 4px; padding: calc(var(--top) + 8px) 10px 8px 18px; background: var(--bg); border-bottom: 1px solid var(--stroke); }
.top h1 { flex: 1; font-size: 24px; font-weight: 500; letter-spacing: -0.01em; }
.top .icon-btn[data-act="back"] { margin-left: -12px; }
.strip { flex: none; padding: 8px 18px; background: rgba(242, 163, 95, 0.12); color: #f7c08f; font-size: 13px; }
.view { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px 24px; }
.tabs { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px 8px calc(var(--bottom) + 6px); background: var(--bg-2); border-top: 1px solid var(--stroke); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 5px; border-radius: 12px; color: var(--text-3); font-size: 11.5px; font-weight: 500; }
.tab.is-active { color: var(--accent-bright); }
.tab .count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-style: normal; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }

/* Notifications prompt */
.banner { display: flex; align-items: center; gap: 12px; padding: 13px 14px; margin-bottom: 14px; border-radius: 16px; background: var(--accent-soft); border: 1px solid rgba(94, 170, 255, 0.28); }
.banner > .ic { color: var(--accent-bright); }
.banner > div { flex: 1; min-width: 0; }
.banner b { display: block; font-weight: 500; font-size: 15px; }
.banner p { color: var(--text-2); font-size: 13.5px; line-height: 1.4; }

/* Messages */
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 6px; color: var(--text-3); font-size: 13.5px; }
.msgs { display: flex; flex-direction: column; gap: 8px; }
.msg { width: 100%; display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--stroke); }
.msg:active { background: var(--panel-2); }
.msg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.msg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.msg-top b { font-weight: 500; font-size: 14px; color: var(--text-2); }
.msg-top time { flex: none; color: var(--text-3); font-size: 12.5px; }
.msg-subject { font-size: 15.5px; line-height: 1.35; color: var(--text-2); overflow-wrap: anywhere; }
.msg-preview { color: var(--text-3); font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.msg.is-new { border-color: rgba(94, 170, 255, 0.4); background: linear-gradient(180deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.03)), var(--panel); }
.msg.is-new .msg-subject { color: var(--text-1); font-weight: 500; }
.msg.is-new .msg-top b::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 7px; border-radius: 50%; background: var(--accent-bright); }
.msg.is-urgent { box-shadow: inset 3px 0 var(--danger); }

.detail { padding: 4px 4px 0; }
.detail-from { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.detail-from b { display: block; font-weight: 500; }
.detail-from time { color: var(--text-3); font-size: 13px; }
.detail h2 { font-size: 21px; font-weight: 500; line-height: 1.3; margin: 6px 0 14px; overflow-wrap: anywhere; }
.detail-body { color: var(--text-2); font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 64px 26px; text-align: center; }
.empty .bot { width: 64px; height: 64px; border-radius: 20px; margin-bottom: 6px; }
.empty .bot svg { width: 46px; height: 46px; }
.empty h2 { font-size: 19px; font-weight: 500; }
.empty p { color: var(--text-3); max-width: 300px; }

/* Team */
.team { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; gap: 13px; align-items: flex-start; padding: 15px; border-radius: 16px; background: var(--panel); border: 1px solid var(--stroke); }
.card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card-main > b { font-weight: 500; font-size: 17px; }
.status { color: var(--text-3); font-size: 14px; display: flex; align-items: center; gap: 7px; }
.status.is-on { color: #8df0c4; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 4px rgba(82, 214, 174, 0.18); }
.meta { color: var(--text-3); font-size: 13px; }
.last { margin-top: 9px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--stroke); color: var(--text-2); font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.last small { display: block; color: var(--text-3); font-size: 12px; margin-bottom: 2px; }

/* Activity */
.log { border-radius: 16px; background: var(--panel); border: 1px solid var(--stroke); }
.log li { padding: 11px 14px; border-top: 1px solid var(--stroke); display: flex; flex-direction: column; gap: 1px; }
.log li:first-child { border-top: 0; }
.log li > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.log b { font-weight: 500; font-size: 14.5px; }
.log time { flex: none; color: var(--text-3); font-size: 12.5px; }
.log span { color: var(--text-2); font-size: 14px; }
.log small { color: var(--text-3); font-size: 13px; overflow-wrap: anywhere; }
.log li.is-refused span { color: #f7c08f; }
.log li.is-failed span { color: #ffb3c0; }

/* Settings sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(8, 8, 10, 0.62); z-index: 5; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; max-width: 560px; margin: 0 auto; padding: 8px 18px calc(var(--bottom) + 20px); border-radius: 22px 22px 0 0; background: var(--panel); border-top: 1px solid var(--stroke-strong); display: flex; flex-direction: column; gap: 4px; }
.sheet > header { display: flex; align-items: center; justify-content: space-between; margin-right: -8px; }
.sheet h2 { font-size: 19px; font-weight: 500; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--stroke); }
.row > div { flex: 1; min-width: 0; }
.row b { display: block; font-weight: 500; }
.row p { color: var(--text-3); font-size: 13.5px; line-height: 1.4; }
.notice { padding: 10px 12px; border-radius: 12px; background: var(--bg-2); color: var(--text-2); font-size: 14px; }
.sheet > .fine { padding-top: 10px; border-top: 1px solid var(--stroke); }

@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }
