:root {
  color-scheme: light;
  --ink: #15120f;
  --muted: #736960;
  --line: rgba(20, 17, 14, 0.15);
  --soft: #f8f3ea;
  --gold: #b98538;
  --panel: #fff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #fff;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: 72px 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

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

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(21px, 2.5vw, 34px);
  line-height: 1;
}

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

.nav-link,
.action,
.file-trigger {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  cursor: pointer;
}

.action.primary,
.file-trigger.primary {
  border-color: rgba(185, 133, 56, 0.45);
  background: #fff4dc;
}

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

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr minmax(220px, 320px);
  gap: 0;
}

.sidebar,
.details {
  min-width: 0;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.details {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.section-title {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.folder {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.folder.is-active {
  border-color: var(--line);
  background: var(--soft);
}

.content {
  min-width: 0;
  padding: 24px;
  background: linear-gradient(#fff, #fffaf3);
}

.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

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

.pathline {
  min-width: 0;
}

.pathline span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.pathline strong {
  display: block;
  margin-top: 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 0.95;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.item {
  min-height: 126px;
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.item.is-selected {
  border-color: rgba(185, 133, 56, 0.75);
  background: #fff7e8;
}

.item .icon {
  font-size: 28px;
}

.item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.photo {
  min-height: 190px;
  padding: 0;
  overflow: hidden;
}

.photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--soft);
}

.photo .caption {
  padding: 12px;
}

.meta {
  display: grid;
  gap: 14px;
}

.meta-row {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.meta-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.meta-row strong {
  overflow-wrap: anywhere;
}

.empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.login-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #fff;
}

.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 24px;
  padding: clamp(24px, 5vw, 44px);
  border: 1px solid var(--line);
  background: #fff;
}

.login-brand {
  justify-content: center;
}

.login-brand img {
  width: 76px;
  height: 76px;
}

.login-brand strong {
  font-size: clamp(34px, 7vw, 54px);
}

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

.login-or {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-or::before,
.login-or::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.login-form label {
  display: grid;
  gap: 6px;
}

.login-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.login-form input:focus {
  outline: 3px solid rgba(185, 133, 56, 0.2);
  border-color: rgba(185, 133, 56, 0.75);
}

.login-error {
  margin: 0;
  color: #8d1d1d;
  font-weight: 800;
}

.login-back {
  justify-self: center;
}

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

  .details {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 700px) {
  .app-shell {
    grid-template-rows: auto 1fr;
  }

  .topbar,
  .content-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    flex-wrap: wrap;
  }

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

  .sidebar,
  .content,
  .details {
    padding: 18px;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

.backdoor-workspace {
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(300px, 380px);
}

.backdoor-details {
  display: grid;
  align-content: start;
  gap: 18px;
}

.viewer-card {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.viewer {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fffaf3;
  padding: 14px;
}

.viewer img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.viewer textarea,
.mail-form textarea,
.mail-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 12px;
}

.viewer textarea {
  resize: vertical;
}

.mail-form {
  display: grid;
  gap: 10px;
}

.move-form {
  display: grid;
  gap: 10px;
}

.move-form label {
  display: grid;
  gap: 6px;
}

.move-form span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.move-form select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.mail-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.mail-list article {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.mail-list strong,
.mail-list span {
  display: block;
}

.mail-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.mail-list p {
  margin: 10px 0 0;
  color: var(--ink);
  line-height: 1.45;
}

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