/* Layout idea: an iPhone-like home screen. Greeting + bell on top, a grid of big rounded app
   tiles (3 per row on a phone), a quieter admin row below that only admins see. */
:root {
  --bg: #eef1f6; --surface: #ffffff; --text: #161b26; --muted: #5d6677; --line: #dde2ea;
  --accent: #2557d6; --navy: #1f2a44; --danger: #d23b3b;
  --font-display: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c111c; --surface: #171e2c; --text: #e9edf4; --muted: #9aa4b6; --line: #273044;
          --accent: #6d95ff; --danger: #ff6b6b; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 var(--font-body);
       -webkit-text-size-adjust: 100%; }
main { max-width: 760px; margin: 0 auto;
       padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
                max(36px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
main.center { text-align: center; padding-top: max(14vh, env(safe-area-inset-top)); }
.logo { width: 96px; height: 96px; border-radius: 22px; }
h1 { font: 700 1.75rem/1.15 var(--font-display); margin: .4rem 0; text-wrap: balance; }
.muted { color: var(--muted); }
.msg { display: inline-block; max-width: 32rem; padding: .6rem .9rem; border-radius: 12px;
       background: rgba(210, 59, 59, .12); color: var(--danger); }

header { display: flex; align-items: center; gap: 12px; }
.hello { flex: 1; min-width: 0; }
.hello h1 { margin: 0; }
.hello p { margin: .15rem 0 0; color: var(--muted); min-height: 1.4em; }
.round { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
         background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
         position: relative; font: 600 1.05rem var(--font-display); padding: 0; }
a.round { text-decoration: none; box-sizing: border-box; }
.round svg { width: 22px; height: 22px; }
.round.me { background: var(--navy); color: #fff; border-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

h2 { font: 600 .8rem/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
     margin: 30px 4px 12px; }
h2 small { text-transform: none; letter-spacing: 0; font-weight: 400; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
        text-decoration: none; color: var(--text); padding: 4px 2px; border-radius: 22px; position: relative;
        -webkit-tap-highlight-color: transparent; }
.icon { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; color: #fff;
        background: var(--c, var(--navy)); box-shadow: 0 6px 16px -8px var(--c, var(--navy)),
        inset 0 1px 0 rgba(255,255,255,.25); transition: transform .15s ease; }
.icon svg { width: 38px; height: 38px; }
.tile:active .icon { transform: scale(.94); }
.name { font: 600 .95rem/1.2 var(--font-display); }
.status { font-size: .78rem; color: var(--muted); line-height: 1.25; min-height: 1.25em; }
.tile.soon .icon { background: var(--line); color: var(--muted); box-shadow: none; }
.tile.soon .name { color: var(--muted); }
.badge { position: absolute; top: 0; left: 50%; margin-left: 22px; font: 700 .62rem/1 var(--font-body);
         padding: 4px 6px; border-radius: 999px; background: var(--surface); color: var(--muted);
         border: 1px solid var(--line); letter-spacing: .03em; z-index: 1; }
.admin.grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.admin .icon { width: 60px; height: 60px; border-radius: 18px; }
.admin .icon svg { width: 30px; height: 30px; }
.admin .name { font-size: .85rem; }
.admin .badge { margin-left: 16px; }
.note, .empty { margin-top: 34px; font-size: .85rem; color: var(--muted); text-align: center; text-wrap: balance; }

.btn { display: inline-block; font: 600 1rem var(--font-body); padding: .65rem 1.1rem; border-radius: 12px;
       border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
       text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.big { font-size: 1.1rem; padding: .85rem 1.6rem; margin-top: 1.4rem; }
.btn.danger { color: var(--danger); }

dialog.sheet { width: 100%; max-width: 520px; margin: auto auto 0; border: 0; color: var(--text);
               background: var(--surface); border-radius: 22px 22px 0 0;
               padding: 22px 20px max(26px, env(safe-area-inset-bottom)); }
dialog.sheet::backdrop { background: rgba(8, 12, 20, .45); }
.sheet h3 { font: 700 1.3rem var(--font-display); margin: 0 0 .3rem; }
.sheet p { margin: .4rem 0; color: var(--muted); }
.sheet .actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; }
.sheet .actions form { margin: 0; }
@media (prefers-reduced-motion: reduce) { .icon { transition: none; } }

/* sign-in page and the Face ID offer */
.stack { display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.link { color: var(--accent); font-size: .95rem; text-decoration: none; padding: .4rem; }
.setup { margin-top: 22px; padding: 16px; border-radius: 18px; background: var(--surface);
         border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.setup p { margin: .2rem 0 0; color: var(--muted); }
.setup .msg { color: var(--danger); }
h2.plain { font: 700 1.1rem var(--font-display); text-transform: none; letter-spacing: 0; color: var(--text); margin: 0; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Frame pages (/tools/*): a Home bar above a full-height iframe of another same-site app. */
body:has(.tool) { margin: 0; overflow: hidden; }
.tool { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg, #fff); }
.toolbar { flex: none; display: flex; align-items: center; gap: 12px;
           padding: calc(env(safe-area-inset-top) + 6px) 14px 8px; border-bottom: 1px solid var(--line); }
.toolbar .back { font-weight: 600; text-decoration: none; color: inherit; padding: 6px 2px; }
.tool-title { font-weight: 600; }
.tool-pick { margin-left: auto; display: flex; gap: 10px; }
.tool-pick a { text-decoration: none; color: inherit; opacity: .6; }
.tool-pick a[aria-current] { opacity: 1; font-weight: 700; }
.tool iframe { flex: 1; width: 100%; border: 0; padding-bottom: env(safe-area-inset-bottom); }
.tool-hint { padding: 16px; text-align: center; opacity: .75; }

/* Connect the Jellyfin app (/watch/connect) */
.connect { padding-top: calc(env(safe-area-inset-top) + 8px); }
.toolbar.plain { border: 0; padding: 0 0 12px; }
.connect .code { font: 600 1.6rem ui-monospace, monospace; letter-spacing: .2em; text-align: center;
                 padding: .6rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
                 color: var(--text); width: 100%; box-sizing: border-box; }
.connect select { font: inherit; margin-left: .4rem; }
.msg.ok { color: #1a7f37; }
.connect .steps { padding-left: 1.2rem; line-height: 1.5; }
