/*
  Anubis Core layout — colors/fonts come from shared/theme (anubis_theme).
  Do not redefine --accent / --bg-* here; edit shared/theme instead.
*/

* { box-sizing: border-box; }

body.core-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.shell-inner,
.shell {
  max-width: min(1600px, calc(100vw - 2rem));
  margin: 0 auto;
  width: 100%;
}

.shell {
  flex: 1;
  padding: 1.25rem 1.25rem 2rem;
  padding-top: 4.5rem; /* clear sticky nav */
}

/* Sticky header — matches Edge site-nav behavior */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1020;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  /* Wordmark stays capitalized now that the display face is not small-caps. */
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand span {
  color: var(--accent);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
  align-items: center;
}

.nav a {
  color: var(--text-muted);
  font-weight: 500;
}

.nav a:hover,
.nav a.active {
  color: var(--accent);
  text-decoration: none;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown > summary {
  list-style: none;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  user-select: none;
}

.nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown > summary::after {
  content: " ▾";
  font-size: 0.75em;
  opacity: 0.8;
}

.nav-dropdown > summary:hover,
.nav-dropdown > summary.active,
.nav-dropdown.open-active > summary {
  color: var(--accent);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  min-width: 10.5rem;
  padding: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 0.15rem;
  z-index: 1100;
}

.account-menu .nav-dropdown-menu {
  right: 0;
  left: auto;
  min-width: 14rem;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.45rem 0.65rem;
  border-radius: 4px;
  color: var(--text-muted);
  text-decoration: none;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
  color: var(--accent);
  background: var(--bg-dark);
}

.account-menu-identity {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem 0.65rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px solid var(--border);
}

.account-menu-identity strong {
  color: var(--text);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-menu-logout {
  width: 100%;
  justify-content: flex-start;
  margin-top: 0.15rem;
  padding: 0.45rem 0.65rem;
  border-radius: 4px;
  text-align: left;
}

.profile-page {
  max-width: 36rem;
}

.profile-card {
  margin-bottom: 1.25rem;
}

.profile-dl {
  display: grid;
  gap: 0.85rem;
  margin: 0;
}

.profile-dl dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-dl dd {
  margin: 0.2rem 0 0;
  color: var(--text);
}

.profile-section h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.profile-section .lede {
  margin-bottom: 0.85rem;
}

.settings-card {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.settings-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  color: inherit;
}

/* Footer — matches Edge */
.site-footer {
  padding: 0.4rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  background: var(--bg-card);
  margin-top: auto;
}

.site-footer .logo-onyx {
  height: 26px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
}

h1, h2 {
  margin: 0 0 0.75rem;
}

.edge-kicker {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  max-width: 42rem;
}

.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1.75rem;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.stat .label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat .value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-top: 0.25rem;
  color: var(--text);
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.25rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.badge.ready,
.badge.open {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
}

.badge.provisioning,
.badge.in_progress {
  color: var(--warn);
  border-color: var(--warn);
  background: rgba(255, 193, 7, 0.1);
}

.badge.disabled,
.badge.closed {
  color: var(--text-muted);
}

.badge.health-active {
  color: var(--ok, #198754);
  border-color: var(--ok, #198754);
  background: rgba(25, 135, 84, 0.12);
}

.badge.health-stale {
  color: var(--warn);
  border-color: var(--warn);
  background: rgba(255, 193, 7, 0.12);
}

.badge.health-failed {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(199, 92, 92, 0.12);
}

.badge.health-unknown,
.badge.health-disabled {
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 4px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #0d0d0d;
}

.btn.primary:hover {
  background: var(--accent-dim);
  color: var(--text);
}

.btn.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn.ghost {
  background: transparent;
}

form.stack {
  display: grid;
  gap: 0.85rem;
  max-width: 32rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-dark);
  color: var(--text);
  border-radius: 4px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color-scheme: dark;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

/* Chrome autofill paints email white — keep dark theme */
input[type="email"]:-webkit-autofill,
input[type="email"]:-webkit-autofill:hover,
input[type="email"]:-webkit-autofill:focus,
input[type="text"]:-webkit-autofill,
input[type="password"]:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--bg-dark) inset;
  transition: background-color 99999s ease-out;
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

.errorlist {
  color: var(--danger);
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

/* Overlay toasts — do not push page content */
.flash-stack {
  position: fixed;
  top: 4.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  list-style: none;
  margin: 0;
  padding: 0;
  width: min(36rem, calc(100vw - 2rem));
  display: grid;
  gap: 0.5rem;
  pointer-events: none;
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.flash-stack.is-hiding {
  opacity: 0;
  transform: translateX(-50%) translateY(-0.5rem);
}

.flash-toast {
  pointer-events: auto;
  margin: 0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

/* Reusable confirm modal (never use window.confirm) */
.anubis-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  place-items: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.62);
}

.anubis-modal.is-open {
  display: grid;
}

.anubis-modal-panel {
  width: min(26rem, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.anubis-modal-title {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
}

.anubis-modal-body {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.anubis-modal-require {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1rem;
}

.anubis-modal-require label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.anubis-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-screen {
  position: relative;
  align-content: center;
  justify-items: center;
  padding-bottom: 5.5rem;
}

.auth-onyx-logo {
  position: absolute;
  left: 50%;
  bottom: 1.75rem;
  transform: translateX(-50%);
  height: 28px;
  width: auto;
  object-fit: contain;
  opacity: 0.92;
  pointer-events: none;
}

.login-card {
  width: min(420px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.75rem 1.5rem 1.5rem;
}

.login-card .brand {
  display: block;
  margin-bottom: 0.35rem;
}

.login-card .lede {
  margin-bottom: 1.25rem;
}

.login-card > .btn.primary,
.signed-out-actions .btn {
  display: flex;
  width: 100%;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

.login-card > .btn.primary {
  margin-bottom: 1rem;
}

/* Shared signed-out landing (Core + Edge post-logout redirect) */
.signed-out-wrap {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
    var(--bg-dark);
}

.signed-out-stack {
  width: min(440px, 100%);
  animation: signed-out-enter 0.55s ease-out both;
}

.signed-out-card {
  width: min(440px, 100%);
  text-align: center;
  animation: signed-out-enter 0.55s ease-out both;
}

.signed-out-mark {
  position: relative;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 1.1rem;
}

.signed-out-ring {
  position: absolute;
  inset: 0;
  border: 2px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 50%;
  animation: signed-out-ring 0.7s ease-out 0.15s both;
}

.signed-out-check {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 0.7rem;
  height: 1.15rem;
  border-right: 2.5px solid var(--accent);
  border-bottom: 2.5px solid var(--accent);
  transform: translate(-50%, -60%) rotate(45deg) scale(0);
  animation: signed-out-check 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.35s both;
}

.signed-out-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0.15rem 0 0.55rem;
  color: var(--text);
}

.signed-out-lede {
  margin-bottom: 1.35rem !important;
}

.signed-out-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

@keyframes signed-out-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes signed-out-ring {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes signed-out-check {
  from {
    opacity: 0;
    transform: translate(-50%, -60%) rotate(45deg) scale(0.4);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -60%) rotate(45deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .signed-out-stack,
  .signed-out-ring,
  .signed-out-check {
    animation: none !important;
  }

  .signed-out-check {
    transform: translate(-50%, -60%) rotate(45deg) scale(1);
  }
}

.comment {
  border-top: 1px solid var(--border);
  padding: 0.85rem 0;
}

.comment .meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.comment-internal {
  background: color-mix(in srgb, var(--warn) 12%, var(--bg-card));
  border-radius: var(--radius);
  padding: 0.85rem;
  border-top: none;
  margin: 0.5rem 0;
}

.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(15rem, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.ticket-attachments {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

@media (max-width: 820px) {
  .ticket-layout {
    grid-template-columns: 1fr;
  }
}

.empty {
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.install-copy-panel {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.install-copy-row {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.install-copy-row.compact {
  margin-top: 0;
  max-width: 36rem;
}

.install-copy-cmd {
  flex: 1;
  display: block;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-dark);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.82rem;
  line-height: 1.35;
}

.install-copy-row .btn {
  flex-shrink: 0;
  align-self: center;
}

dialog.edge-update-modal {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--text);
  max-width: 92vw;
}

dialog.edge-update-modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

dialog.edge-update-modal .panel {
  margin: 0;
}
