/* CargoFL Secure — self-hosted styles only, no external fonts or assets. */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #d8dee6;
  --border-strong: #c2cbd6;
  --text: #16202b;
  --text-muted: #5d6b7a;
  --accent: #0b5fa5;
  --accent-hover: #094c85;
  --accent-contrast: #ffffff;
  --toolbar: #dfeadd;
  --toolbar-border: #c6d6c4;
  --ok-bg: #e6f6ea;
  --ok-border: #b7e3c2;
  --ok-text: #14532d;
  --info-bg: #e7f1fb;
  --info-border: #b9d6f2;
  --info-text: #10375c;
  --warn-bg: #fdf1e3;
  --warn-border: #f2d3a8;
  --warn-text: #7a4a10;
  --danger: #b3261e;
  --code-bg: #f2f4f7;
  --radius: 8px;
  --shadow: 0 1px 2px rgb(16 32 43 / 8%), 0 8px 24px rgb(16 32 43 / 8%);
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171d;
    --surface: #1a2027;
    --surface-2: #202832;
    --border: #2f3945;
    --border-strong: #3d4a58;
    --text: #e6ecf3;
    --text-muted: #9aa8b8;
    --accent: #4c9df0;
    --accent-hover: #6cb0f5;
    --accent-contrast: #08131f;
    --toolbar: #1f2a24;
    --toolbar-border: #2f3f34;
    --ok-bg: #16301f;
    --ok-border: #2c5c3a;
    --ok-text: #b5e8c4;
    --info-bg: #14283c;
    --info-border: #2a4b6d;
    --info-text: #bcd9f5;
    --warn-bg: #382a17;
    --warn-border: #6a5121;
    --warn-text: #f0d3a4;
    --danger: #f2776d;
    --code-bg: #151c24;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 35%);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Mode-driven visibility ---------------------------------------------------*/
/* `hidden` always wins: JS uses it for per-element state, the toolbar uses
   data-show for per-mode state, and the two must not fight. */
[hidden] {
  display: none !important;
}
[data-show] {
  display: none !important;
}
body[data-mode="editor"] [data-show~="editor"]:not([hidden]),
body[data-mode="view"] [data-show~="view"]:not([hidden]),
body[data-mode="sent"] [data-show~="sent"]:not([hidden]) {
  display: inline-flex !important;
}

/* Login-only minimal header ------------------------------------------------*/
/* The gate is visible only when the user is signed out, so hiding toolbar
   extras whenever the gate is shown keeps the login page header clean
   without touching any JavaScript. */
body:has(#gate:not([hidden])) .toolbar-inner > *:not(.brand) {
  display: none !important;
}
body:has(#gate:not([hidden])) .brand-suffix {
  display: none !important;
}
body:has(#gate:not([hidden])) .toolbar .progress {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* Toolbar ------------------------------------------------------------------*/
.toolbar {
  background: var(--toolbar);
  border-bottom: 1px solid var(--toolbar-border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  max-width: 1240px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  margin-right: 8px;
  white-space: nowrap;
}
.brand-logo {
  height: 30px;
  width: auto;
  display: block;
  flex: none;
}
.brand-suffix {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent);
  border-left: 1px solid var(--border-strong);
  padding-left: 9px;
  line-height: 1.1;
}
.brand:hover .brand-logo {
  filter: brightness(1.06);
}

.spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}
.btn-quiet {
  background: transparent;
  border-color: transparent;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-google {
  text-decoration: none;
}
.google-mark {
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 2px;
  padding: 1px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  padding: 6px 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.check input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
}

.field {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 10px;
  font: inherit;
  font-size: 14px;
  min-width: 190px;
}

.menu {
  position: relative;
}
.menu > summary {
  list-style: none;
  user-select: none;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu > summary::after {
  content: "▾";
  font-size: 11px;
  opacity: 0.7;
  margin-left: 2px;
}
.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-panel-wide {
  min-width: 280px;
  padding: 12px;
  gap: 10px;
}
.menu-panel-right {
  left: auto;
  right: 0;
}
.menu-item {
  appearance: none;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  padding: 7px 12px;
  cursor: pointer;
}
.menu-item:hover {
  background: var(--surface-2);
}
.menu-item[aria-checked="true"] {
  font-weight: 700;
  color: var(--accent);
}
.menu-item[aria-checked="true"]::before {
  content: "✓ ";
}

.link-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn.strong {
  font-weight: 600;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.stack input {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit;
}

/* Main ---------------------------------------------------------------------*/
main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.panel {
  margin-bottom: 16px;
}

.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--info-text);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.banner p {
  margin: 0 0 8px;
}
.banner p:last-child {
  margin-bottom: 0;
}
.banner-body {
  flex: 1;
  min-width: 0;
}
.banner-icon {
  flex: none;
  font-size: 16px;
  line-height: 1.5;
}
.banner-ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-text);
}
.banner-warn,
.banner-lock {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
}
.banner-attachment {
  background: var(--info-bg);
  border-color: var(--info-border);
}

.alert {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
}
.alert-error {
  border-color: color-mix(in srgb, var(--danger) 50%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.alert-ok {
  border-color: var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-text);
}

.link-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.link-row input[type="text"],
.link-row input[type="password"] {
  flex: 1 1 320px;
  min-width: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 13px;
}

.hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 6px 0 0;
}
.hint.warn {
  color: var(--warn-text);
}

/* Gate ---------------------------------------------------------------------*/
.gate {
  max-width: 620px;
  margin: 8vh auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.gate-logo {
  height: 40px;
  width: auto;
  margin: 0 auto 20px;
  display: block;
}
.gate h1 {
  font-size: 21px;
  margin: 0 0 10px;
}
.gate p {
  color: var(--text-muted);
  margin: 0 0 22px;
}
.gate .btn {
  font-size: 15px;
  padding: 10px 18px;
}

/* Gate split-screen -----------------------------------------------------*/
.gate-split {
  display: grid;
  grid-template-columns: 45% 55%;
  min-height: 100vh;
  max-width: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  text-align: left;
  animation: none;
}

.gate-split .gate-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 56px;
  background: var(--surface);
  color: var(--text);
}

.gate-split .gate-form {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.gate-split .gate-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 56px;
  align-self: flex-start;
}
.gate-split .gate-brand-logo {
  height: 34px;
  width: auto;
  display: block;
}
.gate-split .gate-brand-suffix {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

.gate-split .gate-form h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
.gate-split .gate-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 28px;
}
.gate-split .gate-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
}
.gate-split .gate-google .google-mark {
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 2px;
  padding: 1px;
}
.gate-split .gate-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 18px 0 0;
  line-height: 1.5;
}

.gate-split .gate-right {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  color: #fff;
  background: linear-gradient(150deg, #001C48 0%, #0B3D2E 100%);
  overflow: hidden;
}
.gate-split .gate-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(0, 28, 72, 0.92), rgba(6, 60, 50, 0.82) 55%, rgba(0, 28, 72, 0.95));
  pointer-events: none;
}
.gate-split .gate-hero-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08) 0, transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.06) 0, transparent 50%);
  pointer-events: none;
}
.gate-split .gate-hero-content {
  position: relative;
  z-index: 1;
  max-width: 460px;
}
.gate-split .gate-eyebrow {
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
  color: #fff;
}
.gate-split .gate-hero-content h2 {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.25;
  max-width: 420px;
  margin: 22px 0 14px;
  color: #fff;
}
.gate-split .gate-hero-text {
  font-size: 16px;
  line-height: 1.6;
  opacity: 0.9;
  max-width: 440px;
  margin: 0;
}
.gate-split .gate-stats {
  display: flex;
  gap: 32px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.gate-split .gate-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gate-split .gate-stats strong {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.gate-split .gate-stats span {
  font-size: 12px;
  opacity: 0.75;
  color: #fff;
}

@media (max-width: 900px) {
  .gate-split {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }
  .gate-split .gate-right {
    display: none;
  }
  .gate-split .gate-left {
    padding: 32px 24px;
  }
  .gate-split .gate-brand {
    margin-bottom: 32px;
  }
  .gate-split .gate-google {
    width: 100%;
    max-width: 320px;
  }
}

@media (prefers-color-scheme: dark) {
  .gate-split .gate-left {
    background: var(--surface);
    color: var(--text);
  }
}

/* Editor -------------------------------------------------------------------*/
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: -1px;
}
.tab {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-color: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 7px 16px;
  font: inherit;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
}
.tab.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}
.tab-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  padding-right: 4px;
}

#composer,
.preview {
  width: 100%;
  min-height: 46vh;
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  resize: vertical;
}
#composer:focus,
.preview:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.preview {
  overflow: auto;
  font-family: var(--sans);
  font-size: 15px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  font-size: 13px;
  max-width: 100%;
}
.attachment-size {
  color: var(--text-muted);
}
.chip-x {
  appearance: none;
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}
.chip-x:hover {
  color: var(--danger);
}

body.dragging::after {
  content: "Drop the file to attach it";
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 3px dashed var(--accent);
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  pointer-events: none;
}

/* Viewer -------------------------------------------------------------------*/
.content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
}
.content:empty {
  display: none;
}
.content pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.content.is-code {
  background: var(--code-bg);
}
.content h1,
.content h2,
.content h3 {
  margin-top: 1.2em;
  line-height: 1.3;
}
.content h1:first-child,
.content h2:first-child,
.content h3:first-child {
  margin-top: 0;
}
.content code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 1px 5px;
}
.content pre code {
  background: none;
  padding: 0;
}
.content table {
  border-collapse: collapse;
}
.content th,
.content td {
  border: 1px solid var(--border);
  padding: 6px 10px;
}
.content img {
  max-width: 100%;
  height: auto;
}
.content a {
  color: var(--accent);
}

#attachment-preview {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: var(--surface);
}

.raw {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 13.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 70vh;
  overflow: auto;
}

/* Discussion ---------------------------------------------------------------*/
.discussion {
  margin-top: 24px;
}
.discussion h2 {
  font-size: 16px;
  margin: 0 0 12px;
}
.comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.comment[data-reply="1"] {
  margin-left: 28px;
}
.comment-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.comment-author {
  font-weight: 600;
  color: var(--text);
}
.comment-badge {
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
}
.comment-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
}
.comment-form textarea,
.comment-actions input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
}
.comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.comment-actions input {
  flex: 1 1 220px;
}

/* Dialogs ------------------------------------------------------------------*/
dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 20px;
  max-width: min(560px, 92vw);
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: rgb(0 0 0 / 55%);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.dialog-head h2 {
  font-size: 16px;
  margin: 0;
}
#qr-canvas {
  display: block;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  max-width: 100%;
  height: auto;
}

.links-list {
  max-height: 60vh;
  overflow: auto;
  margin-top: 12px;
}
.link-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.link-item code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}
.link-item .meta {
  font-size: 12.5px;
  color: var(--text-muted);
  flex: 1 1 200px;
}

/* Sending: progress, spinner, sealing overlay ------------------------------*/
.progress {
  height: 3px;
  background: transparent;
  overflow: hidden;
}
.progress[hidden] {
  display: none !important;
}
.progress-bar {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: 0 3px 3px 0;
  background: transparent;
  visibility: hidden;
}

.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn.is-busy .btn-spinner {
  display: inline-block;
}
.btn.is-busy .btn-send-icon {
  display: none;
}
.btn-send {
  min-width: 132px;
  justify-content: center;
}
.btn-send-label {
  transition: opacity 0.18s ease;
}
.btn.is-sealed {
  background: var(--ok-text);
  border-color: var(--ok-text);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sealing {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(3px);
  animation: fade 0.2s ease both;
}
.sealing[hidden] {
  display: none !important;
}
.sealing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 30px 34px;
  min-width: 300px;
  text-align: center;
  animation: rise 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.sealing-lock {
  width: 58px;
  height: 66px;
  color: var(--accent);
  margin-bottom: 14px;
}
.sealing-lock .lock-shackle {
  transform-origin: 32px 30px;
  animation: shackle 1.6s ease-in-out infinite;
}
.sealing-lock .lock-body {
  animation: pulse-body 1.6s ease-in-out infinite;
}
.sealing.is-done .lock-shackle,
.sealing.is-done .lock-body {
  animation: none;
}

@keyframes shackle {
  0%,
  100% {
    transform: translateY(-7px) scaleY(1.18);
  }
  45%,
  70% {
    transform: translateY(0) scaleY(1);
  }
}
@keyframes pulse-body {
  0%,
  100% {
    opacity: 0.82;
  }
  55% {
    opacity: 1;
  }
}

.sealing-steps {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
}
.sealing-steps li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
  opacity: 0.45;
  transition: opacity 0.25s ease, color 0.25s ease;
}
.sealing-steps li::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid currentColor;
  flex: none;
  transition: background 0.25s ease;
}
.sealing-steps li[data-state="active"] {
  opacity: 1;
  color: var(--accent);
  font-weight: 600;
}
.sealing-steps li[data-state="active"]::before {
  animation: blip 0.9s ease-in-out infinite;
  background: var(--accent);
}
.sealing-steps li[data-state="done"] {
  opacity: 1;
  color: var(--ok-text);
}
.sealing-steps li[data-state="done"]::before {
  background: currentColor;
}
.sealing-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

@keyframes blip {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  }
  60% {
    box-shadow: 0 0 0 6px transparent;
  }
}

/* Result reveal ------------------------------------------------------------*/
.result .banner-ok {
  animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.seal-tick .seal-ring {
  stroke-dasharray: 64;
  stroke-dashoffset: 64;
  animation: draw 0.5s ease 0.05s forwards;
}
.seal-tick .seal-check {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  animation: draw 0.35s ease 0.42s forwards;
}
#share-link.is-fresh {
  animation: glow 1.5s ease 0.3s 2;
}
.flame {
  animation: flicker 2.4s ease-in-out infinite;
  transform-origin: center bottom;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 transparent;
    border-color: var(--border-strong);
  }
  40% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
    border-color: var(--accent);
  }
}
@keyframes flicker {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  30% {
    transform: scale(1.12) rotate(-4deg);
  }
  60% {
    transform: scale(0.96) rotate(3deg);
  }
}

.alert {
  animation: rise 0.25s ease both;
}

/* Audit trail --------------------------------------------------------------*/
.dialog-wide {
  max-width: min(1120px, 96vw);
  width: 1120px;
}
.tabs-inline {
  margin-bottom: 12px;
}
.audit-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.audit-filters .stack {
  gap: 4px;
}
.audit-filters select {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 14px;
  min-width: 160px;
}
.audit-scroll {
  max-height: 56vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.audit-table[hidden] {
  display: none !important;
}
.audit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 9px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}
.audit-table td {
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
  vertical-align: top;
}
.audit-table tbody tr:hover {
  background: var(--surface-2);
}
.audit-table code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}
.audit-when {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.audit-empty {
  padding: 26px;
  text-align: center;
  color: var(--text-muted);
}
.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.tag-create {
  color: var(--accent);
}
.tag-read {
  color: var(--info-text);
}
.tag-burn,
.tag-delete,
.tag-denied {
  color: var(--danger);
}
.tag-login,
.tag-comment {
  color: var(--text-muted);
}
.tag-live {
  color: var(--ok-text);
}
.tag-gone {
  color: var(--text-muted);
}
.tag-security {
  color: var(--warn-text);
}
.tag-admin-action {
  color: var(--accent);
}

/* Roles */
.tag-role-superadmin {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}
.tag-role-admin {
  color: var(--accent);
}
.tag-role-member {
  color: var(--text-muted);
}

.tab-super::after {
  content: "★";
  font-size: 10px;
  margin-left: 5px;
  vertical-align: super;
  color: var(--accent);
}
.audit-from {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.audit-from b {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.row-self {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.audit-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.audit-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}
.audit-footer .hint {
  flex: 1 1 320px;
  margin: 0;
}

/* Footer -------------------------------------------------------------------*/
.footer {
  border-top: 1px solid var(--border);
  padding: 18px 14px 28px;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.footer-logo {
  height: 24px;
  width: auto;
  opacity: 0.9;
}
.footer-version {
  font-variant-numeric: tabular-nums;
}
.footer-note {
  flex: 1 1 420px;
  min-width: 260px;
}

@media (max-width: 720px) {
  .toolbar-inner {
    gap: 5px;
    padding: 8px;
  }
  .field {
    min-width: 140px;
    flex: 1 1 140px;
  }
  .brand-suffix {
    display: none;
  }
  .brand-logo {
    height: 24px;
  }
  main {
    padding: 14px 10px 32px;
  }
  .menu-panel {
    left: auto;
    right: 0;
  }
  .audit-filters select {
    min-width: 130px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .seal-tick .seal-ring,
  .seal-tick .seal-check {
    stroke-dashoffset: 0;
  }
}
