/* ==========================================================================
   filipeapolinario · Portal de Aplicações
   ========================================================================== */

:root {
  --bg: #0a0b0d;
  --bg-raise: #111316;
  --surface: #15171b;
  --surface-hover: #1b1e23;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #e8e9ec;
  --text-dim: #a3a8b1;
  --text-mute: #6c717a;
  --accent: #f0b35a;
  --accent-soft: rgba(240, 179, 90, 0.14);
  --accent-glow: rgba(240, 179, 90, 0.55);
  --danger: #f07a6a;
  --ok: #7fd1a8;

  --font: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --dock-h: 28px;
  --dock-gap: 6px;
  --stage-gap: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(240, 179, 90, 0.05), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(120, 140, 170, 0.06), transparent 60%),
    var(--bg);
}

button,
input { font: inherit; color: inherit; }

button { cursor: pointer; background: none; border: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#i-more circle { fill: currentColor; stroke: none; }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 11px;
  line-height: 1;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Shell / views
   -------------------------------------------------------------------------- */

.shell { position: fixed; inset: 0; }

.desktop {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: calc(var(--dock-h) + var(--dock-gap) * 3 + var(--safe-b));
  transition: opacity 0.28s var(--ease), transform 0.36s var(--ease-out), visibility 0s linear 0s;
}

.desktop-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 40px) 0;
}

.stage {
  position: absolute;
  inset: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.18s var(--ease), visibility 0s linear 0.18s;
}

.shell[data-view="app"] .desktop {
  visibility: hidden;
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.3s var(--ease-out), visibility 0s linear 0.3s;
}

.shell[data-view="app"] .stage {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 0.24s var(--ease), transform 0.32s var(--ease-out), visibility 0s linear 0s;
}

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */

.desk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 7px);
  gap: 2px;
}

.brand-mark i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--text-mute);
}

.brand-mark i:first-child { background: var(--accent); }

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 8px 0 12px;
  min-width: min(320px, 55vw);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-mute);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.search-trigger span { flex: 1; text-align: left; }
.search-trigger:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); color: var(--text-dim); }

.hero { padding: clamp(40px, 9vh, 96px) 0 clamp(28px, 6vh, 56px); }

.hero-time {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(56px, 9vw, 96px);
  font-weight: 250;
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.hero-date {
  margin: 12px 0 0;
  color: var(--text-dim);
  font-size: 15px;
}

.hero-date::first-letter { text-transform: uppercase; }

.desk-section + .desk-section { margin-top: 36px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  min-height: 32px;
}

.section-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.catalog-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  font-size: 12px;
  color: var(--text-mute);
}

.catalog-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
}

.catalog-status[data-state="cloudflare"]::before { background: var(--ok); box-shadow: 0 0 8px rgba(127, 209, 168, 0.5); }
.catalog-status[data-state="static"]::before { background: var(--accent); }
.catalog-status[data-state="offline"]::before { background: var(--danger); }
.catalog-status[data-state="loading"]::before { animation: pulse 1.2s ease-in-out infinite; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.grid--compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-top: 12px; }

.empty {
  margin: 4px 0 0;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-m);
  color: var(--text-mute);
  text-align: center;
}

/* Tile ------------------------------------------------------------------- */

.tile {
  position: relative;
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
  animation: tile-in 0.42s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}

.tile:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.tile:active { transform: scale(0.99); }

.tile-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 12px 4px 12px 12px;
  text-align: left;
  border-radius: inherit;
}

.tile-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }

.tile-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--text);
}

.tile-name-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tile-host {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-running {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.tile-more {
  display: grid;
  place-items: center;
  width: 32px;
  margin: 8px 8px 8px 0;
  border-radius: var(--radius-s);
  color: var(--text-mute);
  opacity: 0;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}

.tile:hover .tile-more,
.tile:focus-within .tile-more,
.tile-more[aria-expanded="true"] { opacity: 1; }
.tile-more:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

@media (hover: none) {
  .tile-more { opacity: 1; }
}

.tile--hidden { opacity: 0.6; }
.tile--hidden:hover { opacity: 1; }

/* App icon --------------------------------------------------------------- */

.app-icon {
  --hue: 30;
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(160deg, hsl(var(--hue) 22% 22%), hsl(var(--hue) 18% 14%));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: hsl(var(--hue) 45% 82%);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  user-select: none;
}

.app-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 6px;
  object-fit: contain;
  background: #1a1d22;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.app-icon.has-img img { opacity: 1; }
.app-icon.has-img .app-icon-mono { visibility: hidden; }

.app-icon--sm { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }
.app-icon--sm img { padding: 4px; }
.app-icon--dock { width: 18px; height: 18px; border-radius: 4px; font-size: 8px; font-weight: 700; }
.app-icon--dock img { padding: 2px; }
.app-icon--lg { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; }
.app-icon--lg img { padding: 9px; }

/* Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-s);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.btn .ico { width: 16px; height: 16px; }
.btn-quiet { color: var(--text-dim); }
.btn-quiet:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--text-dim); text-decoration: none; }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.btn-primary { background: var(--accent); color: #1a1206; font-weight: 600; }
.btn-primary:hover { background: #f5c077; }

/* Hidden section --------------------------------------------------------- */

.desk-section--hidden summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  color: var(--text-mute);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
}

.desk-section--hidden summary::-webkit-details-marker { display: none; }

.desk-section--hidden summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s var(--ease);
}

.desk-section--hidden details[open] summary::before { transform: rotate(45deg); }
.desk-section--hidden summary:hover { color: var(--text-dim); }

/* --------------------------------------------------------------------------
   Stage / frames
   -------------------------------------------------------------------------- */

.frame-wrap {
  position: absolute;
  inset: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--bg-raise);
  box-shadow: none;
  border: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.18s var(--ease), visibility 0s linear 0.18s;
}

.frame-wrap.is-active {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.18s var(--ease), visibility 0s linear 0s;
}

.frame-wrap:fullscreen { border-radius: 0; }

.frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  color-scheme: normal;
}

.frame-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: var(--bg-raise);
  color: var(--text-dim);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0s linear 0.25s;
}

.frame-wrap.is-loading .frame-overlay {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.12s var(--ease), visibility 0s linear 0s;
}

.frame-msg { margin: 0; font-size: 13px; max-width: 360px; }

.frame-bar {
  width: 120px;
  height: 2px;
  border-radius: 2px;
  background: var(--line-strong);
  overflow: hidden;
}

.frame-bar::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: slide 1.1s var(--ease) infinite;
}

.frame-ext { visibility: hidden; opacity: 0; transition: opacity 0.2s var(--ease); }
.frame-wrap.is-slow .frame-ext { visibility: visible; opacity: 1; }
.frame-wrap.is-slow .frame-bar { display: none; }

/* --------------------------------------------------------------------------
   Dock
   -------------------------------------------------------------------------- */

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-gap) + var(--safe-b));
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 3px;
  height: var(--dock-h);
  max-width: calc(100vw - 20px);
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(14, 16, 20, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s var(--ease);
}

.shell[data-view="app"] ~ .dock {
  opacity: 0.35;
  bottom: 6px;
}

.shell[data-view="app"] ~ .dock:hover {
  opacity: 1;
  background: rgba(14, 16, 20, 0.92);
}

.dock-btn {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--text-dim);
  transition: background 0.12s var(--ease), color 0.12s var(--ease), transform 0.12s var(--ease);
}

.dock-btn .ico {
  width: 12px;
  height: 12px;
  stroke-width: 1.9;
}

.dock-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.dock-btn:active { transform: scale(0.92); }
.dock-btn--sm { width: 20px; height: 20px; border-radius: 5px; }
.dock-btn--sm .ico { width: 11px; height: 11px; }

.shell[data-view="desktop"] ~ .dock .dock-home { color: var(--accent); background: var(--accent-soft); }

.dock-apps {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 2px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dock-apps::-webkit-scrollbar { display: none; }

.dock-apps:not(:empty) {
  margin-left: 2px;
  padding-left: 5px;
  border-left: 1px solid var(--line);
}

.dock-apps:empty { display: none; }

.dock-item {
  position: relative;
  flex: none;
  animation: dock-item-in 0.2s var(--ease-out) both;
}

.dock-item.is-sleeping .app-icon { filter: saturate(0.4); opacity: 0.6; }

.dock-item::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-mute);
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s var(--ease), width 0.2s var(--ease);
}

.dock-item.is-loaded::after { opacity: 0.8; }

.dock-item.is-active::after {
  opacity: 1;
  width: 10px;
  border-radius: 1px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.dock-item.is-active .dock-btn { background: rgba(255, 255, 255, 0.08); }

.dock-close {
  position: absolute;
  top: -3px;
  right: -3px;
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2a2e35;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.12s var(--ease), transform 0.12s var(--ease), background 0.12s var(--ease);
}

.dock-close .ico { width: 7px; height: 7px; stroke-width: 2.8; }
.dock-item:hover .dock-close,
.dock-close:focus-visible { opacity: 1; transform: none; }
.dock-close:hover { background: var(--danger); color: #1a0d0b; border-color: transparent; }

@media (hover: none) {
  .dock-item.is-active .dock-close { opacity: 1; transform: none; }
}

.dock-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
  overflow: hidden;
  max-width: 130px;
  opacity: 1;
  transition: max-width 0.3s var(--ease-out), opacity 0.2s var(--ease), margin 0.3s var(--ease-out), padding 0.3s var(--ease-out);
}

.shell[data-view="desktop"] ~ .dock .dock-actions {
  max-width: 0;
  margin-left: 0;
  padding-left: 0;
  border-left-color: transparent;
  opacity: 0;
  pointer-events: none;
}

/* Tooltip ---------------------------------------------------------------- */

.tip {
  position: fixed;
  z-index: 70;
  padding: 5px 8px;
  border-radius: 6px;
  background: #23272e;
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.12s var(--ease), transform 0.12s var(--ease);
}

.tip.is-visible { opacity: 1; transform: translate(-50%, 0); }
.tip kbd { height: 16px; min-width: 16px; margin-left: 6px; font-size: 10px; }

/* --------------------------------------------------------------------------
   Launcher (Cmd+K)
   -------------------------------------------------------------------------- */

.launcher {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 14vh 16px 16px;
}

.launcher-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 8, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in 0.18s var(--ease) both;
}

.launcher-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(600px, 100%);
  max-height: 70vh;
  border-radius: 16px;
  background: rgba(22, 24, 28, 0.92);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: pop-in 0.24s var(--ease-out) both;
}

.launcher-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 56px;
  border-bottom: 1px solid var(--line);
  color: var(--text-mute);
}

.launcher-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.launcher-search input::placeholder { color: var(--text-mute); }

.launcher-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.launcher-group {
  padding: 10px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.launcher-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-dim);
}

.launcher-item[aria-selected="true"] { background: rgba(255, 255, 255, 0.06); color: var(--text); }

.launcher-item-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.launcher-item-name { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.launcher-item-name mark { background: none; color: var(--accent); }
.launcher-item-host { font-family: var(--mono); font-size: 11px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.launcher-cmd-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line);
}

.launcher-cmd-icon .ico { width: 15px; height: 15px; }

.badge {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-mute);
  border: 1px solid var(--line);
}

.badge--live { color: var(--accent); border-color: rgba(240, 179, 90, 0.3); background: var(--accent-soft); }

.launcher-empty { padding: 28px 12px; text-align: center; color: var(--text-mute); }

.launcher-foot {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--text-mute);
  font-size: 12px;
}

.launcher-foot span { display: inline-flex; align-items: center; gap: 4px; }
.launcher-foot kbd { height: 18px; min-width: 18px; font-size: 10px; }

@media (max-width: 560px) {
  .launcher { padding-top: 8vh; }
  .launcher-foot { display: none; }
}

/* --------------------------------------------------------------------------
   Context menu
   -------------------------------------------------------------------------- */

.menu {
  position: fixed;
  z-index: 50;
  min-width: 210px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(26, 28, 33, 0.96);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.75);
  animation: pop-in 0.16s var(--ease-out) both;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: left;
}

.menu-item .ico { width: 16px; height: 16px; color: var(--text-mute); }
.menu-item:hover,
.menu-item:focus-visible { background: rgba(255, 255, 255, 0.07); color: var(--text); outline: none; }
.menu-item:hover .ico,
.menu-item:focus-visible .ico { color: var(--text); }
.menu-item--danger:hover,
.menu-item--danger:focus-visible { background: rgba(240, 122, 106, 0.14); color: var(--danger); }
.menu-item--danger:hover .ico,
.menu-item--danger:focus-visible .ico { color: var(--danger); }

.menu-sep { height: 1px; margin: 5px 6px; background: var(--line); }

/* --------------------------------------------------------------------------
   Dialog
   -------------------------------------------------------------------------- */

.modal {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #16181c;
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}

.modal[open] { animation: pop-in 0.22s var(--ease-out) both; }

.modal::backdrop {
  background: rgba(5, 6, 8, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.modal h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.field em { font-style: normal; color: var(--text-mute); font-weight: 400; }

.field input {
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.field input::placeholder { color: var(--text-mute); }
.field input:focus { border-color: rgba(240, 179, 90, 0.6); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[aria-invalid="true"] { border-color: var(--danger); }

.form-error { margin: 0; font-size: 12px; color: var(--danger); }

.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.modal-actions .spacer { flex: 1; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h) + var(--dock-gap) * 2 + 8px + var(--safe-b));
  z-index: 60;
  padding: 8px 14px;
  border-radius: 10px;
  background: #23272e;
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  :root { --stage-gap: 0px; --dock-gap: 8px; --dock-h: 52px; }
  .frame-wrap { border-radius: 0; box-shadow: none; }
  .search-trigger { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .search-trigger span,
  .search-trigger kbd { display: none; }
  .grid { grid-template-columns: 1fr; }
  .dock { padding: 5px; }
  .dock-btn { width: 40px; height: 40px; }
  .dock-btn--sm { width: 34px; height: 34px; }
  .tile-host { display: none; }
}

/* --------------------------------------------------------------------------
   Lock Screen (Passkey Auth)
   -------------------------------------------------------------------------- */

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1000px 500px at 50% 35%, rgba(240, 179, 90, 0.08), transparent 70%), #0a0b0d;
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}

.lock-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 380px;
  width: 90%;
  padding: 36px 28px;
  border-radius: 20px;
  background: rgba(18, 20, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: pop-in 0.3s var(--ease-out) both;
}

.lock-badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--accent);
}

.lock-badge .ico {
  width: 24px;
  height: 24px;
}

.lock-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lock-desc {
  margin: 0 0 28px;
  font-size: 13px;
  color: var(--text-dim);
}

.lock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  background: var(--accent);
  color: #1a1206;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
  box-shadow: 0 4px 16px rgba(240, 179, 90, 0.25);
}

.lock-btn:hover {
  background: #f5c077;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(240, 179, 90, 0.35);
}

.lock-btn:active {
  transform: scale(0.98);
}

.lock-btn .ico {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.lock-status {
  margin: 16px 0 0;
  font-size: 12px;
  min-height: 18px;
  color: var(--text-mute);
}

.lock-status.is-error {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes tile-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, 16px); } }
@keyframes dock-item-in { from { opacity: 0; transform: scale(0.6); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pulse { 50% { opacity: 0.3; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
