:root {
  --paper: #FAFAFA;
  --ink: #0A0A0A;
  --muted: #555;
  --line: #D4D4D4;
  --accent: #C41E3A;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-width: 0; min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
body:not(.app-ready) .app-shell { visibility: hidden; }

.app-shell {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 24px 16px;
}

.panel { width: min(100%, 360px); }
.login-panel { padding: 22px 0; }
.identity { display: flex; align-items: center; min-height: 34px; }
.identity img { display: block; width: 34px; height: 34px; object-fit: contain; }

h1 {
  margin: 24px 0 28px;
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -.04em;
  line-height: .95;
}

h2 { margin: 0; font-size: 13px; font-weight: 700; }
form { display: grid; gap: 9px; }
label { color: var(--muted); font-size: 13px; font-weight: 600; }
input[type="text"], input[type="password"] {
  width: 100%;
  min-height: 48px;
  margin: 0 0 9px;
  padding: 11px 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
}
input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--accent);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.button-dark { color: var(--paper); background: var(--ink); }
.button-dark:hover, .button-dark:focus-visible { background: var(--accent); border-color: var(--accent); }
.button:focus-visible, .drop-zone:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button-quiet { min-height: 34px; padding: 7px 10px; color: var(--muted); background: transparent; border-color: var(--line); font-size: 11px; }
.button-quiet:hover, .button-quiet:focus-visible { color: var(--ink); border-color: var(--ink); }
.icon { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.icon-lg { width: 20px; height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.message { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.message-error { color: var(--accent); }

.workspace-panel { width: min(100%, 760px); }
.workspace-top, .workspace-heading, .workspace-actions { display: flex; align-items: center; gap: 12px; }
.workspace-top { justify-content: space-between; }
.workspace-heading { margin: 28px 0 20px; }
.workspace-heading h1 { flex: 1; min-width: 0; margin: 0; font-size: 36px; }
.compact-icon-button { width: 34px; padding: 7px; }
.breadcrumb { display: flex; min-width: 0; max-width: 100%; align-items: center; gap: 5px; margin: -9px 0 18px; overflow-x: auto; color: var(--muted); font-size: 12px; white-space: nowrap; scrollbar-width: thin; }
.breadcrumb button { flex: 0 0 auto; padding: 2px 0; color: var(--muted); background: transparent; border: 0; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb button:hover, .breadcrumb button:focus-visible { color: var(--ink); }
.breadcrumb-current { flex: 0 0 auto; overflow: hidden; color: var(--ink); text-overflow: ellipsis; }
.breadcrumb-separator { flex: 0 0 auto; color: var(--line); }
.workspace-actions { align-items: stretch; }
.drop-zone {
  display: flex;
  min-height: 44px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 14px;
  color: var(--muted);
  border: 1px dashed var(--line);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone:focus, .drop-zone.is-dragging { color: var(--ink); border-color: var(--accent); outline: 0; }
.drop-zone input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
.workspace-actions > .button { flex: 0 0 auto; }

.section-heading, .progress-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-heading { margin-bottom: 9px; }
.section-count, .progress-count { color: var(--muted); font-size: 11px; }
.selection-panel, .upload-progress { margin-top: 20px; }
.selected-file-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.selected-file-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 9px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.selected-file-name { min-width: 0; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.selected-file-size { color: var(--muted); font-size: 11px; white-space: nowrap; }
.remove-file { width: 30px; min-height: 30px; padding: 5px; }
.progress-heading { margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.progress-track { height: 8px; overflow: hidden; background: #E7E7E7; }
.progress-bar { width: 0; height: 100%; background: var(--accent); transition: width .08s linear; }
.progress-count { margin-top: 6px; }

.file-list { display: grid; gap: 0; margin: 24px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; min-width: 0; padding: 13px 0; border-bottom: 1px solid var(--line); }
.file-main { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; min-width: 0; align-items: center; }
.file-main-clickable { cursor: pointer; }
.file-main-clickable:hover .file-name, .file-main-clickable:focus-visible .file-name { text-decoration: underline; text-underline-offset: 3px; }
.file-main-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.file-kind { display: inline-flex; width: 22px; color: var(--accent); align-items: center; justify-content: center; }
.file-name { min-width: 0; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--muted); font-size: 11px; white-space: nowrap; }
.file-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.file-action { width: 34px; min-height: 34px; padding: 7px; }
.empty-state { padding: 22px 0; color: var(--muted); font-size: 13px; }
.no-script { width: min(calc(100% - 32px), 360px); margin: 48px auto; color: var(--muted); }

@media (max-width: 560px) {
  .app-shell { padding: 20px 16px; }
  .workspace-actions { align-items: stretch; flex-direction: column; }
  .workspace-actions > .button { width: 100%; }
  .workspace-heading { gap: 8px; }
  .workspace-heading h1 { font-size: 32px; }
  .file-row { gap: 8px; }
  .file-main { gap: 7px; }
  .file-actions { gap: 3px; }
  .file-action { width: 32px; min-height: 32px; }
  .selected-file-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .selected-file-size { grid-column: 2; grid-row: 2; }
  .remove-file { grid-column: 3; grid-row: 1 / span 2; }
}
