/* NMR Digital — shared design tokens + app shell chrome.
   Loaded by every page alongside its own <style> block for page-specific UI. */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&display=swap');

:root {
  --navy: #081f42;
  --navy2: #0f2d5c;
  --teal: #1e8a9e;
  --teal-light: #47b2cc;
  --gray-bg: #f5f6f8;
  --gray-border: #e1e4ea;
  --gray-text: #5a6472;
  --ink: #17305e;
  --red: #c0392b;
  --green: #1e8a5f;
  --amber: #b8860b;
  --radius: 10px;
  --font: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: var(--font);
  background: var(--gray-bg);
  color: #1a2433;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

/* ------------------------------------------------------------- app shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}
.brand { padding: 4px 6px 18px; }
.brand svg { width: 150px; height: auto; display: block; }
.nav-links { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.nav-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.hamburger-btn {
  display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px; width: 38px; height: 38px;
  border-radius: 6px; flex-shrink: 0;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.08); }
.hamburger-line {
  display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.hamburger-btn.open .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open .hamburger-line:nth-child(2) { opacity: 0; }
.hamburger-btn.open .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
body.nav-open { overflow: hidden; }

.nav-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: rgba(255,255,255,0.45); padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; color: rgba(255,255,255,0.85);
  font-size: 14px; font-weight: 500; cursor: pointer; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,0.14); color: #fff; }
.nav-item .nav-icon { width: 18px; text-align: center; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.nav-item .nav-label { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  margin-left: auto; background: rgba(255,255,255,0.16); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px;
}
.nav-subitems { margin: 2px 0 6px; }
.nav-subitem {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 42px; border-radius: 6px; cursor: pointer;
  font-size: 12.5px; color: rgba(255,255,255,0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-subitem-label { overflow: hidden; text-overflow: ellipsis; }
.nav-subitem:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-subitem.active { color: var(--teal-light); font-weight: 700; }
.nav-subitem .nav-count { margin-left: auto; }
/* Wraps a whole button (e.g. boards.html's My Jobs/My Tasks toolbar buttons)
   plus its notif-badge overlay -- sized to the button's own content, not a
   fixed box, since this now has no other caller wrapping just a bare badge. */
.btn-badge-wrap { position: relative; display: inline-flex; }
.notif-badge {
  position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 999px; min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
  border: 2px solid var(--navy);
}

.sidebar-spacer { flex: 1; }
.me-box {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  border-top: 1px solid rgba(255,255,255,0.12); margin-top: 10px;
}
.me-box .avatar { flex: none; }
.me-name { font-size: 13px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-email { font-size: 11px; color: rgba(255,255,255,0.5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout-btn {
  background: none; border: none; color: rgba(255,255,255,0.5); font-size: 12px;
  padding: 2px 0; text-align: left; text-decoration: none; display: inline;
}
.signout-btn:hover { color: #fff; }

.main { flex: 1; min-width: 0; padding: 28px 32px 60px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; color: var(--navy); margin: 0; }
.page-sub { font-size: 13px; color: var(--gray-text); margin: 4px 0 0; }

/* ------------------------------------------------------------- buttons */
.btn {
  background: #fff; border: 1px solid var(--gray-border); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: #2a3446;
}
.btn:hover { border-color: #c7cdd8; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: #197e91; border-color: #197e91; }
.btn-danger { background: #fff; border-color: #f0c4bd; color: var(--red); }
.btn-danger:hover { background: #fdf1ef; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* ------------------------------------------------------------- avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px; color: #fff;
  font-size: 11px; font-weight: 700; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  background: #1a2433; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease; z-index: 4000; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------- modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,18,32,0.45);
  display: none; align-items: center; justify-content: center; z-index: 3500; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 420px;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-sm { max-width: 360px; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.modal-sub { font-size: 13px; color: var(--gray-text); margin-bottom: 14px; }
.modal-input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--gray-border); border-radius: 8px;
  font-size: 14px; margin-bottom: 4px;
}
.modal-input:focus { outline: none; border-color: var(--teal); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-choices { display: flex; flex-direction: column; gap: 8px; }
.modal-choice {
  text-align: left; background: var(--gray-bg); border: 1px solid var(--gray-border);
  border-radius: 10px; padding: 10px 12px;
}
.modal-choice:hover { border-color: var(--teal-light); background: #eef8fa; }
.mc-title { font-size: 13px; font-weight: 700; color: #1a2433; }
.mc-desc { font-size: 12px; color: var(--gray-text); margin-top: 2px; }

/* ------------------------------------------------------------- popovers */
.mini-popover {
  position: fixed; background: #fff; border: 1px solid var(--gray-border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(20,30,50,0.18); padding: 8px; z-index: 3200; min-width: 200px; max-width: 280px;
}

/* ------------------------------------------------------------- badges/pills */
.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-flag {
  display: inline-flex; align-items: center; gap: 4px; background: #fff2e0; color: #94590a;
  border: 1px solid #f3d8a8; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.date-chip { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #eef1f5; color: #4b5567; font-weight: 600; }
.date-chip.due-soon { background: #fff2d9; color: #8a5a06; }
.date-chip.due-over { background: #fdeceb; color: var(--red); }

/* ------------------------------------------------------------- auth gate */
.gate {
  position: fixed; inset: 0; background: var(--navy); z-index: 5000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gate[hidden] { display: none; }
.gate-box { width: 100%; max-width: 360px; text-align: center; }
.gate-logo { width: 200px; height: auto; margin: 0 auto 22px; display: block; }
.gate-box h2 { color: #fff; font-size: 20px; margin: 0 0 6px; }
.gate-box p#gateSub { color: rgba(255,255,255,0.6); font-size: 13px; margin: 0 0 20px; }
.gate-checking { color: rgba(255,255,255,0.7); font-size: 13px; }
.gate-spinner {
  width: 26px; height: 26px; margin: 0 auto 12px; border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.2); border-top-color: #fff;
  animation: gate-spin 0.8s linear infinite;
}
@keyframes gate-spin { to { transform: rotate(360deg); } }
.gate-form { display: flex; flex-direction: column; gap: 10px; }
.gate-form input {
  padding: 11px 13px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06); color: #fff; font-size: 14px;
}
.gate-form input::placeholder { color: rgba(255,255,255,0.4); }
.gate-form input:focus { outline: none; border-color: var(--teal-light); }
.gate-btn {
  margin-top: 4px; background: var(--teal); border: none; color: #fff; font-weight: 700;
  padding: 11px; border-radius: 8px; font-size: 14px;
}
.gate-btn:hover { background: #197e91; }
.gate-btn:disabled { opacity: 0.6; }
.gate-err { color: #ff9d8f; font-size: 13px; margin-top: 12px; }
.gate-ok { color: #8fe0c0; font-size: 13px; margin-top: 12px; }
.gate-link {
  display: block; margin: 14px auto 0; background: none; border: none;
  color: rgba(255,255,255,0.6); font-size: 12px; text-decoration: underline;
}
.gate-link:hover { color: #fff; }

/* ------------------------------------------------------------- tiles / cards */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.tile {
  background: #fff; border: 1px solid var(--gray-border); border-radius: 16px; padding: 28px;
  display: flex; flex-direction: column; gap: 12px; min-height: 168px;
}
.tile:hover { border-color: var(--teal-light); box-shadow: 0 8px 24px rgba(20,40,70,0.08); text-decoration: none; }
.tile-icon { width: 54px; height: 54px; border-radius: 13px; display: flex; align-items: center; justify-content: center; color: #fff; }
.tile-icon svg { width: 26px; height: 26px; }
.tile-title { font-size: 19px; font-weight: 700; color: var(--navy); }
.tile-sub { font-size: 13.5px; color: var(--gray-text); line-height: 1.45; }

.panel { background: #fff; border: 1px solid var(--gray-border); border-radius: 14px; padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.panel-title { font-size: 14px; font-weight: 700; color: var(--navy); margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; }

.empty-state { color: var(--gray-text); font-size: 13px; padding: 18px 4px; text-align: center; }

/* ------------------------------------------------------------- responsive
   Matches the old Planner app's mobile pattern: the sidebar collapses into
   a horizontal top bar (logo + hamburger), and the nav itself becomes a
   panel that slides in from the right over a dimmed backdrop -- rather
   than the sidebar sliding in from the left. */
@media (max-width: 900px) {
  .app { flex-direction: column; min-height: auto; }
  .sidebar {
    width: 100%; height: auto; flex: none; position: static; flex-direction: row;
    align-items: center; justify-content: space-between;
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px 14px; gap: 4px;
  }
  .brand { padding: 0; margin: 0; flex-shrink: 0; }
  .brand svg { width: 110px; height: auto; margin: 0; }
  .hamburger-btn { display: flex; }
  .nav-links {
    position: fixed; top: 0; right: 0; height: 100%;
    width: min(78vw, 300px); background: var(--navy); flex: none;
    padding: calc(20px + env(safe-area-inset-top)) 0 20px 0;
    transform: translateX(100%); transition: transform 0.28s ease;
    z-index: 2100; box-shadow: -8px 0 28px rgba(0,0,0,0.28);
  }
  .nav-links.open { transform: translateX(0); }
  .nav-scroll { padding: 0 14px; }
  .nav-item { padding: 12px 10px; white-space: normal; flex-shrink: 0; }
  .main { padding: 18px 16px 60px; }
  .nav-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(8,31,66,0.45);
    z-index: 2050; opacity: 0; transition: opacity 0.25s ease;
  }
  .nav-backdrop.open { display: block; opacity: 1; }
}
@media (min-width: 901px) {
  .hamburger-btn, .nav-backdrop { display: none; }
}
