/* Shared mode: sign-in screen, sync status, account box, and role-based controls. */
.trace-auth {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(circle at 70% -10%, #1c262b 0%, transparent 50%), #080d11;
  overflow: auto;
}
.trace-auth-card {
  width: min(400px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px 26px;
  background: linear-gradient(155deg, #151b20, #10161a);
  border: 1px solid #323c42;
  border-top: 2px solid #c6a252;
  border-radius: 10px;
  box-shadow: 0 20px 60px #0008;
  color: #e7ebee;
}
.trace-auth-card img {
  width: 220px;
  max-width: 100%;
  justify-self: center;
}
.trace-auth-card h1 {
  margin: 4px 0 0;
  font-size: 22px;
}
.trace-auth-sub {
  margin: -8px 0 4px;
  color: #a9b6be;
  font-size: 12px;
}
.trace-auth-card label {
  color: #b7c1c8;
}
.trace-auth-card [hidden] {
  display: none;
}
.trace-auth-msg {
  min-height: 18px;
  margin: 0;
  color: #f2c97a;
  font-size: 13px;
  line-height: 1.4;
}
.trace-auth-card .primary {
  width: 100%;
}
.trace-auth-links {
  display: grid;
  justify-items: center;
}
.trace-auth-card .text-link {
  padding: 6px;
}

.trace-sync-chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #4a565e;
  background: #182126;
  color: #c8d3d9;
  white-space: nowrap;
}
.trace-sync-chip::before {
  content: "●";
  margin-right: 6px;
}
.trace-sync-chip[data-state="live"] {
  border-color: #3b9865;
  color: #8be1aa;
}
.trace-sync-chip[data-state="syncing"],
.trace-sync-chip[data-state="connecting"] {
  border-color: #b78d3f;
  color: #f5d084;
}
.trace-sync-chip[data-state="offline"] {
  border-color: #b6575b;
  color: #ffadad;
}

.trace-account {
  display: grid;
  gap: 6px;
  margin: 14px 10px 0;
}
.trace-account .side-note {
  margin: 0 2px 2px;
}
.trace-account-name {
  display: grid;
  padding: 0 2px;
}
.trace-account-name strong {
  color: #eef2f4;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.trace-account-name small {
  color: #d6b45b;
  font-size: 11px;
}
.trace-account button {
  background: #151d22;
  border: 1px solid #344048;
  color: #d6e0e7;
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 12px;
  text-align: left;
}
.trace-account button:hover {
  background: #2a4558;
  color: #fff;
}

.trace-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 1100;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid #b78d3f;
  border-radius: 8px;
  background: #1a232a;
  color: #f2e4bd;
  font-size: 13px;
  box-shadow: 0 12px 40px #000a;
  transform: translate(-50%, 140%);
  transition: transform 0.25s;
}
.trace-toast.show {
  transform: translate(-50%, 0);
}

/* Restoring a backup would only replace this device's cache; admins upload to the shared database instead. */
.trace-shared #trace42Import {
  display: none;
}

/* OC/Ts see units, events, and the T&EO library read-only; TRACE admins manage them. */
.trace-oct #t18add,
.trace-oct [data-t18edit],
.trace-oct [data-t18archive],
.trace-oct [data-t18restore],
.trace-oct [data-t18delete],
.trace-oct [data-trace-teo-unit],
.trace-oct #trace23Drop,
.trace-oct #trace23Status,
.trace-oct [data-t23-remove] {
  display: none !important;
}
.trace-oct .trace18-top::after {
  content: "Managed by TRACE admins";
  font-size: 11px;
  letter-spacing: 0.6px;
  color: #a9b6be;
  border: 1px solid #3b474e;
  border-radius: 4px;
  padding: 7px 10px;
}

/* Accounts page (admins). */
.trace-acct-switch {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid #3b474e;
  border-radius: 8px;
  background: #151d22;
  font-weight: 400;
  margin-bottom: 18px;
  cursor: pointer;
}
.trace-acct-switch input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
  accent-color: #c6a252;
}
.trace-acct-switch strong {
  display: block;
  color: #eef2f4;
  font-size: 13px;
}
.trace-acct-switch small {
  display: block;
  margin-top: 4px;
  color: #a9b6be;
  font-size: 12px;
  line-height: 1.4;
}
.trace-acct-invite {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px auto;
  gap: 12px;
  align-items: end;
}
.trace-acct-list {
  display: grid;
  /* One set of columns for every row, so the badges line up even though each
     row's buttons differ in width (rows use subgrid to share them). */
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) auto;
  gap: 8px 14px;
  margin: 8px 0 12px;
}
.trace-acct-list > * {
  grid-column: 1 / -1;
}
.trace-acct-row {
  display: grid;
  grid-template-columns: subgrid;
  gap: 14px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid #343b43;
  border-radius: 8px;
  background: #13191e;
}
.trace-acct-row.off {
  opacity: 0.65;
}
.trace-acct-who strong {
  display: block;
  color: #eef2f4;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.trace-acct-who small,
.trace-acct-meta small {
  display: block;
  color: #a9b6be;
  font-size: 11px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.trace-acct-you {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.6px;
  color: #10161a;
  background: #c6a252;
  border-radius: 3px;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: 2px;
}
.trace-acct-badge,
.trace-acct-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border: 1px solid #66747d;
  border-radius: 4px;
  padding: 3px 7px;
  margin-right: 6px;
  color: #d8e1e7;
}
.trace-acct-badge.admin {
  border-color: #b78d3f;
  color: #f5d084;
}
.trace-acct-status.pending {
  border-color: #b78d3f;
  color: #f5d084;
}
.trace-acct-waiting {
  border-color: #806e44;
}
.trace-schema-warning {
  border-left-color: #b6575b;
}
.trace-schema-warning code {
  font-size: 12px;
}
.trace-nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #c6a252;
  color: #10161a;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  text-align: center;
}
.trace-nav-badge[hidden] {
  display: none;
}
.trace-acct-row.off .trace-acct-status {
  border-color: #b6575b;
  color: #ffadad;
}
.trace-acct-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.trace-acct-actions button {
  padding: 8px 11px;
  font-size: 12px;
}
@media (max-width: 850px) {
  .trace-acct-list,
  .trace-acct-row,
  .trace-acct-invite {
    grid-template-columns: minmax(0, 1fr);
  }
  .trace-acct-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 850px) {
  .trace-account {
    grid-template-columns: 1fr auto;
    align-items: center;
    margin: 10px 0 0;
  }
  .trace-account .side-note {
    display: none;
  }
}
/* Installed-app support (js/pwa.js). */
.trace-install {
  margin: 14px 10px 0;
}
.trace-install button {
  width: 100%;
  background: linear-gradient(90deg, #3c3420aa, #202427);
  border: 1px solid #6d5b35;
  color: #f2d07d;
  border-radius: 7px;
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}
.trace-install button:hover {
  border-color: #d5ac51;
}
.trace-update {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 1100;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px;
  border: 1px solid #b78d3f;
  border-radius: 8px;
  background: #1a232a;
  color: #f2e4bd;
  font-size: 13px;
  box-shadow: 0 12px 40px #000a;
}
.trace-update .primary {
  padding: 8px 14px;
}
@media (max-width: 850px) {
  .trace-install {
    margin: 10px 0 0;
  }
}
.trace-sync-chip[data-state="signin"] {
  border-color: #b6575b;
  color: #ffadad;
  cursor: pointer;
}

@media print {
  .trace-install,
  .trace-update,
  .trace-sync-chip,
  .trace-account,
  .trace-toast {
    display: none !important;
  }
}
