:root {
  --paper: #f3f0e8;
  --paper-deep: #eae5d9;
  --card: #fcfaf5;
  --card-strong: #fffdf8;
  --ink: #1c2924;
  --ink-soft: #47554d;
  --muted: #7a827b;
  --faint: #a4aaa2;
  --line: #ded8cb;
  --line-strong: #cdc5b5;
  --forest: #19332c;
  --forest-2: #214039;
  --forest-soft: #2d5147;
  --orange: #c55c35;
  --orange-dark: #a74626;
  --orange-soft: #f6e6dc;
  --green-soft: #e4ece6;
  --red: #b3483e;
  --blue: #3d657a;
  --shadow-sm: 0 1px 2px rgba(35, 43, 36, .04), 0 8px 20px rgba(35, 43, 36, .035);
  --shadow-md: 0 18px 45px rgba(35, 43, 36, .09);
  --sidebar-w: 274px;
  --radius: 14px;
  --font-sans: "Avenir Next", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body.is-locked { overflow: hidden; }

button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg:not(.svg-sprite) {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------- sidebar ------------------------------- */

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  padding: 27px 18px 20px;
  display: flex;
  flex-direction: column;
  color: #f2eee4;
  background:
    radial-gradient(circle at 10% 0%, rgba(98, 141, 119, .22), transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(197, 92, 53, .1), transparent 35%),
    var(--forest);
  border-right: 1px solid rgba(255, 255, 255, .055);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: radial-gradient(rgba(255, 255, 255, .12) .6px, transparent .6px);
  background-size: 7px 7px;
  mask-image: linear-gradient(to bottom, #000, transparent 55%);
}

.sidebar > * { position: relative; z-index: 1; }

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 0 8px 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--forest);
  background: #eee7d7;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65);
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .04em;
}

.brand-sub {
  margin-top: 4px;
  color: rgba(242, 238, 228, .46);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .18em;
}

.side-nav {
  display: grid;
  gap: 4px;
  padding-bottom: 25px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.side-link {
  position: relative;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: rgba(242, 238, 228, .67);
  background: transparent;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: color .18s ease, background .18s ease;
}

.side-link svg {
  width: 17px;
  height: 17px;
  opacity: .8;
}

.side-link:hover { color: #fff; background: rgba(255, 255, 255, .055); }

.side-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, .095);
}

.side-link.is-active::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--orange);
}

.side-section-head {
  padding: 24px 12px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(242, 238, 228, .43);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .15em;
}

.side-count {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 20px;
  color: rgba(242, 238, 228, .66);
  background: rgba(255, 255, 255, .08);
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-align: center;
  letter-spacing: 0;
}

.side-folders {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  padding: 0 2px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}

.side-folders::-webkit-scrollbar { width: 4px; }
.side-folders::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 4px; }

.folder-nav-item {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(242, 238, 228, .58);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}

.folder-nav-item:hover { color: #f7f3e9; background: rgba(255, 255, 255, .055); }
.folder-nav-item.is-current { color: #fff; background: rgba(197, 92, 53, .18); }
.folder-nav-item.is-current .folder-nav-icon { color: #e6a17f; }

.folder-nav-icon {
  width: 15px;
  height: 15px;
  flex: none;
  color: rgba(242, 238, 228, .35);
}

.folder-nav-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: -.02em;
}

.folder-nav-count {
  margin-left: auto;
  color: rgba(242, 238, 228, .3);
  font-family: var(--font-mono);
  font-size: 9px;
}

.side-foot { padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .09); }

.security-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 3px 10px;
  color: rgba(242, 238, 228, .5);
}

.security-note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; color: #9ab6a7; }
.security-note strong { display: block; color: rgba(242, 238, 228, .75); font-size: 10.5px; font-weight: 600; }
.security-note span { display: block; margin-top: 3px; font-size: 9.5px; line-height: 1.5; }

.sidebar-scrim { display: none; }

/* -------------------------------- main --------------------------------- */

.main {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 82px;
  padding: 15px 42px;
  display: flex;
  align-items: center;
  gap: 22px;
  background: rgba(243, 240, 232, .88);
  border-bottom: 1px solid rgba(205, 197, 181, .55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.mobile-menu { display: none; }

.search-box {
  width: min(630px, 100%);
  height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, .82);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.search-box:focus-within {
  border-color: #a99c86;
  background: var(--card-strong);
  box-shadow: 0 0 0 4px rgba(197, 92, 53, .08);
}

.search-icon { width: 18px; height: 18px; flex: none; color: #8d938c; }

.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.search-box input::placeholder { color: #9a9f97; }
.search-box input::-webkit-search-cancel-button { display: none; }

.search-box kbd {
  flex: none;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: #969b93;
  background: #f4f0e7;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.5;
}

.search-clear {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #eee9df;
  cursor: pointer;
}

.search-clear svg { width: 13px; height: 13px; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 36px 42px 46px;
  flex: 1;
}

.page-footer {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 42px 24px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #999e96;
  font-size: 9.5px;
  letter-spacing: .02em;
}

.footer-dot { width: 2px; height: 2px; border-radius: 50%; background: #b1b5ad; }

/* -------------------------------- buttons ------------------------------- */

.btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  color: #fffaf1;
  background: var(--forest);
  border-color: var(--forest);
  box-shadow: 0 4px 12px rgba(25, 51, 44, .14);
}
.btn-primary:hover:not(:disabled) { background: #25473d; border-color: #25473d; }

.btn-accent {
  color: #fffaf1;
  background: var(--orange);
  border-color: var(--orange);
  box-shadow: 0 4px 12px rgba(197, 92, 53, .18);
}
.btn-accent:hover:not(:disabled) { background: var(--orange-dark); border-color: var(--orange-dark); }

.btn-ghost {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line-strong);
}
.btn-ghost:hover:not(:disabled) { background: #f6f1e8; color: var(--ink); border-color: #b9ae9b; }

.btn-quiet {
  color: var(--ink-soft);
  background: rgba(255, 253, 248, .58);
  border-color: var(--line);
}
.btn-quiet:hover { color: var(--ink); background: var(--card-strong); border-color: var(--line-strong); }

.btn-small { min-height: 33px; padding: 0 12px; font-size: 11px; border-radius: 7px; }

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: #eae5da; color: var(--ink); }

.logout-btn { border-color: transparent; }
.logout-btn:hover { color: var(--red); background: #f4e7e3; }

.text-link {
  padding: 0;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--orange);
  background: none;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.text-link svg { width: 14px; height: 14px; transition: transform .15s ease; }
.text-link:hover svg { transform: translateX(3px); }

/* ------------------------------- page head ------------------------------ */

.hero {
  padding: 2px 0 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 30px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: block;
  color: var(--orange);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .2em;
}

.hero-title {
  margin: 12px 0 10px;
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.1vw, 50px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: .01em;
}

.hero-title em {
  color: var(--orange);
  font-style: normal;
}

.hero-desc {
  max-width: 620px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.8;
}

.hero-side {
  padding-bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 15px;
}

.hero-date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
}

.hero-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.view-head {
  padding: 2px 0 28px;
  border-bottom: 1px solid var(--line);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 17px;
  color: var(--muted);
  font-size: 10.5px;
}

.crumb {
  padding: 3px 5px;
  border: 0;
  border-radius: 4px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-size: inherit;
}
.crumb:hover { color: var(--orange); background: var(--orange-soft); }
.crumb.is-current { color: var(--ink-soft); cursor: default; }
.crumb.is-current:hover { color: var(--ink-soft); background: transparent; }
.crumb-sep { color: #b7b3a9; display: grid; place-items: center; }
.crumb-sep svg { width: 12px; height: 12px; }

.view-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.view-title-wrap { display: flex; align-items: center; gap: 16px; min-width: 0; }

.folder-hero-icon {
  width: 52px;
  height: 52px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--orange);
  background: var(--orange-soft);
  border: 1px solid rgba(197, 92, 53, .1);
}
.folder-hero-icon svg { width: 27px; height: 27px; }

.view-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; }
.view-title-line .status-pill { height: 29px; padding: 0 11px; font-size: 10px; }

.view-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: clamp(23px, 2.8vw, 34px);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1.2;
}

.view-sub {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 10.5px;
}
.sub-dot { width: 2px; height: 2px; border-radius: 50%; background: #aaa99f; }

.view-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* -------------------------------- stats --------------------------------- */

.stats {
  margin: 22px 0 33px;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(252, 250, 245, .55);
  overflow: hidden;
}

.stat {
  flex: 1;
  min-width: 0;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: 0; }

.stat-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--forest-soft);
  background: #e9eee8;
}
.stat-icon svg { width: 17px; height: 17px; }
.stat:nth-child(2) .stat-icon { color: #8d5a3d; background: #f1e8de; }
.stat:nth-child(3) .stat-icon { color: #526b7b; background: #e8edf0; }

.stat-value {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.01em;
}
.stat-value small { margin-left: 3px; font-family: var(--font-sans); font-size: 10px; font-weight: 500; color: var(--muted); }
.stat-label { margin-top: 5px; color: var(--muted); font-size: 9px; letter-spacing: .06em; }

/* ------------------------------ section head ---------------------------- */

.section { margin-top: 30px; }
.section:first-child { margin-top: 0; }

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

.section-title-wrap { display: flex; align-items: baseline; gap: 10px; }
.section-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .015em;
}
.section-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}
.section-tools { display: flex; align-items: center; gap: 10px; }

/* ------------------------------ folder cards ---------------------------- */

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

.folder-card {
  position: relative;
  min-width: 0;
  padding: 18px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  overflow: hidden;
}

.folder-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--orange), #dfa080 60%, transparent);
  opacity: 0;
  transition: opacity .2s ease;
}

.folder-card:hover {
  transform: translateY(-3px);
  border-color: #cdc2af;
  box-shadow: 0 16px 34px rgba(40, 47, 40, .09);
}

.folder-card:hover::before { opacity: 1; }

.folder-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.folder-card-icon {
  width: 40px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--orange);
  background: var(--orange-soft);
}
.folder-card-icon svg { width: 22px; height: 22px; }

.folder-card-actions { display: flex; align-items: center; gap: 4px; margin: -3px -4px 0 0; }
.folder-card-actions .icon-btn { width: 32px; height: 32px; color: #8b9189; }
.folder-card-actions .icon-btn svg { width: 16px; height: 16px; }
.folder-card-actions .icon-btn:hover { color: var(--orange); background: var(--orange-soft); }

.status-pill {
  height: 27px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: filter .15s ease, box-shadow .15s ease, transform .15s ease;
}
.status-pill .status-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.status-pill.is-sold { color: #326047; background: #e5efe6; border-color: #cdddcf; }
.status-pill.is-sold .status-dot { background: #3d7b59; box-shadow: 0 0 0 2px rgba(61, 123, 89, .1); }
.status-pill.is-unsold { color: #a5502f; background: #f7e8dd; border-color: #edd2c0; }
.status-pill.is-unsold .status-dot { background: #c55c35; box-shadow: 0 0 0 2px rgba(197, 92, 53, .1); }
.status-pill:hover:not(:disabled) { filter: brightness(.975); box-shadow: 0 2px 7px rgba(45, 55, 46, .08); }
.status-pill:active:not(:disabled) { transform: translateY(1px); }
.status-pill:disabled { opacity: .55; cursor: wait; }

.status-summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
  color: var(--muted);
  font-size: 9.5px;
  white-space: nowrap;
}
.status-summary b { color: var(--ink-soft); font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; }
.status-summary i { width: 2px; height: 2px; margin: 0 3px; border-radius: 50%; background: #b2b3aa; }

.folder-card-name {
  margin: 14px 0 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card-name button {
  max-width: 100%;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: inherit;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.folder-card-name button:hover { color: var(--orange); }

.folder-card-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9.5px;
}

.folder-card-foot {
  margin-top: 15px;
  padding-top: 11px;
  border-top: 1px solid #eee8dc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.folder-card-foot .text-link { color: var(--ink-soft); font-size: 10px; }
.folder-card-foot .text-link:hover { color: var(--orange); }
.folder-card-size { color: #a0a59d; font-family: var(--font-mono); font-size: 8.5px; }

/* -------------------------------- file list ------------------------------ */

.file-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(252, 250, 245, .58);
}

.file-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 90px 38px;
  gap: 16px;
  padding: 10px 18px;
  color: #969b92;
  background: rgba(234, 229, 217, .45);
  border-bottom: 1px solid var(--line);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .1em;
}
.file-list-head span:nth-child(2),
.file-list-head span:nth-child(3) { text-align: right; }

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 90px 38px;
  gap: 16px;
  align-items: center;
  padding: 11px 18px;
  border-bottom: 1px solid #ece6db;
  transition: background .15s ease;
}
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: rgba(255, 253, 248, .82); }

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

.file-badge {
  width: 34px;
  height: 38px;
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #7a817a;
  background: #eeeae1;
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.file-badge::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 3px;
  height: 12px;
  border-radius: 2px 0 0 0;
  background: currentColor;
  opacity: .5;
}
.file-badge.pdf { color: #b34b40; background: #f5e6e2; }
.file-badge.jpg, .file-badge.jpeg, .file-badge.png { color: #4e7159; background: #e8efe7; }
.file-badge.xlsx, .file-badge.xls { color: #47705b; background: #e5efe7; }
.file-badge.csv { color: #4c6979; background: #e8eef1; }
.file-badge.zip { color: #9a6b37; background: #f2e9da; }

.file-text { min-width: 0; }
.file-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-name mark { padding: 0 1px; color: #8b3b20; background: #f5d9c9; border-radius: 2px; }
.file-folder { margin-top: 2px; color: #9ba097; font-family: var(--font-mono); font-size: 8.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-meta {
  color: #8e948c;
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: right;
  white-space: nowrap;
}

.file-download {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #9a9f97;
  background: transparent;
  cursor: pointer;
  transition: all .15s ease;
}
.file-download svg { width: 16px; height: 16px; }
.file-download:hover { color: var(--orange); background: var(--orange-soft); border-color: rgba(197, 92, 53, .12); }

.file-list.compact { border: 0; border-radius: 0; background: transparent; }

.file-list.compact .file-row { padding: 9px 15px; }

.folder-card-name mark {
  padding: 0 1px;
  color: #8b3b20;
  background: #f5d9c9;
  border-radius: 2px;
}

.error-state-actions { margin-top: 14px; }
.empty-wrap { margin-top: 26px; }

.side-empty {
  padding: 10px;
  color: rgba(242, 238, 228, .4);
  font-size: 10px;
  line-height: 1.6;
}

/* -------------------------------- search -------------------------------- */

.search-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 0 25px;
  border-bottom: 1px solid var(--line);
}

.search-summary h1 {
  margin: 9px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.search-summary h1 mark { color: var(--orange); background: none; }
.search-summary p { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.search-summary .btn { flex: none; }

.result-group { margin-top: 29px; }

.folder-grid.search-folders { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.result-note { color: var(--muted); font-size: 9.5px; }

.load-more { display: flex; justify-content: center; padding: 18px 0 2px; }

.search-file-list .file-row { grid-template-columns: minmax(0, 1fr) 110px 90px 38px; }

.result-file-group {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(252, 250, 245, .55);
}

.result-group-head {
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(234, 229, 217, .4);
  border-bottom: 1px solid var(--line);
}

.result-group-head svg { width: 15px; height: 15px; color: var(--orange); flex: none; }
.result-group-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}
.result-group-count { color: var(--muted); font-size: 9px; white-space: nowrap; }
.result-group-head .icon-btn { margin-left: auto; width: 29px; height: 29px; }
.result-group-head .icon-btn svg { width: 14px; height: 14px; }

.result-file-group .file-row { grid-template-columns: minmax(0, 1fr) 100px 80px 38px; }

/* -------------------------------- empty --------------------------------- */

.empty {
  padding: 68px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(252, 250, 245, .4);
}

.empty-art {
  width: 66px;
  height: 58px;
  margin-bottom: 18px;
  position: relative;
  display: grid;
  place-items: center;
  color: #b5aa98;
  border: 1px solid var(--line);
  border-radius: 9px 9px 12px 12px;
  background: #f8f4eb;
  transform: rotate(-3deg);
  box-shadow: 5px 7px 0 #eee7da;
}
.empty-art::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 7px;
  width: 24px;
  height: 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #f8f4eb;
}
.empty-art svg { width: 24px; height: 24px; }
.empty h3 { margin: 0; font-family: var(--font-serif); font-size: 19px; }
.empty p { max-width: 380px; margin: 8px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.7; }

/* -------------------------------- modal --------------------------------- */

.modal {
  width: min(470px, calc(100vw - 32px));
  max-height: calc(100vh - 44px);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 18px;
  color: var(--ink);
  background: var(--card-strong);
  box-shadow: 0 34px 90px rgba(20, 30, 25, .3);
  overflow: auto;
}

.modal-wide { width: min(610px, calc(100vw - 32px)); }

.modal[open] { animation: modal-in .22s cubic-bezier(.2, .8, .2, 1); }
.modal::backdrop { background: rgba(17, 28, 23, .5); backdrop-filter: blur(5px); animation: fade-in .2s ease; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal form { padding: 27px 28px 25px; }

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.modal-head h2 { margin: 7px 0 0; font-family: var(--font-serif); font-size: 26px; font-weight: 700; }
.modal-close { width: 32px; height: 32px; margin: -5px -6px 0 0; color: #969b93; }
.modal-close svg { width: 17px; height: 17px; }

.modal-desc { margin: 13px 0 23px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.modal-desc strong { color: var(--ink-soft); font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; }

.field-label {
  display: block;
  margin: 0 0 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .03em;
}

.text-input, .select-input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: #fffdf9;
  font-size: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.text-input:focus, .select-input:focus { border-color: #a49a87; box-shadow: 0 0 0 3px rgba(197, 92, 53, .08); }
.text-input::placeholder { color: #aeb0a8; }
.select-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8c9189 50%), linear-gradient(135deg, #8c9189 50%, transparent 50%); background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 35px; }

.field-hint { margin: 7px 0 0; color: #9ca198; font-size: 9.5px; line-height: 1.6; }
.form-error { min-height: 16px; margin: 10px 0 0; color: var(--red); font-size: 10.5px; line-height: 1.5; }

.modal-actions {
  margin-top: 19px;
  padding-top: 18px;
  border-top: 1px solid #eee8dd;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dropzone {
  margin-top: 17px;
  padding: 25px 20px 21px;
  border: 1.5px dashed #cfc5b5;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #faf6ee;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over { border-color: var(--orange); background: #fbf1e9; outline: 0; }
.dropzone > svg { width: 29px; height: 29px; margin-bottom: 8px; color: var(--orange); opacity: .8; }
.dropzone strong { font-size: 12px; font-weight: 600; }
.dropzone > span { margin-top: 4px; color: var(--muted); font-size: 9.5px; }
.dropzone-actions { margin-top: 13px; display: flex; gap: 7px; }
.dropzone-actions .btn { background: #fffdf8; }

.selected-files {
  max-height: 160px;
  margin-top: 10px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.selected-files:empty { display: none; }

.selected-row {
  padding: 8px 2px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #f0ebe1;
  font-size: 10.5px;
}
.selected-row:last-child { border-bottom: 0; }
.selected-row svg { width: 14px; height: 14px; flex: none; color: #9b9f97; }
.selected-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.selected-size { color: var(--muted); font-family: var(--font-mono); font-size: 8.5px; white-space: nowrap; }
.selected-remove { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; color: #a3a69e; background: transparent; cursor: pointer; }
.selected-remove:hover { color: var(--red); background: #f6e7e3; }
.selected-remove svg { width: 12px; height: 12px; }

.upload-progress { margin-top: 14px; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 9.5px; }
.progress-track { height: 5px; border-radius: 5px; overflow: hidden; background: #ebe5da; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), #da8d68); transition: width .2s ease; }

/* -------------------------------- toasts -------------------------------- */

.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(370px, calc(100vw - 36px));
  padding: 11px 15px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 9px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #f5f1e8;
  background: rgba(25, 51, 44, .96);
  box-shadow: 0 12px 30px rgba(20, 30, 25, .22);
  font-size: 11px;
  line-height: 1.55;
  animation: toast-in .25s ease;
  pointer-events: auto;
}
.toast::before { content: ""; width: 5px; height: 5px; flex: none; margin-top: 6px; border-radius: 50%; background: #9fc0aa; }
.toast.is-error::before { background: #e2a18d; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------ drop overlay ----------------------------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  padding: 26px;
  display: none;
  place-items: center;
  background: rgba(20, 36, 30, .62);
  backdrop-filter: blur(6px);
}
.drop-overlay.is-visible { display: grid; }
.drop-card {
  width: min(410px, 100%);
  padding: 52px 30px;
  border: 1.5px dashed rgba(255, 255, 255, .35);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #f5f1e8;
  background: rgba(255, 255, 255, .07);
  text-align: center;
}
.drop-card svg { width: 38px; height: 38px; color: #e3b69d; margin-bottom: 13px; }
.drop-card strong { font-family: var(--font-serif); font-size: 22px; }
.drop-card span { margin-top: 7px; color: rgba(245, 241, 232, .6); font-size: 11px; }

/* -------------------------------- loading ------------------------------- */

.skeleton-card {
  height: 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(105deg, #f8f5ee 30%, #fffdf8 45%, #f8f5ee 60%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { to { background-position: -120% 0; } }
.side-skeleton { height: 27px; margin: 3px 8px; border-radius: 5px; background: rgba(255, 255, 255, .06); animation: pulse 1.5s infinite; }
.side-skeleton.short { width: 70%; }
@keyframes pulse { 50% { opacity: .45; } }

.loading-block { padding: 70px 20px; display: flex; flex-direction: column; align-items: center; color: var(--muted); font-size: 11px; gap: 12px; }
.spinner { width: 20px; height: 20px; border: 2px solid #ddd6c9; border-top-color: var(--orange); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-state { padding: 45px 24px; border: 1px solid #e4cfc8; border-radius: var(--radius); background: #fbf2ee; text-align: center; color: #7c4b3f; font-size: 11.5px; line-height: 1.7; }
.error-state strong { display: block; margin-bottom: 4px; font-family: var(--font-serif); font-size: 17px; color: #8f3d2b; }

/* --------------------------------- login -------------------------------- */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 46%) 1fr;
  background: var(--paper);
}

.login-visual {
  position: relative;
  padding: 48px 54px 44px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f2eee4;
  background:
    radial-gradient(circle at 80% 10%, rgba(197, 92, 53, .22), transparent 40%),
    radial-gradient(circle at 0% 70%, rgba(96, 140, 118, .2), transparent 45%),
    var(--forest);
}

.login-visual::before {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -180px;
  width: 500px;
  height: 500px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  box-shadow: 0 0 0 78px rgba(255, 255, 255, .028), 0 0 0 156px rgba(255, 255, 255, .02);
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .4;
  background-image: radial-gradient(rgba(255, 255, 255, .14) .6px, transparent .6px);
  background-size: 8px 8px;
  mask-image: linear-gradient(145deg, #000, transparent 60%);
}

.login-brand, .login-copy, .login-foot { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 12px; }

.login-copy { margin: auto 0; padding: 60px 0; }
.login-copy .eyebrow { color: #d79b7e; }
.login-copy h1 {
  max-width: 570px;
  margin: 18px 0 20px;
  font-family: var(--font-serif);
  font-size: clamp(36px, 4vw, 54px);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: .01em;
}
.login-copy h1 em { color: #e0a586; font-style: normal; }
.login-copy p { max-width: 390px; margin: 0; color: rgba(242, 238, 228, .6); font-size: 12px; line-height: 1.9; }

.login-foot {
  padding-top: 23px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(242, 238, 228, .42);
  font-size: 9.5px;
  letter-spacing: .04em;
}
.login-foot svg { width: 14px; height: 14px; color: #91ad9d; }

.login-panel {
  padding: 45px 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 100% 0%, rgba(197, 92, 53, .05), transparent 32%),
    var(--paper);
}

.login-card { width: min(380px, 100%); }
.login-card .eyebrow { color: var(--orange); }
.login-card h2 { margin: 10px 0 8px; font-family: var(--font-serif); font-size: 33px; font-weight: 700; }
.login-card > p { margin: 0 0 31px; color: var(--muted); font-size: 11.5px; line-height: 1.7; }

.password-wrap { position: relative; }
.password-wrap .text-input { height: 48px; padding-right: 46px; background: #fffdf8; }
.password-toggle {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #93988f;
  background: transparent;
  cursor: pointer;
}
.password-toggle:hover { color: var(--ink-soft); background: #f1ece2; }
.password-toggle svg { width: 17px; height: 17px; }

.login-submit { width: 100%; min-height: 47px; margin-top: 18px; font-size: 12.5px; }
.login-error { min-height: 18px; margin: 10px 0 0; color: var(--red); font-size: 10.5px; line-height: 1.5; }
.login-helper { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); color: #9ba097; font-size: 9.5px; line-height: 1.7; }

.shake { animation: shake .32s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* --------------------------------- 404 ---------------------------------- */

.notfound-page { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: var(--paper); }
.notfound-card { max-width: 440px; text-align: center; }
.notfound-card .brand-mark { margin: 0 auto 28px; background: var(--forest); color: #f2eee4; }
.notfound-card h1 { margin: 0 0 10px; font-family: var(--font-serif); font-size: 42px; }
.notfound-card .eyebrow { margin-top: 18px; color: var(--orange); }
.notfound-card p { margin: 0 0 23px; color: var(--muted); font-size: 12px; line-height: 1.8; }

/* ------------------------------- responsive ------------------------------ */

@media (max-width: 1180px) {
  :root { --sidebar-w: 244px; }
  .sidebar { padding-left: 14px; padding-right: 14px; }
  .side-link.is-active::before { left: -14px; }
  .topbar { padding-left: 30px; padding-right: 30px; }
  .content { padding-left: 30px; padding-right: 30px; }
  .page-footer { padding-left: 30px; padding-right: 30px; }
  .folder-grid { grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 274px; }
  .sidebar {
    transform: translateX(-102%);
    transition: transform .25s cubic-bezier(.2, .8, .2, 1);
    box-shadow: 20px 0 50px rgba(20, 30, 25, .2);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 39;
    display: block;
    background: rgba(15, 26, 21, .42);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
  }
  .sidebar-scrim.is-visible { opacity: 1; visibility: visible; }
  .main { margin-left: 0; }
  .mobile-menu { display: inline-grid; flex: none; }
  .topbar { padding: 13px 20px; min-height: 72px; gap: 12px; }
  .content { padding: 26px 20px 38px; }
  .page-footer { padding: 12px 20px 20px; }
  .hero { grid-template-columns: 1fr; gap: 22px; }
  .hero-side { align-items: flex-start; flex-direction: row; justify-content: space-between; flex-wrap: wrap; }
  .hero-actions { justify-content: flex-start; }
  .login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 300px; padding: 30px; }
  .login-copy { padding: 35px 0 0; margin: 0; }
  .login-copy h1 { margin: 12px 0; font-size: 34px; }
  .login-copy p { display: none; }
  .login-foot { display: none; }
  .login-panel { padding: 40px 22px 60px; }
}

@media (max-width: 680px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding-top: 11px; padding-bottom: 11px; }
  .search-box { order: 3; width: 100%; height: 43px; }
  .search-box kbd { display: none; }
  .top-actions { margin-left: auto; }
  .top-upload span { display: none; }
  .top-upload { width: 38px; padding: 0; border-color: var(--line); }
  .content { padding: 22px 16px 32px; }
  .page-footer { padding: 10px 16px 18px; flex-wrap: wrap; }
  .hero { padding-bottom: 22px; }
  .hero-title { font-size: 34px; }
  .hero-desc { font-size: 11.5px; }
  .hero-side { display: block; }
  .hero-date { margin-bottom: 11px; }
  .hero-actions .btn { flex: 1; }
  .stats { margin: 16px 0 26px; flex-wrap: wrap; }
  .stat { flex: 1 1 50%; padding: 13px 15px; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(3) { flex-basis: 100%; border-top: 1px solid var(--line); }
  .stat-value { font-size: 21px; }
  .stat-icon { width: 30px; height: 30px; }
  .folder-grid { grid-template-columns: 1fr; }
  .view-head-row { flex-direction: column; align-items: stretch; gap: 17px; }
  .view-actions { justify-content: flex-start; }
  .view-actions .btn { flex: 1; }
  .view-title { font-size: 22px; }
  .folder-hero-icon { width: 43px; height: 43px; }
  .folder-hero-icon svg { width: 23px; height: 23px; }
  .section-head { align-items: flex-end; flex-wrap: wrap; }
  .section-title { font-size: 17px; }
  .status-summary { margin-right: 2px; }
  .file-list-head { display: none; }
  .file-row, .result-file-group .file-row {
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 10px;
    padding: 11px 13px;
  }
  .file-row .file-meta { display: none; }
  .file-row .file-folder { display: none; }
  .file-badge { width: 31px; height: 35px; }
  .file-name { white-space: normal; }
  .search-summary { flex-direction: column; align-items: flex-start; gap: 16px; }
  .search-summary h1 { font-size: 29px; }
  .modal form { padding: 23px 20px 21px; }
  .modal-head h2 { font-size: 23px; }
  .login-visual { min-height: 260px; padding: 25px; }
  .login-copy h1 { font-size: 31px; }
  .login-brand .brand-sub { display: none; }
  .toast-stack { right: 14px; bottom: 14px; left: 14px; }
  .toast { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
