/* Shift Pass Admin layout: sidebar (computer), bottom bar (phone), page header, sub-tabs,
   the settings side panel and the Admin settings page. Loaded after the tool stylesheets. */

body.sp-in { background: #f7f4ea; }
body.sp-in .wrap { max-width: none; padding: 0; }
body.sp-in .login-brand { display: none; }
.sp-old-tabs { display: none !important; }

.sp-app { display: flex; min-height: 100vh; min-height: 100dvh; }

/* ---------- Sidebar ---------- */
.sp-side {
  position: sticky; top: 0; align-self: flex-start; box-sizing: border-box;
  width: 240px; flex: none; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px; padding: 22px 14px;
  background: var(--navy); color: var(--cream);
}
.sp-brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 22px; }
.sp-mark { display: block; border-radius: 11px; object-fit: cover; background: var(--navy); }
.sp-brand strong { display: block; font-size: 16px; }
.sp-brand span { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--light-muted); }
.sp-nav { display: flex; flex-direction: column; gap: 4px; }
.sp-nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 14px;
  border-radius: 10px; background: transparent; color: var(--light-muted); font-weight: 650; text-align: left;
}
.sp-nav-item svg { width: 20px; height: 20px; flex: none; }
.sp-nav-item:hover { background: var(--navy-gradient); color: var(--cream); }
.sp-nav-item[aria-current="page"] { background: var(--cream); color: var(--navy); font-weight: 800; }
.sp-nav-item:focus-visible, .sp-tab:focus-visible, .sp-subtab:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.sp-badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; box-sizing: border-box; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--yellow); color: var(--navy); font-size: 12px; font-weight: 800; line-height: 1;
}
.sp-side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--navy-panel); display: flex; flex-direction: column; gap: 10px; }
.sp-me { display: flex; align-items: center; gap: 10px; padding: 2px 8px; min-width: 0; }
.sp-me strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.sp-me span { display: block; font-size: 12px; color: var(--light-muted); }
.sp-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--yellow); color: var(--navy); font-weight: 800;
}

/* ---------- Main column ---------- */
.sp-main { flex: 1; min-width: 0; box-sizing: border-box; padding: 26px 34px 60px; }
.sp-mobilebar { display: none; }
.sp-head, .sp-subnav, .sp-body { max-width: 1240px; }
.sp-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.sp-head-text { min-width: 0; }
.sp-date { margin: 0; font-size: 13px; color: var(--muted); }
.sp-head h1 { margin: 4px 0 0; font-size: 30px; letter-spacing: -.01em; }
.sp-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-head-actions button { min-height: 42px; }

.sp-subnav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.sp-subtab {
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 8px; background: var(--card); color: var(--muted); font-weight: 750;
}
.sp-subtab[aria-selected="true"] { background: var(--navy); border-color: var(--navy); color: var(--cream); }
.sp-subtab .sp-badge { margin-left: 0; min-width: 20px; height: 20px; font-size: 11px; }
.sp-gear { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.sp-gear svg { width: 18px; height: 18px; flex: none; }
.sp-gear[aria-expanded="true"] { background: var(--navy); color: var(--cream); border-color: var(--navy); }

.sp-body { display: flex; gap: 20px; align-items: flex-start; }
.sp-content { flex: 1; min-width: 0; }

/* The tools' own page titles are replaced by the sub-tabs; their explanation sits behind an ⓘ. */
.sp-content .topbar h2 { display: none; }
.sp-content .topbar { align-items: center; margin-bottom: 12px; }
.sp-content .topbar-copy { display: none; max-width: 70ch; }
.sp-content .topbar-copy.sp-open { display: block; }
.sp-info {
  min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-size: 13px; font-weight: 700;
}
.sp-info[aria-expanded="true"] { border-color: var(--navy); color: var(--navy); }
/* Pages refresh on their own now. */
#refreshBtn, #dailyRefresh, #calRefresh, #kudosRefresh, #jobsRefresh, #msRefresh, #flagsRefresh, #prayerRefresh { display: none; }
/* Shop Care and Special missions are separate sub-tabs, so the old switch is hidden. */
.jobs-mode { display: none !important; }
/* Monthly reviews: keep "Needs feedback" and "Most common skill improved". */
.stat-minor { display: none !important; }
.sp-content .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Team page shows the Shift Board and Prayer Corner one under the other. */
.sp-team #prayerPane { margin-top: 26px; padding-top: 4px; border-top: 1px solid var(--line); }
.sp-team #prayerPane .topbar h2 { display: block; font-size: 20px; }

/* ---------- Settings side panel ---------- */
.sp-panel {
  position: sticky; top: 20px; width: 400px; flex: none; box-sizing: border-box;
  max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--card); border: 2px solid var(--navy); border-radius: 18px;
}
.sp-panel-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: var(--yellow-soft); border-bottom: 1px solid var(--line);
}
.sp-panel-head span { font-size: 12px; }
.sp-panel-head h2 { margin: 2px 0 0; font-size: 18px; }
.sp-panel-loading { margin: 0; padding: 16px 18px; }
.sp-panel-body { padding: 4px 16px 18px; }
.sp-panel-body > .card, .sp-panel-body > details, .sp-panel-body > form, .sp-panel-body > section {
  margin: 0; padding: 16px 2px; border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0; box-shadow: none; background: transparent;
}
.sp-panel-body > :last-child { border-bottom: 0; }
.sp-panel summary { pointer-events: none; list-style: none; font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.sp-panel summary::-webkit-details-marker { display: none; }
.sp-panel .reward-row { flex-wrap: wrap; }

/* ---------- Admin settings page ---------- */
.sp-settings { display: flex; flex-direction: column; gap: 16px; }
.sp-settings > .card { margin: 0; }
.sp-card h3, .sp-settings .claims-card h3 { margin: 0 0 4px; font-size: 18px; }
.sp-card > .muted { margin: 0; font-size: 13px; }
.sp-name-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sp-name-row input, .sp-targets input {
  border: 1px solid var(--border); background: var(--cream); border-radius: 11px; padding: 10px 12px; font: inherit; color: var(--text);
}
.sp-name-row input { flex: 1 1 220px; }
.sp-matrix { margin-top: 12px; overflow-x: auto; }
.sp-matrix table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sp-matrix th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.sp-matrix td { padding: 10px; border-bottom: 1px solid var(--border-soft); }
.sp-tg { min-height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.sp-tg.on { background: #e1f2e8; color: #14532d; }
.sp-tg.off { background: var(--border-soft); color: var(--muted); }
.sp-tg:hover { outline: 1px solid var(--navy); }
.sp-inner-details { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.sp-inner-details > summary { cursor: pointer; font-weight: 800; min-height: 40px; display: flex; align-items: center; }
.sp-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.sp-targets label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
.sp-targets input { width: 84px; }
.sp-targets-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.sp-account-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border-soft); }
.sp-account-row:first-of-type { border-top: 0; }
.sp-account-row p { margin: 2px 0 0; font-size: 13px; }
.sp-account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-settings .admin-install { margin: 0; box-shadow: none; border-left: 0; border-right: 0; border-radius: 0; }

/* "Your name" is set once in Admin settings, so the tools stop asking for it. */
.sp-has-name .kudos-from, .sp-has-name .flags-from, .sp-has-name .board-from { display: none; }

/* ---------- Account menu (phone) ---------- */
.sp-menu-wrap { position: relative; }
.sp-avatar-btn {
  position: relative; width: 42px; height: 42px; min-height: 42px; padding: 0; border-radius: 50%;
  background: var(--yellow); color: var(--navy); font-weight: 800;
}
.sp-badge-dot { position: absolute; top: -4px; right: -4px; margin: 0; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; background: var(--navy); color: var(--cream); }
.sp-menu {
  position: absolute; right: 0; top: 50px; z-index: 40; width: 250px; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.sp-menu-me { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.sp-menu-me strong, .sp-menu-me span { display: block; }
.sp-menu-me span { font-size: 12px; color: var(--muted); }
.sp-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  border-radius: 0; background: transparent; color: var(--navy); font-weight: 650; text-align: left; border-bottom: 1px solid var(--border-soft);
}
.sp-menu button:last-child { border-bottom: 0; }

.sp-bottom { display: none; }

/* ---------- Phone and narrow windows ---------- */
@media (max-width: 900px) {
  .sp-side { display: none; }
  .sp-main { padding: 0 14px 100px; }
  .sp-mobilebar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
    margin: 0 -14px 12px; padding: 10px 14px; background: var(--cream); border-bottom: 1px solid var(--line);
  }
  .sp-brand-mini { padding: 0; gap: 10px; color: var(--navy); }
  .sp-head { margin-bottom: 12px; }
  .sp-head h1 { font-size: 24px; }
  .sp-head-actions { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .sp-head-actions button { flex: none; min-height: 40px; padding: 8px 12px; font-size: 14px; }
  .sp-subnav { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 14px; padding: 0 14px 4px; scrollbar-width: none; }
  .sp-subtab, .sp-gear { flex: none; }
  .sp-body { display: block; }
  .sp-panel { position: fixed; inset: 0; z-index: 60; width: auto; max-height: none; border: 0; border-radius: 0; }
  body.sp-panel-open { overflow: hidden; }
  .sp-bottom {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
    padding: 4px 6px calc(8px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
  }
  .sp-tab {
    position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-height: 56px; padding: 6px 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750;
  }
  .sp-tab svg { width: 22px; height: 22px; }
  .sp-tab[aria-current="page"] { color: var(--navy); background: var(--yellow-soft); }
  .sp-tab .sp-badge { position: absolute; top: 2px; left: 56%; margin: 0; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }
  .sp-content .stats { grid-template-columns: 1fr; }
}

/* Tool settings live behind the ⚙️ button now, so they're hidden on the pages themselves. */
.sp-content #flagsSettings, .sp-content #dailySettings, .sp-content #calSettings, .sp-content #jobsEditorCard,
.sp-content #jobsPings, .sp-content #msTemplates, .sp-content #kudosSettings, .sp-content #growthSettings,
.sp-content #rewardForm, .sp-content #boardValuesCard, .sp-content #boardTipsCard,
.sp-content #prayerSettingsCard, .sp-content #prayerPromptsCard { display: none !important; }

/* Buttons in the narrow panel keep their words whole. */
.sp-panel-body button, .sp-panel-body .tag { overflow-wrap: normal; word-break: normal; }
.sp-panel-body button { flex-shrink: 0; }
.sp-me .sp-avatar { display: flex; font-size: 15px; color: var(--navy); }

/* Practice mode's striped bar sits on top; everything that sticks to the top goes below it. */
.sp-side { top: var(--sp-top, 0px); height: calc(100vh - var(--sp-top, 0px)); height: calc(100dvh - var(--sp-top, 0px)); }
.sp-panel { top: calc(20px + var(--sp-top, 0px)); max-height: calc(100vh - 40px - var(--sp-top, 0px)); }
@media (max-width: 900px) {
  .sp-mobilebar { top: var(--sp-top, 0px); }
  .sp-panel { top: var(--sp-top, 0px); max-height: none; }
}
