:root {
  color-scheme: light;
  --canvas: #f5f6f2;
  --surface: #ffffff;
  --surface-muted: #eef2ee;
  --ink: #16221f;
  --muted: #63716b;
  --line: #d8e0da;
  --line-strong: #becdc3;
  --brand: #176451;
  --brand-strong: #0f4e40;
  --brand-soft: #e4f1eb;
  --blue: #176d84;
  --blue-soft: #e6f2f5;
  --gold: #a66611;
  --gold-soft: #fbefdc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --shadow: 0 18px 46px rgba(20, 37, 31, 0.15);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.admin-open,
body.share-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(23, 109, 132, 0.28);
  outline-offset: 2px;
}

.page {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.siteHeader {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brandMark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 7px;
  color: #ffffff;
  background: var(--brand);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.brandName {
  font-size: 18px;
  font-weight: 760;
}

.brandDivider {
  width: 1px;
  height: 20px;
  background: var(--line-strong);
}

.brandArea {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.quietButton,
.primaryButton,
.secondaryButton,
.textButton,
.iconButton,
.downloadLink,
.deleteButton {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.quietButton,
.primaryButton,
.secondaryButton,
.downloadLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 680;
  line-height: 1;
  text-decoration: none;
}

.quietButton {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.quietButton:hover {
  background: var(--surface-muted);
  box-shadow: inset 0 0 0 1px #aebfb3;
}

.primaryButton,
.downloadLink {
  color: #ffffff;
  background: var(--brand);
}

.primaryButton:hover,
.downloadLink:hover {
  background: var(--brand-strong);
}

.secondaryButton {
  color: var(--ink);
  background: var(--surface-muted);
}

.secondaryButton:hover {
  background: #e0e8e1;
}

.textButton {
  width: fit-content;
  min-height: 32px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.textButton:hover {
  color: var(--ink);
}

.iconButton,
.fieldClear,
.deleteButton {
  width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.iconButton {
  color: var(--ink);
  background: var(--surface-muted);
}

.iconButton:hover {
  background: #e0e8e1;
}

.iconButton.isLoading svg {
  animation: spin 720ms linear infinite;
}

.hero {
  padding: 72px 0 30px;
}

.heroCopy {
  max-width: 640px;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 12px 0 0;
  font-size: 58px;
  font-weight: 760;
  line-height: 1;
}

h2,
h3 {
  margin: 0;
}

.intro {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.directoryToolbar {
  min-height: 72px;
  margin-top: 42px;
  padding: 14px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.searchField {
  width: min(440px, 100%);
  min-height: 42px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
}

.searchField:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 109, 132, 0.14);
}

.searchField input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}

.searchField input::placeholder {
  color: #86938d;
}

.fieldClear {
  width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
}

.fieldClear:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

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

.fileCount {
  min-width: 92px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.directory {
  padding-bottom: 42px;
}

.directoryHead,
.fileRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 142px 86px minmax(116px, auto);
  gap: 20px;
}

.directoryHead {
  min-height: 48px;
  align-items: center;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
}

.directoryHead span:first-child {
  padding-left: 56px;
}

.fileList {
  min-height: 1px;
}

.fileRow {
  min-height: 88px;
  grid-template-columns: 40px minmax(0, 1fr) 142px 86px minmax(116px, auto);
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.fileRow:hover {
  background: rgba(255, 255, 255, 0.48);
}

.fileIcon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--brand);
  background: var(--brand-soft);
}

.fileIcon[data-kind="archive"] {
  color: var(--gold);
  background: var(--gold-soft);
}

.fileIcon[data-kind="image"],
.fileIcon[data-kind="media"] {
  color: var(--blue);
  background: var(--blue-soft);
}

.fileIcon[data-kind="code"] {
  color: #6954a5;
  background: #ede9f8;
}

.fileMeta {
  min-width: 0;
}

.fileTitleLine {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fileTitle {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.32;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fileExtension {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 10px;
  font-weight: 760;
  line-height: 1;
  text-transform: uppercase;
}

.fileDescription,
.fileOriginalName {
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fileInfo {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.compactLabel {
  display: none;
}

.fileActions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.downloadLink {
  min-width: 116px;
}

.deleteButton {
  color: var(--danger);
  background: var(--danger-soft);
}

.deleteButton:hover {
  color: #8e1c13;
  background: #f9d8d4;
}

.emptyState {
  max-width: 400px;
  padding: 72px 0 38px 56px;
}

.emptyIcon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--brand);
  background: var(--brand-soft);
}

.emptyState h2 {
  margin-top: 18px;
  font-size: 20px;
  line-height: 1.25;
}

.emptyState p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.emptyState .secondaryButton {
  margin-top: 20px;
}

.siteFooter {
  min-height: 80px;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.siteFooter a {
  color: inherit;
  text-underline-offset: 3px;
}

.footerDot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.adminBackdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(15, 31, 25, 0.38);
}

.shareBackdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 31, 25, 0.42);
}

.shareDialog {
  width: min(430px, calc(100% - 32px));
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 31;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.shareHeader {
  min-height: 88px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.shareHeader h2 {
  margin-top: 5px;
  font-size: 22px;
  line-height: 1.1;
}

.shareBody {
  padding: 22px;
}

.shareFileName {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qrCode {
  width: 216px;
  height: 216px;
  margin: 22px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.qrCode > * {
  max-width: 184px;
  max-height: 184px;
}

.shareLinkField {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.shareLinkField input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}

.copyShareLink {
  width: 100%;
  margin-top: 14px;
}

.adminDrawer {
  width: min(440px, 100vw);
  min-height: 100vh;
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 11;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.drawerHeader {
  min-height: 94px;
  padding: 24px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.drawerHeader h2 {
  margin-top: 6px;
  font-size: 25px;
  line-height: 1;
}

.drawerBody {
  padding: 26px;
}

.sessionState {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 14px;
}

.sessionState p {
  margin: 0;
}

.sessionIcon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--gold);
  background: var(--gold-soft);
}

.loginForm,
.uploadForm {
  display: grid;
  gap: 16px;
}

.loginForm {
  margin-top: 16px;
}

.formField {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.formField input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
}

.formField input:focus {
  border-color: var(--blue);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(23, 109, 132, 0.14);
}

.uploadSection {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.sectionHeading h3 {
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.12;
}

.uploadForm {
  margin-top: 20px;
}

.filePicker {
  display: block;
  cursor: pointer;
}

.filePicker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.filePickerButton {
  min-height: 58px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px dashed #9aafa2;
  border-radius: 6px;
  color: var(--ink);
  background: #f8fbf9;
  font-size: 14px;
  font-weight: 650;
}

.filePicker:hover .filePickerButton {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.filePickerButton > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploadButton {
  min-width: 126px;
}

.uploadSection .textButton {
  margin-top: 22px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: min(390px, calc(100vw - 44px));
  padding: 12px 15px;
  border-radius: 6px;
  color: #ffffff;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.4;
}

.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

@media (max-width: 760px) {
  .page {
    width: min(100%, 640px);
    padding: 0 20px;
  }

  .siteHeader {
    min-height: 72px;
  }

  .brandArea,
  .brandDivider {
    display: none;
  }

  .hero {
    padding: 48px 0 20px;
  }

  h1 {
    font-size: 42px;
  }

  .intro {
    font-size: 16px;
  }

  .directoryToolbar {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 30px;
  }

  .searchField {
    width: 100%;
  }

  .directoryActions {
    justify-content: space-between;
  }

  .fileCount {
    min-width: 0;
    text-align: left;
  }

  .directoryHead {
    display: none;
  }

  .fileRow {
    min-height: 108px;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 7px 12px;
    padding: 16px 0;
  }

  .fileIcon {
    grid-row: 1 / span 2;
  }

  .fileMeta {
    grid-column: 2;
  }

  .fileTitle {
    white-space: normal;
  }

  .fileDate,
  .fileSize {
    grid-column: 2;
    grid-row: 2;
    font-size: 12px;
  }

  .fileDate {
    justify-self: start;
  }

  .fileSize {
    justify-self: end;
    padding-left: 12px;
  }

  .compactLabel {
    display: none;
  }

  .fileActions {
    grid-column: 3;
    grid-row: 1 / span 2;
    flex-direction: column;
    align-self: center;
  }

  .downloadLink,
  .deleteButton {
    width: 40px;
    min-width: 40px;
    padding: 0;
  }

  .downloadLabel {
    display: none;
  }

  .emptyState {
    padding: 58px 0 32px 52px;
  }

  .adminDrawer {
    width: 100%;
  }

  .shareDialog {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }

  .drawerHeader,
  .drawerBody {
    padding-right: 20px;
    padding-left: 20px;
  }
}

@media (max-width: 430px) {
  .page {
    padding: 0 16px;
  }

  .brandMark {
    width: 31px;
    height: 31px;
  }

  h1 {
    font-size: 38px;
  }

  .fileExtension {
    display: none;
  }

  .fileDescription,
  .fileOriginalName {
    max-width: 190px;
  }
}
