/* Quill by Kestrel Labs: shared styles for Docs, Sheets, Slides and the home page. */
:root {
  --bg: #f4f3f8; --surface: #ffffff; --surface-2: #eceaf3; --ink: #1c1b29; --soft: #625f75; --line: #dedbe8;
  --brand: #3b3f9e; --brand-ink: #ffffff; --brand-soft: #e6e6f8;
  --docs: #3559c7; --sheets: #1f8a5b; --slides: #d9822b; --danger: #c0392b;
  --radius: 12px; --shadow: 0 10px 30px -12px rgba(20, 20, 50, .35);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121219; --surface: #1b1b25; --surface-2: #242432; --ink: #ecebf5; --soft: #a3a1b8; --line: #2f2f40;
    --brand: #a9adff; --brand-ink: #15163a; --brand-soft: #2a2b4a; --docs: #8aa6ff; --sheets: #63d39e; --slides: #ffb066;
    --danger: #ff7b6b; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---------- App bar ---------- */
.appbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 56px; }
.appbar .logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; text-decoration: none; }
.appbar .logo svg { width: 20px; height: 20px; }
.title-input { border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 5px 8px; font-size: 1.05rem; font-weight: 600; min-width: 0; width: min(420px, 50vw); }
.title-input:hover { border-color: var(--line); }
.title-input:focus { border-color: var(--brand); outline: none; background: var(--bg); }
.save-state { color: var(--soft); font-size: .82rem; white-space: nowrap; }
.spacer { flex: 1; }

/* ---------- Buttons & menus ---------- */
.btn { border: 0; border-radius: 999px; padding: 8px 16px; background: var(--brand); color: var(--brand-ink); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.icon-btn { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--ink); flex: none; }
.icon-btn:hover, .icon-btn.on { background: var(--brand-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.menu.right { left: auto; right: 0; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 8px; }
.menu button:hover { background: var(--brand-soft); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 2px; padding: 4px 8px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; flex: none; }
.toolbar select { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 6px; height: 32px; flex: none; }
.color-btn { position: relative; }
.color-btn input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* ---------- Dialogs ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 10, 25, .45); display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; width: min(440px, 100%); display: grid; gap: 12px; }
.dialog h2 { margin: 0; font-size: 1.15rem; }
.dialog p { margin: 0; color: var(--soft); }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.dialog input[type=text], .dialog input[type=number] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); font-size: .9rem; }

/* ---------- Home ---------- */
.home { max-width: 1000px; margin: 0 auto; padding: 24px 16px 64px; }
.home h1 { font-size: 1.5rem; margin: 8px 0 16px; }
.new-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 32px; }
@media (max-width: 640px) { .new-row { grid-template-columns: 1fr; } }
.new-card { border: 1px solid var(--line); background: var(--surface); border-radius: 18px; padding: 18px; display: flex; gap: 14px; align-items: center; text-align: left; transition: transform .15s; }
.new-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.new-card .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; }
.new-card .ic svg { width: 26px; height: 26px; }
.new-card b { display: block; font-size: 1rem; }
.new-card span { color: var(--soft); font-size: .85rem; }
.recent-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.recent-head h2 { margin: 0; font-size: 1.05rem; flex: 1; }
.recent-head input { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; width: min(260px, 50vw); }
.file-list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.file-row { display: grid; grid-template-columns: 40px 1fr 140px 36px; gap: 12px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.file-row:first-child { border-top: 0; }
.file-row:hover { background: var(--brand-soft); }
.file-row .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; }
.file-row .ic svg { width: 18px; height: 18px; }
.file-row .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .where { color: var(--soft); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .date { color: var(--soft); font-size: .85rem; }
@media (max-width: 560px) { .file-row { grid-template-columns: 40px 1fr 36px; } .file-row .date { display: none; } }
.empty { padding: 48px 16px; text-align: center; color: var(--soft); }

.local-note { background: var(--brand-soft); border-radius: 14px; padding: 12px 16px; margin-bottom: 20px; font-size: .9rem; }
.local-note a { color: var(--brand); font-weight: 600; }

/* ---------- Signed out ---------- */
.signin-wall { min-height: 100%; display: grid; place-items: center; padding: 24px; text-align: center; }
.signin-wall .box { max-width: 380px; display: grid; gap: 12px; justify-items: center; }

@media print {
  .no-print, .appbar, .toolbar, .toast, .overlay { display: none !important; }
  body { background: #fff !important; }
}
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
