/*
 * ILP shared chrome - the one header every application wears.
 *
 * Served from /shared/ so both apps load the same file: change a colour here
 * and ILP EDGE and ILP Apps change together. That is the whole point of it
 * living outside either application.
 *
 * The palette is the one the AP dashboard already uses, promoted to variables
 * so nothing has to guess at the orange again.
 */

:root {
  --ilp-brand:       #f16100;
  --ilp-brand-dark:  #c44e00;
  --ilp-brand-ink:   #ffffff;

  --ilp-ink:         #22252a;
  --ilp-muted:       #6b7280;
  --ilp-surface:     #ffffff;
  --ilp-bg:          #f5f5f5;
  --ilp-line:        #dfe1e5;
  --ilp-dark:        #2f3237;
  --ilp-dark-hover:  #414650;

  --ilp-ok:          #3f9c46;
  --ilp-warn:        #e0952b;
  --ilp-late:        #cc3d33;

  --ilp-topbar-h:    52px;
  --ilp-radius:      4px;
  --ilp-shadow:      0 1px 3px rgba(0,0,0,.16);
}

/* ===================================================================
   Top bar
   =================================================================== */

.ilp-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--ilp-topbar-h);
  padding: 0 12px;
  background: var(--ilp-brand);
  color: var(--ilp-brand-ink);
  box-shadow: var(--ilp-shadow);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* The three-bar button. A real <button> so it is reachable by keyboard and
   announced to a screen reader without any extra markup. */
.ilp-burger {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 9px 8px;
  background: transparent;
  border: 0;
  border-radius: var(--ilp-radius);
  cursor: pointer;
}
.ilp-burger:hover,
.ilp-burger:focus { background: rgba(0,0,0,.14); outline: none; }
.ilp-burger span {
  display: block;
  height: 2px;
  margin: 4px 0;
  background: var(--ilp-brand-ink);
  border-radius: 2px;
  transition: transform .18s ease, opacity .18s ease;
}
/* Bars fold into an X while the drawer is open. */
.ilp-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.ilp-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.ilp-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.ilp-appname {
  flex: 0 0 auto;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

/* The launcher chip for the *other* application. Deliberately looks like a
   button rather than a nav item: it leaves this tab behind. */
.ilp-applaunch {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  color: var(--ilp-brand-ink);
  background: rgba(0,0,0,.16);
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease;
}
.ilp-applaunch:hover,
.ilp-applaunch:focus {
  background: rgba(0,0,0,.3);
  color: var(--ilp-brand-ink);
  text-decoration: none;
}
.ilp-applaunch svg { width: 13px; height: 13px; flex: 0 0 auto; }

.ilp-topbar-spacer { flex: 1 1 auto; }

.ilp-who {
  flex: 0 0 auto;
  font-size: .85rem;
  text-align: right;
  line-height: 1.25;
  white-space: nowrap;
}
.ilp-who b { font-weight: 600; }
.ilp-who span { display: block; font-size: .74rem; opacity: .85; }

/* On a phone the identity block is the first thing worth losing. */
@media (max-width: 620px) {
  .ilp-who      { display: none; }
  .ilp-appname  { font-size: 1rem; }
  .ilp-applaunch span.ilp-applaunch-label { display: none; }
}

/* ===================================================================
   Drawer
   =================================================================== */

.ilp-scrim {
  position: fixed;
  inset: 0;
  z-index: 1035;
  background: rgba(0,0,0,.38);
  opacity: 0;
  transition: opacity .2s ease;
}
.ilp-scrim.is-open { opacity: 1; }

.ilp-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  width: 272px;
  max-width: 84vw;
  background: var(--ilp-surface);
  box-shadow: 2px 0 12px rgba(0,0,0,.24);
  transform: translateX(-100%);
  transition: transform .2s ease;
  overflow-y: auto;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.ilp-drawer.is-open { transform: translateX(0); }

.ilp-drawer-head {
  display: flex;
  align-items: center;
  height: var(--ilp-topbar-h);
  padding: 0 16px;
  background: var(--ilp-brand);
  color: var(--ilp-brand-ink);
  font-size: 1.05rem;
  font-weight: 600;
}

.ilp-drawer-group { padding: 10px 0 6px; border-bottom: 1px solid var(--ilp-line); }
.ilp-drawer-group:last-child { border-bottom: 0; }
.ilp-drawer-group h3 {
  margin: 0 0 4px;
  padding: 0 16px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ilp-muted);
}

.ilp-drawer a,
.ilp-drawer button.ilp-drawer-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 16px;
  background: none;
  border: 0;
  color: var(--ilp-ink);
  font-size: .92rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.ilp-drawer a:hover,
.ilp-drawer a:focus,
.ilp-drawer button.ilp-drawer-item:hover,
.ilp-drawer button.ilp-drawer-item:focus {
  background: #f0f1f3;
  color: var(--ilp-ink);
  text-decoration: none;
  outline: none;
}
.ilp-drawer .is-active {
  background: #fdf0e6;
  color: var(--ilp-brand-dark);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--ilp-brand);
}
/* ---- Drop-down sections (AP, AR, Payroll, ...) --------------------------
   The heading is a button rather than a link because it opens nothing; the
   chevron is the only thing that says so, so it turns as the section opens. */
.ilp-submenu-toggle .ilp-submenu-label { flex: 1 1 auto; }
.ilp-submenu-toggle .ilp-chevron {
  flex: 0 0 auto;
  transition: transform .16s ease;
}
.ilp-submenu-toggle[aria-expanded="true"] { font-weight: 600; }
.ilp-submenu-toggle[aria-expanded="true"] .ilp-chevron { transform: rotate(180deg); }

/* Indented and on a tint, so a process reads as belonging to the section
   above it rather than as another top-level entry. */
.ilp-submenu { background: #fafbfc; box-shadow: inset 0 1px 0 var(--ilp-line), inset 0 -1px 0 var(--ilp-line); }
.ilp-drawer .ilp-subitem {
  padding-left: 34px;
  font-size: .88rem;
}
.ilp-drawer .ilp-submenu-empty {
  display: block;
  padding: 9px 16px 9px 34px;
  color: var(--ilp-muted);
  font-style: italic;
  cursor: default;
}

.ilp-drawer .is-current {
  color: var(--ilp-muted);
  cursor: default;
}
.ilp-drawer .is-current:hover { background: none; }
.ilp-drawer svg { width: 13px; height: 13px; flex: 0 0 auto; opacity: .6; }

.ilp-drawer .ilp-signout { color: var(--ilp-late); font-weight: 600; }
.ilp-drawer .ilp-signout:hover { background: #fdecea; color: var(--ilp-late); }

.ilp-drawer-foot {
  padding: 12px 16px 18px;
  color: var(--ilp-muted);
  font-size: .74rem;
  line-height: 1.5;
}

/*
 * ILP EDGE only: its buttons are wired by id in main.js, and the legacy code
 * reads $('#logOutButton').is(':visible') as a stand-in for "logged in". So the
 * original row is moved off-screen rather than hidden - display:none would make
 * :visible false and change behaviour. The drawer clicks these buttons for us.
 */
.ilp-legacy-controls {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media print {
  .ilp-topbar, .ilp-drawer, .ilp-scrim { display: none !important; }
}
