/* nova26 web core — layout + components. Phone-first. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}
#app { display: flex; flex-direction: column; height: 100dvh; max-width: 560px; margin: 0 auto; }

/* header */
header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px calc(10px + env(safe-area-inset-top) * 0);
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.brand .n26 { color: var(--primary); }
#biz-btn {
  flex: 1; display: flex; align-items: center; gap: 6px;
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 8px 12px; font-size: 14px; font-weight: 600;
  min-width: 0;
}
#biz-btn .biz-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#biz-btn .biz-tag { color: var(--ink-faint); font-weight: 400; font-size: 12px; }
#theme-btn {
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; width: 38px; height: 38px; font-size: 17px; flex: none;
}

/* business sheet */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40;
  display: none;
}
.sheet-backdrop.open { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--bg-elev); border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .25s ease;
  max-width: 560px; margin: 0 auto;
  max-height: 70dvh; overflow-y: auto;
}
.sheet-backdrop.open + .sheet, .sheet.open { transform: translateY(0); }
.sheet h2 { margin: 8px 0 12px; font-size: 17px; }
.biz-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; color: var(--ink); text-align: left;
  padding: 13px 8px; border-bottom: 1px solid var(--line); font-size: 16px;
}
.biz-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex: none; }
.biz-row.current .biz-row-name { font-weight: 700; }
.biz-row .check { margin-left: auto; color: var(--primary); font-weight: 700; }

/* main + screens */
main { flex: 1; overflow-y: auto; padding: 12px 16px 16px; }
.screen { display: none; }
.screen.active { display: block; }

/* bottom nav */
nav {
  display: flex; background: var(--nav-bg); border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  position: sticky; bottom: 0; z-index: 10;
}
nav button {
  flex: 1; background: none; border: none; color: var(--ink-faint);
  font-size: 11px; font-weight: 600; padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border-radius: 10px;
}
nav button .ico { font-size: 22px; }
nav button.active { color: var(--primary); }
nav button .badge {
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 999px; min-width: 18px; height: 18px; line-height: 18px;
  padding: 0 5px; margin-top: -26px; margin-left: 28px;
}

/* chat */
#chat-log { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.msg { max-width: 85%; padding: 10px 13px; border-radius: var(--radius); font-size: 15px; }
.msg.user { align-self: flex-end; background: var(--bubble-user); color: var(--bubble-user-ink); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--bubble-ai); border: 1px solid var(--line); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg .who { font-size: 11px; font-weight: 700; color: var(--ink-faint); margin-bottom: 3px; }
.msg.typing { color: var(--ink-faint); }
#chat-form { display: flex; gap: 8px; padding: 10px 0 4px; position: sticky; bottom: 0; background: var(--bg); }
#chat-input {
  flex: 1; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-elev);
  color: var(--ink); padding: 12px 16px; font-size: 16px; outline: none;
}
#chat-input:focus { border-color: var(--primary); }
#chat-send {
  background: var(--primary); color: var(--primary-ink); border: none; border-radius: 999px;
  font-weight: 700; font-size: 15px; padding: 0 20px;
}
#chat-send:disabled { opacity: .5; }

/* approvals */
.appr-card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.appr-kind {
  display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
}
.appr-kind.money { background: #FDE8C8; color: #8A5A00; }
.appr-kind.publish { background: #DCEAFD; color: #1D4FA3; }
.appr-kind.irreversible { background: #FBDCDC; color: #A31621; }
.appr-kind.generic { background: var(--bg-sunken); color: var(--ink-soft); }
[data-theme="ketchup"] .appr-kind.money { background: #4A3208; color: #F4C95D; }
[data-theme="ketchup"] .appr-kind.publish { background: #1E3A66; color: #A9C7F5; }
[data-theme="ketchup"] .appr-kind.irreversible { background: #5E1A1A; color: #FF9B9B; }
.appr-summary { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.appr-context { font-size: 13px; color: var(--ink-soft); margin: 0 0 6px; }
.appr-meta { font-size: 12px; color: var(--ink-faint); margin-bottom: 10px; }
.appr-actions { display: flex; gap: 10px; }
.appr-actions button { flex: 1; padding: 12px; border-radius: 12px; font-size: 16px; font-weight: 700; border: none; }
.btn-approve { background: var(--ok); color: #fff; }
.btn-deny { background: var(--bg-sunken); color: var(--danger); border: 1px solid var(--line) !important; }
.appr-decided { font-size: 13px; font-weight: 700; }
.appr-decided.approved { color: var(--ok); }
.appr-decided.denied { color: var(--danger); }
.empty { text-align: center; color: var(--ink-faint); padding: 48px 20px; font-size: 15px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 10px; }

/* checklist */
#checklist-form { display: flex; gap: 8px; margin-bottom: 12px; }
#checklist-input {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elev);
  color: var(--ink); padding: 12px 14px; font-size: 16px; outline: none;
}
#checklist-add {
  background: var(--primary); color: var(--primary-ink); border: none; border-radius: 12px;
  font-weight: 700; font-size: 15px; padding: 0 18px;
}
.chk-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; margin-bottom: 8px; color: var(--ink); font-size: 15px; text-align: left;
}
.chk-box {
  width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--primary);
  flex: none; display: flex; align-items: center; justify-content: center;
  color: var(--primary-ink); font-weight: 800; font-size: 15px;
}
.chk-row.done .chk-box { background: var(--primary); }
.chk-row.done .chk-text { text-decoration: line-through; color: var(--ink-faint); }
.chk-text { flex: 1; }

/* misc */
.loading { text-align: center; color: var(--ink-faint); padding: 32px; }
.error { background: #FBDCDC; color: #A31621; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
[data-theme="ketchup"] .error { background: #5E1A1A; color: #FF9B9B; }
h1.screen-title { font-size: 22px; margin: 4px 0 12px; }
.sub { color: var(--ink-soft); font-size: 13px; margin: -8px 0 12px; }

/* ---- drawer (Muse-style left nav) ---- */
#menu-btn {
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; width: 38px; height: 38px; font-size: 17px; flex: none;
}
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 48;
  opacity: 0; pointer-events: none; transition: opacity .22s ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 49;
  width: min(320px, 84vw);
  background: var(--bg-elev); border-right: 1px solid var(--line);
  transform: translateX(-102%); transition: transform .25s ease;
  display: flex; flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 4px 12px;
}
.drawer-header .brand { font-size: 22px; }
#drawer-close {
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; width: 34px; height: 34px; font-size: 14px;
}
.drawer-section-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
  color: var(--ink-faint); padding: 14px 10px 6px;
}
#drawer-chats { overflow-y: auto; }
.drawer-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; color: var(--ink); text-align: left;
  padding: 11px 10px; border-radius: 10px; font-size: 15px; font-weight: 500;
}
.drawer-row .ico { font-size: 18px; width: 24px; text-align: center; flex: none; }
.drawer-row .drawer-row-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-row.current { background: var(--bg-sunken); font-weight: 700; }
.drawer-row .check { color: var(--primary); font-weight: 800; }
.drawer-badge {
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; min-width: 20px; height: 20px; line-height: 20px;
  text-align: center; padding: 0 6px;
}
.drawer-footer { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }

/* ---- Muse-style chat polish ---- */
#screen-chat { display: none; flex-direction: column; height: 100%; }
#screen-chat.active { display: flex; }
#chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 8px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.5; }
.msg.user { border-bottom-right-radius: 6px; }
.msg.ai { border-bottom-left-radius: 6px; }
#chat-form {
  display: flex; gap: 8px; padding: 10px 0 calc(4px + env(safe-area-inset-bottom));
  background: var(--bg); position: sticky; bottom: 0;
}
