/* ═══════════════════════════════════════════════════════════════════════════
   LogHog — shared topbar  (linked in every module)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --topbar-content-h: 56px;
  --topbar-safe-top: env(safe-area-inset-top, 0px);
  --topbar-total-h: calc(var(--topbar-content-h) + var(--topbar-safe-top));
  --topbar-slot-w: 100px;
}

/* ── Layout: push content below fixed topbar ── */
body {
  padding-top: var(--topbar-total-h) !important;
  /* border-box: padding-top is counted inside the 100dvh budget,
     so body never exceeds one screen height → no phantom scroll space */
  box-sizing: border-box !important;
  min-height: 100dvh !important;
}

/* Let .app be its natural content height — body background fills the rest.
   Overrides the min-height:100vh each module sets on .app, which was
   forcing it to fill the whole screen and creating blank space on short pages. */
.app {
  min-height: 0 !important;
}

/* ── Topbar shell ── */
.topbar {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: grid !important;
  grid-template-columns: var(--topbar-slot-w) 1fr var(--topbar-slot-w) !important;
  align-items: stretch !important;
  padding-top: var(--topbar-safe-top);
  box-sizing: border-box;
  height: var(--topbar-total-h);
  box-shadow: 0 1px 16px rgba(0,0,0,0.4);
}

/* ── Three slots ── */
.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  height: var(--topbar-content-h);
}

.topbar-left   { justify-content: flex-start; padding-left: 10px; }
.topbar-center { justify-content: center; }
.topbar-right  { justify-content: flex-end; padding-right: 10px; }

/* ── Title ── */
.topbar h1 {
  font-family: "DM Serif Display", serif;
  font-size: 21px !important;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.3px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Topbar action buttons (.tb-btn) ── */
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  background: none;
  border: 1px solid var(--border2);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  min-width: 36px;
  min-height: 36px;
}

@media (hover: hover) {
  .tb-btn:hover {
    color: var(--text);
    background: var(--surface2);
  }
}

/* Add button — gold accent */
.tb-btn-add {
  color: var(--accent);
  border-color: rgba(200, 169, 110, 0.45);
}

/* ── Index logo in right slot ── */
.topbar-logo-slot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
}

.topbar-logo-slot img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 50%;
  object-position: center;
}

/* ── Admin "Inc. self?" checkbox label ── */
.tb-inc-self {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.tb-inc-self input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Watchlist floating bell (anchored just below fixed header) ── */
.float-bell {
  position: fixed;
  top: var(--topbar-total-h);
  right: 10px;
  z-index: 190;
}

/* ═══════════════════════════════════════════════════════════════════════════
   iOS native — liquid glass (modals, Ask AI pill, sync pill)
   Applied only when html.is-native is set by Capacitor at startup.
   Revert: git reset --hard 950e06f
   ═══════════════════════════════════════════════════════════════════════════ */

/* Overlay: lighter dim + background blur */
html.is-native .modal-overlay {
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
html.is-native.light .modal-overlay {
  background: rgba(0,0,0,0.12);
}

/* Modal shell: frosted glass */
html.is-native .modal {
  background: rgba(26,26,26,0.72);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.13);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 0 0 0.5px rgba(255,255,255,0.05),
    0 24px 48px rgba(0,0,0,0.65);
}
html.is-native.light .modal {
  background: rgba(238,235,229,0.78);
  border-color: rgba(0,0,0,0.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 24px 48px rgba(0,0,0,0.18);
}

/* Modal header: separator + clear solid background (sticky headers in some modules set background: var(--surface)) */
html.is-native .modal-header {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: transparent;
}
html.is-native.light .modal-header {
  border-bottom-color: rgba(0,0,0,0.07);
  background: transparent;
}

/* Modal footer: same — clear solid background set by bookings/money sticky footers */
html.is-native .modal-footer {
  background: transparent;
  border-top-color: rgba(255,255,255,0.08);
}
html.is-native.light .modal-footer {
  background: transparent;
  border-top-color: rgba(0,0,0,0.07);
}

/* Ask AI pill */
html.is-native .claude-pill {
  background: rgba(26,26,26,0.58);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-color: rgba(255,255,255,0.1);
  border-top-color: rgba(255,255,255,0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 4px 24px rgba(0,0,0,0.45);
}
html.is-native.light .claude-pill {
  background: rgba(238,235,229,0.68);
  border-color: rgba(0,0,0,0.1);
  border-top-color: rgba(255,255,255,0.75);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 24px rgba(0,0,0,0.12);
}

/* Ask AI expanded panel */
html.is-native .claude-panel {
  background: rgba(26,26,26,0.72);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-color: rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 12px 40px rgba(0,0,0,0.5);
}
html.is-native.light .claude-panel {
  background: rgba(238,235,229,0.78);
  border-color: rgba(0,0,0,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 12px 40px rgba(0,0,0,0.12);
}

/* index.html: settings overlay + modal (different class names from .modal-overlay/.modal) */
html.is-native .settings-overlay {
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
html.is-native.light .settings-overlay {
  background: rgba(0,0,0,0.12);
}
html.is-native .settings-modal {
  background: rgba(26,26,26,0.72);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.13);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 0 0 0.5px rgba(255,255,255,0.05),
    0 24px 48px rgba(0,0,0,0.65);
}
html.is-native.light .settings-modal {
  background: rgba(238,235,229,0.78);
  border-color: rgba(0,0,0,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 24px 48px rgba(0,0,0,0.18);
}
html.is-native .settings-header {
  border-bottom-color: rgba(255,255,255,0.08);
}
html.is-native.light .settings-header {
  border-bottom-color: rgba(0,0,0,0.07);
}

/* index.html: login modal (all inline styles — requires !important) */
html.is-native #loginModal {
  background: rgba(0,0,0,0.28) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
html.is-native.light #loginModal {
  background: rgba(0,0,0,0.12) !important;
}
html.is-native #loginModal > div {
  background: rgba(26,26,26,0.72) !important;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.13) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 0 0 0.5px rgba(255,255,255,0.05),
    0 24px 48px rgba(0,0,0,0.65);
}
html.is-native.light #loginModal > div {
  background: rgba(238,235,229,0.78) !important;
  border-color: rgba(0,0,0,0.08) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 24px 48px rgba(0,0,0,0.18);
}

/* ── Claude AI message link colours ── */
.claude-msg a { color: #60a5fa; }
html.light .claude-msg a { color: #2563eb; }
