/* Barmouj KeyVault interface. Tokens live in tokens.css. */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink-night);
  color: var(--fog);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-lg);
}

p {
  margin: 0;
}

a {
  color: inherit;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

::selection {
  background: var(--brass);
  color: var(--brass-ink);
}

.icon {
  flex: none;
  width: 18px;
  height: 18px;
}

.muted {
  color: var(--fog-muted);
}

.mono {
  font-family: var(--font-mono);
}

.pad {
  padding: var(--s4);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.link {
  color: var(--brass-bright);
  text-decoration: underline;
  text-decoration-color: rgba(232, 188, 102, 0.4);
  text-underline-offset: 3px;
}

.link:hover {
  text-decoration-color: currentColor;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--fog-muted);
  font: inherit;
  font-size: var(--text-sm);
  text-decoration: underline;
  cursor: pointer;
}

/* ---- Brand ---------------------------------------------------------------- */

.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
}

.brand-words {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

.brand-product {
  margin-top: 3px;
  color: var(--brass);
  font-weight: 500;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}

/* ---- Buttons and controls ------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 40px;
  padding: 0 var(--s4);
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font: inherit;
  font-weight: 500;
  font-size: var(--text-md);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brass);
  color: var(--brass-ink);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brass-bright);
}

.btn-secondary {
  background: var(--gunmetal-2);
  border-color: var(--seam-strong);
  color: var(--fog);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--brass-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--fog-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gunmetal-2);
  color: var(--fog);
}

.btn-danger {
  background: var(--signal);
  color: #1b0a08;
  font-weight: 600;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--fog-muted);
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover {
  background: var(--gunmetal-3);
  color: var(--fog);
}

.icon-btn.is-primary {
  color: var(--brass);
}

.icon-btn.is-on {
  color: var(--brass);
}

.icon-btn.is-on .icon {
  fill: currentColor;
}

.input {
  width: 100%;
  min-height: 42px;
  padding: 9px var(--s3);
  border: 1px solid var(--seam-strong);
  border-radius: var(--r-control);
  background: var(--ink-night);
  color: var(--fog);
  font: inherit;
  font-size: var(--text-md);
}

.input::placeholder {
  color: var(--fog-faint);
}

.input:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-wash);
}

.input.mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.input-short {
  width: 110px;
}

.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

input[type="file"].input {
  padding: 8px;
}

input[type="file"].input::file-selector-button {
  margin-right: var(--s3);
  padding: 6px var(--s3);
  border: 1px solid var(--seam-strong);
  border-radius: 7px;
  background: var(--gunmetal-2);
  color: var(--fog);
  font: inherit;
  cursor: pointer;
}

.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--seam-strong);
  border-radius: var(--r-control);
  background: var(--ink-night);
}

.input-group:focus-within {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-wash);
}

.input-group .input {
  border: 0;
  background: transparent;
  box-shadow: none;
  min-width: 0;
}

.input-addon {
  display: grid;
  place-items: center;
  width: 42px;
  border: 0;
  border-left: 1px solid var(--seam);
  background: transparent;
  color: var(--fog-muted);
  cursor: pointer;
}

.input-addon:hover {
  color: var(--brass);
}

.with-unit {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fog-muted);
}

.form-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--fog-faint);
}

.form-error {
  padding: var(--s2) var(--s3);
  border-left: 3px solid var(--signal);
  border-radius: 4px;
  background: var(--signal-wash);
  color: #f2a79e;
  font-size: var(--text-sm);
}

.check {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--text-sm);
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--brass);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s3) var(--s4);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s2);
}

.actions-start {
  justify-content: flex-start;
}

.actions-spread {
  justify-content: space-between;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  margin-left: var(--s2);
  padding: 1px 8px;
  border-radius: var(--r-chip);
  background: var(--gunmetal-3);
  color: var(--fog-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  vertical-align: middle;
}

.chip-ok {
  background: var(--verdigris-wash);
  color: var(--verdigris);
}

.chip-warn {
  background: var(--brass-wash);
  color: var(--brass-bright);
}

.chip-danger {
  background: var(--signal-wash);
  color: var(--signal);
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--ink-night);
  border: 1px solid var(--seam);
}

.segment {
  padding: 6px var(--s3);
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fog-muted);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}

.segment[aria-checked="true"] {
  background: var(--gunmetal-3);
  color: var(--fog);
  box-shadow: inset 0 0 0 1px var(--seam-strong);
}

.slider {
  display: grid;
  grid-template-columns: 110px 1fr 44px;
  align-items: center;
  gap: var(--s3);
}

.slider input {
  accent-color: var(--brass);
}

.slider-label {
  font-size: var(--text-sm);
  color: var(--fog-muted);
}

.slider-value {
  font-family: var(--font-mono);
  text-align: right;
}

.option-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: var(--s3);
}

.meter {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.meter-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--seam);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0;
  background: var(--signal);
  transition: width 200ms var(--ease), background-color 200ms var(--ease);
}

.meter-fill[data-level="1"] { width: 25%; background: var(--signal); }
.meter-fill[data-level="2"] { width: 50%; background: var(--brass); }
.meter-fill[data-level="3"] { width: 78%; background: var(--verdigris); }
.meter-fill[data-level="4"] { width: 100%; background: var(--verdigris); }

.meter-label {
  min-width: 150px;
  font-size: var(--text-xs);
  color: var(--fog-muted);
  text-align: right;
}

/* Secrets: digits in verdigris, symbols in brass, letters in fog. */
.secret-text,
.value-secret {
  font-family: var(--font-mono);
  word-break: break-all;
}

.ch-d {
  color: var(--verdigris);
}

.ch-s {
  color: var(--brass-bright);
}

/* ---- Locked screens -------------------------------------------------------- */

.auth {
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--s6);
  min-height: 100dvh;
  padding: var(--s6) var(--s4);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(214, 162, 70, 0.08), transparent 60%),
    var(--ink-night);
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  width: min(440px, 100%);
  padding: var(--s8);
  border: 1px solid var(--seam);
  border-radius: var(--r-panel);
  background: var(--gunmetal);
}

.auth-title {
  font-size: var(--text-2xl);
}

.auth-lead {
  color: var(--fog-muted);
}

.auth-foot {
  max-width: 440px;
  color: var(--fog-faint);
  font-size: var(--text-xs);
  text-align: center;
}

.steps {
  margin: 0;
  padding-left: 1.3em;
  color: var(--fog-muted);
}

.steps li + li {
  margin-top: 4px;
}

.network-hint {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--text-xs);
  color: var(--fog-muted);
}

.network-hint[data-private="true"] .icon {
  color: var(--verdigris);
}

.pairing-code {
  display: flex;
  justify-content: center;
  gap: var(--s2);
}

.pairing-code span {
  display: grid;
  flex: 1 1 0;
  place-items: center;
  max-width: 48px;
  height: 60px;
  border: 1px solid var(--brass-deep);
  border-radius: 10px;
  background: var(--brass-wash);
  color: var(--brass-bright);
  font-family: var(--font-mono);
  font-size: 1.9rem;
  font-weight: 600;
}

.pairing-code span:nth-child(3) {
  margin-right: var(--s3);
}

.pairing-status {
  text-align: center;
  font-size: var(--text-sm);
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px var(--s4);
  margin: 0;
  font-size: var(--text-sm);
}

.facts dt {
  color: var(--fog-muted);
}

.facts dd {
  margin: 0;
}

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

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s6);
  height: 100dvh;
  padding: var(--s5) var(--s3);
  border-right: 1px solid var(--seam);
  background: var(--gunmetal);
  overflow-y: auto;
}

.sidebar > .brand {
  padding: 0 var(--s2);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-heading {
  padding: 0 var(--s3) var(--s2);
  color: var(--fog-faint);
  font-size: var(--text-xs);
  font-weight: 500;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 8px var(--s3);
  border-radius: var(--r-control);
  color: var(--fog-muted);
  text-decoration: none;
  font-size: var(--text-md);
}

.nav-item:hover {
  background: var(--gunmetal-2);
  color: var(--fog);
}

.nav-item[aria-current="page"] {
  background: var(--gunmetal-3);
  color: var(--fog);
}

.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brass);
}

.nav-item[aria-current="page"] .icon {
  color: var(--brass);
}

.nav-label {
  flex: 1;
}

.nav-count {
  color: var(--fog-faint);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-top: auto;
  padding: var(--s3) var(--s2) 0;
  border-top: 1px solid var(--seam);
}

.who {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.who strong {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who small {
  color: var(--fog-faint);
}

.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brass-wash);
  color: var(--brass-bright);
  font-weight: 600;
}

.content {
  min-width: 0;
}

.mobile-head,
.tabbar {
  display: none;
}

.main {
  min-height: 100dvh;
}

/* ---- Pages ------------------------------------------------------------------ */

.page {
  display: flex;
  flex-direction: column;
  gap: var(--s6);
  max-width: 880px;
  padding: var(--s8) var(--s8) var(--s12);
}

.page-narrow {
  max-width: 720px;
}

.page-head {
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.page-head p {
  margin-top: 4px;
}

.panel {
  padding: var(--s6);
  border: 1px solid var(--seam);
  border-radius: var(--r-panel);
  background: var(--gunmetal);
}

.section {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.section + .section {
  margin-top: var(--s6);
}

/* ---- Vault: list and detail ---------------------------------------------- */

.vault {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) var(--detail-width);
  min-height: 100dvh;
}

.list-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--seam);
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s6) var(--s6) var(--s4);
}

.list-title {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
}

.count {
  color: var(--fog-faint);
  font-variant-numeric: tabular-nums;
}

.search {
  position: relative;
  margin: 0 var(--s6) var(--s4);
}

.search > .icon {
  position: absolute;
  left: 12px;
  top: 12px;
  color: var(--fog-faint);
}

.search-input {
  padding-left: 40px;
  background: var(--gunmetal);
}

.rows {
  flex: 1;
  margin: 0;
  padding: 0 var(--s3) var(--s8);
  list-style: none;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding-right: var(--s2);
  border-radius: 10px;
}

.row:hover,
.row.is-selected {
  background: var(--gunmetal);
}

.row.is-selected {
  box-shadow: inset 0 0 0 1px var(--seam-strong);
}

.row-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
  padding: 10px var(--s3);
  color: inherit;
  text-decoration: none;
}

.row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.row-name {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-name .icon {
  width: 13px;
  height: 13px;
  color: var(--brass);
  fill: currentColor;
}

.row-sub {
  overflow: hidden;
  color: var(--fog-muted);
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 2px;
}

.row .quick-user {
  opacity: 0;
}

.row:hover .quick-user,
.row:focus-within .quick-user {
  opacity: 1;
}

.row .quick-copy {
  color: var(--brass);
}

.type-tile {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gunmetal-3);
  color: var(--fog-muted);
}

.type-tile-lg {
  width: 48px;
  height: 48px;
  border-radius: 13px;
}

.type-tile-lg .icon {
  width: 22px;
  height: 22px;
}

[data-type="login"] .type-tile,
.detail-head .type-tile {
  color: var(--brass-bright);
}

[data-type="ssh"] .type-tile,
[data-type="token"] .type-tile {
  color: var(--verdigris);
}

.rows-empty {
  list-style: none;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s12) var(--s6);
  text-align: center;
}

.empty img {
  opacity: 0.85;
}

.empty .actions {
  justify-content: center;
  margin-top: var(--s3);
}

.menu-anchor {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 6px;
  border-radius: 12px;
  background: var(--gunmetal-2);
  box-shadow: var(--shadow-float);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 9px var(--s3);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fog);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--gunmetal-3);
}

.detail-pane {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  height: 100dvh;
  padding: var(--s6);
  background: var(--gunmetal);
  overflow-y: auto;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: 100%;
  color: var(--fog-muted);
  text-align: center;
}

.detail-empty > .icon {
  width: 36px;
  height: 36px;
  margin-bottom: var(--s2);
  color: var(--seam-strong);
}

.detail-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.detail-title {
  flex: 1;
  min-width: 0;
}

.detail-title h2 {
  overflow-wrap: anywhere;
  font-size: var(--text-xl);
}

.detail-title .muted {
  font-size: var(--text-sm);
}

.detail-tools {
  display: flex;
}

.back-btn {
  display: none;
}

.fields {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--seam);
  border-radius: 12px;
  background: var(--ink-night);
}

.field {
  padding: var(--s3) var(--s4);
}

.field + .field {
  border-top: 1px solid var(--seam);
}

.field-label {
  margin-bottom: 2px;
  color: var(--fog-faint);
  font-size: var(--text-xs);
}

.field-body {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 36px;
}

.field-body-block {
  align-items: flex-start;
}

.value {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.value-block {
  max-height: 260px;
  overflow: auto;
}

.value-block pre {
  font-size: var(--text-xs);
}

.mask {
  color: var(--fog-muted);
  letter-spacing: 0.12em;
}

.mask-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fog-muted);
  font-size: var(--text-sm);
}

.mask-note .icon {
  width: 14px;
  height: 14px;
}

.field-actions {
  display: flex;
  flex: none;
}

.value-totp {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.totp-code {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--verdigris);
}

.totp-ring {
  --progress: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(var(--verdigris) calc(var(--progress) * 360deg), var(--seam) 0);
  color: var(--fog);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  mask: radial-gradient(circle, transparent 0 9px, #000 9.5px);
}

.totp-ring[data-low="true"] {
  background: conic-gradient(var(--signal) calc(var(--progress) * 360deg), var(--seam) 0);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.tags .chip {
  margin: 0;
}

.detail-foot {
  margin-top: auto;
  color: var(--fog-faint);
  font-size: var(--text-xs);
}

/* Large, character-by-character view for reading a secret aloud or typing it elsewhere. */
.large-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s6);
  padding: var(--s6);
  background: rgba(8, 11, 18, 0.96);
}

.large-label {
  color: var(--fog-muted);
}

.large-chars {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 1000px;
}

.large-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  padding: 6px 4px 4px;
  border-radius: 8px;
  background: var(--gunmetal);
  font-family: var(--font-mono);
  font-size: 2rem;
  line-height: 1.2;
}

.large-cell small {
  color: var(--fog-faint);
  font-size: 10px;
}

/* ---- Editor and generator -------------------------------------------------- */

.inline-actions {
  margin-top: var(--s2);
}

.generator {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.gen-result {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s4);
  border: 1px solid var(--seam);
  border-radius: 12px;
  background: var(--ink-night);
}

.gen-output {
  flex: 1;
  min-height: 2.2em;
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  line-height: 1.5;
  word-break: break-all;
}

.gen-actions {
  display: flex;
  flex-direction: column;
}

.gen-options {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

/* ---- Devices, people, activity --------------------------------------------- */

.pending-list {
  display: grid;
  gap: var(--s3);
}

.pending-card {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s4);
  border: 1px solid var(--brass-deep);
  border-radius: 12px;
  background: linear-gradient(var(--brass-wash), var(--brass-wash)), var(--gunmetal);
}

.pending-head {
  display: flex;
  gap: var(--s3);
}

.pending-head > .icon {
  margin-top: 3px;
  color: var(--brass);
}

.pending-head p {
  font-size: var(--text-sm);
}

.pending-approve {
  display: flex;
  gap: var(--s2);
}

.code-input {
  max-width: 160px;
  font-size: var(--text-lg);
  letter-spacing: 0.3em;
  text-align: center;
}

.devices,
.people {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--seam);
  border-radius: 12px;
  background: var(--gunmetal);
}

.device,
.person {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
}

.device + .device,
.person + .person {
  border-top: 1px solid var(--seam);
}

.device-text,
.person-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.device-text .muted,
.person-text .muted {
  font-size: var(--text-sm);
}

.device-name,
.person-name {
  font-weight: 500;
}

.device-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
}

.status {
  font-size: var(--text-xs);
  white-space: nowrap;
}

.status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-approved {
  color: var(--verdigris);
}

.status-pending {
  color: var(--brass);
}

.status-revoked {
  color: var(--signal);
}

.device[data-status="revoked"] .device-name,
.person[data-disabled="true"] .person-name {
  color: var(--fog-muted);
  text-decoration: line-through;
}

.activity {
  margin: 0;
  padding: 0;
  list-style: none;
}

.event {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 2px var(--s4);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--seam);
}

.event time {
  grid-row: span 2;
  color: var(--fog-faint);
  font-size: var(--text-sm);
}

.event .muted {
  font-size: var(--text-sm);
}

.event[data-alert="true"] .event-name {
  color: var(--signal);
}

/* ---- Clipboard fuse: the countdown before the clipboard is wiped ----------- */

.clip {
  position: fixed;
  left: 50%;
  bottom: var(--s6);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--s3);
  max-width: calc(100vw - 32px);
  padding: 10px var(--s3) 10px var(--s4);
  border-radius: var(--r-chip);
  background: var(--gunmetal-2);
  box-shadow: var(--shadow-float);
  transform: translateX(-50%);
  overflow: hidden;
  animation: clip-in 180ms var(--ease);
}

.clip > .icon {
  color: var(--brass);
}

.clip-text {
  overflow: hidden;
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-clear {
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--seam-strong);
  border-radius: var(--r-chip);
  background: transparent;
  color: var(--fog);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.clip-clear:hover {
  border-color: var(--brass);
}

.clip-fuse {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 2px;
}

.clip-burn {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--brass);
  box-shadow: 0 0 8px var(--brass);
  transform-origin: left center;
}

@keyframes clip-in {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}

/* ---- Toasts and modals ------------------------------------------------------ */

.toasts {
  position: fixed;
  top: var(--s5);
  right: var(--s5);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.toast {
  max-width: 360px;
  padding: 10px var(--s4);
  border-left: 3px solid var(--fog-muted);
  border-radius: 8px;
  background: var(--gunmetal-2);
  box-shadow: var(--shadow-float);
  font-size: var(--text-sm);
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}

.toast-success {
  border-left-color: var(--verdigris);
}

.toast-error {
  border-left-color: var(--signal);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--r-panel);
  background: var(--gunmetal);
  color: var(--fog);
  box-shadow: var(--shadow-float);
}

.modal-wide {
  width: min(620px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(5, 8, 14, 0.7);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) var(--s4) 0 var(--s6);
}

.modal-body {
  padding: var(--s4) var(--s6) var(--s6);
}

/* ---- Small screens ---------------------------------------------------------- */

@media (max-width: 1180px) {
  :root {
    --detail-width: 380px;
  }
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-head {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s3) var(--s4);
    border-bottom: 1px solid var(--seam);
    background: rgba(14, 20, 32, 0.92);
    backdrop-filter: blur(8px);
  }

  .mobile-head .brand-mark {
    width: 30px;
    height: 30px;
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--seam);
    background: var(--gunmetal);
  }

  .tabbar .nav-item {
    flex-direction: column;
    gap: 2px;
    padding: 6px 0;
    font-size: 11px;
  }

  .tabbar .nav-item[aria-current="page"]::before {
    display: none;
  }

  .tabbar .nav-count {
    display: none;
  }

  .main {
    min-height: auto;
    padding-bottom: 76px;
  }

  .vault {
    display: block;
    min-height: auto;
  }

  .list-pane {
    border-right: 0;
  }

  .list-head {
    padding: var(--s4) var(--s4) var(--s3);
  }

  .search {
    margin: 0 var(--s4) var(--s3);
  }

  .rows {
    padding: 0 var(--s2) var(--s6);
  }

  .row .quick-user {
    opacity: 1;
  }

  .detail-pane {
    display: none;
  }

  .vault.has-detail .list-pane {
    display: none;
  }

  .vault.has-detail .detail-pane {
    position: static;
    display: flex;
    height: auto;
    min-height: calc(100dvh - 140px);
    padding: var(--s4);
  }

  .back-btn {
    display: inline-grid;
  }

  .page {
    padding: var(--s5) var(--s4) var(--s10);
  }

  .panel {
    padding: var(--s4);
  }

  .auth-card {
    padding: var(--s6) var(--s5);
  }

  .clip {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .slider,
  .option-row {
    grid-template-columns: 90px 1fr 40px;
  }

  .option-row {
    grid-template-columns: 1fr;
  }

  .device,
  .person {
    flex-wrap: wrap;
  }

  .toasts {
    left: var(--s4);
    right: var(--s4);
  }
}

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