/* =============================================================================
   Mediquip Assistant — website styles.

   UNIFIED PROJECT: shares the brand system with the Outlook add-in
   (addin/src/taskpane/taskpane.css) and the browser extension. The variables,
   card, list-item, badge and suggest styles below are lifted from that sheet;
   this file adds the desktop page layout the 320px task pane doesn't need.
   If the brand look changes there, change it here too.
   ========================================================================== */

:root {
  --brand: #dd0431;
  --brand-dark: #87001c;
  --brand-tint: #fdeef1;
  --ink: #1c1c1e;
  --ink-soft: #6b6b70;
  --line: #e8e6e3;
  --bg: #f6f5f3;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(28, 28, 30, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #ff3b5c;
    --brand-dark: #dd0431;
    --brand-tint: #3a1220;
    --ink: #f2f2f4;
    --ink-soft: #9a9aa2;
    --line: #3a3a3e;
    --bg: #1f1f21;
    --card: #2a2a2d;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", -apple-system, Arial, sans-serif;
  font-size: 14px;
}

/* --- header (same as the pane's, scaled up) -------------------------------- */
.site-header {
  background: var(--card);
  border-bottom: 3px solid var(--brand);
  padding: 18px 24px 14px;
  text-align: center;
}
.site-header h1 { margin: 0; font-size: 24px; letter-spacing: -0.3px; }
.site-header .accent { color: var(--brand); }
.site-sub { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 22px 18px 40px; }

/* --- search ----------------------------------------------------------------- */
.search-block { position: relative; margin-bottom: 18px; }
#q {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}
#q:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

.suggest {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  z-index: 20;
  overflow: hidden;
}
.suggest-item { padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.suggest-item:first-child { border-top: none; }
.suggest-item:hover { background: var(--brand-tint); }
.suggest-item .title { font-weight: 600; }
.suggest-item .meta { color: var(--ink-soft); font-size: 12px; }

/* --- customer card (the add-in's red identity bubble) ----------------------- */
.sender-bubble {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  color: #fff;
  box-shadow: var(--shadow);
}
.sender-bubble.is-customer { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.sender-top { display: flex; align-items: center; gap: 12px; }
.sender-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.sender-name { font-weight: 700; font-size: 17px; }
.sender-email { font-size: 12.5px; opacity: 0.9; }
.badges { margin-top: 8px; }
.badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-right: 6px;
}
.badge.solid { background: #fff; color: var(--brand-dark); }
.identity-facts {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 3px 14px;
  margin: 10px 0 0;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 12.5px;
}
.identity-facts dt { opacity: 0.8; margin: 0; }
.identity-facts dd { margin: 0; font-weight: 600; word-break: break-word; }
.sender-bubble a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }

/* --- content cards ----------------------------------------------------------- */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex; align-items: center; gap: 8px;
}
.src-badge {
  background: var(--brand-tint);
  color: var(--brand-dark);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.list-item { padding: 9px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: none; padding-top: 2px; }
.list-item .title { font-weight: 600; }
.list-item .meta { color: var(--ink-soft); font-size: 12px; margin-top: 1px; }
.list-item a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
.list-item a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { .list-item a { color: var(--brand); } }

.meta { color: var(--ink-soft); font-size: 12px; }
.warn { color: #986f0b; }
.err  { color: var(--brand-dark); font-weight: 600; }

.spinner {
  display: inline-block; width: 11px; height: 11px;
  border: 2px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 6px; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.foot-note { color: var(--ink-soft); font-size: 11.5px; text-align: center; margin-top: 26px; }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  border-radius: 8px; padding: 8px 16px; font-size: 13px;
  opacity: 0; transition: opacity 0.25s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; }
.hidden { display: none !important; }

/* ================= additions: nav, auth, profile, table, buttons ========= */

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 980px;
  margin: 0 auto;
  gap: 12px;
}
.brand { text-align: center; flex: 1; }

.site-nav { display: flex; gap: 6px; min-width: 180px; }
.site-nav button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.site-nav button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.auth-area { min-width: 180px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--brand-tint); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-small { padding: 2px 10px; font-size: 11px; margin-left: auto; }
.btn:disabled { opacity: 0.5; cursor: default; }

.profile-card { margin-bottom: 18px; }
.profile-grid { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: flex-end; }
.profile-grid .facts { font-size: 12.5px; color: var(--ink-soft); }
.profile-grid .facts strong { color: var(--ink); }
.field-inline label { display: block; font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
.field-inline input {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); font-size: 13px; min-width: 260px;
}

/* Top-500 table */
table.board { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.board th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ink-soft); padding: 6px 8px; border-bottom: 2px solid var(--line);
  position: sticky; top: 0; background: var(--card);
}
table.board td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.board tr:hover td { background: var(--brand-tint); cursor: pointer; }
table.board td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.board th.num { text-align: right; }
.board-scroll { max-height: 65vh; overflow: auto; }
.stale { color: var(--ink-soft); }

/* ============ additions: home/customer views, tabbar, banner ============ */

.brand { cursor: pointer; }

/* System tabs under the customer banner — same look as the add-in's tabbar. */
.tabbar {
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}
.tabbar button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
}
.tabbar button.active { background: var(--brand); color: #fff; }

/* Close (×) on the customer banner — back to home. */
.bubble-close {
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  margin-left: auto;
}
.bubble-close:hover { background: rgba(255, 255, 255, 0.35); }

/* Top-500 standing line inside the banner. */
.standing {
  margin-top: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  border-left: 3px solid #ffd166;
  font-size: 12.5px;
}
.standing strong { font-weight: 700; }

/* The real Mediquip mark beside the wordmark. */
.logo-mark { width: 28px; height: 28px; vertical-align: -5px; margin-right: 8px; }

/* ------------------------------------------------- landing gate (2026-09-02) --
   Covers the whole app until a Microsoft sign-in exists. The server already
   401s every data call; this keeps the UI itself behind the front door. */
.gate {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.gate.hidden { display: none; }
.gate-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 40px 48px; text-align: center; max-width: 420px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.gate-card h1 { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 6px; }
.gate-sub { color: var(--ink-soft); margin: 0 0 18px; font-size: 14px; }
.gate-note { color: var(--ink-soft); font-size: 13px; margin: 0 0 16px; }
.gate-btn { font-size: 15px; padding: 10px 22px; }
