:root {
  --blue: #1a4a8a; --blue-dark: #0a2340; --accent: #e8a020;
  --border: #d5deeb; --bg: #eef2f7; --danger: #b02a2a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: #1a1a2e; height: 100vh; }
.view { height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px; background: white; cursor: pointer; }
button:hover { border-color: var(--blue); }
button.primary { background: var(--blue); border-color: var(--blue); color: white; font-weight: 600; }
button.primary:hover { background: var(--blue-dark); }
input { font: inherit; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; width: 100%; }
.logo { font-size: 20px; font-weight: 900; color: var(--blue-dark); }
.logo span { color: var(--accent); }
.muted { color: #667; font-size: 13px; }
.spacer { flex: 1; }

.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: white; border-bottom: 1px solid var(--border); }

#view-login { align-items: center; justify-content: center; }
.card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.login-card { width: 320px; }

.library { max-width: 860px; width: 100%; margin: 0 auto; padding: 24px 18px; overflow-y: auto; }
.library h2 { font-size: 15px; margin: 22px 0 8px; color: var(--blue-dark); }
#dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 22px; text-align: center; background: white; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#dropzone.drag { border-color: var(--accent); background: #fdf6e8; }
.doc-list { display: flex; flex-direction: column; gap: 6px; }
.doc-row { display: flex; align-items: center; gap: 8px; background: white; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.doc-open { flex: 1; text-align: left; border: none; background: none; font-weight: 600; color: var(--blue); padding: 4px; }
.doc-open:hover { text-decoration: underline; }
.doc-date { font-size: 12px; color: #778; }
.empty { color: #99a; font-size: 13px; padding: 8px; }

.editor-wrap { flex: 1; display: flex; min-height: 0; }
#edit-frame { flex: 1; border: none; background: white; }
#history-panel { width: 260px; border-left: 1px solid var(--border); background: white; padding: 14px; overflow-y: auto; }
#history-panel h3 { font-size: 14px; margin-bottom: 10px; }
.version-item { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: pointer; font-size: 12.5px; }
.version-item:hover { border-color: var(--blue); }
.version-item.current { border-color: var(--accent); background: #fdf6e8; }
.version-author { color: #667; }
#dirty-dot { color: var(--accent); font-size: 18px; }
#version-banner { display: flex; align-items: center; gap: 12px; background: #fdf3e0; border-bottom: 1px solid var(--accent); padding: 8px 18px; font-size: 13.5px; }

.check-label { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: #445; }
.check-label input { width: auto; }

dialog { border: 1px solid var(--border); border-radius: 12px; padding: 20px; min-width: 300px; }
#password-dialog input { margin: 14px 0; }
dialog::backdrop { background: rgba(10, 35, 64, .4); }
#share-users { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; max-height: 40vh; overflow-y: auto; }
#share-users label { display: flex; gap: 8px; align-items: center; }
#share-users input { width: auto; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--blue-dark); color: white; padding: 10px 22px; border-radius: 24px; font-size: 14px; z-index: 99; }
#toast.error { background: var(--danger); }
