/* Nexa Desk component styles. Colours, radii and shadows are ONLY token references
   (var(--...)). No literal hex, radius or shadow lives here — those belong in tokens.css.
   Font sizes are literal px and never drop below 11px (two documented exceptions:
   46px login wordmark, 16px command-palette input). */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--surface-0);
  color: var(--text-1);
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 18px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-2); text-decoration: none; }
a:hover { color: var(--brand); }
.nx-icon, .nx-flag { flex-shrink: 0; display: inline-flex; vertical-align: middle; }
.nx-flag { border-radius: var(--r-sm); box-shadow: var(--shadow-1); }

@keyframes nx-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes nx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* --- type helpers --- */
.label { font-weight: 600; font-size: 11px; line-height: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.h1 { font-weight: 600; font-size: 24px; line-height: 30px; color: var(--text-1); }
.h3 { font-weight: 600; font-size: 15px; line-height: 20px; color: var(--text-1); }
.muted { color: var(--text-3); }

/* --- buttons --- */
.btn { height: 36px; padding: 0 16px; border: none; border-radius: var(--r-md); font: 600 13px/1 Inter; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn-primary { background: var(--brand); color: var(--text-on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-press); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: var(--focus-ring); }
.btn-secondary { background: transparent; border: 1px solid var(--border-strong); color: var(--text-1); font-weight: 500; }
.btn-block { width: 100%; height: 44px; font-size: 14px; }

/* --- inputs --- */
.field-label { display: block; font: 400 13px/18px Inter; color: var(--text-2); margin-bottom: 6px; }
.input { width: 100%; height: 44px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 12px; color: var(--text-1); font: 400 14px/20px Inter; outline: none; }
.input:focus { border-color: var(--brand); box-shadow: var(--focus-ring-input); }
.input.is-error { border-color: var(--danger); }

/* --- login (S-01) --- */
.login { min-height: 100vh; display: flex; }
.login-brand { width: 58%; background: var(--panel-black); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 30px; padding: 56px; position: relative; }
.login-brand img { width: 236px; height: auto; display: block; }
.wordmark-1 { font-family: Archivo, sans-serif; font-weight: 800; font-size: 46px; letter-spacing: .01em; color: var(--brand); line-height: 1; } /* 46px: documented exception */
.wordmark-2 { font-family: Archivo, sans-serif; font-weight: 800; font-size: 18px; letter-spacing: .44em; color: var(--wordmark-muted); margin-top: 12px; padding-left: .44em; }
.login-brand .footprint { position: absolute; left: 56px; bottom: 44px; font: 400 12px/16px Inter; color: var(--text-3); }
.login-form-wrap { flex: 1; background: var(--surface-0); display: flex; justify-content: center; align-items: center; padding: 56px; }
.login-form { width: 360px; }
.alert-error { display: flex; gap: 10px; background: var(--danger-bg); border: 1px solid var(--danger); border-radius: var(--r-md); padding: 11px 12px; margin-bottom: 20px; font: 400 13px/18px Inter; color: var(--danger); }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: var(--text-2); font: 500 12px/1 Inter; cursor: pointer; padding: 6px 8px; border-radius: var(--r-sm); }
.pw-toggle:hover { color: var(--text-1); }
.code-cells { display: flex; gap: 10px; margin: 8px 0 26px; }
.code-cell { width: 48px; height: 56px; text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text-1); font: 600 24px/1 Inter; font-variant-numeric: tabular-nums; outline: none; }
.code-cell:focus { border-color: var(--brand); box-shadow: var(--focus-ring-input); }
.enroll-uri { word-break: break-all; font: 400 11px/16px Inter; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 18px; }

/* --- app shell (S-02) --- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--surface-1); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-logo { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.sidebar-logo img { height: 24px; width: auto; display: block; }
.sidebar-word-1 { font-family: Archivo, sans-serif; font-weight: 800; font-size: 13px; letter-spacing: .02em; color: var(--brand); }
.sidebar-word-2 { font-family: Archivo, sans-serif; font-weight: 800; font-size: 11px; letter-spacing: .34em; color: var(--wordmark-muted); margin-top: 3px; padding-left: .34em; }
.nav { flex: 1; overflow: auto; padding: 12px 10px; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 12px; border-radius: var(--r-md); margin: 1px 0; color: var(--text-2); font-size: 14px; line-height: 20px; }
.nav-item:hover { background: var(--surface-3); }
.nav-item.is-active { background: var(--brand-subtle); box-shadow: var(--nav-active-bar); color: var(--brand); }
.nav-item.is-active span { color: var(--text-1); font-weight: 500; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--border); position: relative; }
.topbar-title { font: 600 15px/20px Inter; color: var(--text-1); white-space: nowrap; }
.search-pill { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 400px; height: 34px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 8px 0 12px; cursor: pointer; color: var(--text-3); font: 400 13px/1 Inter; }
.search-pill:hover { border-color: var(--border-strong); }
.kbd { font: 600 11px/1 Inter; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px 5px; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--r-md); border: none; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-2); color: var(--text-1); }
.badge-count { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: var(--r-full); background: var(--brand); color: var(--text-on-brand); font: 600 11px/16px Inter; text-align: center; }
.avatar { width: 28px; height: 28px; border-radius: var(--r-full); background: var(--surface-3); border: 1px solid var(--border); color: var(--text-1); font: 600 11px/1 Inter; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-btn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 3px 6px 3px 3px; border-radius: var(--r-md); border: none; background: transparent; cursor: pointer; color: var(--text-1); font: 500 13px/1 Inter; }
.user-btn:hover { background: var(--surface-2); }
.menu { position: absolute; top: 52px; right: 16px; width: 240px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; z-index: 30; }
.menu-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.menu-role { display: inline-flex; margin-top: 8px; font: 600 11px/1 Inter; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px 7px; }
.menu-list { padding: 6px; }
.menu-list a { display: block; padding: 9px 10px; border-radius: var(--r-md); font: 400 14px/20px Inter; color: var(--text-1); }
.menu-list a:hover { background: var(--surface-3); }
.menu-sep { height: 1px; background: var(--border); }
.menu-danger { color: var(--danger); }
.menu-danger:hover { background: var(--danger-bg); }
.content { flex: 1; padding: 32px; }
.content-cap { max-width: 1440px; margin: 0 auto; }

/* --- generic surfaces --- */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-lg); }
.empty { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-1); padding: 56px 24px; text-align: center; }
.empty h3 { font: 600 15px/20px Inter; color: var(--text-1); margin: 0; }
.empty p { font: 400 12px/16px Inter; color: var(--text-3); margin: 6px 0 16px; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch a { flex: 1; text-align: center; font: 600 11px/1 Inter; padding: 7px 0; border-radius: var(--r-sm); color: var(--text-2); }
.lang-switch a.is-active { background: var(--brand-subtle); color: var(--brand); }
.lang-switch a:hover { background: var(--surface-3); }

/* --- command palette (⌘K) --- */
.palette-overlay { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding-top: 96px; z-index: 50; }
/* the hidden attribute must win over the flex display above, or the palette shows on load */
.palette-overlay[hidden], .menu[hidden], [data-palette][hidden], [data-menu][hidden] { display: none !important; }
.palette { width: 560px; max-width: 92vw; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; }
.palette-input { width: 100%; height: 52px; background: transparent; border: none; border-bottom: 1px solid var(--border); color: var(--text-1); font: 400 16px/1 Inter; padding: 0 16px; outline: none; } /* 16px: documented exception */
.palette-list { max-height: 320px; overflow: auto; padding: 8px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); color: var(--text-1); font: 400 14px/20px Inter; cursor: pointer; }
.palette-item.is-active, .palette-item:hover { background: var(--surface-3); }

/* --- deferred surface placeholder --- */
.deferred { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

/* --- responsive: 768 icon rail, 390 stacked + bottom bar --- */
@media (max-width: 1023px) {
  .sidebar { width: 64px; }
  .sidebar .nav-item { justify-content: center; padding: 0; }
  .sidebar-logo { justify-content: center; padding: 0; }
  .sidebar .nav-item span, .sidebar-word-1, .sidebar-word-2 { display: none; }
}
@media (max-width: 767px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: fixed; bottom: 0; top: auto; flex-direction: row; border-right: none; border-top: 1px solid var(--border); z-index: 40; }
  .sidebar-logo { display: none; }
  .nav { display: flex; padding: 0; }
  .nav-item { flex: 1; flex-direction: column; gap: 4px; height: 64px; font-size: 11px; }
  .content { padding: 16px 16px 88px; }
  .login { flex-direction: column; }
  .login-brand { width: 100%; }
  .login-form-wrap { padding: 24px; }
  .login-form { width: 100%; max-width: 360px; }
}
