:root {
  --ink: #24352f;
  --muted: #65746e;
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --accent: #aa5c40;
  --accent-dark: #81432e;
  --line: rgba(36, 53, 47, .15);
  --success: #256b4a;
  --danger: #9d2f2f;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--accent-dark); }
button, input, select { font: inherit; }
button { border: 0; border-radius: .65rem; padding: .75rem 1rem; color: white; background: var(--accent); cursor: pointer; font-weight: 700; }
button:hover { background: var(--accent-dark); }
input, select { width: 100%; border: 1px solid var(--line); border-radius: .65rem; padding: .75rem; background: white; color: var(--ink); }
label { display: block; margin-bottom: .45rem; font-size: .86rem; font-weight: 700; }
.muted, .path { color: var(--muted); }
.eyebrow { margin: 0 0 .55rem; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.login-page { display: grid; place-items: center; padding: 1.25rem; background: radial-gradient(circle at 15% 10%, rgba(170,92,64,.18), transparent 28rem), var(--paper); }
.login-shell { width: min(28rem, 100%); }
.back { display: inline-block; margin-bottom: 1rem; text-decoration: none; }
.login-card { padding: clamp(1.5rem, 7vw, 3rem); border: 1px solid var(--line); border-radius: 1rem; background: rgba(255,255,255,.75); box-shadow: 0 1.5rem 5rem rgba(36,53,47,.08); }
.login-card h1 { margin: 0; font: 400 2.5rem/1.05 Georgia, serif; }
.login-card form { display: grid; gap: .8rem; margin-top: 1.75rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 5vw, 4rem); border-bottom: 1px solid var(--line); background: rgba(255,253,248,.92); }
.brand { color: var(--ink); font: 500 1.3rem Georgia, serif; text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.topbar nav a, .link-button { color: var(--muted); background: none; padding: .3rem; font-size: .9rem; font-weight: 650; text-decoration: none; }
.topbar form { margin: 0; }
.content { width: min(74rem, 100%); margin: 0 auto; padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2rem); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.page-heading h1 { margin: 0; font: 400 clamp(2.3rem, 6vw, 4.5rem)/1 Georgia, serif; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.card { min-height: 10rem; display: flex; flex-direction: column; justify-content: end; padding: 1.25rem; border: 1px solid var(--line); border-radius: .9rem; color: var(--ink); background: var(--surface); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 .75rem 2rem rgba(36,53,47,.08); }
.card span { font: 500 1.45rem Georgia, serif; }
.card small { margin-top: .35rem; color: var(--muted); }
.card.featured { background: var(--ink); color: white; }
.card.featured small { color: #ced7d3; }
.project { display: flex; justify-content: space-between; align-items: center; gap: 2rem; margin-top: 1rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: .9rem; background: #ebe4d7; }
.project h2 { margin: 0; font: 500 1.7rem Georgia, serif; }
.project p:last-child { margin-bottom: 0; color: var(--muted); }
.secondary { display: inline-block; flex: none; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); font-weight: 700; text-decoration: none; }
.notice { margin: 0 0 1rem; padding: .85rem 1rem; border-radius: .65rem; border: 1px solid; }
.notice.error { color: var(--danger); background: #fff0f0; }
.notice.success { color: var(--success); background: #effaf4; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.actions form { padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); }
.inline { display: flex; gap: .55rem; }
.heading-actions, .row-actions { display: flex; align-items: center; gap: .5rem; }
.search-form { display: flex; gap: .55rem; margin-bottom: 1rem; }
.search-summary { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.drop-zone { display: grid; gap: .45rem; margin-bottom: .75rem; padding: .8rem; border: 2px dashed var(--line); border-radius: .7rem; color: var(--muted); }
.drop-zone.dragging { border-color: var(--accent); background: #f7ece6; }
.upload-status { display: inline-block; margin-left: .7rem; color: var(--muted); font-size: .85rem; }
.file-list { overflow: hidden; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); }
.file-row { display: grid; grid-template-columns: minmax(12rem, 2fr) minmax(6rem, .7fr) minmax(9rem, .9fr) minmax(6rem, .6fr); gap: 1rem; align-items: center; padding: .85rem 1rem; border-top: 1px solid var(--line); font-size: .9rem; }
.file-row:first-child { border-top: 0; }
.file-head { color: var(--muted); background: #eee9df; font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.filename { overflow-wrap: anywhere; font-weight: 650; }
.path-cell { overflow-wrap: anywhere; color: var(--muted); }
.trash-row { grid-template-columns: minmax(11rem, 1.2fr) minmax(12rem, 1.5fr) minmax(9rem, .8fr) minmax(12rem, 1fr); }
.text-action { padding: 0; color: var(--accent-dark); background: none; font-weight: 700; }
.text-action:hover { color: var(--ink); background: none; }
.danger { background: var(--danger); }
.item-menu { position: relative; }
.item-menu summary { width: 2rem; cursor: pointer; color: var(--ink); font-size: 1.25rem; list-style: none; text-align: center; }
.item-menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; z-index: 10; right: 0; width: min(20rem, 82vw); padding: .8rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); box-shadow: 0 1rem 3rem rgba(36,53,47,.18); }
.menu-panel form { display: grid; gap: .45rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.menu-panel form:first-child { border-top: 0; }
.empty { padding: 1.25rem; color: var(--muted); }
.separator { color: var(--muted); }
.sandbox-note { margin-bottom: 1rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .65rem; color: var(--muted); background: #eee9df; font-size: .9rem; }
.workflow-frame { width: 100%; min-height: 68vh; border: 1px solid var(--line); border-radius: .8rem; background: white; }
.docx-viewer { min-height: 65vh; overflow: auto; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; background: #d8d8d8; }
.docx-viewer .docx-wrapper { background: transparent; }
@media (max-width: 700px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar nav { width: 100%; justify-content: space-between; }
  .page-heading, .project { align-items: flex-start; flex-direction: column; }
  .heading-actions, .search-form { width: 100%; align-items: stretch; flex-direction: column; }
  .actions { grid-template-columns: 1fr; }
  .inline { flex-direction: column; }
  .file-head { display: none; }
  .file-row { grid-template-columns: 1fr auto; gap: .35rem 1rem; }
  .trash-row { grid-template-columns: 1fr; }
  .file-row span:nth-child(2), .file-row span:nth-child(3) { color: var(--muted); font-size: .8rem; }
}
