:root { font: 16px/1.45 system-ui, sans-serif; color: #1d2233; background: #fff; --side: #f5f6fa; --line: #e3e5ee; --accent: #4338ca; --muted: #646b80; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, summary, .upload, .download-button { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; color: inherit; background: white; }
button, summary, .upload { cursor: pointer; }
button:hover, summary:hover { background: var(--side); }
:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
.primary:hover { background: #3730a3; }
.muted { color: var(--muted); font-size: .85rem; }
#notice:not(:empty) { position: fixed; z-index: 30; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1d2233; color: white; border-radius: 10px; padding: 10px 18px; max-width: 90vw; }
#login-screen:has(#login:not([hidden])) { min-height: 100vh; display: grid; place-items: center; background: var(--side); }
#login { width: min(400px, 92vw); display: grid; gap: 14px; padding: 32px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 10px 30px #1d22331a; }
#login h1, .brand { color: var(--accent); font-size: 1.2rem; margin: 0; }
#login label, #edit-form label { display: grid; gap: 6px; }
#library { display: grid; min-height: 100vh; grid-template-columns: 250px minmax(0,1fr) minmax(320px,400px); grid-template-rows: auto 1fr; }
.sidebar { grid-row: 1 / 3; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px; background: var(--side); border-right: 1px solid var(--line); }
.brand { font-weight: 700; padding: 4px 8px 8px; }
.upload { text-align: center; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload:focus-within { outline: 3px solid #a5b4fc; }
.tree-title { margin: 8px 8px 0; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tree, .tree ul, #items { padding: 0; margin: 0; list-style: none; }
.tree ul { padding-left: 16px; }
.tree button { width: 100%; border: 0; background: transparent; text-align: left; overflow-wrap: anywhere; }
.tree button.current, li.selected { background: #e8e7fb; color: var(--accent); }
.storage { margin-top: auto; font-size: .82rem; color: var(--muted); padding: 0 8px; }
.topbar { grid-column: 2 / 4; display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
#search { flex: 1; max-width: 560px; background: var(--side); }
#session-timer { margin-left: auto; white-space: nowrap; }
.file-pane, .preview-pane { min-width: 0; padding: 16px 20px; }
#location { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
#location button { border: 0; font-weight: 600; }
.table-head, #items > li:not(.empty) { display: grid; grid-template-columns: minmax(0,1fr) 80px 100px auto; gap: 12px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table-head { font-size: .75rem; text-transform: uppercase; color: var(--muted); }
#items > li:hover { background: var(--side); }
#items > li.selected { background: #e8e7fb; }
#items .name { text-align: left; border: 0; background: transparent; overflow-wrap: anywhere; padding: 4px 0; }
.sub, .cell { color: var(--muted); font-size: .82rem; }
.sub { display: block; }
.empty { padding: 30px 10px; color: var(--muted); text-align: center; }
.actions, .preview-actions { display: flex; align-items: center; gap: 8px; }
.actions { justify-content: flex-end; }
.actions a, .download-button { text-decoration: none; }
details.more { position: relative; }
details.more summary { list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
.menu { position: absolute; right: 0; z-index: 5; display: grid; min-width: 150px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 10px 24px #1d22332a; }
.menu button { border: 0; text-align: left; }
.preview-pane { border-left: 1px solid var(--line); }
.preview-heading { display: flex; justify-content: space-between; gap: 8px; }
.preview-heading h2 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.preview-actions { margin-top: 10px; flex-wrap: wrap; }
#preview { width: 100%; height: 68vh; border: 0; background: var(--side); }
#preview-image { display: block; max-width: 100%; max-height: 70vh; object-fit: contain; margin: 1rem auto; }
#preview-text { white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; max-height: 70vh; padding: 16px; background: var(--side); font: .9rem/1.6 ui-monospace, monospace; }
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: min(420px,92vw); }
dialog::backdrop { background: #1d223370; }
#edit-form { display: grid; gap: 14px; }
#edit-form h2, #edit-form p { margin: 0; }
#edit-error { color: #c0262d; }
.drop-overlay { position: fixed; inset: 12px; z-index: 50; display: grid; place-content: center; border: 3px dashed var(--accent); border-radius: 18px; background: #e8e7fbee; color: var(--accent); font-size: 1.4rem; font-weight: 700; text-align: center; pointer-events: none; }
@media (max-width: 1150px) { #library { grid-template-columns: 220px minmax(0,1fr); } .topbar { grid-column: 2; } .preview-pane { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); } }
@media (max-width: 650px) { #library { display: flex; flex-direction: column; } .sidebar { border-right: 0; border-bottom: 1px solid var(--line); } .storage { margin: 0; } .topbar { flex-wrap: wrap; } #search { flex-basis: 100%; } #session-timer { margin-left: 0; } .table-head { display: none; } #items > li:not(.empty) { grid-template-columns: minmax(0,1fr) auto; } .cell { display: none; } .preview-pane { min-height: 300px; } }
