:root {
  --bg-top: #f8fbff;
  --bg-mid: #eef3f8;
  --bg-bottom: #e8eff7;
  --surface: #ffffff;
  --surface-soft: #f7faff;
  --line: #d6e0ea;
  --line-strong: #b7c7d9;
  --text: #132033;
  --muted: #5b6b7e;
  --accent: #1d5cab;
  --accent-strong: #12467f;
  --accent-soft: #e8f1ff;
  --success: #1d7a47;
  --success-soft: #e9f8ef;
  --danger: #b3262e;
  --danger-soft: #fdecee;
  --shadow-soft: 0 10px 28px rgba(16, 39, 66, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Aptos", "Segoe UI Variable Text", "Calibri", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 95% -5%, rgba(29, 92, 171, 0.08), transparent 34%),
    linear-gradient(165deg, var(--bg-top) 0%, var(--bg-mid) 56%, var(--bg-bottom) 100%);
}

code {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  background: rgba(29, 92, 171, 0.1);
  border: 1px solid rgba(29, 92, 171, 0.14);
  border-radius: 6px;
  padding: 0.08rem 0.34rem;
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
}

.hero {
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.94)),
    linear-gradient(120deg, rgba(29, 92, 171, 0.06), rgba(255, 255, 255, 0));
  box-shadow: var(--shadow-soft);
}

.eyebrow {
  margin: 0 0 0.66rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1,
.panel h2,
.file-card h3 {
  margin: 0;
  font-family: "Bahnschrift", "Aptos", "Segoe UI Variable Display", "Calibri", sans-serif;
  letter-spacing: 0.01em;
}

.hero h1 {
  max-width: 14ch;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  line-height: 1.05;
  color: #0f2845;
}

.hero-copy {
  margin: 0.95rem 0 0;
  max-width: 68ch;
  color: var(--muted);
  line-height: 1.6;
}

.notice,
.panel {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.notice {
  padding: 0.82rem 0.98rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.notice-success {
  color: var(--success);
  border-color: rgba(29, 122, 71, 0.3);
  background: var(--success-soft);
}

.notice-error {
  color: var(--danger);
  border-color: rgba(179, 38, 46, 0.3);
  background: var(--danger-soft);
}

.panel {
  padding: 1.25rem;
}

.panel-head {
  margin-bottom: 1rem;
}

.panel-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}

.panel-head-inline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.auth-panel {
  max-width: 520px;
}

.app-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: start;
}

.upload-panel {
  position: sticky;
  top: 1rem;
}

.stack-form {
  display: grid;
  gap: 0.72rem;
}

label {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #223751;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.72rem 0.78rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fcfeff;
  color: var(--text);
  font: inherit;
}

input::placeholder,
textarea::placeholder {
  color: #8090a4;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 92, 171, 0.16);
}

textarea {
  resize: vertical;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.66rem;
}

.primary-button,
.ghost-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.62rem 0.98rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease, color 0.14s ease,
    border-color 0.14s ease;
}

.primary-button {
  color: #ffffff;
  border-color: var(--accent);
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 6px 18px rgba(20, 74, 139, 0.28);
}

.ghost-button,
.small-button {
  color: var(--accent-strong);
  border-color: var(--line-strong);
  background: #ffffff;
}

.primary-button:hover,
.ghost-button:hover,
.small-button:hover {
  transform: translateY(-1px);
}

.logout-row {
  margin-top: 0.75rem;
}

.search-wrap {
  width: min(320px, 100%);
}

.search-wrap label {
  display: block;
  margin-bottom: 0.36rem;
}

.tab-strip {
  margin-bottom: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.46rem;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.48rem 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: #2f4a68;
  background: #ffffff;
  font-size: 0.81rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 0.14s ease, border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.tab-button:hover {
  border-color: #8aa8ca;
  color: #153d68;
}

.tab-button.is-active {
  color: #ffffff;
  border-color: var(--accent);
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 5px 14px rgba(20, 74, 139, 0.2);
}

.file-list {
  display: grid;
  gap: 0.82rem;
}

.file-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(150deg, #ffffff, #f8fbff 72%),
    linear-gradient(120deg, rgba(29, 92, 171, 0.05), rgba(255, 255, 255, 0));
  padding: 1rem;
}

.file-copy {
  min-width: 0;
}

.file-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.file-card h3 {
  font-size: 1.15rem;
  color: #152f4f;
}

.file-category {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(18, 70, 127, 0.22);
  background: rgba(29, 92, 171, 0.08);
  color: #174779;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.file-name,
.file-meta,
.empty-state,
.guide-meta {
  margin: 0.3rem 0 0;
}

.file-name {
  color: var(--accent-strong);
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.file-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.file-description {
  margin: 0.4rem 0 0;
  color: #3f526a;
  font-size: 0.86rem;
  line-height: 1.46;
}

.divider {
  margin: 0 0.4rem;
  color: #96a6bb;
}

.versions-panel,
.guide-panel,
.manage-panel {
  margin-top: 0.62rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 0.52rem 0.62rem;
}

.versions-panel summary,
.manage-panel summary {
  color: #1a3657;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
}

.version-list {
  margin: 0.56rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.28rem 0.64rem;
}

.version-link {
  color: var(--accent);
  font-size: 0.83rem;
  font-weight: 700;
  text-decoration: none;
}

.version-link:hover {
  text-decoration: underline;
}

.version-meta,
.guide-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.card-actions {
  margin-top: 0.62rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.manage-body {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.62rem;
}

.meta-form,
.guide-upload-form,
.guide-remove-form,
.delete-form {
  margin: 0;
}

.meta-grid {
  display: grid;
  gap: 0.45rem;
}

.meta-grid input,
.meta-grid textarea,
.guide-upload-form input[type="file"] {
  border-radius: 8px;
  font-size: 0.84rem;
  padding: 0.54rem 0.64rem;
}

.meta-grid textarea {
  min-height: 72px;
}

.meta-actions {
  margin-top: 0.42rem;
}

.guide-upload-form,
.guide-remove-form,
.delete-form {
  display: grid;
  gap: 0.46rem;
}

.danger-button {
  color: #942225;
  border-color: rgba(179, 38, 46, 0.36);
  background: #fff8f8;
}

.danger-button:hover {
  box-shadow: 0 6px 14px rgba(179, 38, 46, 0.14);
}

.empty-state {
  padding: 0.86rem;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: #fbfdff;
  color: var(--muted);
}

.hero,
.panel,
.file-card {
  animation: panelRise 0.36s ease both;
}

.file-card:nth-child(2n) {
  animation-delay: 0.04s;
}

.file-card:nth-child(3n) {
  animation-delay: 0.08s;
}

@keyframes panelRise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .upload-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100%, calc(100% - 1rem));
    padding-top: 0.9rem;
  }

  .hero,
  .panel {
    padding: 0.95rem;
  }

  .panel-head-inline {
    align-items: stretch;
    flex-direction: column;
  }

  .search-wrap {
    width: 100%;
  }

  .tab-strip {
    margin-bottom: 0.72rem;
  }

  .tab-button {
    width: 100%;
  }

  .password-row {
    grid-template-columns: 1fr;
  }

  .card-actions {
    flex-direction: column;
  }

  .primary-button,
  .ghost-button,
  .small-button {
    width: 100%;
  }

  .version-item {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
