/* =============================================================================
   safeshare.css
   Built on the GIP NOC dark-ui design system. Project-specific additions:
   topbar, login card, secret list, credential reveal, mobile overrides.
   ============================================================================= */


/* ── Design tokens ────────────────────────────────────────────────────── */
:root {
  --bg:      #0d0f14;
  --s1:      #161920;
  --s2:      #1e222d;
  --s3:      #252a38;
  --border:  #2a2f3d;

  --accent:  #e63946;
  --blue:    #457b9d;
  --text:    #e8eaf0;
  --muted:   #7a8099;
  --ok:      #2ec4b6;
  --warn:    #f4a261;

  --font:    'IBM Plex Sans', system-ui, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, monospace;
  --r:       6px;
  --ease:    0.16s ease;
}


/* ── Reset + base ────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: #7ab8d4; text-decoration: none; transition: var(--ease); }
a:hover { color: var(--text); }
strong { font-weight: 600; }


/* ── Section headers ─────────────────────────────────────────────────── */
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.sec-title { font-size: 17px; font-weight: 600; }


/* ── Stat cards ──────────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.stat-value { font-size: 22px; font-weight: 600; font-family: var(--mono); }
.stat-ok    { color: var(--ok); }
.stat-warn  { color: var(--warn); }
.stat-blue  { color: var(--blue); }
.stat-red   { color: var(--accent); }


/* ── Tables ──────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 8px 16px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--s2);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  white-space: nowrap;
}
td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.015); }


/* ── Forms ───────────────────────────────────────────────────────────── */
label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
input[type=text],
input[type=email],
input[type=number],
input[type=password],
input[type=date],
input[type=time],
input[type=datetime-local],
input[type=tel],
input[type=url],
input[type=search],
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;          /* prevents iOS zoom-on-focus */
  outline: none;
  transition: border-color var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
select option { background: var(--s2); }
textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
}
.form-group { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }


/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  transition: var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary       { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #c1121f; color: #fff; }

.btn-secondary       { background: var(--s2); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--blue); color: var(--text); }

.btn-danger       { background: rgba(230, 57, 70, 0.12); border-color: rgba(230, 57, 70, 0.3); color: var(--accent); }
.btn-danger:hover { background: rgba(230, 57, 70, 0.22); color: var(--accent); }

.btn-ok       { background: rgba(46, 196, 182, 0.12); border-color: rgba(46, 196, 182, 0.3); color: var(--ok); }
.btn-ok:hover { background: rgba(46, 196, 182, 0.22); color: var(--ok); }

.btn-sm   { padding: 6px 12px; min-height: 32px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }


/* ── Badges (status pills) ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-blue  { background: rgba(69, 123, 157, 0.15);  color: var(--blue); }
.badge-warn  { background: rgba(244, 162, 97, 0.15);  color: var(--warn); }
.badge-ok    { background: rgba(46, 196, 182, 0.15);  color: var(--ok); }
.badge-red   { background: rgba(230, 57, 70, 0.15);   color: var(--accent); }
.badge-muted { background: rgba(122, 128, 153, 0.15); color: var(--muted); }


/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 13px;
  border-radius: var(--r);
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid;
  line-height: 1.5;
  display: none;
}
.alert.show { display: block; }
.alert-error   { background: rgba(230, 57, 70, 0.10);  border-color: rgba(230, 57, 70, 0.25);  color: #ff8086; }
.alert-success { background: rgba(46, 196, 182, 0.10); border-color: rgba(46, 196, 182, 0.25); color: var(--ok); }
.alert-info    { background: rgba(69, 123, 157, 0.10); border-color: rgba(69, 123, 157, 0.25); color: #7ab8d4; }
.alert-warn    { background: rgba(244, 162, 97, 0.10); border-color: rgba(244, 162, 97, 0.25); color: var(--warn); }


/* ── Divider ─────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }


/* ── Utilities ───────────────────────────────────────────────────────── */
.mono       { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.text-ok    { color: var(--ok); }
.text-warn  { color: var(--warn); }
.text-red   { color: var(--accent); }
.text-blue  { color: var(--blue); }
.text-muted { color: var(--muted); }
.faded      { opacity: 0.5; }
.muted      { color: var(--muted); }
.faint      { color: var(--muted); font-size: 12px; }
.text-center { text-align: center; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 32px; }
.stack > * + * { margin-top: 14px; }


/* =============================================================================
   Safeshare-specific components
   ============================================================================= */


/* ── Topbar ──────────────────────────────────────────────────────────── */
.topbar {
  height: 50px;
  background: var(--s1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.topbar-brand:hover { color: var(--text); }
.brand-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}
.topbar-nav {
  display: flex;
  gap: 2px;
  margin-left: 12px;
  flex: 1;
  overflow-x: auto;
}
.nav-btn {
  padding: 6px 12px;
  border-radius: var(--r);
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  white-space: nowrap;
  transition: var(--ease);
}
.nav-btn:hover, .nav-btn.active {
  background: var(--s2);
  color: var(--text);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.user-chip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text);
}
@media (min-width: 700px) {
  .user-chip { display: inline-flex; }
}
.user-avatar-fallback {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}


/* ── Container ───────────────────────────────────────────────────────── */
.container {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
}
.container-wide { max-width: 1080px; }


/* ── Login page (anonymous landing) ──────────────────────────────────── */
.login-page {
  min-height: 100vh;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 55% 40% at 15% 85%, rgba(69,123,157,0.09) 0%, transparent 65%),
    radial-gradient(ellipse 45% 35% at 85% 15%, rgba(230,57,70,0.07) 0%, transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.login-header {
  padding: 28px 32px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--s1) 0%, #1a1d28 100%);
}
.login-logo { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 500; font-size: 12px;
  color: #fff; letter-spacing: -0.5px; flex-shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 600; color: var(--text); }
.logo-sub  {
  font-size: 11px; color: var(--muted); margin-top: 2px;
  font-family: var(--mono); letter-spacing: 0.4px; text-transform: uppercase;
}
.login-body { padding: 28px 32px; }
.login-body p { font-size: 13px; color: var(--muted); line-height: 1.55; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  min-height: 44px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: var(--r);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  transition: var(--ease);
}
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 6px rgba(0,0,0,0.2); color: #3c4043; }
.google-icon { width: 18px; height: 18px; flex-shrink: 0; }


/* ── Detail list (status page) ───────────────────────────────────────── */
.detail-list {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
}
.detail-list .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.detail-list .row:last-child { border-bottom: none; padding-bottom: 0; }
.detail-list .label {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  flex-shrink: 0;
}
.detail-list .value { color: var(--text); text-align: right; font-size: 13px; }


/* ── Secret list (dashboard) ─────────────────────────────────────────── */
.secret-list { display: grid; gap: 8px; }
.secret-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  transition: var(--ease);
}
.secret-row:hover { border-color: var(--blue); color: inherit; }
.secret-row .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.secret-row .meta .id { font-family: var(--mono); font-size: 12px; color: var(--text); }
.secret-row .meta .when { color: var(--muted); font-size: 11px; }
.secret-row .right { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.secret-row .views { color: var(--muted); font-family: var(--mono); font-size: 12px; }


/* ── Credential reveal box (recipient) ──────────────────────────────── */
.credential-box {
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
  white-space: pre-wrap;
  user-select: all;
  margin-bottom: 12px;
}

/* ── 6-digit verification code input ─────────────────────────────────── */
.code-inputs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 16px 0 8px;
}
.code-digit {
    width: 44px;
    height: 56px;
    text-align: center;
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 0;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color var(--ease), background-color var(--ease);
    -moz-appearance: textfield;
    caret-color: var(--accent);
}
.code-digit::-webkit-outer-spin-button,
.code-digit::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.code-digit:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--s3);
}
.code-digit:not(:placeholder-shown),
.code-digit[value]:not([value=""]) {
    border-color: var(--border);
}
@media (max-width: 380px) {
    .code-inputs { gap: 6px; }
    .code-digit { width: 38px; height: 50px; font-size: 20px; }
}

/* ── 6-digit verification code input (keypad-driven) ─────────────────── */
/* Note: this section appears later than the previous .code-inputs/.code-digit
   block and overrides it where the rules differ. */
.code-inputs {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 14px 0 8px;
}
.code-digit {
    width: 44px;
    height: 50px;
    text-align: center;
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 500;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color var(--ease), background-color var(--ease);
    caret-color: transparent;       /* readonly anyway, but suppress caret */
    cursor: default;
    user-select: none;
}
.code-digit.is-active {
    border-color: var(--blue);
    background: var(--s3);
}
@media (max-width: 380px) {
    .code-inputs { gap: 4px; }
    .code-digit { width: 38px; height: 46px; font-size: 20px; }
}

/* On-screen numeric keypad (kiosk-style) */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 18px;
}
.keypad-btn {
    height: 60px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    font-family: var(--font);
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--ease), border-color var(--ease), color var(--ease), transform 0.08s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    padding: 0;
}
.keypad-btn:hover {
    background: var(--s3);
}
.keypad-btn:active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
    transform: scale(0.97);
}
.keypad-btn.keypad-action {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}
.keypad-btn.keypad-action[data-action="backspace"] {
    font-size: 20px;
    color: var(--text);
}
@media (max-width: 380px) {
    .keypad { gap: 6px; }
    .keypad-btn { height: 54px; font-size: 20px; }
}

/* ── Specificity overrides for keypad UI ─────────────────────────────── */
/* The generic `input[type=text]` rule earlier in the file has specificity
   (0,0,1,1), which beat the previous `.code-digit` (0,0,1,0) rules. These
   selectors use `.code-inputs input.code-digit` to push specificity to
   (0,0,2,1), which wins cleanly. */

.code-inputs {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 14px 0 8px;
}
.code-inputs input.code-digit {
    width: 44px;
    height: 50px;
    min-height: 0;
    padding: 0;
    text-align: center;
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 500;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color var(--ease), background-color var(--ease);
    caret-color: transparent;
    cursor: default;
    user-select: none;
}
.code-inputs input.code-digit.is-active {
    border-color: var(--blue);
    background: var(--s3);
}
@media (max-width: 380px) {
    .code-inputs { gap: 4px; }
    .code-inputs input.code-digit { width: 38px; height: 46px; font-size: 20px; }
}

div.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 18px;
}
div.keypad button.keypad-btn {
    display: block;
    width: 100%;
    height: 60px;
    min-height: 0;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    font-family: var(--font);
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    transition: background-color var(--ease), border-color var(--ease), color var(--ease), transform 0.08s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
div.keypad button.keypad-btn:hover {
    background: var(--s3);
}
div.keypad button.keypad-btn:active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
    transform: scale(0.97);
}
div.keypad button.keypad-btn.keypad-action {
    font-size: 13px;
    color: var(--muted);
}
div.keypad button.keypad-btn.keypad-action[data-action="backspace"] {
    font-size: 20px;
    color: var(--text);
}
@media (max-width: 380px) {
    div.keypad { gap: 6px; }
    div.keypad button.keypad-btn { height: 54px; font-size: 20px; }
}

/* ============================================================================
   Upload UI (Phase 3b.3c)
   ============================================================================ */

.upload-zone {
    border: 1px dashed var(--border);
    background: var(--s1);
    border-radius: var(--r);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--ease), background var(--ease);
    outline: none;
}
.upload-zone:hover,
.upload-zone:focus {
    border-color: var(--blue);
    background: var(--s2);
}
.upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(230, 57, 70, 0.06);
}

.upload-zone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-zone-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--s2);
    color: var(--muted);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.upload-zone-text {
    font-size: 14px;
    color: var(--text);
}

.upload-zone-hint {
    font-size: 12px;
    color: var(--muted);
}

.upload-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-item {
    background: var(--s1);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        "info  actions"
        "bar   bar"
        "status status";
    gap: 6px 12px;
    align-items: center;
}

.upload-item-info {
    grid-area: info;
    min-width: 0;
}

.upload-item-name {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-item-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.upload-item-actions {
    grid-area: actions;
}

.upload-progress {
    grid-area: bar;
    height: 4px;
    background: var(--s3);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--blue);
    transition: width 0.12s linear;
}

.upload-item-status {
    grid-area: status;
    font-size: 11px;
    color: var(--muted);
    font-family: var(--mono);
}
.upload-item-status.status-ok  { color: var(--ok); }
.upload-item-status.status-err { color: #ff8086; }

/* Quota bar shown beneath the upload list */
.quota-bar-wrap {
    margin-top: 10px;
}

.quota-bar {
    height: 4px;
    background: var(--s3);
    border-radius: 2px;
    overflow: hidden;
}

.quota-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--ok);
    transition: width 0.2s ease;
}
.quota-bar-fill.over { background: var(--accent); }

.quota-bar-label {
    font-size: 11px;
    color: var(--muted);
    font-family: var(--mono);
    margin-top: 4px;
    text-align: right;
}

/* Mobile tweaks: drop the actions column under info if narrow */
@media (max-width: 480px) {
    .upload-item {
        grid-template-columns: 1fr;
        grid-template-areas:
            "info"
            "actions"
            "bar"
            "status";
    }
    .upload-item-actions {
        justify-self: end;
    }
}

/* Disabled submit button while uploads are in flight */
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ============================================================================
   Recipient file list (Phase 3b.5)
   ============================================================================ */

.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    background: var(--s1);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.file-item-info {
    min-width: 0;
    flex: 1 1 auto;
}

.file-item-name {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

@media (max-width: 480px) {
    .file-item {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ============================================================================
   <select> styling + side-by-side form rows (Phase 4a follow-up)
   ============================================================================ */

/* Native <select> is white-on-white in dark themes by default. Strip
   appearance and use the same surface tokens as input/textarea. The
   chevron is an inline SVG via data: URL — works under our CSP because
   img-src includes data:. */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--s2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 9px 36px 9px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    width: 100%;
    cursor: pointer;
    transition: border-color var(--ease), background-color var(--ease);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none' stroke='%238f95a3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 5 7 9 11 5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px 14px;
}

select:hover {
    border-color: var(--blue);
}

select:focus {
    outline: none;
    border-color: var(--blue);
    background-color: var(--s2);
}

/* The popup options list uses native OS rendering on most browsers and
   only honors a subset of CSS, but setting these helps where supported
   (e.g. Firefox respects them). */
select option {
    background: var(--s2);
    color: var(--text);
}

/* Side-by-side form rows. Used when two fields share a horizontal slot. */
.form-row {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 16px;
    align-items: start;
}

/* Inside a form-row, the contained .form-group's bottom margin still
   applies so the row spaces correctly from what follows. */
.form-row > .form-group {
    margin-top: 0;
}

/* Stack on narrow screens (mobile) for readability. */
@media (max-width: 560px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ============================================================================
   Mask segments + hover-reveal copy (Phase 4d)
   ============================================================================ */

/* The credential card is a positioning context for the floating copy button. */
.credential-card {
    position: relative;
    background: var(--s1);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px 16px;
}

/* The text container preserves whitespace so newlines render correctly. */
.credential-text {
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.55;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    /* Reserve space on the right so the long lines don't slide under the
       hover-revealed copy button. */
    padding-right: 28px;
}

/* Masked inline segment */
.masked {
    display: inline;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 1px 6px;
    margin: 0 1px;
}
.masked-display {
    color: var(--text);
    letter-spacing: 0.06em;
}
.masked.revealed .masked-display {
    letter-spacing: normal;
    color: var(--accent);
}

/* Buttons inside a masked segment (eye, copy) */
.mask-btn {
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    padding: 1px 3px;
    margin-left: 4px;
    vertical-align: middle;
    border-radius: 3px;
    transition: color var(--ease), background var(--ease);
}
.mask-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}
.mask-btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}
.mask-btn svg {
    display: inline-block;
    vertical-align: -2px;
}

/* Eye icon: show "open" by default, "off" when revealed (mirrors the action). */
.mask-eye .icon-eye-off { display: none; }
.masked.revealed .mask-eye .icon-eye { display: none; }
.masked.revealed .mask-eye .icon-eye-off { display: inline-block; }

/* Copy icon: swap to checkmark briefly after a successful copy. */
.mask-copy .icon-check { display: none; }
.mask-copy.copied .icon-copy { display: none; }
.mask-copy.copied .icon-check { display: inline-block; color: var(--ok); }

/* ---------- whole-message copy button (top-right floating) ---------- */

.msg-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    line-height: 0;
    transition: opacity 0.18s var(--ease), background var(--ease), color var(--ease);
}

/* Hover-discovered on mouse devices; always visible on touch. */
@media (hover: hover) {
    .msg-copy-btn { opacity: 0; pointer-events: none; }
    .credential-card:hover .msg-copy-btn,
    .credential-card:focus-within .msg-copy-btn {
        opacity: 0.7;
        pointer-events: auto;
    }
}
@media (hover: none) {
    .msg-copy-btn { opacity: 0.65; }
}

.msg-copy-btn:hover { opacity: 1 !important; background: var(--s2); color: var(--text); }
.msg-copy-btn:focus-visible {
    opacity: 1 !important;
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

/* Icon swap on copy */
.msg-copy-btn .icon-check { display: none; }
.msg-copy-btn.copied .icon-copy { display: none; }
.msg-copy-btn.copied .icon-check { display: block; color: var(--ok); opacity: 1 !important; }
.msg-copy-btn.copied { opacity: 1 !important; }

/* Inline <code> styling for hints (used in create.html mask hint) */
.hint code {
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0 4px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text);
}

/* ============================================================================
   4d follow-up: subject heading, hint, top-right action area, countdown timer
   ============================================================================ */

/* The subject line above the credential card. Matches the visual weight of
   a section heading without competing with the brand bar above. */
.reveal-subject {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 12px 0;
    word-break: break-word;
}

.files-heading {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

/* The credential-card already has padding; we override paddingTop slightly
   to make room for the floating action buttons at the top-right. */
.credential-card {
    position: relative;
    padding-top: 38px;
}

/* Top-right action area: eye + copy buttons, side-by-side. */
.msg-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 1;
}

.msg-action-btn {
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    line-height: 0;
    transition: opacity 0.18s var(--ease), background var(--ease), color var(--ease);
}

/* Hover-discovered on mouse devices; always visible on touch. */
@media (hover: hover) {
    .msg-action-btn { opacity: 0; pointer-events: none; }
    .credential-card:hover .msg-action-btn,
    .credential-card:focus-within .msg-action-btn {
        opacity: 0.7;
        pointer-events: auto;
    }
}
@media (hover: none) {
    .msg-action-btn { opacity: 0.65; }
}

.msg-action-btn:hover {
    opacity: 1 !important;
    background: var(--s2);
    color: var(--text);
}
.msg-action-btn:focus-visible {
    opacity: 1 !important;
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

/* Eye button icon swap: closed-eye when revealed. */
.msg-eye-btn .icon-eye-off { display: none; }
.msg-eye-btn.revealed .icon-eye { display: none; }
.msg-eye-btn.revealed .icon-eye-off { display: block; color: var(--accent); }
.msg-eye-btn.revealed { opacity: 1 !important; color: var(--accent); }

/* Copy button icon swap: checkmark briefly after a successful copy. */
.msg-copy-btn .icon-check { display: none; }
.msg-copy-btn.copied .icon-copy { display: none; }
.msg-copy-btn.copied .icon-check { display: block; color: var(--ok); opacity: 1 !important; }
.msg-copy-btn.copied { opacity: 1 !important; }

/* Hint paragraph: appears at the top of the credential card whenever the
   message contains [mask] segments, before the credential text itself. */
.mask-hint {
    font-size: 11px;
    color: var(--muted);
    margin: 0 60px 10px 0;       /* right margin so it doesn't slide under the buttons */
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
    line-height: 1.5;
}

/* Make sure credential-text doesn't reserve right padding for an inline
   button anymore — the action buttons live above it now. */
.credential-text {
    padding-right: 0;
}

/* Countdown timer line. Same baseline styling as the .faint paragraph that
   follows it; we just match font-size explicitly to keep them visually
   consistent regardless of where mt-3 lands. */
.purge-timer-line {
    font-size: 12px;
    margin-bottom: 0;
}
.purge-timer-line + .faint {
    margin-top: 0;
}
#purge-timer {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

/* ============================================================================
   4d button redesign — Reveal/Hide and Copy as a small button row above the
   message. Replaces the prior top-right floating icons.
   ============================================================================ */

/* Force pre-wrap on the credential text — guarantees that newlines submitted
   by staff render as line breaks in the recipient view. !important here is
   intentional: any later override would defeat the purpose. */
.credential-text {
    white-space: pre-wrap !important;
    word-break: break-word;
    padding-right: 0;
}

/* The credential card no longer needs top padding to clear floating icons. */
.credential-card {
    padding-top: 14px;
}

/* The action button row sits above the credential text, divider line below. */
.msg-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.msg-ctrl-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-family: inherit;
    line-height: 1.3;
    transition: color var(--ease), border-color var(--ease), background var(--ease);
}

.msg-ctrl-btn:hover {
    color: var(--text);
    border-color: var(--text);
    background: var(--s2);
}

.msg-ctrl-btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

/* Reveal button — toggle text via aria-pressed. */
.reveal-btn .lbl-hide { display: none; }
.reveal-btn[aria-pressed="true"] .lbl-show { display: none; }
.reveal-btn[aria-pressed="true"] .lbl-hide { display: inline; }
.reveal-btn[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

/* Copy button — toggle text via .copied. */
.copy-btn .lbl-copied { display: none; }
.copy-btn.copied .lbl-default { display: none; }
.copy-btn.copied .lbl-copied { display: inline; }
.copy-btn.copied {
    color: var(--ok);
    border-color: var(--ok);
}

/* ---- Override the previous top-right floating button behavior ----
   The prior CSS append set up .msg-actions absolute-positioned and
   hover-revealed buttons. The new template doesn't render that markup,
   so the rules become dead, but we explicitly hide any stragglers
   in case of cached/old templates. */
.msg-actions { display: none !important; }

/* The mask-hint is no longer rendered in this design. Hide it if it
   somehow appears (cached template, etc). */
.mask-hint { display: none !important; }

/* ============================================================================
   Reveal/Hide and Copy button row (final): uses standard .btn .btn-secondary
   classes, with state-based color overrides for revealed/copied.
   ============================================================================ */

/* Force pre-wrap on the credential text — safety net so newlines from staff
   input always render as line breaks regardless of any earlier override. */
.credential-text {
    white-space: pre-wrap !important;
    word-break: break-word;
    padding-right: 0;
}

.credential-card {
    padding-top: 14px;
}

/* Button row above the message. Buttons use the existing .btn .btn-secondary
   styling, sized down with .btn-sm. */
.msg-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

/* When the user clicks Reveal/Hide and masks are showing, give the button
   an accent color so the active state is obvious without changing its text. */
#reveal-btn.revealed {
    color: var(--accent);
    border-color: var(--accent);
}

/* When the copy succeeds, the button briefly becomes "ok"-colored. */
#copy-btn.copied {
    color: var(--ok);
    border-color: var(--ok);
}

/* Hide stale markup from earlier drops if templates somehow get cached. */
.msg-actions { display: none !important; }
.mask-hint   { display: none !important; }

/* ============================================================================
   Manual delete button + confirmation modal (Phase 4d)
   ============================================================================ */

.purge-now-row {
    margin-top: 6px;
}

/* Danger button: red border + red text. On hover, red wash. */
.btn-danger {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-danger:hover {
    background: rgba(230, 57, 70, 0.1);
    color: var(--accent);
    border-color: var(--accent);
}
.btn-danger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Modal ---------- */

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-backdrop.show {
    display: flex;
}

.modal-card {
    background: var(--s1);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 20px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text);
}

.modal-body {
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
    margin: 0 0 18px 0;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ============================================================================
   Center the action buttons (Phase 4d polish)
   ============================================================================ */

/* Reveal/Hide and Copy to Clipboard sit above the credential text. */
.msg-controls {
    justify-content: center;
}

/* Permanently Delete Now sits below the countdown line. */
.purge-now-row {
    display: flex;
    justify-content: center;
    margin-top: 6px;
}

/* ============================================================================
   Download All button (Phase 4d)
   ============================================================================ */

.download-all-row {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

/* ============================================================================
   Credential field label-row + Mask button
   ============================================================================ */

.credential-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    gap: 12px;
}

/* The label inside .credential-label-row shouldn't double up on
   bottom margin (the row container provides it). */
.credential-label-row label {
    margin-bottom: 0;
}

/* Small ghost-button used for in-form text-editor actions like Mask. */
.btn-text-action {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    line-height: 1.3;
    transition: color var(--ease), border-color var(--ease), background var(--ease);
    flex-shrink: 0;
}

.btn-text-action:hover {
    color: var(--text);
    border-color: var(--text);
    background: var(--s2);
}

.btn-text-action:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

/* ============================================================================
   Wider desktop layout + Message ID line
   ============================================================================ */

/* Bump max-widths so desktop has more room. Mobile responsiveness is
   preserved because width:100% (from existing rules) caps at the actual
   viewport when it's narrower than the max-width. */
.container {
    max-width: 960px;
}

.login-card {
    max-width: 720px;
}

/* On smaller screens make sure the recipient card breathes properly. */
@media (max-width: 640px) {
    .login-card {
        margin: 16px auto;
        padding: 22px;
    }
}

/* ---------- Message ID display on the reveal page ---------- */

.message-id-line {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin-top: 18px;
}

.message-id-value {
    font-family: var(--mono);
    color: var(--text);
    background: var(--s2);
    padding: 1px 6px;
    border-radius: 3px;
}

/* ============================================================================
   Auth/landing card (sign-in)
   ============================================================================ */

.auth-card {
    max-width: 460px;
    margin: 60px auto;
    background: var(--s1, #161616);
    border: 1px solid var(--border, #2b2b2b);
    border-radius: 8px;
    overflow: hidden;
}

.auth-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 26px;
    border-bottom: 1px solid var(--border, #2b2b2b);
    background: var(--s2, #1d1d1d);
}

.auth-card-logo {
    width: 44px;
    height: 44px;
    background: var(--accent, #e63946);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.6px;
    flex-shrink: 0;
    font-family: var(--mono, monospace);
}

.auth-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    line-height: 1.2;
}

.auth-card-subtitle {
    font-size: 11px;
    color: var(--muted);
    margin: 3px 0 0 0;
    letter-spacing: 1.4px;
    font-family: var(--mono, monospace);
}

.auth-card-body {
    padding: 26px;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 18px;
    background: #fff;
    color: #1f1f1f;
    border-radius: 6px;
    border: 1px solid #dadce0;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #1f1f1f;
}

.btn-google:focus-visible {
    outline: 2px solid var(--blue, #4f9eff);
    outline-offset: 2px;
}

.google-g {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.auth-card-footnote {
    margin: 18px 0 0 0;
    font-size: 11px;
    color: var(--muted);
    text-align: center;
}

.auth-card-footnote code {
    font-family: var(--mono, monospace);
    background: var(--s2);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--text);
}

@media (max-width: 540px) {
    .auth-card {
        margin: 30px 16px;
    }
}

/* ============================================================================
   Recipient error page — X (top-right) + Close button + fallback hint
   ============================================================================ */

.error-content {
    position: relative;
}

.close-x {
    position: absolute;
    top: -10px;
    right: -10px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: inherit;
    transition: color var(--ease), background var(--ease);
}

.close-x:hover {
    color: var(--text);
    background: var(--s2);
}

.close-x:focus-visible {
    outline: 2px solid var(--blue, #4f9eff);
    outline-offset: 1px;
}

.close-row {
    margin-top: 28px;
    display: flex;
    justify-content: center;
}

.close-hint {
    display: none;
    margin-top: 18px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    font-style: italic;
}

.close-hint.show {
    display: block;
}

.error-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ============================================================================
   Message Log dashboard — 6-column table
   ============================================================================ */

.dashboard-table-wrap {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dashboard-table thead th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    background: var(--s2);
    white-space: nowrap;
}

.dashboard-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.dashboard-table tbody tr:hover {
    background: var(--s2);
}

.dashboard-table .msg-id {
    font-family: var(--mono, monospace);
    color: var(--blue, #4f9eff);
    text-decoration: none;
    font-weight: 600;
}

.dashboard-table .msg-id:hover {
    text-decoration: underline;
}

.dashboard-table .xs {
    font-size: 11px;
    margin-top: 2px;
}

.dashboard-table .cell-recipient {
    word-break: break-all;
    max-width: 220px;
}

.dashboard-table .cell-subject {
    max-width: 280px;
    line-height: 1.35;
}

.dashboard-table .cell-ticket {
    font-family: var(--mono, monospace);
    font-size: 12px;
    color: var(--muted);
}

.dashboard-table .cell-views {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ============================================================================
   Status badges (Pending / Verified / Viewed / Failed / Expired)
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.4;
}

.badge-pending {
    background: rgba(180, 180, 180, 0.15);
    color: #b4b4b4;
}

.badge-verified {
    background: rgba(79, 158, 255, 0.18);
    color: #6dadff;
}

.badge-viewed {
    background: rgba(89, 219, 130, 0.15);
    color: #59db82;
}

.badge-failed {
    background: rgba(230, 57, 70, 0.20);
    color: #ff7a82;
}

.badge-expired {
    background: rgba(120, 120, 120, 0.15);
    color: #9a9a9a;
}

.badge-default {
    background: rgba(180, 180, 180, 0.12);
    color: var(--muted);
}

/* ============================================================================
   Activity timeline on Share Status page
   ============================================================================ */

.timeline-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 28px 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.event-timeline {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.event-row {
    display: grid;
    grid-template-columns: 170px 1fr 140px;
    gap: 14px;
    padding: 9px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    align-items: baseline;
}

.event-row:last-child {
    border-bottom: none;
}

.event-row.event-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    padding: 8px 4px;
    background: var(--s2);
}

.event-ts {
    color: var(--muted);
    font-family: var(--mono, monospace);
    font-size: 12px;
}

.event-label {
    font-weight: 500;
    color: var(--text);
}

.event-label.event-invalidated_brute_force,
.event-label.event-decrypt_failed {
    color: #ff7a82;
}

.event-label.event-expired {
    color: var(--muted);
}

.event-label.event-verified {
    color: #6dadff;
}

.event-label.event-viewed {
    color: #59db82;
}

.event-detail {
    color: var(--muted);
    font-size: 12px;
    margin-left: 6px;
}

.event-ip {
    font-family: var(--mono, monospace);
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

@media (max-width: 700px) {
    .event-row {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 10px 4px;
    }

    .event-row.event-header {
        display: none;
    }

    .event-ts,
    .event-ip {
        font-size: 11px;
    }
}

/* ============================================================================
   Auth/landing card (sign-in)
   ============================================================================ */

.auth-card {
    max-width: 460px;
    margin: 60px auto;
    background: var(--s1, #161616);
    border: 1px solid var(--border, #2b2b2b);
    border-radius: 8px;
    overflow: hidden;
}

.auth-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 26px;
    border-bottom: 1px solid var(--border, #2b2b2b);
    background: var(--s2, #1d1d1d);
}

.auth-card-logo {
    width: 44px;
    height: 44px;
    background: var(--accent, #e63946);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.6px;
    flex-shrink: 0;
    font-family: var(--mono, monospace);
}

.auth-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    line-height: 1.2;
}

.auth-card-subtitle {
    font-size: 11px;
    color: var(--muted);
    margin: 3px 0 0 0;
    letter-spacing: 1.4px;
    font-family: var(--mono, monospace);
}

.auth-card-body {
    padding: 26px;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 18px;
    background: #fff;
    color: #1f1f1f;
    border-radius: 6px;
    border: 1px solid #dadce0;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #1f1f1f;
}

.btn-google:focus-visible {
    outline: 2px solid var(--blue, #4f9eff);
    outline-offset: 2px;
}

.google-g {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.auth-card-footnote {
    margin: 18px 0 0 0;
    font-size: 11px;
    color: var(--muted);
    text-align: center;
}

.auth-card-footnote code {
    font-family: var(--mono, monospace);
    background: var(--s2);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--text);
}

@media (max-width: 540px) {
    .auth-card {
        margin: 30px 16px;
    }
}

/* ============================================================================
   Recipient error page — X (top-right) + Close button + fallback hint
   ============================================================================ */

.error-content {
    position: relative;
}

.close-x {
    position: absolute;
    top: -10px;
    right: -10px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: inherit;
    transition: color var(--ease), background var(--ease);
}

.close-x:hover {
    color: var(--text);
    background: var(--s2);
}

.close-x:focus-visible {
    outline: 2px solid var(--blue, #4f9eff);
    outline-offset: 1px;
}

.close-row {
    margin-top: 28px;
    display: flex;
    justify-content: center;
}

.close-hint {
    display: none;
    margin-top: 18px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    font-style: italic;
}

.close-hint.show {
    display: block;
}

.error-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ============================================================================
   Message Log dashboard — 6-column table
   ============================================================================ */

.dashboard-table-wrap {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dashboard-table thead th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    background: var(--s2);
    white-space: nowrap;
}

.dashboard-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.dashboard-table tbody tr:hover {
    background: var(--s2);
}

.dashboard-table .msg-id {
    font-family: var(--mono, monospace);
    color: var(--blue, #4f9eff);
    text-decoration: none;
    font-weight: 600;
}

.dashboard-table .msg-id:hover {
    text-decoration: underline;
}

.dashboard-table .xs {
    font-size: 11px;
    margin-top: 2px;
}

.dashboard-table .cell-recipient {
    word-break: break-all;
    max-width: 220px;
}

.dashboard-table .cell-subject {
    max-width: 280px;
    line-height: 1.35;
}

.dashboard-table .cell-ticket {
    font-family: var(--mono, monospace);
    font-size: 12px;
    color: var(--muted);
}

.dashboard-table .cell-views {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ============================================================================
   Status badges (Pending / Verified / Viewed / Failed / Expired)
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.4;
}

.badge-pending {
    background: rgba(180, 180, 180, 0.15);
    color: #b4b4b4;
}

.badge-verified {
    background: rgba(79, 158, 255, 0.18);
    color: #6dadff;
}

.badge-viewed {
    background: rgba(89, 219, 130, 0.15);
    color: #59db82;
}

.badge-failed {
    background: rgba(230, 57, 70, 0.20);
    color: #ff7a82;
}

.badge-expired {
    background: rgba(120, 120, 120, 0.15);
    color: #9a9a9a;
}

.badge-default {
    background: rgba(180, 180, 180, 0.12);
    color: var(--muted);
}

/* ============================================================================
   Activity timeline on Share Status page
   ============================================================================ */

.timeline-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 28px 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.event-timeline {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.event-row {
    display: grid;
    grid-template-columns: 170px 1fr 140px;
    gap: 14px;
    padding: 9px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    align-items: baseline;
}

.event-row:last-child {
    border-bottom: none;
}

.event-row.event-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    padding: 8px 4px;
    background: var(--s2);
}

.event-ts {
    color: var(--muted);
    font-family: var(--mono, monospace);
    font-size: 12px;
}

.event-label {
    font-weight: 500;
    color: var(--text);
}

.event-label.event-invalidated_brute_force,
.event-label.event-decrypt_failed {
    color: #ff7a82;
}

.event-label.event-expired {
    color: var(--muted);
}

.event-label.event-verified {
    color: #6dadff;
}

.event-label.event-viewed {
    color: #59db82;
}

.event-detail {
    color: var(--muted);
    font-size: 12px;
    margin-left: 6px;
}

.event-ip {
    font-family: var(--mono, monospace);
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

@media (max-width: 700px) {
    .event-row {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 10px 4px;
    }

    .event-row.event-header {
        display: none;
    }

    .event-ts,
    .event-ip {
        font-size: 11px;
    }
}

/* ============================================================================
   Dashboard filter form
   ============================================================================ */

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    margin-top: 18px;
    padding: 14px 16px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.filter-group.filter-grow {
    flex-grow: 1;
    min-width: 130px;
}

.filter-group label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    margin: 0;
    font-weight: 600;
}

.filter-group input,
.filter-group select {
    padding: 7px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg, #0f0f0f);
    color: var(--text);
    min-width: 130px;
    font-family: inherit;
    line-height: 1.3;
    box-sizing: border-box;
}

.filter-group.filter-grow input {
    width: 100%;
    min-width: 0;
}

.filter-group input::placeholder {
    color: var(--muted);
    opacity: 0.55;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: 2px solid var(--blue, #4f9eff);
    outline-offset: 1px;
    border-color: transparent;
}

/* Date input — keep the calendar icon visible on dark background */
.filter-group input[type="date"] {
    color-scheme: dark;
    min-width: 138px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-clear {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 4px;
    line-height: 1.4;
}

.btn-clear:hover {
    color: var(--text);
    background: var(--bg, #0f0f0f);
    text-decoration: none;
}

.filter-summary {
    font-size: 12px;
    margin: 12px 0 0 0;
}

@media (max-width: 1000px) {
    .filter-form {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    /* In stacked mode, reset all width caps so every field is full-width
     * via align-items: stretch on the parent. */
    .filter-form .filter-group,
    .filter-form .filter-group:has(input[type="date"]),
    .filter-form .filter-group:has(select[name="status"]),
    .filter-form .filter-group:has(select[name="i_status"]),
    .filter-form .filter-group.filter-ticket,
    .filter-form .filter-group.filter-grow {
        flex: 0 0 auto;
        width: auto;
        max-width: none;
        min-width: 0;
    }

    /* Apply button: shrink wrapper to content + align to right edge.
     * Gap to previous field is just the form's normal gap (10px),
     * not "empty wrapper space" anymore. */
    .filter-form .filter-actions {
        align-self: flex-end;
        margin-left: 0;
        width: auto;
        justify-content: flex-end;
    }

    .filter-group input,
    .filter-group select {
        width: 100%;
        min-width: 0;
    }

    .filter-actions {
        margin-left: 0;
        flex-direction: row;
        justify-content: flex-end;
    }
}

/* ============================================================================
   .sec-head spacing — match implicit <h2> top margin used on other pages
   ============================================================================ */

.sec-head {
    margin-top: 1em;
}

/* ============================================================================
   Topbar must never shrink below its 50px height even when sibling content
   (e.g. tall dashboard table) exerts flex pressure.
   ============================================================================ */

.topbar {
    flex-shrink: 0;
}

/* ============================================================================
   form-row equal-column fix
   ----------------------------------------------------------------------------
   The grid uses 1fr 1fr but inputs were rendering at content-driven widths
   instead of filling the grid cell. min-width: 0 on the .form-group breaks
   the implicit min-width:auto that grid items inherit; width:100% on inputs
   forces them into the cell.
   ============================================================================ */

.form-row .form-group {
    min-width: 0;
}

.form-row input,
.form-row select {
    width: 100%;
    box-sizing: border-box;
}

/* ============================================================================
   Notify-me checkboxes
   ============================================================================ */

.notify-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    padding: 12px 14px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    margin: 0;
    padding: 2px 0;
    user-select: none;
    line-height: 1.4;
}

.check-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--accent, #e63946);
    cursor: pointer;
}

.check-row span {
    flex: 1;
}

/* ============================================================================
   .split-row — explicit 50/50 columns, stacks on narrow screens
   ----------------------------------------------------------------------------
   Uses !important to win over any pre-existing .form-row rule that may set
   a different display/grid behaviour. Children get min-width:0 so grid
   columns can actually be equal (defaults to min-width:auto otherwise,
   which lets long content blow out the column).
   ============================================================================ */

.split-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
    align-items: start;
}

.split-row > .form-group {
    min-width: 0;
    margin: 0;
}

.split-row input,
.split-row select,
.split-row textarea {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 700px) {
    .split-row {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================================================
   Link-expiration radios — visually matches .notify-options
   ============================================================================ */

.radio-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    padding: 12px 14px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.radio-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    margin: 0;
    padding: 2px 0;
    user-select: none;
    line-height: 1.4;
}

.radio-row input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--accent, #e63946);
    cursor: pointer;
}

.radio-row span {
    flex: 1;
}

/* Match the natural .form-group bottom spacing so that .split-row sits
   visually like any other field row in the form. (Inner .form-groups have
   their margins stripped to avoid double-spacing inside the grid; the
   spacing has to come back on the row wrapper.) */

.split-row {
    margin-bottom: 1rem;
}
/* ----------------------------------------------------------------
 * Phase 10: live email-match validation styling
 * Append to /opt/safeshare/static/css/safeshare.css
 * ---------------------------------------------------------------- */

.field-error {
    color: #ef6b6b;
    font-size: 12px;
    margin-top: 6px;
    line-height: 1.5;
}

input.input-error,
input.input-error:focus {
    border-color: #ef6b6b;
    box-shadow: 0 0 0 1px #ef6b6b inset;
    outline: none;
}
/* ----------------------------------------------------------------
 * Phase 11: Message ID chip, three-button form actions, reset modal
 * Append to /opt/safeshare/static/css/safeshare.css
 * ---------------------------------------------------------------- */

/* ---- Message ID chip in heading -------------------------------- */
.sec-head-with-id {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.sec-head-with-id .sec-title {
    margin: 0;
}

.message-id-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    background: var(--s2);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-weight: normal;
    white-space: nowrap;
    cursor: default;
}
.message-id-chip .message-id-label {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
}
.message-id-chip code {
    font-family: ui-monospace, SFMono-Regular, Menlo, "Liberation Mono", monospace;
    color: var(--text);
    font-size: 12px;
    background: transparent;
    padding: 0;
    letter-spacing: 0.02em;
}

/* ---- Three-button form actions row ----------------------------- */
.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
}
.form-actions-spacer {
    flex: 1;
}

@media (max-width: 600px) {
    .form-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }
    .form-actions > .btn {
        width: 100%;
    }
    .form-actions-spacer {
        display: none;
    }
}

/* ---- Reset confirmation modal ---------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: modal-fade-in 0.12s ease-out;
}
.modal-overlay[hidden] {
    display: none;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    background: var(--s1, #1a1d21);
    border: 1px solid var(--border, #2a2e34);
    border-radius: 10px;
    padding: 24px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: var(--text, #e8e8e8);
    line-height: 1.3;
}
.modal p {
    margin: 0 0 24px 0;
    color: var(--muted, #999);
    line-height: 1.5;
    font-size: 14px;
}
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
@media (max-width: 480px) {
    .modal-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }
    .modal-actions > .btn {
        width: 100%;
    }
}
/* ----------------------------------------------------------------
 * Phase 14: Cancel-share UI (Actions column, Cancelled badge, modal)
 * Append to /opt/safeshare/static/css/safeshare.css
 * ---------------------------------------------------------------- */

/* ---- Cancelled badge -------------------------------------------- */
.badge-cancelled {
    background: #4a2a2a;
    color: #f0a0a0;
    border: 1px solid #6e3838;
}

/* ---- Actions column on dashboard table ------------------------- */
.cell-actions-th,
.cell-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.cell-actions-empty {
    color: var(--muted, #888);
    font-size: 12px;
    padding: 0 8px;
}

/* ---- Cancel-modal-specific check row --------------------------- */
.modal .check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--s2, #1a1d21);
    border: 1px solid var(--border, #2a2e34);
    border-radius: 6px;
    margin: 0 0 20px 0;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
}
.modal .check-row input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent, #5a8dee);
    flex-shrink: 0;
}
.modal .check-row span {
    color: var(--text, #e8e8e8);
}

/* ---- Cancel modal title 'code' tag styling --------------------- */
.modal p code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--s2, #1a1d21);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.92em;
    color: var(--text, #e8e8e8);
}
/* ----------------------------------------------------------------
 * Phase 15: user-chip dropdown + status-page action row
 * Append to /opt/safeshare/static/css/safeshare.css
 * ---------------------------------------------------------------- */

/* ---- User chip dropdown ---------------------------------------- */
.user-chip-wrap {
    position: relative;
    display: inline-block;
}

button.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border, #2a2e34);
    border-radius: 999px;
    padding: 3px 12px 3px 3px;
    color: var(--text, #e8e8e8);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    line-height: 1;
    transition: background 0.12s ease;
}
button.user-chip:hover,
button.user-chip:focus-visible {
    background: var(--s2, #1a1d21);
    outline: none;
}

.user-chip-caret {
    font-size: 10px;
    opacity: 0.6;
    margin-left: 2px;
}

.user-chip-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--s1, #1a1d21);
    border: 1px solid var(--border, #2a2e34);
    border-radius: 6px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 100;
    padding: 4px 0;
}
.user-chip-menu[hidden] { display: none; }

.user-chip-menu-item {
    display: block;
    padding: 8px 14px;
    color: var(--text, #e8e8e8);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
}
.user-chip-menu-item:hover {
    background: var(--s2, #1a1d21);
}

.user-chip-menu-divider {
    border: 0;
    border-top: 1px solid var(--border, #2a2e34);
    margin: 4px 0;
}

.user-chip-menu-email {
    padding: 8px 14px 4px 14px;
    font-size: 11px;
    color: var(--muted, #888);
    word-break: break-all;
}

/* ---- Status page action row (Resend + Cancel side-by-side) ---- */
.sec-head-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.inline-form {
    display: inline;
    margin: 0;
}
/* ----------------------------------------------------------------
 * Phase 15b: Multi-button action cells on dashboard rows
 * Append to /opt/safeshare/static/css/safeshare.css
 * ---------------------------------------------------------------- */

.cell-actions-row {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
}

/* When the form-wrapped Resend button sits in the row, the form element
   itself shouldn't introduce any spacing or layout quirks. */
.cell-actions-row .inline-form {
    margin: 0;
    line-height: 1;
}
/* ============================================================
 * Phase 16 part B — collapsible dashboard sections + header
 * action group. Appended to safeshare.css.
 * ============================================================ */

/* Header buttons sit inline next to the heading. */
.sec-head .header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* A section is just a wrapper for spacing + grouping. */
.dashboard-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border, #e3e6ea);
}
.dashboard-section:first-of-type {
    border-top: none;
    margin-top: 1rem;
    padding-top: 0;
}

/* Section header is a button so it's keyboard-accessible. */
.section-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    background: transparent;
    border: 0;
    padding: 0.4rem 0;
    margin: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.section-toggle:hover .section-title {
    color: var(--color-link, #2a5db0);
}
.section-toggle:focus-visible {
    outline: 2px solid var(--color-link, #2a5db0);
    outline-offset: 3px;
    border-radius: 4px;
}

.section-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.2;
}

.section-sub {
    font-size: 0.85rem;
    font-weight: 400;
    margin-left: -0.25rem;   /* tighter against the title */
}

/* Count chip on the far right of the header. */
.section-count {
    margin-left: auto;
    background: var(--color-bg-subtle, #f0f2f5);
    color: var(--color-muted, #6a7280);
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.5;
    min-width: 1.5rem;
    text-align: center;
}

/* Chevron — pure CSS triangle. Points down when expanded,
 * rotates -90° (points right) when collapsed. */
.section-chevron {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    transition: transform 120ms ease;
    flex: 0 0 auto;
    opacity: 0.7;
}
.section-toggle[aria-expanded="false"] .section-chevron {
    transform: rotate(-90deg);
}

/* Body collapse — driven by aria-expanded on the sibling toggle. */
.section-body {
    margin-top: 0.4rem;
}
/* New structure wraps .section-toggle inside <header class="section-header-row">,
 * so .section-body is no longer the toggle's adjacent sibling. Use :has()
 * to look upward for a collapsed toggle anywhere within the section. */
.dashboard-section:has(.section-toggle[aria-expanded="false"]) .section-body {
    display: none;
}

/* Mobile: drop the subtitle next to the title to keep the header
 * line readable. The count and chevron stay. */
@media (max-width: 540px) {
    .section-sub {
        display: none;
    }
}
/* ============================================================
 * Phase 16 part B.1 — public submission pages.
 * Appended to safeshare.css.
 *
 * The public pages don't extend base.html, so they need their own
 * top-level layout. Keep it minimal and centered.
 * ============================================================ */

body.public-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.public-header {
    padding: 1.5rem 0 1rem;
    border-bottom: 1px solid var(--color-border, #e3e6ea);
    margin-bottom: 2rem;
}
.public-header .brand {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}
.public-header .brand-name {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.public-header .brand-sub {
    font-size: 0.85rem;
    color: var(--color-muted, #6a7280);
}

.public-main {
    padding: 0 0 3rem;
}

.public-h1 {
    margin: 0 0 1rem;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.2;
}

.public-intro {
    margin: 0 0 1.75rem;
    line-height: 1.55;
}

.public-footer {
    padding: 1.25rem 0;
    border-top: 1px solid var(--color-border, #e3e6ea);
    margin-top: 2rem;
    text-align: center;
}

/* Read-only context blocks (Subject + Note from inviter) */
.invitation-context {
    background: var(--color-bg-subtle, #f7f8fa);
    border: 1px solid var(--color-border, #e3e6ea);
    border-radius: 6px;
    padding: 1rem 1.1rem;
    margin: 0 0 1.75rem;
}
.readonly-block {
    margin-bottom: 0.75rem;
}
.readonly-block:last-child {
    margin-bottom: 0;
}
.readonly-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-muted, #6a7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}
.readonly-value {
    font-weight: 500;
}
.readonly-text {
    white-space: pre-wrap;
    line-height: 1.5;
}

/* The destination "lock" field */
.locked-field {
    background: var(--color-bg-subtle, #f0f2f5);
    color: var(--color-muted, #444);
    cursor: not-allowed;
    font-weight: 500;
}
.locked-field:focus {
    outline: none;
}

/* Public success / error panels */
.public-success,
.public-error {
    text-align: center;
    padding: 2rem 0;
}
.public-success .public-h1 {
    color: var(--color-success, #1a7f3c);
}
.public-error .public-h1 {
    color: var(--color-danger, #b3261e);
}
/* ============================================================
 * Phase 16 part B.1.5 — invite "Sent securely" page tweaks
 * Spacing fixes + Close tab button.
 * ============================================================ */

.public-success .success-lede {
    margin: 0 0 2.5rem;     /* clear breathing room before the muted hint */
    line-height: 1.55;
}
.public-success .success-hint {
    margin: 0 0 2rem;       /* gap above the Close button */
}
.public-success .success-actions {
    margin-top: 0;
}
.btn.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
/* ============================================================
 * Phase 16 part B.1.6 — invitation_context dark-theme fix
 * The earlier appendix gave it a near-white fallback background
 * which became invisible-on-white on the dark theme. Use a
 * theme-agnostic translucent overlay instead.
 * ============================================================ */

.invitation-context {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Slightly punchier label color so it's readable on the new bg */
.invitation-context .readonly-label {
    color: rgba(255, 255, 255, 0.55);
}
/* ============================================================
 * Phase 16 part B.2 — staff inbound message viewing
 * ============================================================ */

/* Mono font helper class — replaces the inline style="font-family:..."
 * that was violating CSP style-src 'self'. */
.value-mono {
    font-family: var(--mono, "IBM Plex Mono", monospace);
}

/* "Message" heading above the decrypted body. Matches the visual
 * weight of the existing .timeline-heading (audit log section). */
.inbound-message-heading {
    margin-top: 2rem;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-muted, rgba(255, 255, 255, 0.6));
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* The decrypted message body itself. pre-wrap preserves line breaks
 * the sender typed; max-height + overflow keeps long messages from
 * pushing the page below the fold. */
.inbound-message-body {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 1.25rem 1.4rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 70vh;
    overflow-y: auto;
}
/* ============================================================
 * Phase 16 part C — inline message-content expansion
 * Toggle chevron + collapsible content row + content panel.
 * ============================================================ */

/* Chevron toggle button — sits in the leftmost cell of each row,
 * before the message ID link. */
.content-toggle {
    background: transparent;
    border: 0;
    padding: 0.15rem 0.4rem;
    cursor: pointer;
    color: inherit;
    margin-right: 0.3rem;
    vertical-align: middle;
    line-height: 1;
}
.content-toggle:focus-visible {
    outline: 2px solid var(--color-link, #2a5db0);
    outline-offset: 2px;
    border-radius: 3px;
}

/* Pure-CSS triangle, points down when expanded, rotates -90deg when not */
.content-chevron {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    transition: transform 120ms ease;
    opacity: 0.55;
}
.content-toggle[aria-expanded="false"] .content-chevron {
    transform: rotate(-90deg);
}
.content-toggle:hover .content-chevron {
    opacity: 0.9;
}

/* Reserve the same horizontal space when there's no toggle (e.g.,
 * Awaiting invitation rows) so columns stay aligned. */
.content-toggle-placeholder {
    display: inline-block;
    width: calc(10px + 0.6rem + 0.6rem);  /* triangle width + button padding */
    margin-right: 0.3rem;
    vertical-align: middle;
}

/* The expansion row itself — a single full-width <td>. */
.content-row > td {
    background: rgba(255, 255, 255, 0.025);
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.content-cell-inner {
    padding: 0.9rem 1.1rem 1.2rem;
}

.content-loading,
.content-error,
.content-unavailable {
    color: var(--color-muted, rgba(255, 255, 255, 0.6));
    font-style: italic;
    padding: 0.4rem 0;
}
.content-error {
    color: var(--color-danger, #f55);
    font-style: normal;
}
.content-unavailable {
    color: rgba(255, 255, 255, 0.55);
}

/* Content panel: From/Recipient + Subject metadata, then body. */
.content-panel {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.content-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.content-meta-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    font-size: 0.9rem;
}
.content-meta-label {
    color: var(--color-muted, rgba(255, 255, 255, 0.55));
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    min-width: 4.5rem;
}
.content-meta-value {
    font-weight: 500;
}

.content-body {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 50vh;
    overflow-y: auto;
}
/* ============================================================
 * Phase 16 part D.1 — uniform first-column width across the
 * Outbound and Inbound dashboard tables. The two tables compute
 * widths independently, so without an explicit width they vary
 * with their content (e.g. the inbound 'UTC' suffix made that
 * column wider).
 * ============================================================ */

.dashboard-table th:first-child,
.dashboard-table td:first-child {
    width: 12.5em;
    min-width: 12.5em;
    box-sizing: border-box;
}
/* ============================================================
   PHASE 16F — SETTINGS MODAL
   ============================================================
   The Settings modal reuses .modal-overlay / .modal patterns
   from the existing cancel-share modal but adds a few rules
   specific to the settings-form layout (label above select,
   helper text, action row alignment).
   ============================================================ */

.settings-modal {
  min-width: 28rem;
  max-width: 36rem;
}

.settings-modal h3 {
  margin: 0 0 1rem 0;
  font-size: 1.05rem;
  color: var(--fg);
}

.settings-modal .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.settings-modal label {
  font-weight: 500;
  color: var(--fg);
  font-size: 0.92rem;
}

.settings-modal select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--bg, #0d0d0e);
  color: var(--fg);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
}

.settings-modal select:focus {
  outline: none;
  border-color: var(--accent, #7aa2f7);
  box-shadow: 0 0 0 2px rgba(122, 162, 247, 0.25);
}

.settings-modal .form-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--fg-muted, rgba(255,255,255,0.55));
}

.settings-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.2rem;
}
/* ============================================================
   PHASE 16G — BACK BUTTON
   ============================================================
   Small chevron-left button placed before the heading on the
   message-status and invitation-status pages. Sized to align
   with the .sec-title baseline; subtle styling that doesn't
   compete with the page title.
   ============================================================ */

.sec-head .back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  margin-right: 0.7rem;
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 4px;
  color: var(--fg-muted, rgba(255, 255, 255, 0.6));
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
  flex-shrink: 0;
}

.sec-head .back-btn:hover {
  color: var(--fg, #e6e6e6);
  border-color: var(--fg-muted, rgba(255, 255, 255, 0.45));
  background: rgba(255, 255, 255, 0.04);
}

.sec-head .back-btn:focus {
  outline: none;
  border-color: var(--accent, #7aa2f7);
  box-shadow: 0 0 0 2px rgba(122, 162, 247, 0.25);
}

.sec-head .back-btn svg {
  display: block;
}

/* ============================================================
   PHASE 16G — BACK BUTTON ALIGN
   ============================================================
   Keep the back chevron and the heading flush left; push any
   optional sibling (e.g. the message-id chip) to the right
   regardless of the .sec-head-with-id flex setting.
   ============================================================ */

.sec-head.sec-head-with-id .sec-title {
  margin-right: 0;
}

.sec-head.sec-head-with-id > .message-id-chip,
.sec-head.sec-head-with-id > .header-actions {
  margin-left: auto;
}

/* ============================================================
   PHASE 16K — SECHEAD FLUSH
   ============================================================
   Make the back-button + title sit flush-left in
   .sec-head-with-id, regardless of whether a message-id-chip or
   header-actions sibling exists. When those siblings are present
   they get pushed right via margin-left:auto (already in 16G).
   ============================================================ */

.sec-head.sec-head-with-id {
  justify-content: flex-start;
}

/* ============================================================
   PHASE 16M — FILTER LAYOUT
   ============================================================
   Tighten the Ticket filter input (~8em wide) and ensure the
   filter row stays on a single line at typical viewport widths
   when there are 6 fields + Apply/Clear actions.
   ============================================================ */

.filter-form .filter-group.filter-ticket {
  flex: 0 0 auto;
}

.filter-form .filter-group.filter-ticket input {
  width: 8em;
  min-width: 8em;
}

/* Recipient and Subject share the available stretch space in the
   filter row — keep them growable but with a sane minimum so they
   don't squeeze unreadable. */
.filter-form .filter-group.filter-grow {
  flex: 1 1 8em;
  min-width: 8em;
}

/* Date inputs sized to native value width */
.filter-form input[type="date"] {
  min-width: 9em;
}

/* ============================================================
   PHASE 16M-MOBILE — FILTER STACK
   ============================================================
   On narrow viewports stack each filter group full-width with
   a consistent gap. The desktop flex sizing (filter-grow's
   min-width: 12em, filter-ticket's fixed 8em) makes wrapped
   items leave large dead space; here we reset all of that.
   ============================================================ */

@media (max-width: 1024px) {
  .filter-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .filter-form .filter-group,
  .filter-form .filter-group.filter-grow,
  .filter-form .filter-group.filter-ticket {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    margin: 0;
  }

  /* Full-width inputs on mobile, including the otherwise-tight
     ticket input. */
  .filter-form .filter-group input,
  .filter-form .filter-group select,
  .filter-form .filter-group.filter-ticket input {
    width: 100%;
    min-width: 0;
  }

  /* Apply / Clear sit on their own row. */
  .filter-form .filter-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 0.2rem;
  }
}


/* ===========================
   PHASE 16Q ICON BUTTONS
   =========================== */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border, #2a2f3a);
    background: transparent;
    border-radius: 6px;
    color: var(--muted, #9aa3b2);
    cursor: pointer;
    transition: color 120ms, border-color 120ms, background 120ms;
}
.btn-icon:hover {
    color: var(--text, #e7eaf0);
    background: rgba(255,255,255,0.04);
}
.btn-icon:focus-visible {
    outline: 2px solid var(--accent, #ef4444);
    outline-offset: 2px;
}
.btn-icon-warn:hover  { color: #f59e0b; border-color: #f59e0b; }
.btn-icon-danger:hover { color: #ef4444; border-color: #ef4444; }
.btn-icon svg { display: block; }

.inline-form { display: inline-block; margin: 0; padding: 0; }
.cell-actions { white-space: nowrap; }
.cell-actions .inline-form + .inline-form { margin-left: 6px; }

.activity-table { margin-top: 8px; }

/* Phase 16T — centered wrapper for the Download all (zip) button.
 * Defined as a class because CSP style-src 'self' blocks inline
 * style="..." attributes silently. */
.download-all-wrap {
    text-align: center;
    margin-top: 1rem;
}


/* ============================================================================
   Phase 16W — filter toggle (collapsible filter panels with funnel icon)
   ============================================================================ */
/* Phase 16W — filter toggle */

.section-header-row {
    display: flex;
    align-items: center;
    gap: 10px;           /* tight — title sits ~1 space from subtitle */
    width: 100%;
}

.section-header-row .section-toggle {
    flex: 0 1 auto;
    width: auto;        /* override base .section-toggle { width: 100% } */
    min-width: 0;
}

/* Push the count badge to the far right of the row. */
.section-header-row > .section-count {
    margin-left: auto;
}

.section-header-row .section-sub {
    flex-shrink: 0;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
    opacity: 0.6;
    flex-shrink: 0;
    transition: color 140ms ease, background 140ms ease, opacity 140ms ease;
}

.filter-toggle:hover,
.filter-toggle:focus-visible {
    color: var(--accent, #4f9eff);
    opacity: 1;
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

.filter-toggle.is-active,
.filter-toggle.is-open {
    color: var(--accent, #4f9eff);
    opacity: 1;
}

.filter-toggle svg {
    display: block;
    pointer-events: none;
}

/* Default collapsed; .is-open expands. CSS-only — input values stay
   intact across toggles because we never touch the form DOM. */
.filter-form {
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: 0;
    border-bottom: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1),
                opacity 200ms ease,
                margin-top 200ms ease,
                margin-bottom 200ms ease,
                padding 200ms ease;
}

.filter-form.is-open {
    max-height: 800px;
    margin-top: 18px;
    padding-top: 12px;
    padding-bottom: 12px;
    opacity: 1;
}


/* Hide filter-summary when filter is collapsed */
.section-body:has(.filter-form:not(.is-open)) .filter-summary {
    display: none;
}


/* Cap the narrow fields so flex-grow doesn't inflate them — only the
 * Recipient and Subject (which have .filter-grow) should expand. */
.filter-group:has(input[type="date"]) {
    flex: 0 0 auto;
    width: 140px;
}

.filter-group.filter-ticket {
    flex: 0 0 auto;
    width: 130px;
}

.filter-group:has(select[name="status"]) {
    flex: 0 0 auto;
    width: 120px;
}

/* Apply button sits at the end of the row, aligned with input bottoms. */
.filter-actions {
    flex: 0 0 auto;
    align-self: flex-end;
}

/* Mobile (iPhone / narrow viewport): every filter-group becomes a full-
 * width row stacked vertically. This overrides the width caps above. */


/* Phase 16W follow-up #7 — definitive filter widths.
 * High specificity (.filter-form prefix) to beat existing rules.
 * Use flex: 0 0 <px> for explicit basis, no auto resolution. */

.filter-form .filter-group:has(input[type="date"]) {
    flex: 0 0 140px;
}

.filter-form .filter-group.filter-ticket {
    flex: 0 0 130px;
}

.filter-form .filter-group:has(select[name="status"]),
.filter-form .filter-group:has(select[name="i_status"]) {
    flex: 0 0 130px;
}

/* Ensure the input/select inside each capped group fills its width
 * exactly — no overflow, no extra-wide content pushing the group. */
.filter-form .filter-group:has(input[type="date"]) input,
.filter-form .filter-group.filter-ticket input,
.filter-form .filter-group:has(select[name="status"]) select,
.filter-form .filter-group:has(select[name="i_status"]) select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.filter-form .filter-actions {
    flex: 0 0 auto;
    align-self: flex-end;
}

/* Mobile (iPhone): stack everything full-width vertically. */
@media (max-width: 720px) {
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-form .filter-group,
    .filter-form .filter-group:has(input[type="date"]),
    .filter-form .filter-group:has(select),
    .filter-form .filter-group.filter-ticket,
    .filter-form .filter-group.filter-grow {
        flex: 0 0 auto;
        width: 100%;
        max-width: none;
        min-width: 0;
    }
    .filter-form .filter-actions {
        align-self: stretch;
    }
}


/* Phase 16W follow-up #10 — mobile cascade override */
/* IMPORTANT: this @media block MUST come AFTER Phase 16W #7 in source
 * order. Same selector specificity, later wins. Without this, the
 * desktop flex:0 0 <px> wins at narrow viewports and gets interpreted
 * as HEIGHT in column-mode, padding each .filter-group to 130-140px tall.
 */
@media (max-width: 1000px) {
    .filter-form .filter-group:has(input[type="date"]),
    .filter-form .filter-group.filter-ticket,
    .filter-form .filter-group:has(select[name="status"]),
    .filter-form .filter-group:has(select[name="i_status"]),
    .filter-form .filter-group.filter-grow {
        flex: 0 0 auto;
        width: auto;
        max-width: none;
        min-width: 0;
    }

    /* Apply button: compact, right-aligned, normal gap to previous field */
    .filter-form .filter-actions {
        flex: 0 0 auto;
        align-self: flex-end;
        width: auto;
        margin-left: 0;
        justify-content: flex-end;
    }
}

/* MFA-177: role badges + banner */
.role-badge {
    display: inline-block;
    padding: 2px 7px;
    margin: 0 8px 0 4px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    line-height: 1.4;
    text-transform: uppercase;
    border: 1px solid transparent;
    vertical-align: middle;
}

.role-badge-owner {
    background: rgba(231, 76, 60, 0.16);
    color: #ff7e74;
    border-color: rgba(231, 76, 60, 0.35);
}

.role-badge-admin {
    background: rgba(241, 196, 15, 0.14);
    color: #f0c346;
    border-color: rgba(241, 196, 15, 0.35);
}

.role-badge-user {
    background: rgba(150, 160, 170, 0.14);
    color: #aab2bc;
    border-color: rgba(150, 160, 170, 0.30);
}

.info-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 16px 0;
    border-radius: 6px;
    background: rgba(241, 196, 15, 0.12);
    border: 1px solid rgba(241, 196, 15, 0.30);
    color: var(--text, #e7e7e7);
    font-size: 13px;
    line-height: 1.4;
}

.info-banner-icon {
    font-size: 16px;
    flex: 0 0 auto;
}

.info-banner-text {
    flex: 1;
}

.info-banner-text strong {
    font-weight: 600;
}

.info-banner-close {
    background: none;
    border: none;
    color: var(--muted, #888);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 4px;
    flex: 0 0 auto;
}

.info-banner-close:hover {
    color: var(--text, #e7e7e7);
    background: rgba(255, 255, 255, 0.06);
}

/* MFA-178b: enrollment + verification pages */

/* Wider auth card for the enrollment page (more content than verify) */
.auth-card-wide {
    max-width: 560px;
}

.setup-steps {
    margin: 0 0 20px 0;
    padding-left: 22px;
}
.setup-steps li {
    margin-bottom: 12px;
    line-height: 1.5;
}
.setup-step-heading {
    margin: 24px 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

/* QR code display — on a white background for max contrast */
.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 8px;
    margin: 16px 0;
}
.qr-image {
    display: block;
    width: 200px;
    height: 200px;
}

/* Manual secret fallback for users who can't scan */
.manual-secret {
    margin: 8px 0 24px 0;
    font-size: 13px;
}
.manual-secret summary {
    cursor: pointer;
    color: var(--muted, #aab2bc);
    padding: 4px 0;
}
.manual-secret summary:hover {
    color: var(--text, #e7e7e7);
}
.secret-display {
    display: block;
    font-family: ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    margin: 8px 0;
    user-select: all;
    word-break: break-all;
    letter-spacing: 1px;
}

/* Recovery codes — 2-column grid for readability */
.recovery-codes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
    list-style: none;
    margin: 16px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
}
.recovery-codes-grid li {
    padding: 4px 0;
}
.recovery-codes-grid code {
    font-family: ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 14px;
    letter-spacing: 0.5px;
    user-select: all;
}

/* "I have saved my codes" checkbox label */
.confirm-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 16px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}
.confirm-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #ff7e74;
}

/* TOTP / recovery input — centered monospace, large enough to read */
.totp-input,
.recovery-input {
    font-family: ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 20px;
    text-align: center;
    padding: 12px;
}
.totp-input {
    letter-spacing: 8px;
}
.recovery-input {
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* Full-width buttons */
.btn-block {
    display: block;
    width: 100%;
    margin-top: 16px;
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Alerts (error / warning) */
.alert {
    padding: 12px 14px;
    border-radius: 6px;
    margin: 0 0 16px 0;
    font-size: 14px;
    line-height: 1.4;
}
.alert-error {
    background: rgba(231, 76, 60, 0.14);
    border: 1px solid rgba(231, 76, 60, 0.32);
    color: #ff8e84;
}
.alert-warning {
    background: rgba(241, 196, 15, 0.14);
    border: 1px solid rgba(241, 196, 15, 0.32);
    color: #f0c346;
}

/* Recovery code fallback section in verify page */
.recovery-fallback {
    margin: 20px 0 16px 0;
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.recovery-fallback summary {
    cursor: pointer;
    color: var(--muted, #aab2bc);
    padding: 4px 0;
    font-size: 14px;
}
.recovery-fallback summary:hover {
    color: var(--text, #e7e7e7);
}

/* Auth card footnote (sign-out link, etc.) */
.auth-card-footnote {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
}
.auth-card-footnote a {
    color: var(--muted, #aab2bc);
}
.auth-card-footnote a:hover {
    color: var(--text, #e7e7e7);
}

/* Mobile: collapse 2-col grid */
@media (max-width: 480px) {
    .recovery-codes-grid {
        grid-template-columns: 1fr;
    }
    .qr-image {
        width: 180px;
        height: 180px;
    }
}

/* ============================================================
 * Staff admin page (179a, fix1: proper dark-theme variables)
 * Uses the site's :root vars (--s1/s2/s3, --border, --text, --muted,
 * --accent, --blue, --ok, --warn, --r, --ease, --font).
 * ============================================================ */

.admin-section {
    margin: 24px 0;
}

.admin-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    display: inline;
    color: var(--text);
}

.admin-section-desc {
    margin: 0 0 12px 0;
    font-size: 0.92rem;
    color: var(--muted);
}

.admin-stat {
    display: inline-block;
    padding: 3px 10px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.82rem;
    margin-right: 6px;
    color: var(--muted);
}
.admin-stat-attention {
    background: rgba(244, 162, 97, 0.14);
    color: var(--warn);
    border-color: rgba(244, 162, 97, 0.35);
    font-weight: 600;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--s1);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    color: var(--text);
}
.admin-table th,
.admin-table td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.admin-table thead th {
    background: var(--s2);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.admin-table tr:last-child td {
    border-bottom: none;
}
.admin-actions-col {
    width: 210px;
}
/* the cell needs position:relative so the absolute menu anchors here */
.admin-table td:has(> .action-menu),
.admin-table td .action-menu {
    position: relative;
}
.admin-row-self {
    background: rgba(69, 123, 157, 0.06);
}
.admin-self-label {
    font-size: 0.78rem;
    color: var(--muted);
    margin-left: 4px;
    font-style: italic;
}

/* ─── Action disclosure widget per row (fix2: floating popover) ─── */
.action-menu {
    display: inline-block;
    position: relative;
}
.action-menu > summary {
    cursor: pointer;
    user-select: none;
    padding: 5px 12px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    font-size: 0.85rem;
    color: var(--text);
    list-style: none;
    transition: border-color var(--ease), background var(--ease);
    white-space: nowrap;
}
.action-menu > summary::-webkit-details-marker {
    display: none;
}
.action-menu > summary::before {
    content: "▾ ";
    font-size: 0.8em;
    color: var(--muted);
}
.action-menu[open] > summary::before {
    content: "▴ ";
}
.action-menu[open] > summary {
    border-color: var(--blue);
    background: var(--s3);
}
.action-menu > summary:hover {
    border-color: var(--blue);
}

/* Floating popover — does NOT affect row height */
.action-menu-body {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: var(--s2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.action-menu-body form {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
}

/* ─── Small action buttons inside the menu ─── */
.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    line-height: 1.3;
    border-radius: var(--r);
    border: 1px solid var(--border);
    background: var(--s3);
    color: var(--text);
    cursor: pointer;
    font-family: var(--font);
    transition: border-color var(--ease), background var(--ease);
    text-align: center;
}
.btn-small:hover {
    border-color: var(--blue);
    background: var(--s1);
}
.btn-small:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

.btn-small.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-small.btn-primary:hover {
    background: #c1121f;
    border-color: #c1121f;
    color: #fff;
}

.btn-small.btn-danger {
    background: rgba(230, 57, 70, 0.12);
    color: var(--accent);
    border-color: rgba(230, 57, 70, 0.3);
}
.btn-small.btn-danger:hover {
    background: rgba(230, 57, 70, 0.22);
    border-color: rgba(230, 57, 70, 0.45);
    color: var(--accent);
}

/* ─── Disable form's optional reason input ─── */
.admin-disable-form .admin-reason-input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    font-size: 0.85rem;
    width: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
}
.admin-disable-form .admin-reason-input::placeholder {
    color: var(--muted);
}
.admin-disable-form .admin-reason-input:focus {
    outline: none;
    border-color: var(--blue);
}

/* ─── MFA status indicators ─── */
.mfa-ok {
    color: var(--ok);
    font-weight: 500;
}
.mfa-locked {
    color: var(--warn);
    font-weight: 500;
    margin-left: 6px;
}
.mfa-none {
    font-style: italic;
    color: var(--muted);
}

/* ─── Disabled-staff collapsible section ─── */
.admin-disabled-section > summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
    padding: 6px 0;
}
.admin-disabled-section > summary::-webkit-details-marker {
    display: none;
}
.admin-disabled-section > summary::before {
    content: "▸ ";
    color: var(--muted);
}
.admin-disabled-section[open] > summary::before {
    content: "▾ ";
}
.admin-disabled-section > summary h3 {
    display: inline;
}

/* ─── Topbar "Manage staff" link ─── */
.topbar-admin-link {
    display: inline-block;
    margin-right: 12px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.92rem;
    padding: 4px 10px;
    border-radius: var(--r);
    border: 1px solid transparent;
    transition: border-color var(--ease), background var(--ease), color var(--ease);
}
.topbar-admin-link:hover {
    background: var(--s2);
    border-color: var(--border);
    text-decoration: none;
    color: var(--text);
}

/* ============================================================
 * Staff admin page (179a, fix3: letter-icon action buttons)
 * Reuses the existing .btn-icon base class from the codebase.
 * Each variant matches the corresponding .role-badge color.
 * ============================================================ */

.action-icons-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}
.action-icons-row form {
    display: inline-block;
    margin: 0;
    padding: 0;
}

/* Letter-content icon buttons. .btn-icon (existing) gives the
 * box; these variants set the colors. Font-weight bold so the
 * single letter reads as a label, not a typo. */
.btn-icon.btn-icon-role-user {
    background: rgba(150, 160, 170, 0.14);
    color: #aab2bc;
    border: 1px solid rgba(150, 160, 170, 0.30);
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}
.btn-icon.btn-icon-role-user:hover {
    background: rgba(150, 160, 170, 0.24);
    border-color: rgba(150, 160, 170, 0.50);
    color: #aab2bc;
}

.btn-icon.btn-icon-role-admin {
    background: rgba(241, 196, 15, 0.14);
    color: #f0c346;
    border: 1px solid rgba(241, 196, 15, 0.35);
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}
.btn-icon.btn-icon-role-admin:hover {
    background: rgba(241, 196, 15, 0.24);
    border-color: rgba(241, 196, 15, 0.55);
    color: #f0c346;
}

.btn-icon.btn-icon-role-owner {
    background: rgba(231, 76, 60, 0.16);
    color: #ff7e74;
    border: 1px solid rgba(231, 76, 60, 0.35);
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}
.btn-icon.btn-icon-role-owner:hover {
    background: rgba(231, 76, 60, 0.26);
    border-color: rgba(231, 76, 60, 0.55);
    color: #ff7e74;
}

.btn-icon.btn-icon-reset {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}
.btn-icon.btn-icon-reset:hover {
    background: var(--s3);
    border-color: var(--text);
    color: var(--text);
}

/* Disable form layout: reason input + cancel icon inline */
.admin-disable-form {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.admin-disable-form .admin-reason-input {
    flex: 1;
    min-width: 0;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    font-size: 0.82rem;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
}
.admin-disable-form .admin-reason-input::placeholder {
    color: var(--muted);
}
.admin-disable-form .admin-reason-input:focus {
    outline: none;
    border-color: var(--blue);
}

/* Tighten the popover for the new compact layout */
.action-menu-body {
    min-width: 220px;
    gap: 10px;
}

/* ============================================================
 * Disable modal (179a, fix4) — opens when ⊘ icon is clicked.
 * Reuses .modal-overlay / .modal / .modal-actions from the site.
 * ============================================================ */
.disable-modal {
    max-width: 480px;
    width: 92%;
    padding: 24px;
    box-sizing: border-box;
}

.disable-modal h3 {
    margin-top: 0;
}

.disable-modal-reason-label {
    display: block;
    margin: 16px 0 4px 0;
}
.disable-modal-reason-text {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 6px;
}
.disable-modal-reason-label input[type="text"] {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--s1);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.92rem;
    box-sizing: border-box;
}
.disable-modal-reason-label input[type="text"]::placeholder {
    color: var(--muted);
}
.disable-modal-reason-label input[type="text"]:focus {
    outline: none;
    border-color: var(--blue);
}

/* Inline icons row (no longer inside a popover) */
.action-icons-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0;
}
.action-icons-row form {
    display: inline-block;
    margin: 0;
    padding: 0;
}
