/* =====================================================================
 * /rentals/kit-tech-portal — staff portal styles.
 * The portal renders inside the standard rentals chrome — the fixed
 * rentals .nav is visible at top, MegaFooter (isRentals) sits at the
 * bottom. The portal adds a sticky secondary "PortalBar" right below
 * the rentals nav, styled to match the rentals menu pill.
 * Tokens come from colors_and_type.css.
 * ===================================================================== */

.kit-portal {
  background: var(--vf-bg);
  color: var(--vf-ink);
  min-height: 100vh;
  /* Top padding clears the fixed rentals nav (~72px tall) so the
     login card / boot spinner appear immediately below it. The
     dashboard variant adds more padding below to also clear the
     fixed portal bar — see .kit-portal-dashboard. */
  padding-top: 72px;
  font-feature-settings: "ss01";
}

/* Dashboard adds another ~64px of top padding so the first tab-content
   block lands below the fixed portal bar (which sits at top: 72px and
   is ~64px tall). */
.kit-portal-dashboard {
  padding-top: 136px;
}

/* Boot spinner shown while we wait for /api/portal/session to respond.
   Sits inside the rentals chrome rather than full-viewport, so the
   page still has the rentals nav + footer for context. */
.kp-boot-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.kp-boot-spin {
  width: 32px; height: 32px;
  border-radius: 999px;
  border: 2px solid var(--vf-line);
  border-top-color: var(--vf-blue);
  animation: kpSpin 720ms linear infinite;
}
@keyframes kpSpin { to { transform: rotate(360deg); } }

/* =====================================================================
 * Login screen — sits in the page flow between the rentals nav and
 * the MegaFooter rather than covering the full viewport.
 * ===================================================================== */
.kp-login-shell {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(9, 94, 223, 0.06), transparent 60%),
    transparent;
}
.kp-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--vf-surface);
  border: 1px solid var(--vf-line);
  border-radius: 18px;
  padding: 36px 32px 28px;
  box-shadow: 0 1px 2px rgba(10, 15, 26, 0.04), 0 12px 36px rgba(10, 15, 26, 0.06);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.kp-login-logo {
  width: 132px;
  height: auto;
  margin: 0 auto 18px;
  display: block;
}
.kp-login-card h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  text-align: center;
}
.kp-login-sub {
  font-size: 14.5px;
  color: var(--vf-ink-3);
  line-height: 1.55;
  margin: 0 0 22px;
  text-align: center;
}
.kp-login-fine {
  font-size: 12.5px;
  color: var(--vf-ink-4);
  line-height: 1.55;
  margin: 18px 0 0;
  text-align: center;
}
.kp-login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 16px;
}
.kp-login-field span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--vf-ink-3);
}
.kp-login-field input {
  font: inherit;
  font-size: 16px;  /* 16px prevents iOS Safari zoom on focus */
  color: var(--vf-ink);
  background: var(--vf-bg);
  border: 1px solid var(--vf-line);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.kp-login-field input:focus {
  border-color: var(--vf-blue);
  box-shadow: 0 0 0 4px rgba(9, 94, 223, 0.12);
  background: var(--vf-surface);
}
.kp-login-error {
  font-size: 13px;
  color: #B0331A;
  background: #FDECE8;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 12px;
}
.kp-btn-primary {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  background: var(--vf-blue);
  border-radius: 999px;
  padding: 13px 22px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.kp-btn-primary:hover:not(:disabled) { background: var(--vf-blue-600); }
.kp-btn-primary:active:not(:disabled) { transform: translateY(1px); }
.kp-btn-primary:disabled { opacity: 0.55; cursor: progress; }

.kp-textlink {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  color: var(--vf-blue);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

/* =====================================================================
 * PortalBar — fixed secondary nav that sits right below the fixed
 * rentals .nav. The tab pill mirrors the rentals menu pill styling
 * (chip-shaped links inside a rounded container) so the portal feels
 * like a natural extension of the rentals chrome.
 *
 * Fixed (not sticky) because body.is-rentals-page sets overflow-y: auto,
 * which breaks position: sticky for descendant elements. Fixed has the
 * same visual behaviour and works regardless of the body overflow.
 * ===================================================================== */
.kp-portalbar {
  position: fixed;
  top: 72px;            /* clears the fixed rentals .nav above */
  left: 0;
  right: 0;
  z-index: 40;          /* below the rentals nav (z:80), above content */
  background:
    linear-gradient(180deg, rgba(247,248,250,0.86) 0%, rgba(247,248,250,0.78) 100%);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid rgba(10,15,26,0.08);
  box-shadow: 0 1px 0 rgba(255,255,255,0.85), 0 4px 12px rgba(10,15,26,0.04);
}
.kp-portalbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.kp-portalbar-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--vf-ink-4);
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Mirror of .nav .menu / .nav.is-light .menu styling — pill container
   with chip-shaped buttons inside. Active chip gets the white-on-pill
   treatment used across the rentals/films light pages. */
.kp-portaltabs {
  display: flex;
  gap: 4px;
  background: rgba(10,15,26,0.06);
  border: 1px solid rgba(10,15,26,0.10);
  border-radius: 999px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.kp-portaltabs::-webkit-scrollbar { display: none; }
.kp-portaltab {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: rgba(10,15,26,0.92);
  cursor: pointer;
  white-space: nowrap;
  transition: all 200ms;
}
.kp-portaltab:hover { color: var(--vf-ink); }
.kp-portaltab.is-active {
  background: white;
  color: var(--vf-ink);
  box-shadow: 0 1px 3px rgba(10,15,26,0.08);
}

/* User chip — sits at the right end of the portal bar, balances the
   "Kit-tech portal" label on the left. */
.kp-userchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--vf-ink-3);
  flex: 0 0 auto;
  white-space: nowrap;
}
.kp-userchip-name {
  font-weight: 600;
  color: var(--vf-ink);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kp-userchip-divider {
  color: var(--vf-line-strong);
}
.kp-userchip-signout {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--vf-blue);
  cursor: pointer;
  padding: 4px 0;
}
.kp-userchip-signout:hover { text-decoration: underline; }

/* =====================================================================
 * Content area
 * ===================================================================== */
.kp-content {
  padding: 32px 24px 64px;
}
.kp-content-inner {
  max-width: 1080px;
  margin: 0 auto;
}
.kp-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.kp-section-head h2 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.kp-section-head p {
  font-size: 15px;
  color: var(--vf-ink-3);
  margin: 0;
  line-height: 1.55;
  max-width: 60ch;
}
.kp-section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* =====================================================================
 * Bin location card
 * ===================================================================== */
.kp-bin-card {
  background: linear-gradient(135deg, #0A1A38, #095EDF);
  color: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(9, 94, 223, 0.18);
}
.kp-bin-card::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), transparent 60%);
  pointer-events: none;
}
.kp-bin-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}
.kp-bin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 320px;
}
.kp-bin-key {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 4px;
}
.kp-bin-val {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* =====================================================================
 * Phase placeholder
 * ===================================================================== */
.kp-placeholder {
  background: var(--vf-surface);
  border: 1px dashed var(--vf-line-strong);
  border-radius: 14px;
  padding: 28px 28px 30px;
}
.kp-placeholder-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--vf-blue);
  background: var(--vf-blue-50);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.kp-placeholder h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px;
}
.kp-placeholder p {
  font-size: 14.5px;
  color: var(--vf-ink-3);
  line-height: 1.55;
  margin: 0;
  max-width: 60ch;
}

/* =====================================================================
 * SOP iframe wrapper
 * ===================================================================== */
.kp-sop-frame {
  position: relative;
  background: var(--vf-surface);
  border: 1px solid var(--vf-line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 70vh;
}
.kp-sop-frame iframe {
  display: block;
  border: 0;
  width: 100%;
  height: 78vh;
  background: var(--vf-surface);
}

/* =====================================================================
 * Rates table + billing cards
 * ===================================================================== */
.kp-rates-card {
  background: var(--vf-surface);
  border: 1px solid var(--vf-line);
  border-radius: 14px;
  overflow: hidden;
}
.kp-rates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.kp-rates-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--vf-ink-4);
  padding: 14px 18px;
  background: var(--vf-bg);
  border-bottom: 1px solid var(--vf-line);
}
.kp-rates-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--vf-line);
  color: var(--vf-ink-2);
}
.kp-rates-table tbody tr:last-child td { border-bottom: 0; }
.kp-rates-pay { text-align: right; }
.kp-mult {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  color: var(--vf-ink-3);
}

.kp-bill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.kp-bill-card {
  background: var(--vf-surface);
  border: 1px solid var(--vf-line);
  border-radius: 14px;
  padding: 22px 24px;
}
.kp-bill-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
}
.kp-bill-card p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--vf-ink-2);
  margin: 0 0 12px;
}
.kp-bill-card p:last-child { margin-bottom: 0; }
.kp-bill-card a {
  color: var(--vf-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.kp-bill-card address {
  font-style: normal;
  font-size: 14px;
  line-height: 1.55;
  color: var(--vf-ink-3);
}

/* =====================================================================
 * Mobile (≤760px)
 * ===================================================================== */
@media (max-width: 760px) {
  /* Portal bar: drop the "Kit-tech portal" label so the tabs + user
     chip fit on one row; tabs scroll horizontally if they don't. */
  .kp-portalbar-inner {
    padding: 10px 16px;
    gap: 10px;
  }
  .kp-portalbar-label { display: none; }
  .kp-portaltab { padding: 7px 12px; font-size: 12.5px; }
  .kp-userchip { font-size: 12px; }
  .kp-userchip-name { max-width: 100px; }

  .kp-content { padding: 22px 16px 56px; }
  .kp-section-head h2 { font-size: 22px; }
  .kp-bill-grid { grid-template-columns: 1fr; }
  .kp-rates-table thead th,
  .kp-rates-table tbody td { padding: 12px 14px; font-size: 13.5px; }
  /* Compact the rate table on narrow screens — drop the "Default time"
     and "Length" columns so the essentials (type / multiplier / pay)
     stay legible. */
  .kp-rates-table thead th:nth-child(2),
  .kp-rates-table thead th:nth-child(3),
  .kp-rates-table tbody td:nth-child(2),
  .kp-rates-table tbody td:nth-child(3) { display: none; }
  .kp-sop-frame iframe { height: 70vh; }
  .kp-login-card { padding: 28px 22px 22px; border-radius: 14px; }
}

/* =====================================================================
 * Tasks tab — quick-log buttons, task list, row layout
 * ===================================================================== */
.kp-quicklog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.kp-quicklog-btn {
  appearance: none;
  border: 1px solid var(--vf-line);
  background: var(--vf-surface);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--vf-ink);
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.kp-quicklog-btn:hover {
  border-color: var(--vf-blue);
  background: var(--vf-blue-50);
}
.kp-quicklog-btn:active { transform: translateY(1px); }
.kp-quicklog-staff {
  border-style: dashed;
}
.kp-quicklog-icon {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--vf-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}
.kp-quicklog-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.kp-quicklog-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--vf-ink);
}
.kp-quicklog-text em {
  font-style: normal;
  font-size: 12.5px;
  color: var(--vf-ink-3);
}

.kp-error-banner {
  background: #FDECE8;
  color: #B0331A;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
}

.kp-task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kp-empty {
  background: var(--vf-surface);
  border: 1px dashed var(--vf-line-strong);
  border-radius: 14px;
  padding: 28px 24px;
  text-align: center;
  color: var(--vf-ink-3);
  font-size: 14.5px;
}
.kp-task-row {
  background: var(--vf-surface);
  border: 1px solid var(--vf-line);
  border-radius: 14px;
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kp-task-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.kp-prio {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--vf-line);
  color: var(--vf-ink-2);
}
.kp-prio-immediate { background: #FDECE8; color: #B0331A; }
.kp-prio-high      { background: #FFE3CB; color: #8A4500; }
.kp-prio-medium    { background: #FFF4D1; color: #7A5A00; }
.kp-prio-low       { background: var(--vf-blue-50); color: var(--vf-blue-700); }

.kp-status {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--vf-bg-tint);
  color: var(--vf-ink-3);
}
.kp-status-in-progress { background: var(--vf-blue-50); color: var(--vf-blue); }
.kp-status-for-review  { background: #F0E8FB; color: #5B2F9E; }

.kp-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--vf-bg-tint);
  color: var(--vf-ink-3);
}

.kp-task-name {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--vf-ink);
  line-height: 1.35;
}
.kp-task-brief {
  font-size: 14px;
  color: var(--vf-ink-2);
  margin: 0;
  line-height: 1.5;
}
.kp-task-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.kp-task-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--vf-ink-3);
  flex-wrap: wrap;
}
.kp-task-date {
  font-variant-numeric: tabular-nums;
}
.kp-task-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--vf-blue);
  text-decoration: none;
  font-weight: 500;
}
.kp-task-link:hover { text-decoration: underline; }
.kp-task-assignee {
  width: 22px; height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--vf-blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kp-task-assignee img { width: 100%; height: 100%; object-fit: cover; }
.kp-task-assignee-initials {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.kp-btn-small {
  padding: 8px 14px;
  font-size: 13px;
}

/* =====================================================================
 * Task form modal (quick-log + add-task)
 * ===================================================================== */
.kp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 8, 12, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.kp-modal {
  background: var(--vf-surface);
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  padding: 28px 28px 22px;
  position: relative;
  box-shadow: 0 24px 64px rgba(10, 15, 26, 0.18);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.kp-modal h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.kp-modal-sub {
  font-size: 14px;
  color: var(--vf-ink-3);
  line-height: 1.5;
  margin: -4px 0 4px;
}
.kp-modal-close {
  appearance: none;
  border: 0;
  background: var(--vf-bg-tint);
  color: var(--vf-ink-3);
  width: 30px; height: 30px;
  border-radius: 999px;
  position: absolute;
  top: 16px; right: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}
.kp-modal-close:hover { background: var(--vf-line); color: var(--vf-ink); }

.kp-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kp-form-field > span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vf-ink-3);
}
.kp-form-field input,
.kp-form-field textarea,
.kp-form-field select {
  font: inherit;
  font-size: 15px;
  color: var(--vf-ink);
  background: var(--vf-bg);
  border: 1px solid var(--vf-line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
  resize: vertical;
}
.kp-form-field input:focus,
.kp-form-field textarea:focus,
.kp-form-field select:focus {
  border-color: var(--vf-blue);
  box-shadow: 0 0 0 4px rgba(9, 94, 223, 0.12);
  background: var(--vf-surface);
}
.kp-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.kp-form-error {
  font-size: 13px;
  color: #B0331A;
  background: #FDECE8;
  border-radius: 8px;
  padding: 8px 12px;
}
.kp-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* Tasks tab — mobile */
@media (max-width: 760px) {
  .kp-quicklog { grid-template-columns: 1fr; }
  .kp-modal { padding: 22px 20px 18px; border-radius: 14px; }
  .kp-form-row { grid-template-columns: 1fr; }
  .kp-task-foot { align-items: flex-start; }
}

/* =====================================================================
 * When the portal is mounted, keep the standard rentals nav visible
 * (so users can navigate back to the public site) but hide the
 * customer-facing floating cart/search bar — there's no shopping in
 * the portal and the affordance would be confusing.
 * ===================================================================== */
body.is-rentals-portal .floating-rentals-bar,
body.is-rentals-portal .booqable-floating-cart {
  display: none !important;
}
