/* The employee frame (emp-shell.js): the dark sidebar of the owner's screens, for the sales team.
   Laptop / tablet (900 px and wider): the sidebar is always there and the top bar is hidden (the account card sits at the bottom of the sidebar).
   Phone (under 900 px): the top bar carries a Menu button; the same sidebar slides in from the left, with a dimmed backdrop; a slim bottom bar keeps four shortcuts.
   Uses only the theme's colour variables, so light and dark both work. Loaded after theme-aurex.css and the other page styles. */

/* ---------- the row: sidebar + page ---------- */
[data-mode="employee"] .shell.es-shell { flex-direction: row; min-width: 0; }
[data-mode="employee"] .es-shell > .main { flex: 1 1 0; min-width: 0; padding: 22px 28px 48px; background: var(--bg); }

/* ---------- the sidebar (always dark, like the owner's) ---------- */
.es-side {
  --surface: var(--obsidian); --surface-2: var(--obsidian-2); --surface-3: var(--obsidian-3);
  --ink: #F3EBDD; --text: #D8D3C8; --muted: #A9A6A0; --muted-2: #9A978F;
  --line: var(--obsidian-line); --line-2: var(--obsidian-line); --hover: var(--obsidian-3);
  --gold-ink: #D9B873; --gold-deep: #E2C58A; --gold-soft: #2A2418; --gold-wash: #1E1A12; --gold-line: #3A3020;
  flex: 0 0 244px; width: 244px; box-sizing: border-box; background: var(--obsidian); color: var(--text); border-right: 1px solid var(--obsidian-line);
  padding: 14px 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overscroll-behavior: contain; min-height: 0;
}
.es-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.es-logo { display: flex; flex-direction: column; gap: 3px; padding: 8px 8px 12px; }
.es-logo-img { height: 22px; width: auto; align-self: flex-start; display: block; }
.es-logo-sub { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.es-close { display: none; appearance: none; border: 0; background: transparent; color: var(--muted); width: 38px; height: 38px; border-radius: 10px; align-items: center; justify-content: center; cursor: pointer; margin-top: 4px; }
.es-close:hover { background: var(--hover); color: var(--ink); }
.es-org { margin: 0 0 8px; }
.es-org-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 9px 10px; }
.es-org-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.es-org-text b { font-size: 12.5px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.es-org-text em { font-style: normal; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.es-org-chip { font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--gold-wash); color: var(--gold-ink); border: 1px solid var(--gold-line); white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.es-nav { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; }
.es-group { margin: 12px 12px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.es-link {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; box-sizing: border-box; text-align: left; cursor: pointer;
  padding: 7px 12px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.es-link .ic { color: var(--muted); flex: 0 0 auto; transition: color .15s ease; vertical-align: 0; }
.es-link .es-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.es-link:hover { background: var(--hover); }
.es-link:hover .ic { color: var(--gold-pale); }
.es-link.active, .es-link.active:hover { background: #1F2024; border-color: #2E2F35; color: #fff; }
.es-link.active .ic { color: var(--gold-pale); }
.es-link:focus-visible, .es-user:focus-visible, .es-bell:focus-visible, .es-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
/* the count of site visits that need the person (my-visits-ui.js writes it) sits at the right edge of the sidebar item */
.es-link .mv-badge { position: static; margin: 0 0 0 auto; flex: 0 0 auto; transform: none; background: var(--gold); color: #1A1305; }
.es-foot { margin-top: auto; position: sticky; bottom: -10px; background: var(--obsidian); padding: 8px 0 4px; z-index: 2; }
.es-user-row { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line-2); padding-top: 8px; }
.es-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; border-radius: 10px; padding: 6px; }
.es-user:hover { background: var(--hover); }
.es-user .avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex: 0 0 auto; background: var(--gold); color: #1A1305; }
.es-user .ic { margin-left: auto; color: var(--muted); }
.es-user-text { display: flex; flex-direction: column; min-width: 0; }
.es-user-text b { font-size: 12.5px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.es-user-text em { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.es-bell { position: relative; flex: 0 0 auto; width: 38px; height: 38px; border: 0; background: none; color: var(--muted); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.es-bell:hover { background: var(--hover); color: var(--ink); }
.es-bell .notif-badge { top: 1px; right: 1px; box-shadow: 0 0 0 2px var(--obsidian); }
.es-backdrop { display: none; }

/* ---------- laptop / tablet: no top bar, the account menu opens above the account card ---------- */
@media (min-width: 900px) {
  .es-topbar { height: 0; min-height: 0; padding: 0; border: 0; box-shadow: none; background: transparent; position: static; overflow: visible; }
  .es-topbar > *:not(.user-menu-wrap) { display: none !important; }
  .es-topbar .user-menu-wrap { position: static; }
  .es-topbar .user-btn { display: none; }
  .es-topbar .user-menu { position: fixed; left: 12px; right: auto; top: auto; bottom: 74px; width: 284px; z-index: 600; }
  .es-bottom { display: none !important; }
  .es-shell .es-side { position: sticky; top: var(--strip-h, 0px); height: calc(100vh - var(--strip-h, 0px)); align-self: flex-start; }
}
.es-topbar .user-menu-item { white-space: nowrap; }
.es-topbar .user-menu.es-from-side { position: fixed; left: 12px; right: auto; top: auto; bottom: 74px; width: min(284px, calc(100vw - 24px)); z-index: 600; }
.es-menu-btn { display: none !important; }

/* ---------- phone: the sidebar is a drawer ---------- */
@media (max-width: 899.98px) {
  .es-menu-btn { display: inline-flex !important; }
  [data-mode="employee"] .shell.es-shell { display: block; }
  .es-shell .es-side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 70; width: min(304px, 86vw); flex: none; height: auto;
    padding-top: calc(14px + env(safe-area-inset-top, 0px)); padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-104%); visibility: hidden;
    transition: transform .26s cubic-bezier(.22, .8, .3, 1), visibility 0s linear .26s;
  }
  .es-shell.es-open .es-side { transform: none; visibility: visible; box-shadow: 0 0 0 1px var(--obsidian-line), 24px 0 60px rgba(0,0,0,.45); transition: transform .26s cubic-bezier(.22, .8, .3, 1), visibility 0s; }
  .es-close { display: inline-flex; }
  .es-backdrop { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(8, 9, 11, .55); opacity: 0; visibility: hidden; transition: opacity .26s ease, visibility 0s linear .26s; }
  .es-shell.es-open .es-backdrop { opacity: 1; visibility: visible; transition: opacity .26s ease, visibility 0s; }
  [data-mode="employee"] .es-shell > .main { padding: 16px 14px calc(78px + env(safe-area-inset-bottom, 0px)); }
  /* The page scrolls INSIDE .main, the same way it does on a laptop, and it needs a height to scroll within.
     The rule above turns the shell into a plain block on a phone, which takes .main out of the flex row and leaves
     it as tall as its own content. html, body and #app are all pinned to the height of the screen, so that content
     had nowhere to overflow to and nothing scrolled: on a phone the Leads list could not be moved past the first
     screenful, and everything below it was unreachable. */
  [data-mode="employee"] .es-shell > .main { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .es-foot { bottom: calc(-10px - env(safe-area-inset-bottom, 0px)); }
  /* the slim bottom bar: four buttons */
  .es-bottom { display: flex; }
  [data-mode="employee"] .es-bottom { overflow: visible; }
  [data-mode="employee"] .es-bottom button { flex: 1 1 0; min-width: 0; font-size: .68rem; font-weight: 600; padding: 9px 4px 7px; min-height: 52px; }
  .es-bottom button.active { color: var(--ink); font-weight: 800; }
  .es-bottom button.active .ic { color: var(--gold-ink); }
  .es-bottom .mv-badge { top: 4px; left: 50%; margin-left: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .es-shell .es-side, .es-backdrop, .es-link, .es-link .ic { transition: none !important; }
}

/* ---------- the top bar on a phone: menu button, logo, bell, avatar ---------- */
@media (max-width: 899.98px) {
  .es-topbar { gap: 8px; }
  .es-topbar .signed-in.view-switcher { display: none; }
  .es-topbar .brand { margin-right: auto; }
  .es-topbar .topbar-spacer { display: none; }
}

/* ---------- page header used by the new pages ---------- */
.es-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 18px; flex-wrap: wrap; margin: 0 0 18px; }
.es-head-text { min-width: 0; flex: 1 1 320px; }
.es-page-head h1 { font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1.05; letter-spacing: -.015em; margin: 0; color: var(--ink); }
.es-sub { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); max-width: 720px; }
.es-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.es-head-actions .btn { display: inline-flex; align-items: center; gap: 7px; }
@media (max-width: 899.98px) {
  .es-page-head h1 { font-size: 30px; }
  .es-head-actions { width: 100%; }
  .es-head-actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
}

/* wide tables scroll inside their own box, never the page */
.es-wrap { overflow-x: auto; margin: 0 -2px; }

/* the Selfie / Add Lead buttons line up with the page, not with the owner's wider gutter */
.es-shell .emp-util { padding-left: 0; padding-right: 0; padding-top: 0; background: transparent; margin-bottom: 10px; }

/* ---------- shared bits of the new pages ---------- */
.es-shell .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.es-shell .ap-pill.bad { background: var(--red-bg); color: var(--red); }
.es-shell .ap-page { max-width: 1240px; }
.es-shell .ap-card { margin-bottom: 18px; }
.es-shell .es-hr-tabs, .es-shell .gv-tabs.es-hr-tabs { padding: 0; margin: 0 0 16px; background: transparent; }
.es-shell .es-head-actions .btn.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

/* ---------- Calls ---------- */
.cl-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.cl-bar-row .seg { flex: 0 1 auto; max-width: 100%; overflow-x: auto; }
.cl-search { flex: 1 1 220px; max-width: 340px; min-width: 0; }
.cl-search input { width: 100%; box-sizing: border-box; }
.cl-table td { vertical-align: top; }
.cl-row { cursor: pointer; }
.cl-row:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.cl-when { white-space: nowrap; }
.cl-sum { min-width: 220px; max-width: 420px; }
.cl-tags { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-top: 6px; }
.cl-q { display: inline-flex; align-items: center; gap: 8px; }
.cl-bar { display: inline-block; width: 54px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.cl-bar > span { display: block; height: 100%; border-radius: 99px; }
.cl-play { white-space: nowrap; }
.cl-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 44px 18px 48px; color: var(--muted); font-size: 13.5px; }
.cl-empty b { color: var(--ink); font-size: 16px; }
.cl-empty span:last-child { max-width: 440px; }
.cl-empty-ic { width: 56px; height: 56px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--gold-wash, var(--surface-2)); color: var(--gold-ink); margin-bottom: 6px; }
.cl-more { margin: 10px 0 0; }
.cl-detail { min-width: 0; }
.cl-detail h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 26px; color: var(--ink); }
.cl-ai { margin: 14px 0; padding: 14px 16px; border: 1px solid var(--gold-line, var(--line)); background: var(--gold-wash, var(--surface-2)); border-radius: 14px; }
.cl-ai p { margin: 6px 0 0; color: var(--ink); line-height: 1.5; }
.cl-ai-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); }
.cl-h3 { font-size: 13.5px; margin: 16px 0 6px; color: var(--ink); }
.cl-transcript { max-height: 240px; overflow: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.55; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); }
.cl-detail-foot { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 18px; }

/* ---------- Attendance & HR ---------- */
.es-hr-num { font-size: 30px !important; }
.es-hr-of { font-size: 13px; font-weight: 600; color: var(--muted); font-family: var(--sans, inherit); }
.es-hr-card { margin-top: 18px; }
.es-hr-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; }
.es-hr-hol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 8px 18px; font-size: 13px; }
.es-hr-hol li { display: flex; gap: 10px; align-items: baseline; }
.es-hr-hol li b { min-width: 92px; color: var(--ink); }
.es-rules h2 { margin: 0 0 4px; font-family: var(--serif); font-weight: 400; font-size: 26px; color: var(--ink); }
.es-rules-list { margin: 14px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.5; color: var(--text); }

/* ---------- My requests ---------- */
.mr-bar { margin: 0 0 16px; }
.mr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.mr-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mr-card.st-waiting { border-left-color: var(--gold); }
.mr-card.st-approved { border-left-color: var(--green); }
.mr-card.st-declined { border-left-color: var(--red); }
.mr-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mr-kind { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mr-title { margin: 2px 0 0; font-size: 15px; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.mr-details, .mr-when, .mr-decided { margin: 0; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.mr-details { color: var(--text); }
.mr-decided b { color: var(--ink); }
.mr-note { margin: 4px 0 0; padding: 8px 12px; border-left: 3px solid var(--gold); background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.mr-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.mr-actions:empty { display: none; }
.mr-foot { margin: 14px 0 0; }
.cl-search.field { margin: 0; display: block; }
.es-hr-tiles { grid-template-columns: repeat(auto-fit, minmax(min(172px, 100%), 1fr)); }
@media (max-width: 760px) {
  .cl-table.stack td.cl-sum { display: block; text-align: left; max-width: none; min-width: 0; }
  .cl-table.stack td.cl-sum::before { display: block; margin-bottom: 4px; }
  .cl-table.stack td.cl-sum > div { text-align: left; }
  .cl-table.stack td.ap-act { justify-content: space-between; }
  .cl-table.stack .cl-tags { justify-content: flex-start; }
  .es-hr .ap-table.stack td .ap-sub { text-align: right; }
}
@media (max-width: 899.98px) {
  .es-head-actions .btn { min-height: 42px; }
}

/* Call tracking report (calls-ui.js) */
.ct-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 18px; }
.ct-tile { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.ct-k { font-size: 12px; color: var(--ink-soft); }
.ct-v { font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.2; margin-top: 2px; }
.ct-s { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.ct-dates { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ct-dates input { box-sizing: border-box; }
.ct-lead-calls .cl-tags { margin-top: 2px; }
.ct-lead-row { padding: 8px 0; border-top: 1px solid var(--line); }
.ct-lead-row:first-child { border-top: 0; }
