/* =========================================================================
   PBC Linear Executive — mobile-first shell
   ========================================================================= */

:root {
  --brand: #0a2540;          /* deep navy — executive */
  --brand-2: #0078E6;        /* PBC blue accent */
  --brand-grad: linear-gradient(135deg, #0a2540 0%, #123a63 100%);
  --ink: #1a2330;
  --muted: #6b7785;
  --line: #e6e9ee;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #1a9e63;
  --danger: #e0314b;

  --header-h: 56px;
  --nav-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 32, 56, 0.08), 0 1px 2px rgba(16, 32, 56, 0.04);
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Pages that use the standard chrome get padding for the fixed header + nav. */
body.has-chrome {
  padding-top: calc(var(--header-h) + var(--safe-top));
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}

a { color: var(--brand-2); text-decoration: none; }

/* ---------------------------------------------------------------- Header */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1030;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--brand-grad);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  padding-right: 16px;
  box-shadow: 0 2px 10px rgba(10, 37, 64, 0.18);
}
.app-header__title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.app-header__brand {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
}
.app-header__logo {
  width: 26px; height: 26px; border-radius: 7px;
  background: rgba(255,255,255,0.14);
  display: grid; place-items: center;
  font-size: 0.95rem; color: #fff; flex-shrink: 0;
}
.app-header__action {
  background: rgba(255,255,255,0.12);
  border: none; color: #fff;
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.1rem;
}
.app-header__action:active { background: rgba(255,255,255,0.25); }

/* ---------------------------------------------------------- Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1030;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,0.96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
}
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 500;
  text-decoration: none;
  padding-top: 6px;
}
.bottom-nav__item i { font-size: 1.32rem; line-height: 1; }
.bottom-nav__item.active { color: var(--brand-2); }
.bottom-nav__item:active { opacity: 0.6; }

/* ---------------------------------------------------------------- Content */
.app-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}
.section-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 18px 4px 10px;
}

/* Cards */
.ex-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 12px;
}

/* Module / link tiles on welcome */
.module-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 12px;
  color: var(--ink);
}
.module-tile:active { transform: scale(0.99); }
.module-tile__icon {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--brand-grad);
  color: #fff;
  display: grid; place-items: center;
  font-size: 1.35rem; flex-shrink: 0;
}
.module-tile__body { flex: 1; min-width: 0; }
.module-tile__title { font-weight: 600; font-size: 0.98rem; }
.module-tile__desc { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.module-tile__chev { color: var(--muted); font-size: 1.1rem; }

/* Buttons */
.btn-brand {
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #fff;
  font-weight: 600;
  border-radius: 12px;
  padding: 12px 18px;
}
.btn-brand:hover, .btn-brand:focus { background: #0066c7; border-color: #0066c7; color: #fff; }
.btn-block-lg { width: 100%; min-height: 52px; font-size: 1rem; }

/* Greeting */
.greeting { padding: 4px 4px 2px; }
.greeting__hello { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.greeting__sub { color: var(--muted); font-size: 0.9rem; }

/* Version footer */
.version-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  padding: 14px 0 6px;
}

/* ---------------------------------------------------- Auth / login page */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  background: var(--brand-grad);
}
.auth-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
}
.auth-logo {
  width: 60px; height: 60px; border-radius: 16px;
  background: var(--brand-grad);
  display: grid; place-items: center;
  color: #fff; font-size: 1.7rem;
  margin: 0 auto 14px;
}
.auth-title { text-align: center; font-weight: 700; font-size: 1.3rem; }
.auth-sub { text-align: center; color: var(--muted); font-size: 0.86rem; margin-bottom: 22px; }
.btn-sso {
  width: 100%;
  min-height: 52px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  font-weight: 600; color: var(--ink);
  font-size: 1rem;
}
.btn-sso:active { background: #f4f6f9; }
.auth-foot { text-align: center; color: rgba(255,255,255,0.7); font-size: 0.72rem; margin-top: 18px; }
.admin-toggle { text-align: center; margin-top: 16px; }
.admin-toggle a { color: var(--muted); font-size: 0.8rem; }

/* Badges */
.pill {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 600;
}
.pill--pending { background: #fff3d6; color: #9a6b00; }
.pill--active { background: #d8f3e3; color: #137a4b; }
.pill--disabled { background: #f1d6da; color: #9a2233; }

/* Brand block + spacer in the nav — only rendered on the desktop rail. */
.side-brand { display: none; }
.bottom-nav__spacer { display: none; }

/* =========================================================================
   Desktop (≥992px) — "normal website" shell.
   The mobile bottom tab bar is restyled into a persistent left sidebar; the
   navy header becomes a light page-title bar. Phones (<992px) are untouched.
   ========================================================================= */
@media (min-width: 992px) {
  :root { --sidebar-w: 224px; }

  /* --- Left nav rail (reuses the .bottom-nav element) --- */
  .bottom-nav {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: var(--sidebar-w);
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    padding: 0 0 10px;
    border-top: none;
    border-right: 1px solid var(--line);
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Brand at the top of the rail */
  .side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
  }
  .side-brand__logo {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--brand-grad);
    display: grid; place-items: center;
    color: #fff; font-size: 1.05rem; flex-shrink: 0;
  }
  .side-brand__name {
    font-weight: 700; font-size: 1.02rem; color: var(--ink);
    letter-spacing: -0.01em;
  }

  /* Nav items become horizontal icon + label rows */
  .bottom-nav__item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    margin: 2px 10px;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink);
  }
  .bottom-nav__item i { font-size: 1.15rem; width: 22px; text-align: center; }
  .bottom-nav__item span { line-height: 1; }
  .bottom-nav__item:hover { background: var(--bg); }
  .bottom-nav__item.active { background: #e8f1fd; color: var(--brand-2); }
  .bottom-nav__item:active { opacity: 1; }

  /* Pushes "Sign out" to the bottom of the rail */
  .bottom-nav__spacer { display: block; flex: 1; }

  /* --- Light page-title bar, offset to start after the rail --- */
  .app-header {
    left: var(--sidebar-w);
    height: var(--header-h);
    padding-top: 0;
    background: #fff;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }
  .app-header__title { color: var(--ink); }
  .app-header__logo { display: none; }
  .app-header__action { background: var(--bg); color: var(--ink); }
  .app-header__action:active { background: var(--line); }

  /* --- Content: clear the rail, widen, drop the bottom-bar gap --- */
  body.has-chrome {
    padding-left: var(--sidebar-w);
    padding-bottom: 24px;
  }
  .app-content { max-width: 1080px; padding: 24px 28px; }

  /* Tile groups go 2-up instead of a single stacked column */
  .tile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .tile-grid .module-tile { margin-bottom: 0; }
}
