:root {
  --accent: #2F5D50;
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --border: #E2DED4;
  --ink: #201E1A;
  --ink-secondary: #6E6A5E;
  --ink-faint: #948F80;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand-name { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; }
.topbar nav { display: flex; gap: 30px; font-size: 14px; }
.topbar nav a { text-decoration: none; color: var(--ink-secondary); padding-bottom: 6px; }
.topbar nav a.active { color: var(--accent); font-weight: 600; border-bottom: 2px solid var(--accent); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; text-decoration: none; color: var(--ink);
}

main { max-width: 1100px; margin: 0 auto; padding: 32px 40px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 24px;
}
.card h2 { font-family: 'Fraunces', serif; font-size: 18px; margin: 0 0 4px; font-weight: 600; }
.card p.hint { font-size: 13px; color: var(--ink-secondary); margin: 0 0 16px; }

label { display: block; font-size: 12px; color: var(--ink-secondary); margin-bottom: 6px; }
input[type=text], input[type=search], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1px solid #D8D3C6;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid #D8D3C6; }
.btn.danger { background: #fff; color: #A24328; border: 1px solid #D8B8AC; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px; border: 1px solid #D8D3C6;
  background: #fff; color: var(--ink); font-size: 13px; font-family: inherit;
  cursor: pointer; text-decoration: none;
}
.pill.selected { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pill.add { border-style: dashed; color: var(--ink-secondary); width: 32px; height: 32px; padding: 0; border-radius: 999px; justify-content: center; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }

.results-layout { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); min-height: 500px; }
.results-list { width: 380px; border-right: 1px solid var(--border); overflow-y: auto; }
.result-card { display: block; width: 100%; text-align: left; padding: 16px 20px; border: none; border-bottom: 1px solid #F0EDE4; background: transparent; border-left: 3px solid transparent; cursor: pointer; font-family: inherit; }
.result-card.selected { background: var(--bg); border-left-color: var(--accent); }
.result-row { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.result-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--ink-secondary); }
.tag-chip { background: #E3EAE6; color: #2F5D50; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.result-snippet { margin-top: 8px; font-size: 12px; color: #55524A; line-height: 1.5; }
mark { background: #EADFC9; color: var(--ink); padding: 0 2px; border-radius: 2px; }

.viewer { flex: 1; padding: 32px; display: flex; gap: 28px; }
.viewer-preview { flex: 1; border: 1px solid var(--border); border-radius: 12px; display: flex; align-items: center; justify-content: center; min-height: 460px; text-align: center; color: var(--ink-faint); }
.viewer-details { width: 280px; flex-shrink: 0; }
.field-row { display: flex; flex-direction: column; gap: 14px; font-size: 13px; margin-bottom: 26px; }
.field-row .label { color: var(--ink-faint); margin-bottom: 2px; }

.filters { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.filters select { width: auto; padding: 8px 12px; border-radius: 999px; }

.doc-number { font-size: 13px; color: var(--ink-faint); font-weight: 600; letter-spacing: 0.03em; }
.doc-number-note { font-size: 12px; color: var(--ink-faint); }

.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 16px 0; }
.folder-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--ink); text-align: center; font-size: 14px; font-weight: 600; }
.folder-tile:hover { border-color: var(--accent); }
.folder-tile .folder-icon { width: 40px; height: 34px; }
.folder-tile .folder-count { font-size: 12px; color: var(--ink-faint); font-weight: 400; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin: 16px 0; }
.photo-tile { display: block; text-decoration: none; color: inherit; }
.photo-tile .photo-thumb { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.photo-tile:hover .photo-thumb { border-color: var(--accent); }
.photo-tile .photo-caption { margin-top: 6px; font-size: 12px; color: var(--ink-secondary); line-height: 1.4; }
.photo-tile .photo-caption .fname { display: block; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
