:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f2efe8;
  color: #1d2633;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(29, 38, 51, 0.1);
  box-shadow: 0 6px 24px rgba(35, 48, 67, 0.08);
}

.header .brand {
  margin: 0;
  border: 1px solid rgba(29, 38, 51, 0.14);
  background: rgba(255, 255, 255, 0.6);
  color: #344256;
  text-decoration: none;
}

.header .button {
  padding: 10px 18px;
  font-size: 0.85rem;
  border-radius: 14px;
  box-shadow: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions form {
  margin: 0;
}

.login-card {
  width: min(100%, 460px);
}

.login-error {
  margin: 0;
  border: 1px solid #e5a7a2;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff1f0;
  color: #8f1d15;
  font-size: 0.9rem;
  font-weight: 700;
}

.logout-form {
  margin: 0;
}

.page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 0.86fr);
  gap: clamp(22px, 4vw, 56px);
  align-items: center;
  padding: calc(clamp(20px, 5vw, 72px) + 72px) clamp(20px, 5vw, 72px) clamp(20px, 5vw, 72px);
  background:
    radial-gradient(circle at 12% 18%, rgba(151, 98, 44, 0.2), transparent 28rem),
    radial-gradient(circle at 92% 82%, rgba(38, 86, 110, 0.18), transparent 26rem),
    linear-gradient(135deg, #fbf8f0 0%, #e8edf0 100%);
}

.page.center {
  grid-template-columns: 1fr;
  justify-items: center;
}

.page.center > * {
  max-width: 760px;
}

.hero,
.panel {
  width: 100%;
}

.brand {
  width: fit-content;
  max-width: min(100%, 420px);
  margin-bottom: 28px;
  border: 1px solid rgba(29, 38, 51, 0.18);
  border-radius: 999px;
  padding: 7px 13px;
  background: rgba(255, 255, 255, 0.54);
  color: #344256;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: #8a5424;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.7rem, 7vw, 6.6rem);
  line-height: 0.9;
  letter-spacing: -0.075em;
}

.intro {
  max-width: 620px;
  margin: 24px 0 0;
  color: #596677;
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.6;
}

.panel {
  display: grid;
  gap: 18px;
  max-width: 620px;
  justify-self: end;
}

.page.center .panel {
  justify-self: center;
}

.panel-list {
  width: 100%;
  min-width: 0;
}

.list-heading {
  margin-bottom: 18px;
}

.list-heading h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -0.03em;
}

.list-intro {
  margin: 8px 0 0;
  color: #596677;
  line-height: 1.55;
}

.uploads-list {
  display: grid;
  gap: 12px;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 6px;
}

.upload-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(29, 38, 51, 0.1);
  border-radius: 20px;
  padding: 14px 14px 14px 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 30px rgba(35, 48, 67, 0.08);
  backdrop-filter: blur(10px);
}

.upload-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.upload-title {
  color: #203044;
  font-size: 1rem;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.upload-meta {
  color: #647084;
  font-size: 0.84rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.upload-file {
  color: #7a7f8c;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.upload-open {
  flex: 0 0 auto;
  padding: 11px 18px;
  font-size: 0.85rem;
  border-radius: 14px;
  box-shadow: none;
}

.list-empty {
  margin: 0;
  border: 1px dashed #c9b89a;
  border-radius: 18px;
  padding: 22px;
  background: rgba(250, 246, 238, 0.7);
  color: #7a5b36;
  line-height: 1.5;
}

@media (max-width: 920px) {
  .uploads-list {
    max-height: none;
  }
}

.form-card,
.file-card {
  border: 1px solid rgba(29, 38, 51, 0.1);
  border-radius: 30px;
  padding: clamp(22px, 4vw, 34px);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 24px 70px rgba(35, 48, 67, 0.13);
  backdrop-filter: blur(14px);
}

.section-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.section-heading span {
  display: grid;
  min-width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: #1f3f55;
  color: #fff;
  font-weight: 900;
}

h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.section-heading p {
  margin: 4px 0 0;
  color: #667386;
  line-height: 1.45;
}

.form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: #253248;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid #d2d8df;
  border-radius: 16px;
  padding: 15px 16px;
  font: inherit;
  background: #fbfcfd;
}

input[type='file'] {
  padding: 12px;
}

select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.books-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.books-list strong {
  color: #253248;
  font-size: 0.92rem;
}

.books-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.books-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #d8dde3;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
}

.books-list li.empty {
  justify-content: center;
  color: #667386;
  font-size: 0.92rem;
}

.book-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.book-info strong {
  color: #203044;
  overflow-wrap: anywhere;
}

.book-info small {
  color: #7a8760;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.remove-book {
  flex: 0 0 auto;
  border-radius: 12px;
  padding: 9px 14px;
  color: #8f1d15;
  background: #fff1f0;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: none;
}

.selected-files[hidden] {
  display: none;
}

.selected-files {
  display: grid;
  gap: 10px;
  border: 1px solid #d8dde3;
  border-radius: 18px;
  padding: 14px;
  background: #f7f9fb;
}

.selected-files strong {
  color: #253248;
  font-size: 0.92rem;
}

.selected-files ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.selected-files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 12px;
  padding: 9px 10px;
  background: #fff;
  color: #536175;
  font-size: 0.92rem;
}

.selected-files li span {
  min-width: 0;
  overflow-wrap: anywhere;
}

button,
.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 18px;
  padding: 16px 18px;
  color: #fff;
  background: #48639C;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 16px 30px rgba(72, 99, 156, 0.24);
}

.button.secondary {
  color: #1f3f55;
  background: #eef3f7;
  box-shadow: none;
}

.success-button {
  background: #15803d;
  box-shadow: 0 16px 30px rgba(21, 128, 61, 0.24);
}

.danger-button {
  background: #b42318;
  box-shadow: 0 16px 30px rgba(180, 35, 24, 0.22);
}

button::before {
  width: 18px;
  height: 18px;
  display: none;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  content: '';
  animation: spin 0.8s linear infinite;
}

button.is-loading::before {
  display: block;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.result {
  border: 1px solid #d8dde3;
  border-radius: 22px;
  padding: 18px;
  background: #f7f9fb;
}

.result strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.result p {
  margin: 8px 0 0;
  color: #657184;
  line-height: 1.5;
}

.result.loading {
  border-color: #b9c7d3;
  background: #eef5fb;
}

.result.loading strong::before {
  width: 16px;
  height: 16px;
  display: inline-block;
  margin-right: 9px;
  border: 3px solid rgba(31, 63, 85, 0.18);
  border-top-color: #1f3f55;
  border-radius: 50%;
  vertical-align: -3px;
  content: '';
  animation: spin 0.8s linear infinite;
}

.result.success {
  border-color: #9ed2b1;
  background: #effaf3;
}

.result.error {
  border-color: #e5a7a2;
  background: #fff1f0;
}

.result dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.result dl div {
  display: grid;
  gap: 3px;
}

.result dt {
  color: #647084;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result dd {
  margin: 0;
  color: #203044;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.result code,
.path-box code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

.link-box {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  border: 1px solid #d8dde3;
  border-radius: 18px;
  padding: 14px;
  background: #f7f9fb;
}

.link-box strong {
  color: #253248;
  font-size: 0.92rem;
}

.link-box a {
  color: #1f5f8a;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.file-header {
  margin-bottom: 22px;
}

.file-card h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1.05;
  margin-bottom: 20px;
}

.file-meta {
  display: grid;
  gap: 10px;
  margin: 0;
}

.file-meta div {
  display: grid;
  gap: 3px;
}

.file-meta dt {
  color: #647084;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.file-meta dd {
  margin: 0;
  color: #203044;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.path-box {
  display: grid;
  gap: 8px;
  margin: 22px 0;
  border: 1px dashed #c9b89a;
  border-radius: 18px;
  padding: 16px;
  background: #faf6ee;
}

.path-box strong {
  color: #7a5426;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.path-box code {
  color: #4a3a1e;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.preview {
  width: 100%;
  height: 60vh;
  min-height: 360px;
  border: 1px solid #d8dde3;
  border-radius: 18px;
  background: #f4f6f8;
}

.preview-image {
  width: 100%;
  border: 1px solid #d8dde3;
  border-radius: 18px;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 29, 40, 0.58);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(100%, 620px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 28px;
  padding: clamp(24px, 5vw, 36px);
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.status-modal-card {
  width: min(100%, 520px);
}

.modal-card h2 {
  margin-bottom: 12px;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.modal-card p {
  margin: 0 0 14px;
  color: #556275;
  line-height: 1.6;
}

.modal-actions {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions.single {
  grid-template-columns: 1fr;
}

@media (max-width: 920px) {
  .page {
    grid-template-columns: 1fr;
    align-items: start;
  }

  h1 {
    font-size: clamp(2.5rem, 13vw, 4.8rem);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
