:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #5d6a7c;
  --line: #d9e1ea;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --navy: #1d3557;
  --teal: #087f8c;
  --green: #1f8a5f;
  --red: #b6423c;
  --shadow: 0 18px 45px rgba(29, 53, 87, 0.12);
  --shadow-soft: 0 10px 28px rgba(29, 53, 87, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(29, 53, 87, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(29, 53, 87, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 18% 0%, rgba(8, 127, 140, 0.12), transparent 26%),
    linear-gradient(180deg, #eef4f9 0, #f8fafc 360px, #ffffff 100%);
  background-size: 30px 30px, 30px 30px, auto;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

[hidden] {
  display: none !important;
}

.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;
}

.login-shell,
.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  align-items: center;
  padding: 28px 0 44px;
}

.app-shell {
  display: grid;
  gap: 20px;
  padding: 28px 0 44px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  background: var(--navy);
  font-weight: 700;
}

.brand-name {
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.2rem, 8vw, 4.4rem);
  line-height: 0.98;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.intro,
.upload-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.login-panel,
.upload-panel,
.library-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(620px, 100%);
  padding: clamp(24px, 6vw, 48px);
}

.login-panel .brand-row {
  margin-bottom: 34px;
}

.login-form,
.upload-form {
  display: grid;
  gap: 14px;
}

.login-form {
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
}

input:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(8, 127, 140, 0.25);
  outline-offset: 2px;
}

.login-form button,
.upload-form button,
.file-actions a,
.file-actions button,
.secondary-button,
.pdf-header button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
}

.login-form button,
.upload-form button,
.file-actions a.primary,
.file-actions button.primary {
  color: #fff;
  background: var(--navy);
}

.secondary-button,
.file-actions a,
.file-actions button,
.pdf-header button {
  border: 1px solid var(--line);
  color: var(--navy);
  background: #fff;
}

.file-actions button.danger {
  color: #fff;
  background: var(--red);
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-message.error {
  color: var(--red);
}

.form-message.success {
  color: var(--green);
}

.app-header {
  display: flex;
  gap: 20px;
  align-items: start;
  justify-content: space-between;
  padding: 10px 0 6px;
}

.app-header .brand-row {
  margin-bottom: 28px;
}

.upload-panel,
.library-panel {
  padding: 26px;
  border: 1px solid rgba(217, 225, 234, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(280px, 1.15fr);
  gap: 22px;
  align-items: start;
}

.drop-zone {
  min-height: 156px;
  align-items: center;
  justify-items: center;
  border: 2px dashed #b8c4d2;
  border-radius: 18px;
  padding: 18px;
  color: var(--navy);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(244, 247, 251, 0.82), rgba(255, 255, 255, 0.96));
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--teal);
  background: #e8f5f6;
  transform: translateY(-1px);
}

.drop-zone strong {
  display: block;
  font-size: 1.15rem;
}

.drop-zone span {
  color: var(--muted);
}

.drop-zone.dragging {
  border-color: var(--teal);
  background: #e8f5f6;
}

.drop-zone input {
  max-width: 360px;
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
}

.progress-shell {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebf3;
}

.upload-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px 12px;
}

.upload-summary span {
  color: var(--muted);
  font-weight: 700;
}

.small-button {
  min-height: 30px !important;
  padding: 0 10px !important;
  font-size: 0.82rem;
}

.selected-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.selected-list span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  padding: 7px 10px;
}

.selected-list b {
  color: var(--teal);
  font-size: 0.68rem;
}

.selected-list small {
  color: var(--muted);
  font-size: 0.72rem;
}

.progress-shell span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 160ms ease;
}

.upload-panel .form-message {
  grid-column: 1 / -1;
}

.toolbar {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.search-box {
  flex: 0 1 360px;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-row article {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--wash);
}

.summary-row span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.summary-row strong {
  display: block;
  font-size: 1.7rem;
}

.file-list {
  display: grid;
  gap: 12px;
}

.file-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(29, 53, 87, 0.06);
}

.file-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  font-weight: 700;
}

.file-icon.pdf {
  background: var(--red);
}

.file-icon.office {
  background: var(--green);
}

.file-name {
  margin: 0 0 7px;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.file-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
  background: var(--wash);
}

.pdf-dialog {
  width: min(1120px, calc(100% - 28px));
  height: min(860px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 26px 80px rgba(17, 24, 39, 0.28);
}

.pdf-dialog::backdrop {
  background: rgba(17, 24, 39, 0.55);
}

.pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

.pdf-header strong {
  overflow-wrap: anywhere;
}

.pdf-dialog iframe {
  display: block;
  width: 100%;
  height: calc(100% - 58px);
  border: 0;
  background: #fff;
}

@media (max-width: 820px) {
  .login-shell,
  .app-shell {
    width: min(100% - 22px, 1120px);
    padding-top: 18px;
  }

  .app-header,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-panel,
  .summary-row,
  .file-card {
    grid-template-columns: 1fr;
  }

  .file-actions {
    justify-content: stretch;
  }

  .file-actions a,
  .file-actions button,
  .secondary-button {
    width: 100%;
  }

  .search-box {
    flex: none;
  }
}
