:root {
  color-scheme: light;
  --bg: #f7fbff;
  --surface: #ffffff;
  --text: #152033;
  --muted: #667085;
  --line: #dbe8f6;
  --blue: #1677d2;
  --blue-dark: #075da8;
  --blue-soft: #e8f4ff;
  --shadow: 0 18px 48px rgba(20, 80, 140, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 52px);
  background: rgba(247, 251, 255, 0.9);
  border-bottom: 1px solid rgba(219, 232, 246, 0.8);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(145deg, #1f8de8, #0b6fc8);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(22, 119, 210, 0.26);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  display: flex;
  gap: 10px;
}

.top-nav a,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.top-nav a,
.button.secondary {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #cfe6fb;
}

.button.primary {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(22, 119, 210, 0.22);
}

.button.danger {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 28px;
  align-items: end;
  padding: 34px 0 28px;
}

.hero.compact {
  padding-top: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
}

.hero p,
.section-heading p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.8;
}

.vault-pill {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.vault-pill span,
.vault-pill strong {
  display: block;
}

.vault-pill span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.vault-pill strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.menu-card {
  min-height: 160px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(20, 80, 140, 0.07);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.menu-card:hover {
  transform: translateY(-3px);
  border-color: #b9daf5;
  box-shadow: var(--shadow);
}

.menu-card span {
  display: block;
  margin-bottom: 18px;
  font-size: 30px;
}

.menu-card strong,
.menu-card small {
  display: block;
}

.menu-card strong {
  margin-bottom: 8px;
  font-size: 18px;
}

.menu-card small {
  color: var(--muted);
  line-height: 1.5;
}

.menu-card.wide {
  grid-column: span 2;
}

.drop-panel,
.recent-panel {
  margin-top: 18px;
}

.panel {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.panel.narrow {
  max-width: 760px;
}

.section-heading {
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-bottom: 10px;
  font-size: 24px;
}

.section-heading h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 4vw, 42px);
}

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

.form-row,
.search-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-row.three {
  grid-template-columns: 1.2fr 1fr 180px;
}

.search-form {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) auto;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  color: var(--text);
  background: #fbfdff;
  border: 1px solid #ccdced;
  border-radius: 10px;
  font: inherit;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(22, 119, 210, 0.16);
  border-color: var(--blue);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 6px;
}

.notice-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.notice {
  margin: 0;
  padding: 12px 14px;
  color: #075985;
  background: #e8f7ff;
  border: 1px solid #bde7fb;
  border-radius: 12px;
  font: inherit;
  white-space: pre-wrap;
}

.notice.success::first-line {
  font-weight: 900;
}

.notice.error {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
}

.results {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.result-actions,
.user-actions {
  display: grid;
  gap: 10px;
}

.user-actions form {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.user-actions input,
.user-actions select {
  min-width: 140px;
}

.auth-panel {
  margin-inline: auto;
}

.result-card h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

.result-card p {
  color: var(--muted);
  line-height: 1.7;
}

.result-meta {
  margin-bottom: 6px;
  color: var(--blue-dark) !important;
  font-size: 13px;
  font-weight: 800;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-row span,
.folder-list span {
  padding: 6px 10px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.folder-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.source-picker legend {
  width: 100%;
  margin-bottom: 4px;
  color: #344054;
  font-weight: 800;
}

.source-picker label {
  display: inline-flex;
  width: auto;
  cursor: pointer;
}

.source-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.source-picker span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border: 1px solid #cfe6fb;
  border-radius: 999px;
  font-weight: 800;
}

.source-picker input:checked + span {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(22, 119, 210, 0.22);
}

.drop-form {
  display: grid;
  gap: 16px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 22px;
  text-align: center;
  color: var(--blue-dark);
  background: #f4faff;
  border: 2px dashed #9bcdf6;
  border-radius: 16px;
  cursor: pointer;
}

.drop-zone:hover {
  background: #edf7ff;
  border-color: var(--blue);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-zone span {
  font-size: 18px;
  font-weight: 900;
}

.drop-zone small {
  margin-top: 6px;
  color: var(--muted);
}

.recent-list {
  display: grid;
  gap: 10px;
}

.recent-item {
  display: grid;
  gap: 5px;
  padding: 14px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.recent-item:hover {
  border-color: #b9daf5;
  box-shadow: 0 10px 24px rgba(20, 80, 140, 0.08);
}

.recent-item strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.recent-item span {
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}

.recent-item small {
  color: var(--muted);
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.empty.slim {
  padding: 18px;
}

@media (max-width: 860px) {
  .hero,
  .home-layout,
  .form-row,
  .form-row.three,
  .search-form,
  .result-card {
    grid-template-columns: 1fr;
  }

  .user-actions form {
    align-items: stretch;
    flex-direction: column;
  }

  .menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-card.wide {
    grid-column: span 1;
  }
}

@media (max-width: 560px) {
  .app-header,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
  }

  .top-nav a {
    flex: 1;
  }

  .menu-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 20px;
  }
}
