:root {
  --navy: #12324d;
  --navy-2: #0e263b;
  --blue: #075e78;
  --purple: #382578;
  --primary: #123f69;
  --primary-hover: #0b3155;
  --surface: #ffffff;
  --canvas: #f6f9fd;
  --line: #d8e2ec;
  --muted: #6a7c8d;
  --text: #20384e;
  --success: #2b8b69;
  --danger: #bf3c4c;
  --warning: #a36613;
  --shadow: 0 12px 32px rgba(25, 56, 83, 0.09);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--text);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; font-size: 16px; }
body { min-height: 100vh; margin: 0; background: var(--canvas); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: var(--primary); }
img { max-width: 100%; }

.site-header {
  min-height: 131px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  color: white;
  background: linear-gradient(112deg, #00506f 0%, #14345a 48%, #38207b 100%);
  box-shadow: 0 3px 12px rgba(16, 38, 67, 0.22);
}
.brand { display: flex; align-items: center; gap: 26px; color: white; text-decoration: none; font-size: 32px; font-weight: 750; letter-spacing: .01em; }
.brand img { width: 72px; height: 96px; object-fit: contain; transform: scale(1.65); transform-origin: center; }
.admin-link { display: inline-flex; align-items: center; gap: 10px; color: white; text-decoration: none; font-size: 19px; font-weight: 650; }
.admin-link img, .primary-button img, .danger-button img, .secondary-button img, .danger-outline-button img { filter: brightness(0) invert(1); }
.site-main { width: min(1190px, calc(100% - 48px)); min-height: calc(100vh - 213px); margin: 0 auto; padding: 42px 0 54px; }
.site-footer { display: flex; justify-content: center; gap: 10px; padding: 22px 20px 30px; color: #8291a0; font-size: 14px; }
.upload-page .site-main { min-height: 0; padding-bottom: 68px; }
.upload-page .site-footer { display: none; }

.upload-workspace { display: grid; gap: 42px; }
.process-steps { list-style: none; margin: 0 auto 15px; padding: 0; width: min(1010px, 100%); display: flex; align-items: center; justify-content: space-between; position: relative; }
.process-steps::before { content: ""; position: absolute; left: 34px; right: 34px; top: 22px; height: 1px; background: #c8d0d9; }
.process-steps li { z-index: 1; width: auto; padding: 0 13px; display: flex; align-items: center; gap: 17px; color: #657180; background: var(--canvas); white-space: nowrap; }
.process-steps li:first-child { padding-left: 0; }
.process-steps li:last-child { padding-right: 0; }
.process-steps li span { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 1px solid #d1d7df; border-radius: 50%; color: #687586; background: #edf1f5; font-size: 19px; font-weight: 600; }
.process-steps li strong { font-size: 19px; font-weight: 600; }
.process-steps li.is-current { color: #5037ad; }
.process-steps li.is-current span { color: white; background: #5940bd; border-color: #5940bd; box-shadow: none; }

.upload-form { display: grid; }
.drop-zone { min-height: 548px; padding: 48px; border: 2px dashed #6960d7; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: #fff; box-shadow: 0 12px 34px rgba(74, 58, 153, .07); cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.is-dragging { outline: none; border-color: #4f36bd; background: #fbfaff; transform: translateY(-1px); }
.drop-zone-empty { display: flex; flex-direction: column; align-items: center; }
.drop-file-icon { width: 146px; height: 170px; margin-bottom: 20px; filter: invert(54%) sepia(27%) saturate(1700%) hue-rotate(202deg); }
.drop-zone-title { max-width: 780px; margin: 0; color: #171923; font-size: 28px; line-height: 1.3; font-weight: 750; }
.drop-zone-help { margin: 16px 0 31px; color: #555d6b; font-size: 20px; }
.primary-button, .secondary-button, .danger-button, .danger-outline-button {
  min-height: 48px; border: 0; border-radius: 7px; padding: 12px 24px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; cursor: pointer; font-weight: 700; transition: transform .16s, background .16s, box-shadow .16s;
}
.primary-button { min-width: 294px; min-height: 80px; padding: 18px 34px; gap: 20px; color: white; background: linear-gradient(115deg, #5d35c4, #4535ae); box-shadow: 0 7px 20px rgba(71, 50, 170, .22); font-size: 24px; }
.primary-button img { width: 38px; height: 38px; }
.primary-button:hover { color: white; background: linear-gradient(115deg, #5330b4, #3e2f9d); transform: translateY(-1px); }
.secondary-button { color: #21465f; background: #e9f0f5; border: 1px solid #c8d6e1; }
.secondary-button img { filter: invert(25%) sepia(18%) saturate(1230%) hue-rotate(158deg); width: 20px; }
.danger-button { color: white; background: var(--danger); }
.danger-outline-button { color: var(--danger); background: white; border: 1px solid #e0a9b0; }
.danger-outline-button img { filter: invert(31%) sepia(55%) saturate(1580%) hue-rotate(320deg); }
.danger-button:disabled, .danger-outline-button:disabled, .secondary-button:disabled { opacity: .45; cursor: not-allowed; }
.wide-button { width: 100%; }
.selected-file-card { width: min(650px, 100%); padding: 28px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 22px; border: 1px solid #d8d3f2; border-radius: 14px; text-align: left; background: #fbfaff; box-shadow: 0 8px 24px rgba(74, 58, 153, .08); }
.selected-file-card > img { width: 72px; height: 72px; filter: invert(54%) sepia(27%) saturate(1700%) hue-rotate(202deg); }
.selected-file-copy { min-width: 0; display: grid; gap: 5px; }
.selected-file-copy > span { color: var(--success); font-size: 13px; font-weight: 750; }
.selected-file-copy strong { overflow: hidden; color: #273d51; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.selected-file-copy small { color: var(--muted); }
.selected-file-card .secondary-button { min-width: 112px; }
.upload-actions { padding-top: 22px; display: grid; justify-items: center; gap: 18px; }
.upload-submit { min-width: 320px; min-height: 64px; font-size: 20px; }
.turnstile-wrap { display: flex; justify-content: center; }
.validation-summary { width: 100%; color: #a72938; background: #fff0f2; border: 1px solid #efc5ca; border-radius: 8px; }
.validation-summary:empty { display: none; }
.validation-summary ul { margin: 0; padding: 12px 18px 12px 36px; }
.security-note { min-height: 126px; display: flex; align-items: center; gap: 28px; padding: 26px 36px; border: 1px solid #e4e8ee; border-radius: 12px; background: #fbfcfd; box-shadow: 0 8px 24px rgba(34, 57, 80, .035); }
.security-note .security-icon { flex: 0 0 auto; width: 70px; height: 70px; display: grid; place-items: center; border-radius: 50%; background: #d9f4ee; }
.security-note img { width: 38px; height: 38px; filter: invert(39%) sepia(88%) saturate(530%) hue-rotate(128deg); }
.security-note > div { padding-left: 35px; border-left: 1px solid #e0e5eb; }
.security-note strong { font-size: 19px; color: #161c24; }
.security-note p { margin: 7px 0 0; color: #454e5b; font-size: 17px; line-height: 1.55; }

.processing-panel, .status-card, .download-card, .auth-card { width: min(900px, 100%); margin: 0 auto; padding: 54px; border: 1px solid var(--line); border-radius: 15px; text-align: center; background: white; box-shadow: var(--shadow); }
.processing-panel h1, .status-card h1, .download-card h1, .auth-card h1 { margin: 18px 0 8px; color: #17364e; }
.processing-panel > p, .status-card > p, .download-card > p, .auth-card > p { color: var(--muted); line-height: 1.65; }
.processing-icon { animation: rotate 1.7s linear infinite; filter: invert(36%) sepia(21%) saturate(1145%) hue-rotate(157deg); }
@keyframes rotate { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .processing-icon { animation: none; } }
.progress-track { height: 9px; margin: 30px 0; overflow: hidden; border-radius: 8px; background: #e5edf3; }
.progress-track span { display: block; width: 42%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #196078, #60449c); animation: progress 1.8s ease-in-out infinite alternate; }
@keyframes progress { to { transform: translateX(130%); } }
.one-time-secret { margin-top: 32px; padding: 22px; text-align: left; border-radius: 9px; background: #fff8e8; border: 1px solid #edd8a9; }
.one-time-secret p { margin: 6px 0 14px; color: #786a47; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }
.copy-row button { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid #bdcbd7; border-radius: 6px; background: white; color: var(--primary); cursor: pointer; }
.copy-row img { filter: invert(26%) sepia(30%) saturate(1235%) hue-rotate(161deg); }

.qr-result-grid { margin-top: 32px; display: grid; grid-template-columns: 310px 1fr; gap: 42px; align-items: center; text-align: left; }
.qr-image { display: block; padding: 12px; border: 1px solid #d6e0e9; border-radius: 10px; background: white; image-rendering: pixelated; }
.file-result-details h2 { margin: 0 0 20px; }
.file-result-details dl, .download-metadata { display: grid; gap: 0; margin: 0 0 24px; }
.file-result-details dl div, .download-metadata div { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid #e5ebf0; }
dt { color: var(--muted); }
dd { margin: 0; }
.hash-value { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.result-link { margin-top: 14px; }
.download-card { width: min(590px, 100%); }
.download-card h1 { overflow-wrap: anywhere; }
.download-metadata { margin-top: 26px; text-align: left; }
.landing-qr-panel { margin-top: 30px; padding-top: 28px; border-top: 1px solid #e5ebf0; }
.landing-qr-panel h2 { margin: 0; color: #17364e; font-size: 21px; }
.landing-qr-panel > p { margin: 8px 0 20px; color: var(--muted); line-height: 1.55; }
.landing-qr-image { width: 244px; height: 244px; margin: 0 auto; }
.landing-qr-panel .handheld-hint { margin: 14px 0 0; color: #456277; font-size: 14px; }
.compact-card { width: min(520px, 100%); }
.muted { color: var(--muted); font-size: 14px; }
.validation-detail { padding: 12px; border-radius: 7px; background: #fff5f6; color: #923240 !important; }

input, select, textarea { width: 100%; min-height: 44px; padding: 9px 11px; color: var(--text); border: 1px solid #bfcdd9; border-radius: 6px; background: white; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(23, 117, 157, .25); outline-offset: 2px; }
textarea { min-height: 84px; resize: vertical; }
label { color: #354f65; font-weight: 650; }
.auth-card { width: min(470px, 100%); }
.auth-card form { display: grid; gap: 10px; margin-top: 28px; text-align: left; }
.auth-card label { margin-top: 7px; }
.auth-card form button { margin-top: 12px; }
.setup-card { width: min(560px, 100%); }
.totp-qr { margin: 24px auto; }
.setup-key { display: block; margin: 12px 0; padding: 10px; overflow-wrap: anywhere; background: #eef3f7; }
.recovery-codes { margin: 24px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recovery-codes code { padding: 9px; border-radius: 5px; background: #eef3f7; }

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Management surface */
.admin-body { overflow-x: hidden; background: #f1f4f8; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 254px minmax(0, 1fr); }
.admin-sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; display: flex; flex-direction: column; color: #dbe5ed; background: linear-gradient(180deg, #102f48, #0c2337); box-shadow: 6px 0 22px rgba(13, 35, 54, .1); }
.admin-brand { display: flex; align-items: center; gap: 13px; padding: 0 7px 26px; color: white; text-decoration: none; font-weight: 750; }
.admin-brand img { object-fit: contain; }
.admin-brand span { display: grid; gap: 2px; }
.admin-brand small { color: #92a9ba; font-size: 12px; font-weight: 500; }
.admin-sidebar nav { display: grid; gap: 5px; }
.admin-sidebar nav a { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 9px 13px; border-radius: 7px; color: #c6d4df; text-decoration: none; }
.admin-sidebar nav a:hover { color: white; background: rgba(255, 255, 255, .08); }
.admin-sidebar nav img, .admin-user img { width: 20px; height: 20px; filter: brightness(0) invert(1); opacity: .82; }
.admin-user { margin-top: auto; padding: 18px 10px 4px; display: grid; gap: 3px; border-top: 1px solid rgba(255,255,255,.12); }
.admin-user small { color: #90a6b6; }
.admin-user form { margin-top: 10px; }
.admin-user button { padding: 5px 0; display: flex; align-items: center; gap: 8px; border: 0; color: #cedae3; background: transparent; cursor: pointer; }
.admin-main { min-width: 0; padding: 36px clamp(24px, 4vw, 56px) 60px; }
.admin-page-header { min-height: 78px; margin-bottom: 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; }
.admin-page-header h1 { margin: 3px 0 6px; color: #19384f; font-size: 29px; }
.admin-page-header p { margin: 0; color: var(--muted); }
.admin-page-header > span { color: var(--muted); font-size: 14px; }
.admin-page-header a { display: inline-block; margin-bottom: 6px; color: var(--muted); text-decoration: none; }
.metric-grid { margin-bottom: 24px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.metric-grid article { min-height: 145px; padding: 23px; display: grid; align-content: space-between; border: 1px solid #dce5ec; border-radius: 10px; background: white; box-shadow: 0 5px 18px rgba(25, 56, 83, .04); }
.metric-grid span, .metric-grid small { color: var(--muted); }
.metric-grid strong { color: #163c58; font-size: 36px; }
.metric-grid article.metric-alert strong { color: var(--danger); }
.admin-grid-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; margin-bottom: 22px; }
.admin-panel { margin-bottom: 22px; padding: 24px; border: 1px solid #dbe4eb; border-radius: 10px; background: white; box-shadow: 0 4px 16px rgba(31, 58, 81, .04); }
.admin-panel > header { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.admin-panel h2 { margin: 0 0 18px; color: #1d3a51; font-size: 19px; }
.admin-panel > header h2 { margin: 0; }
.admin-panel > header a { font-size: 14px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 11px 12px; color: #6b7e8f; text-align: left; font-size: 12px; letter-spacing: .03em; white-space: nowrap; background: #f6f8fa; border-bottom: 1px solid #dfe6ec; }
td { padding: 13px 12px; vertical-align: top; border-bottom: 1px solid #e7edf2; }
td small, td strong { display: block; }
td small { margin-top: 4px; color: #7f8e9b; max-width: 330px; overflow-wrap: anywhere; }
.status-pill, .severity { display: inline-block; padding: 4px 9px; border-radius: 20px; color: #536879; background: #e9eef2; font-size: 12px; font-weight: 700; }
.status-active { color: #17674d; background: #dff4eb; }
.status-rejected, .status-revoked, .status-storagemissing, .severity-critical { color: #9d2e3c; background: #fde8eb; }
.status-quarantined, .status-sanitizing, .severity-warning { color: #8a5b0e; background: #fff1d8; }
.status-expired, .status-deleted, .status-deleting { color: #5c6873; background: #e8edf1; }
.severity-info { color: #1c5f80; background: #e1f1f8; }
.event-list { display: grid; }
.event-list > div { padding: 12px 0; display: grid; grid-template-columns: 1fr auto; border-bottom: 1px solid #e7edf2; }
.event-list strong { font-size: 14px; }
.event-list span { grid-column: 1; color: var(--muted); font-size: 13px; }
.event-list time { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--muted); font-size: 12px; }
.filter-bar { margin-bottom: 18px; padding: 16px 18px; display: flex; align-items: end; gap: 14px; border: 1px solid #dbe4eb; border-radius: 9px; background: white; }
.filter-bar label { min-width: 170px; display: grid; gap: 6px; font-size: 13px; }
.filter-bar button { min-height: 44px; }
.pagination { padding-top: 18px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.pagination div { display: flex; gap: 14px; }
.table-action { border: 0; color: #23658b; background: none; text-decoration: none; cursor: pointer; white-space: nowrap; }
.danger-text { color: var(--danger); }
.details-grid { grid-template-columns: minmax(0, 1.45fr) minmax(340px, .75fr); }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.detail-list div { padding: 13px 5px; border-bottom: 1px solid #e6edf2; }
.detail-list dt { margin-bottom: 4px; font-size: 12px; }
.detail-list .wide { grid-column: 1 / -1; }
.mini-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.mini-metrics div { padding: 15px 8px; display: grid; gap: 5px; text-align: center; border-radius: 7px; background: #f3f7fa; }
.mini-metrics strong { font-size: 24px; }
.mini-metrics span { color: var(--muted); font-size: 12px; }
.admin-action-form { margin-top: 22px; padding-top: 18px; display: grid; grid-template-columns: 110px 1fr auto; align-items: end; gap: 10px; border-top: 1px solid #e4ebf0; }
.admin-action-form h3 { grid-column: 1 / -1; margin: 0; font-size: 15px; }
.admin-action-form label { display: grid; gap: 5px; font-size: 12px; }
.admin-action-form label:nth-of-type(2) { min-width: 180px; }
.stack-form { display: grid; gap: 13px; }
.stack-form label { display: grid; gap: 6px; }
.stack-form button { justify-self: start; }
.policy-list { margin: 0; padding-left: 22px; color: #607486; line-height: 2; }
.empty-state { text-align: center; }
.status-message { margin-bottom: 22px; padding: 14px 18px; color: #17674d; border: 1px solid #adddcc; border-radius: 8px; background: #eaf8f2; }
.field-validation { color: var(--danger); font-size: 13px; }
.field-validation:empty { display: none; }
.storage-metric-grid { margin-bottom: 24px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.storage-metric-grid article { min-height: 132px; padding: 22px; display: grid; align-content: space-between; border: 1px solid #dce5ec; border-radius: 10px; background: white; box-shadow: 0 5px 18px rgba(25, 56, 83, .04); }
.storage-metric-grid span, .storage-metric-grid small { color: var(--muted); }
.storage-metric-grid strong { color: #163c58; font-size: 25px; }
.storage-usage-panel progress { width: 100%; height: 18px; accent-color: #315f9a; }
.storage-usage-panel p { margin: 13px 0 0; color: var(--muted); font-size: 14px; }
.settings-grid .primary-button, .settings-grid .secondary-button { min-height: 48px; min-width: 190px; font-size: 15px; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .storage-metric-grid { grid-template-columns: 1fr 1fr; }
  .details-grid { grid-template-columns: 1fr; }
  .qr-result-grid { grid-template-columns: 260px 1fr; }
}

@media (max-width: 780px) {
  .site-header { min-height: 90px; padding: 16px 22px; }
  .brand { gap: 12px; font-size: 21px; }
  .brand img { width: 54px; height: 54px; transform: none; }
  .admin-link span { display: none; }
  .site-main { width: min(100% - 28px, 1160px); padding-top: 28px; }
  .process-steps { align-items: flex-start; }
  .process-steps li { width: 90px; padding: 0; flex-direction: column; gap: 8px; text-align: center; white-space: normal; background: transparent; }
  .process-steps li span { width: 40px; height: 40px; }
  .process-steps li strong { padding: 0 4px; font-size: 13px; line-height: 1.25; background: var(--canvas); }
  .process-steps::before { top: 19px; }
  .drop-zone { min-height: 390px; padding: 28px 20px; }
  .drop-zone-title { font-size: 24px; }
  .drop-zone-help { font-size: 16px; }
  .selected-file-card { grid-template-columns: auto minmax(0, 1fr); }
  .selected-file-card .secondary-button { grid-column: 1 / -1; width: 100%; }
  .security-note { align-items: flex-start; padding: 18px; }
  .processing-panel, .status-card, .download-card, .auth-card { padding: 32px 20px; }
  .qr-result-grid { grid-template-columns: 1fr; justify-items: center; }
  .file-result-details { width: 100%; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .admin-sidebar nav { grid-template-columns: 1fr 1fr; }
  .admin-user { margin-top: 18px; }
  .admin-main { padding: 26px 16px 50px; }
  .admin-grid-two, .metric-grid { grid-template-columns: 1fr; }
  .storage-metric-grid { grid-template-columns: 1fr; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .admin-action-form { grid-template-columns: 1fr; }
  .admin-action-form h3 { grid-column: 1; }
}

@media (max-width: 480px) {
  .process-steps li strong { font-size: 12px; }
  .drop-file-icon { width: 78px; height: 78px; }
  .copy-row { flex-direction: column; }
  .site-footer { flex-wrap: wrap; }
  .admin-sidebar nav { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list .wide { grid-column: 1; }
  .mini-metrics { grid-template-columns: 1fr; }
  .recovery-codes { grid-template-columns: 1fr; }
}
