/* Autopilot Projects — vanilla PWA styles. Navy/yellow Accurate brand, dark + light. */
:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --card: #1a2740;
  --text: #eef2f8;
  --muted: #9fb0c8;
  --border: #26344f;
  --surface: #002360;
  --accent: #fff100;
  --accent-ink: #1f1d00;
  --danger: #ff6b6b;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eef2f9;
  --panel: #ffffff;
  --card: #ffffff;
  --text: #14233f;
  --muted: #5b6b86;
  --border: #dce3ef;
  --shadow: 0 6px 20px rgba(20, 35, 63, 0.10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}

/* ---------- header / footer ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--surface); color: #fff;
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-chip { width: 30px; height: 30px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: rgba(255,255,255,.08); }
.brand-chip img { width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-size: 1.05rem; margin: 0; font-weight: 650; }
.header-right { display: flex; align-items: center; gap: 8px; }
#user-chip { color: rgba(255,255,255,.8); font-size: .85rem; }
.app-footer { margin-top: auto; padding: 10px 16px; text-align: center; }

main#app { flex: 1; padding: 18px 16px 40px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ---------- typography / utils ---------- */
h2 { margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.kspacer { flex: 1; }

/* ---------- buttons ---------- */
button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: 9px 14px; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.primary:hover { filter: brightness(1.05); }
.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.ghost:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.ghost.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.icon-btn { background: rgba(255,255,255,.12); color: #fff; border: none; padding: 7px 10px; font-size: .85rem; }
[data-theme="light"] .app-header .icon-btn { background: rgba(255,255,255,.18); }
.linkbtn { background: none; border: none; color: var(--accent); padding: 6px; text-decoration: underline; }
[data-theme="light"] .linkbtn { color: #b58900; }
button:disabled { opacity: .6; cursor: default; }

/* ---------- auth card ---------- */
.auth-card {
  max-width: 380px; margin: 6vh auto 0; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 24px; display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.auth-logo-chip { width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 14px; overflow: hidden; background: var(--surface); display: grid; place-items: center; }
.auth-logo-chip img { width: 78%; height: 78%; object-fit: contain; }
.authform { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.authform input, .editor-form input, .editor-form textarea, .editor-form select, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.auth-err { color: var(--danger); font-size: .85rem; margin: 2px 0 0; }
.btn-google { background: #fff; color: #1f2937; border: 1px solid #dadce0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- board ---------- */
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; align-items: start; }
.column { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 120px; transition: outline .12s; }
.column.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { display: flex; align-items: center; justify-content: space-between; font-weight: 650; padding: 4px 6px 10px; }
.col-head .count { background: var(--bg); color: var(--muted); border-radius: 999px; padding: 1px 9px; font-size: .8rem; }
.col-cards { display: flex; flex-direction: column; gap: 8px; min-height: 30px; }

.kcard { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); cursor: grab; }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .45; }
.kcard-top { display: flex; align-items: center; gap: 6px; min-height: 18px; }
.ktitle { margin: 6px 0 2px; font-weight: 600; }
.kbody { margin: 0; color: var(--muted); font-size: .86rem; }
.kmeta { font-size: .8rem; color: var(--muted); }

.badge { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .02em; }
.b-idea { background: #fde6b8; color: #6b4e00; }
.b-build { background: #cfe8ff; color: #0b4a73; }
.b-project { background: #d9f7e4; color: #0a5733; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- overlay / editor modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(2, 8, 20, .55); display: grid; place-items: center; padding: 16px; z-index: 20; }
.overlay-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); width: min(520px, 100%); max-height: 88vh; overflow: auto; padding: 18px 20px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.editor-head .icon-btn { background: var(--border); color: var(--text); }
.editor-form { display: flex; flex-direction: column; gap: 12px; }
.editor-form label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; color: var(--muted); }
.editor-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor-links { display: flex; flex-direction: column; gap: 4px; }
.editor-links a { color: var(--accent); font-size: .85rem; word-break: break-all; }
[data-theme="light"] .editor-links a { color: #b58900; }
.editor-ai { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.editor-ai .ai-label { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.editor-ai p { margin: 4px 0 0; font-size: .9rem; }
.editor-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- view tabs (Board | Projects) ---------- */
.viewtabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.viewtabs .tab {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 600; padding: 8px 14px; border-radius: 8px 8px 0 0;
}
.viewtabs .tab:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.viewtabs .tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- projects tracker ---------- */
.proj-stats { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; }
.proj-stats .stat { color: var(--muted); font-size: .85rem; }
.proj-stats .stat b { color: var(--text); }
.proj-filters { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.proj-filters .filter { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.proj-filters select { width: auto; min-width: 130px; }

.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 10px; align-items: start; }
.proj-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .12s; font-size: .9rem; }
.proj-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.proj-top { display: flex; align-items: center; gap: 6px; min-height: 16px; }
.ptitle { margin: 5px 0 2px; font-weight: 650; font-size: .92rem; line-height: 1.25; }
.pbody { margin: 0 0 6px; color: var(--muted); font-size: .78rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* status badges (reuse .badge base) */
.s-active { background: #d9f7e4; color: #0a5733; }
.s-planning { background: #fde6b8; color: #6b4e00; }
.s-research { background: #cdeef2; color: #0b5563; }
.s-paused { background: #e2e6ee; color: #455066; }
.s-future { background: #e7ddfb; color: #4b2c83; }
.s-done { background: #cfe8ff; color: #0b4a73; }

/* priority row + dot */
.prio { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--muted); margin-bottom: 6px; }
.prio .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.prio-critical .dot { background: var(--danger); }
.prio-high .dot { background: #ff9f45; }
.prio-medium .dot { background: #6aa3ff; }
.prio-low .dot { background: var(--muted); }

/* progress bar */
.progress { height: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s; }
.pmeta { display: flex; align-items: center; margin-top: 6px; }
.editor-form input[type="range"] { padding: 0; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .board { grid-template-columns: 1fr; }
  .editor-row { grid-template-columns: 1fr; }
}
