/* chrome.css — shared hankelsner.tech app-container chrome.
 *
 * Served from the apex and loaded by every app via <link>. Every selector is .hkc-
 * prefixed so it never collides with an app's own CSS. Corporate navy bar, white text,
 * coral primary actions, clean white launcher overlay. Mobile-responsive.
 */

/* push app content below the fixed bar (+ the iOS status-bar inset when a standalone
   PWA draws under the notch; env() is 0 on desktop, so no change there). */
body.hkc-has-bar { padding-top: calc(48px + env(safe-area-inset-top, 0px)); }

.hkc-bar,
.hkc-bar *,
.hkc-launcher,
.hkc-launcher *,
.hkc-loginpop,
.hkc-loginpop * {
  box-sizing: border-box;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---- top bar ---------------------------------------------------------------- */
.hkc-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  /* grow up into the iOS status-bar area and pad the controls back below it, so the
     switcher / account chip never hide under the notch on a home-screen PWA. */
  height: calc(48px + env(safe-area-inset-top, 0px));
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: env(safe-area-inset-top, 0px) 12px 0;
  background: #2A3845;
  color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.18), 0 6px 18px -12px rgba(0,0,0,.5);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hkc-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hkc-center {
  flex: 1; min-width: 0; text-align: center;
  font-weight: 600; font-size: 14px; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: rgba(255,255,255,.92);
}
.hkc-right { display: flex; align-items: center; justify-content: flex-end; }

.hkc-switch {
  appearance: none; cursor: pointer;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #fff; font-size: 18px; line-height: 1;
  transition: background .15s;
}
.hkc-switch:hover { background: rgba(255,255,255,.16); }
.hkc-switch:active { background: rgba(255,255,255,.22); }

.hkc-mark {
  color: #fff; text-decoration: none;
  font-weight: 700; font-size: 13.5px; letter-spacing: -.01em;
  white-space: nowrap; opacity: .92;
}
.hkc-mark:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

/* ---- account chip ----------------------------------------------------------- */
.hkc-acct { position: relative; display: flex; align-items: center; }

.hkc-chip {
  appearance: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  border: 0; border-radius: 20px;
  padding: 4px 12px 4px 4px;
  background: rgba(255,255,255,.08);
  color: #fff; font-size: 13.5px; font-weight: 600;
  transition: background .15s;
}
.hkc-chip:hover { background: rgba(255,255,255,.16); }
.hkc-av {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: #DD6F58; color: #fff;
  font-weight: 700; font-size: 13px;
}
.hkc-fn { white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

.hkc-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 168px;
  background: #fff; color: #2A3845;
  border: 1px solid #e3e8ef; border-radius: 10px;
  box-shadow: 0 18px 40px -18px rgba(22,36,58,.45);
  padding: 6px;
  display: none;
}
.hkc-acct.hkc-open .hkc-menu { display: block; }
.hkc-menu-item {
  appearance: none; cursor: pointer; width: 100%;
  text-align: left; border: 0; background: transparent;
  padding: 9px 11px; border-radius: 7px;
  font-size: 14px; font-weight: 500; color: #2A3845;
}
.hkc-menu-item:hover { background: #f1f4f8; }

.hkc-signin {
  appearance: none; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
  border: 0; border-radius: 8px;
  padding: 8px 16px;
  background: #DD6F58; color: #fff;
  font-size: 13.5px; font-weight: 600;
  transition: background .15s, transform .05s;
}
.hkc-signin:hover { background: #c95f49; }
.hkc-signin:active { transform: translateY(1px); }

/* ---- database switcher ------------------------------------------------------ */
.hkc-db { position: relative; display: flex; align-items: center; margin-right: 8px; }
.hkc-db-btn {
  appearance: none; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 20px;
  padding: 5px 11px;
  background: rgba(255,255,255,.08);
  color: #fff; font-size: 13px; font-weight: 600;
  transition: background .15s, border-color .15s;
  max-width: 190px;
}
.hkc-db-btn:hover { background: rgba(255,255,255,.16); }
.hkc-db-btn.hkc-db-solo { cursor: default; opacity: .85; }
.hkc-db-btn.hkc-db-solo:hover { background: rgba(255,255,255,.08); }
.hkc-db-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #6FCF97; box-shadow: 0 0 0 3px rgba(111,207,151,.2); }
.hkc-db-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hkc-db-caret { flex: none; font-size: 10px; opacity: .8; margin-left: -1px; }

.hkc-db-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px; max-width: 280px;
  background: #fff; color: #2A3845;
  border: 1px solid #e3e8ef; border-radius: 10px;
  box-shadow: 0 18px 40px -18px rgba(22,36,58,.45);
  padding: 6px;
  display: none;
}
.hkc-db.hkc-open .hkc-db-menu { display: block; }
.hkc-db-head {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: #8b97a6; padding: 6px 10px 8px;
}
.hkc-db-item {
  appearance: none; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 8px;
  text-align: left; border: 0; background: transparent;
  padding: 9px 11px; border-radius: 7px;
  font-size: 14px; font-weight: 500; color: #2A3845;
}
.hkc-db-item:hover { background: #f1f4f8; }
.hkc-db-item.hkc-db-cur { font-weight: 700; color: #16243a; }
.hkc-db-check { flex: none; width: 14px; color: #DD6F58; font-weight: 700; }

/* ---- inline login popover --------------------------------------------------- */
.hkc-loginpop {
  position: fixed;
  z-index: 10001;
  background: #fff; color: #2A3845;
  border: 1px solid #e3e8ef; border-radius: 12px;
  box-shadow: 0 24px 56px -22px rgba(22,36,58,.5);
  padding: 14px;
  width: 248px;
}
.hkc-loginform { display: flex; flex-direction: column; gap: 9px; }
.hkc-in {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px; /* >=16 avoids iOS zoom */
  color: #16243a;
  background: #fbfcfe;
  border: 1px solid #e3e8ef; border-radius: 8px;
}
.hkc-in:focus {
  outline: none; border-color: #DD6F58;
  box-shadow: 0 0 0 3px rgba(221,111,88,.16);
}
.hkc-go {
  appearance: none; cursor: pointer;
  border: 0; border-radius: 8px;
  padding: 10px 14px;
  background: #DD6F58; color: #fff;
  font-size: 14px; font-weight: 600;
  transition: background .15s;
}
.hkc-go:hover { background: #c95f49; }
.hkc-msg { font-size: 12.5px; min-height: 1em; color: #5d6b7e; }
.hkc-msg.hkc-bad { color: #b4392f; }

/* ---- launcher overlay ------------------------------------------------------- */
.hkc-launcher {
  position: fixed; inset: 0;
  z-index: 10000;
  background: rgba(22,36,58,.42);
  backdrop-filter: blur(2px);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 60px 16px 24px;
  opacity: 0;
  transition: opacity .16s ease;
  overflow-y: auto;
}
.hkc-launcher.hkc-show { opacity: 1; }

.hkc-launch-panel {
  width: 100%; max-width: 880px;
  background: #fff; color: #16243a;
  border-radius: 16px;
  box-shadow: 0 40px 90px -30px rgba(22,36,58,.6);
  padding: 22px 24px 26px;
}
.hkc-launch-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.hkc-launch-title {
  font-size: 12px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: #8b97a6;
}
.hkc-launch-close {
  appearance: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  border: 0; background: #f1f4f8; color: #5d6b7e;
  font-size: 15px; line-height: 1;
  transition: background .15s, color .15s;
}
.hkc-launch-close:hover { background: #e6ebf2; color: #2A3845; }

.hkc-sec-title {
  margin: 24px 0 13px;
  font-size: 11px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: #8b97a6;
  display: flex; align-items: center; gap: 12px;
}
.hkc-sec-title::after {
  content: ""; flex: 1; height: 1px; background: #e3e8ef;
}

.hkc-tilegrid {
  display: grid; gap: 11px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.hkc-tile {
  display: flex; align-items: center; gap: 13px;
  text-decoration: none; color: inherit;
  border: 1px solid #e3e8ef; border-radius: 12px;
  padding: 13px 15px; background: #fff;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.hkc-tile:hover {
  border-color: #c5d2e2;
  box-shadow: 0 12px 26px -18px rgba(22,36,58,.45);
  transform: translateY(-1px);
}
.hkc-tile-active {
  border-color: #DD6F58;
  box-shadow: 0 0 0 2px rgba(221,111,88,.2);
}
.hkc-tile-ic {
  flex: none; width: 42px; height: 42px; border-radius: 10px;
  background: #eef1f5; border: 1px solid #e3e8ef;
  display: grid; place-items: center; font-size: 1.3rem;
}
.hkc-tile-m { flex: 1; min-width: 0; }
.hkc-tile-nm {
  display: block; font-weight: 650; font-size: 15.5px; color: #16243a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hkc-tile-db {
  display: inline-block; margin-top: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: .03em;
  color: #2c5286; background: rgba(44,82,134,.09);
  border-radius: 20px; padding: 2px 9px;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hkc-empty {
  grid-column: 1 / -1;
  color: #8b97a6; font-size: 14px; padding: 8px 2px;
}

/* ---- mobile ----------------------------------------------------------------- */
@media (max-width: 560px) {
  .hkc-mark { display: none; }
  .hkc-center { display: none; }   /* DB pill carries context on mobile */
  .hkc-fn { display: none; }
  .hkc-chip { padding: 4px; }
  .hkc-db { margin-right: 6px; }
  .hkc-db-btn { max-width: 140px; }
  .hkc-launcher { padding: 56px 10px 18px; }
  .hkc-launch-panel { padding: 18px 16px 20px; }
  .hkc-tilegrid { grid-template-columns: 1fr; }
}