@font-face {
  font-family: "Material Symbols Outlined";
  font-style: normal;
  font-weight: 400;
  src: url("/assets/fonts/material-symbols-outlined.ttf") format("truetype");
}

:root {
  color-scheme: light;
  --ink: #333;
  --muted: #666;
  --line: #ced4da;
  --line-soft: #ddd;
  --paper: #f5f5f5;
  --panel: #f5f5f5;
  --field: #fff;
  --accent: #9ed636;
  --accent-dark: #4c6b17;
  --accent-soft: #e7f2d0;
  --brown: #231815;
  --brown-soft: #e7e1d4;
  --ok: #4c6b17;
  --warn: #a66a21;
  --bad: #b83232;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
a { color: inherit; }
.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga";
}
.icon { flex: 0 0 auto; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.topbar div { display: flex; align-items: center; gap: 14px; }
.topbar span, .muted { color: var(--muted); }
.topbar nav { display: flex; gap: 10px; align-items: center; }
.topbar nav a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
  text-decoration: none;
}
.topbar nav a:hover { color: var(--accent-dark); }
.topbar nav .icon { font-size: 19px; }
.topbar-brand { min-width: 0; }
.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 34px auto 54px;
  display: grid;
  gap: 22px;
}
.upload-surface, .history, .panel, .login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.upload-surface, .history { padding: 28px; }
.upload-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.upload-head p:last-child { margin-bottom: 0; }
.upload-head .meter { flex: 0 0 auto; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 30px; letter-spacing: 0; color: var(--ink); }
h2 { font-size: 18px; margin-top: 12px; }
p { color: var(--muted); line-height: 1.7; }
.meter { min-width: 220px; color: var(--muted); font-size: 13px; }
.meter div {
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--brown-soft);
  overflow: hidden;
}
.meter i { display: block; height: 100%; background: var(--accent); }
.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0;
}
select, input[type="password"] {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--field);
  color: var(--ink);
}
.toggle { display: flex; gap: 8px; align-items: center; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.stage.hidden { display: none; }
.upload-surface.busy .tray-add,
.upload-surface.busy .tray-remove,
.upload-surface.busy .settings-toggle { pointer-events: none; opacity: 0.5; }
.drop-zone {
  position: relative;
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 32px;
  border: 2px dashed #b9aa9f;
  border-radius: 10px;
  background: var(--field);
  text-align: center;
}
.drop-inner { display: grid; justify-items: center; gap: 6px; max-width: 460px; }
.drop-inner .icon { font-size: 46px; color: var(--muted); margin-bottom: 6px; }
.drop-zone strong { display: block; font-size: 20px; }
.drop-zone span { color: var(--muted); line-height: 1.7; }
.drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.upload-surface.dragover .drop-zone,
.upload-surface.dragover .tray { border-color: var(--accent); background: var(--accent-soft); }

.tray {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  overflow: hidden;
}
.tray-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 14px;
}
.tray-head h2 { margin: 0 0 4px; font-size: 20px; }
.tray-size { margin: 0; font-size: 13px; color: var(--muted); }
.tray-size.over { color: var(--bad); font-weight: 700; }
.tray-add { display: flex; gap: 8px; flex: 0 0 auto; }
.tray-add .icon-button { border-radius: 999px; }
.tray-list {
  list-style: none;
  margin: 0;
  padding: 0 20px;
  max-height: 340px;
  overflow-y: auto;
  border-top: 1px solid var(--line-soft);
}
.tray-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.tray-item:last-child { border-bottom: 0; }
.tray-icon .icon { font-size: 24px; color: var(--muted); }
.tray-meta { min-width: 0; }
.tray-meta strong { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.tray-meta small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.tray-remove { min-height: 32px; height: 32px; width: 32px; min-width: 32px; border-color: transparent; background: transparent; }
.tray-remove:hover { border-color: var(--line); }
.tray-remove .icon { font-size: 20px; }
.tray-note {
  margin: 0;
  padding: 12px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
  font-size: 13px;
  color: var(--warn);
}
.tray-note.hidden { display: none; }
.settings-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
}
.settings-panel.hidden { display: none; }
.settings-panel label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tray-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
}
.settings-toggle {
  min-height: 44px;
  gap: 10px;
  border-color: transparent;
  background: transparent;
  text-align: left;
  padding: 0 8px;
}
.settings-toggle:hover { border-color: var(--line); background: var(--field); }
.settings-toggle > span { display: grid; gap: 2px; font-size: 13px; }
.settings-toggle small { color: var(--muted); font-size: 12px; }
.tray-foot .primary { min-height: 42px; padding: 0 22px; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

.result-head { display: flex; gap: 12px; align-items: flex-start; }
.result-head .icon { font-size: 28px; color: var(--ok); }
.result-head strong { font-size: 17px; }
.result-head p { margin: 6px 0 0; font-size: 14px; }
.done-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--field);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}
.icon-button, .icon-only {
  width: 42px;
  min-width: 42px;
  padding: 0;
}
.icon-button .icon, .icon-only .icon { font-size: 22px; }
.button.primary, button.primary { background: var(--accent); color: var(--brown); border-color: var(--accent); font-weight: 700; }
.button.primary:hover, button.primary:hover { background: var(--field); color: var(--accent-dark); }
button.danger { color: var(--bad); }
.result {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #b9dda8;
  border-radius: 8px;
  background: var(--accent-soft);
}
.hidden { display: none; }
.copy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  align-items: stretch;
  gap: 10px;
  margin-top: 10px;
}
.copy-grid code {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-wrap: anywhere;
  font-size: 12.5px;
  line-height: 1.7;
}
.copy-grid button { width: 100%; min-height: 42px; }
.progress-list { margin-top: 16px; display: grid; gap: 10px; }
.progress-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); }
.progress-item progress { width: 100%; grid-column: 1 / -1; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.status { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--brown-soft); font-size: 12px; }
.status.ready { background: var(--accent-soft); color: var(--ok); }
.status.processing, .status.uploading { background: #fff4d8; color: var(--warn); }
.status.blocked, .status.error { background: #ffe2e2; color: var(--bad); }
.row-note { margin-top: 8px; max-width: 320px; color: var(--bad); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.file-summary { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; min-width: 260px; }
.file-summary li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: baseline; font-size: 12px; color: var(--muted); }
.file-summary span { overflow-wrap: anywhere; color: var(--ink); }
.file-summary small { white-space: nowrap; color: var(--muted); }
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.pager a, .pager span, .pager strong {
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--field);
  text-decoration: none;
}
.pager strong { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager span { color: var(--muted); }
.login-shell, .download-page, .narrow {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel, .panel {
  width: min(480px, 100%);
  padding: 28px;
}
.brand { margin-bottom: 26px; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}
.brand-mark img {
  display: block;
  width: 154px;
  height: auto;
}
.brand-mark span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-left: 1px solid var(--line);
  color: var(--accent-dark);
  font-size: 15px;
}
.brand.large .brand-mark {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.brand.large .brand-mark img { width: 230px; }
.brand.large .brand-mark span {
  border-left: 0;
  padding: 0;
  color: var(--accent-dark);
}
.login-actions { display: grid; gap: 12px; }
.password-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.error { color: var(--bad); }
.file-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.file-list li { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); }
.file-list span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }

@media (max-width: 760px) {
  .topbar, .upload-head, .file-list li { flex-direction: column; align-items: stretch; }
  .upload-head { gap: 18px; }
  .meter { min-width: 0; }
  .topbar { padding: 14px 18px; }
  .topbar nav { flex-wrap: wrap; }
  .workspace { width: min(100% - 20px, 1180px); margin-top: 12px; }
  .upload-surface, .history { padding: 16px; overflow-x: auto; }
  .tray-foot { flex-direction: column; align-items: stretch; }
  .tray-foot .primary { width: 100%; }
  .drop-zone { min-height: 220px; padding: 20px; }
  .drop-actions { flex-direction: column; align-items: stretch; }
  .password-form, .copy-grid { grid-template-columns: 1fr; }
  .brand-mark img { width: 132px; }
  .brand.large .brand-mark img { width: 200px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #ddd;
    --muted: #aaa;
    --line: #666;
    --line-soft: #555;
    --paper: #333;
    --panel: #333;
    --field: #222;
    --accent: #9ed636;
    --accent-dark: #c4e08a;
    --accent-soft: #2b361c;
    --brown: #f5f5f5;
    --brown-soft: #444;
    --ok: #c4e08a;
    --warn: #e0a553;
    --bad: #ff8a8a;
  }
  body { background: var(--paper); }
  .topbar { background: var(--paper); }
  .topbar nav a { color: var(--ink); }
  .topbar nav a:hover { color: var(--accent-dark); }
  select, input[type="password"], .button, button, .copy-grid code, .progress-item, .pager a, .pager span, .file-list li {
    background: var(--field);
    color: var(--ink);
  }
  .drop-zone, .tray, .tray-remove:hover {
    background: var(--field);
    border-color: var(--line);
  }
  .tray-note, .settings-panel, .tray-foot { background: var(--panel); }
  .settings-toggle { background: transparent; border-color: transparent; }
  .settings-toggle:hover { background: var(--field); border-color: var(--line); }
  .upload-surface.dragover .drop-zone,
  .upload-surface.dragover .tray {
    background: var(--accent-soft);
    border-color: var(--accent);
  }
  .button.primary, button.primary {
    color: #333;
  }
  .brand-mark img {
    filter: brightness(0) invert(1);
  }
  .brand-mark span {
    border-left-color: var(--line);
  }
  .result {
    background: var(--accent-soft);
    border-color: #3f5d2c;
  }
}
