/*
  IWS brand overrides for GOV.UK Frontend
  static/iws/iws.css
  Load this AFTER govuk-frontend.min.css in base_iws.html
*/

/* ── Colour tokens ─────────────────────────────────────────── */
:root {
  --iws-primary:       #3692aa;
  --iws-primary-dark:  #004258;   /* dark teal — header */
  --iws-primary-mid:   #00698b;   /* mid teal — buttons/links */
  --iws-primary-light: #e5f0f3;
  --iws-lightest:      #F5FAFC;
  --iws-accent:        #ffce1f;   /* GOV.UK focus yellow — do not change */
  --iws-sage:          #589664;
  --iws-sage-light:    #e0ede2;
  --iws-stone:         #c9c2bf;
  --iws-stone-light:   #f4f3f2;
  --iws-amber:         #fdd48c;
  --iws-amber-dark:    #dd8f04;
  --iws-amber-confirm: #fff5d2;
  --text:              #0b0c0c;
  --text-sec:          #505a5f;
  --text-ter:          #6f777b;
}

/* ── Page ──────────────────────────────────────────────────── */
body {
  background: #ffffff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;        /* GOV.UK body text size */
  line-height: 1.6;
  color: var(--text);
}

/* ── Header + nav — single unified dark teal band ─────────── */
.iws-header {
  background: var(--iws-primary-dark);
  padding: 0;
  border-bottom: none;    /* no border — nav continues the band */
}
.iws-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 30px;
  max-width: 1020px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.iws-header__service-name {
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.iws-header__service-name:hover { color: rgba(255,255,255,.85); }
.iws-header__service-name-short { display: none; }
.iws-header__logo {
  height: 20px;
  width: auto;
  display: block;
}

/* BETA badge — subtle, not a distraction */
.iws-header__beta {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,.55);
  letter-spacing: .04em;
  border: 1px solid rgba(255,255,255,.25);
  padding: 1px 6px;
  border-radius: 3px;
}
.iws-header__user {
  font-size: 14px;
  color: rgba(255,255,255,.8);
}
.iws-header__user a {
  color: rgba(255,255,255,.8);
  text-decoration: underline;
}
.iws-header__user a:hover { color: #ffffff; }
.iws-header__signout-btn {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  font: inherit; font-size: 14px; color: rgba(255,255,255,.8);
  text-decoration: underline;
}
.iws-header__signout-btn:hover { color: #ffffff; }

/* ── Service navigation — same dark teal band ──────────────── */
.iws-service-nav {
  background: var(--iws-primary-mid);
  border-bottom: 4px solid var(--iws-primary-dark);
}
.iws-service-nav__inner {
  display: flex;
  align-items: center;
  padding: 0 30px;
  max-width: 1020px;
  margin: 0 auto;
}
.iws-service-nav__list {
  display: flex;
  list-style: none;
  gap: 0;
  margin: 0;
  padding: 0;
}
.iws-service-nav__item a {
  display: block;
  padding: 13px 18px;
  font-size: 15px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color .1s;
}
.iws-service-nav__item a:hover {
  color: #ffffff;
  border-bottom-color: rgba(255,255,255,.5);
}
.iws-service-nav__item--active a {
  color: #ffffff;
  font-weight: 500;
  border-bottom-color: var(--iws-accent);  /* amber underline */
}
.iws-service-nav__item--inactive a {
  color: rgba(255,255,255,.35);
  cursor: default;
  pointer-events: none;
}

/* ── Phase banner — removed (BETA moved to header) ─────────── */
.iws-phase-banner { display: none; }

/* ── Main content container ────────────────────────────────── */
.iws-container {
  max-width: 1020px;
  margin: 0 auto;
  padding: 1.75rem 30px 3rem;
}
.iws-container--wide {
  max-width: 1400px;
}

/* ── Page heading — GOV.UK scale ───────────────────────────── */
.iws-page-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.iws-page-heading h1 {
  font-size: 36px;          /* matches GOV.UK "Popular on GOV.UK" weight */
  font-weight: 700;         /* bold — GOV.UK headings are always bold */
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.1;
  letter-spacing: -.5px;
}
.iws-page-heading__meta {
  font-size: 16px;
  color: var(--text-sec);
}
.iws-page-heading__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Search — gem-c-search pattern, iws- prefixed ─────────── */
.iws-search { width: 100%; }
.iws-search__input-wrapper { display: flex; }
.iws-search-break {
  border-color: #00698b;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}
.iws-search__input {
  flex: 1;
  font-size: 17px;
  padding: 10px 14px;
  border: 2px solid var(--text);
  border-right: none;
  border-radius: 0;
  font-family: inherit;
  color: var(--text);
  background: #ffffff;
  min-width: 0;
}
.iws-search__input:focus {
  outline: 3px solid var(--iws-accent);
  outline-offset: 0;
  z-index: 1;
  position: relative;
}
.iws-search__button {
  background: #00698b;
  border: 2px solid #00698b;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: #ffffff;
  flex-shrink: 0;
}
.iws-search__button:hover { background: #004f69; border-color: #004f69; }
.iws-search__button:focus { outline: 3px solid var(--iws-accent); outline-offset: 0; }

/* ── Filter bar — dropdowns only (no search input here) ────── */
.iws-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.iws-filter-bar select {
  font-size: 15px;
  padding: 7px 10px;
  border: 2px solid var(--iws-stone);
  border-radius: 3px;
  font-family: inherit;
  color: var(--text);
  background: #ffffff;
}
.iws-filter-bar select:focus {
  outline: 3px solid var(--iws-accent);
  outline-offset: 0;
}
.iws-filter-divider {
  width: 1px;
  height: 24px;
  background: var(--iws-stone);
}
.iws-filter-clear {
  font-size: 15px;
  color: var(--iws-primary-mid);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  margin-left: auto;
}
.iws-result-count {
  font-size: 14px;
  color: var(--text-sec);
}

/* ── Buttons ───────────────────────────────────────────────── */
.iws-btn {
  font-size: 15px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  border: 2px solid transparent;
}
.iws-btn--primary {
  background: var(--iws-primary-mid);
  color: #ffffff;
  border-color: var(--iws-primary-mid);
}
.iws-btn--primary:hover {
  background: var(--iws-primary-dark);
  border-color: var(--iws-primary-dark);
  color: #ffffff;
}
.iws-btn--secondary {
  background: #ffffff;
  color: var(--text);
  border-color: var(--iws-stone);
}
.iws-btn--secondary:hover { background: var(--iws-stone-light); }
.iws-btn:focus {
  outline: 3px solid var(--iws-accent);
  outline-offset: 0;
}

/* ── Overflow menu (⋯ details/summary) ────────────────────── */
.iws-overflow-menu { position: relative; display: inline-block; }
.iws-overflow-menu summary { list-style: none; }
.iws-overflow-menu summary::-webkit-details-marker { display: none; }
.iws-overflow-menu__toggle {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 7px 10px;
  border: 2px solid var(--iws-stone);
  border-radius: 3px;
  cursor: pointer;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  line-height: 1;
}
.iws-overflow-menu__toggle:hover { background: var(--iws-stone-light); }
.iws-overflow-menu__toggle:focus { outline: 3px solid var(--iws-accent); outline-offset: 0; }
.iws-overflow-menu__dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #ffffff;
  border: 2px solid var(--iws-primary-mid);
  border-radius: 3px;
  min-width: 150px;
  z-index: 200;
  padding: 4px 0;
}
.iws-overflow-menu__item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 9px 16px;
  font-size: 15px;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
}
.iws-overflow-menu__item:hover { background: var(--iws-primary-light); color: var(--iws-primary-dark); }
.iws-overflow-menu__sub-label {
  display: block;
  padding: 6px 16px 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-sec);
  border-top: 1px solid var(--iws-stone-light);
  margin-top: 2px;
}
.iws-overflow-menu__link {
  display: block;
  padding: 7px 16px 7px 24px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
}
.iws-overflow-menu__link:hover { background: var(--iws-primary-light); color: var(--iws-primary-dark); }
.iws-overflow-menu__link--active { font-weight: 600; color: var(--iws-primary-dark); }
.iws-overflow-menu__link--active::before { content: "✓ "; }

/* ── Checkbox class/status filter dropdown ─────────────────── */
.iws-class-filter { position: relative; }
.iws-class-filter__btn {
  font-size: 15px;
  padding: 7px 10px;
  border: 2px solid var(--iws-stone);
  border-radius: 3px;
  font-family: inherit;
  color: var(--text);
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.iws-class-filter__btn.is-active {
  border-color: var(--iws-primary-mid);
  color: var(--iws-primary-dark);
  font-weight: 500;
}
.iws-class-filter__btn:focus { outline: 3px solid var(--iws-accent); outline-offset: 0; }
.iws-class-filter__dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  background: #ffffff;
  border: 2px solid var(--iws-primary-mid);
  border-radius: 3px;
  min-width: 210px;
  padding: 6px 0;
}
.iws-class-filter__dropdown.is-open { display: block; }
.iws-class-filter__group-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 8px 14px 4px;
  border-top: 1px solid var(--iws-stone-light);
}
.iws-class-filter__group-label:first-child { border-top: none; }
.iws-class-filter__all {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--iws-primary-dark);
  cursor: pointer;
}
.iws-class-filter__all:hover { background: var(--iws-primary-light); }
.iws-class-filter__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 24px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.iws-class-filter__item:hover { background: var(--iws-primary-light); }
.iws-class-filter__item input[type="checkbox"],
.iws-class-filter__all input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--iws-primary-mid);
  cursor: pointer;
  flex-shrink: 0;
}
.iws-class-filter__footer {
  padding: 8px 14px 4px;
  border-top: 1px solid var(--iws-stone-light);
  display: flex;
  gap: 8px;
}

/* ── Bulk action bar ───────────────────────────────────────── */
.iws-bulk-bar {
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--iws-primary-light);
  border: 1px solid var(--iws-primary-mid);
  border-radius: 3px;
  margin-bottom: 10px;
}
.iws-bulk-bar.show { display: flex; }
.iws-bulk-bar__count {
  font-size: 14px;
  font-weight: 500;
  color: var(--iws-primary-dark);
}
.iws-bulk-bar select {
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid var(--iws-primary-mid);
  border-radius: 3px;
  font-family: inherit;
  background: #ffffff;
  color: var(--iws-primary-dark);
}
.iws-bulk-bar select:focus { outline: 3px solid var(--iws-accent); outline-offset: 0; }

/* ── Confirm bar ───────────────────────────────────────────── */
.iws-confirm-bar {
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--iws-amber-confirm);
  border: 1px solid var(--iws-amber-dark);
  border-radius: 3px;
  margin-bottom: 10px;
  font-size: 15px;
  color: #412402;
}
.iws-confirm-bar.show { display: flex; }

/* ── Table layout ──────────────────────────────────────────── */
.iws-table-layout {
  display: flex;
  gap: 0;
  align-items: flex-start;
}
.iws-table-wrap { flex: 1; min-width: 0; overflow-x: auto; }

/* ── Table ─────────────────────────────────────────────────── */
.iws-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.iws-table thead th {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sec);
  text-align: left;
  padding: 10px 16px 10px 0;
  border-bottom: 2px solid var(--text);
  white-space: nowrap;
}
.iws-table thead th.iws-table__cb  { width: 44px; padding-right: 8px; }
.iws-table thead th.iws-table__actions { width: 50px; }
.iws-table tbody tr { border-bottom: 1px solid var(--iws-stone); }
.iws-table tbody tr:hover td { background: var(--iws-primary-light); cursor: pointer; }
.iws-table tbody tr.is-selected td { background: var(--iws-primary-light); }
.iws-table tbody tr.is-active td   { background: var(--iws-sage-light); }
.iws-table td {
  padding: 12px 16px 12px 0;
  font-size: 15px;
  vertical-align: middle;
  color: var(--text);
}
.iws-table td.iws-table__cb { width: 44px; padding-right: 8px; }
.iws-table input[type="checkbox"] {
  width: 24px; height: 24px;
  cursor: pointer;
  accent-color: var(--iws-primary-mid);
  vertical-align: middle;
}
.iws-table__name-link {
  color: var(--iws-primary-mid);
  text-decoration: underline;
  cursor: pointer;
}
.iws-table__name-link:hover { color: var(--iws-primary-dark); }
.iws-table__edit-link {
  font-size: 13px;
  color: var(--iws-primary-mid);
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}
.iws-table__edit-link:hover { color: var(--iws-primary-dark); }

/* Parent 1 name column — cap width + truncate with ellipsis (col 6) */
.iws-table th:nth-child(6),
.iws-table td:nth-child(6) {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sortable headers */
.iws-table th.sortable { cursor: pointer; user-select: none; }
.iws-table th.sortable:hover { color: var(--text); }
.sort-indicator { display: inline-block; margin-left: 4px; font-size: 11px; color: var(--text-ter); }
.iws-table th.sort-asc .sort-indicator,
.iws-table th.sort-desc .sort-indicator { color: var(--iws-primary-dark); }

/* ── Tags ──────────────────────────────────────────────────── */
.govuk-tag { display: inline-block; max-width: none; white-space: nowrap; }

.iws-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: .02em;
}
.iws-tag--active      { background: var(--iws-sage-light); color: #27500a; }
.iws-tag--withdrawn   { background: var(--iws-amber);      color: #412402; }
.iws-tag--leaving     { background: #fff7bf;               color: #594d00; }
.iws-tag--projected   { background: #f3f2f1;               color: #505a5f; }
.iws-tag--incoming    { background: #d2e2f1;               color: #003a69; }
.iws-tag--graduating  { background: #f3f2f1;               color: #505a5f; }
.iws-tag--review      { background: #fff7bf;               color: #594d00; }
.iws-proj-cls-select{font-size:13px;padding:2px 4px;height:auto;border:2px solid #1d70b8;border-radius:2px;font-family:inherit;}

/* ── Detail panel ──────────────────────────────────────────── */
.iws-panel {
  width: 380px;
  flex-shrink: 0;
  border-left: 3px solid var(--iws-primary-mid);
  background: #ffffff;
  display: none;
  flex-direction: column;
  min-height: 500px;
}
.iws-panel.is-open { display: flex; }
.iws-panel__header {
  padding: 16px 18px;
  border-bottom: 2px solid var(--iws-primary-mid);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--iws-primary-light);
}
.iws-panel__title {
  font-size: 16px;
  font-weight: 500;
  color: var(--iws-primary-dark);
  line-height: 1.25;
}
.iws-panel__close {
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--iws-primary-dark);
  background: none;
  border: 1px solid var(--iws-primary-mid);
  border-radius: 3px;
  padding: 4px 10px;
  font-family: inherit;
  line-height: 1.4;
}
.iws-panel__close:hover { background: var(--iws-primary-mid); color: #ffffff; }
.iws-panel__body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.iws-panel__footer {
  padding: 14px 18px;
  border-top: 2px solid var(--iws-stone);
  display: flex;
  gap: 8px;
  background: var(--iws-stone-light);
}

/* Panel read sections */
.iws-panel-section { margin-bottom: 24px; }
.iws-panel-section__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--iws-primary-dark);
  padding: 6px 14px;
  border-left: 4px solid var(--iws-primary-mid);
  background: var(--iws-primary-light);
  margin-left: -18px;
  margin-right: -18px;
  margin-bottom: 0;
  letter-spacing: 0;
  text-transform: none;
}
.iws-panel-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--iws-stone-light);
}
.iws-panel-row:nth-child(even) {
  background: var(--iws-stone-light);
  margin-left: -18px;
  margin-right: -18px;
  padding-left: 18px;
  padding-right: 18px;
}
.iws-panel-row__key   { font-size: 13px; color: var(--text-sec); padding-top: 1px; }
.iws-panel-row__value { font-size: 15px; color: var(--text); line-height: 1.4; }
.iws-panel-row__value.is-empty { color: var(--text-ter); font-style: italic; }

/* Panel edit sections */
.iws-panel-edit-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--iws-primary-dark);
  margin: 16px 0 10px;
  padding-top: 14px;
  border-top: 2px solid var(--iws-stone);
}
.iws-panel-edit-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.iws-form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.iws-form-group label { font-size: 14px; font-weight: 500; color: var(--text); }
.iws-form-group input,
.iws-form-group select,
.iws-form-group textarea {
  font-size: 16px;
  padding: 7px 10px;
  border: 2px solid var(--text);
  border-radius: 0;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  width: 100%;
}
.iws-form-group input:focus,
.iws-form-group select:focus,
.iws-form-group textarea:focus {
  outline: 3px solid var(--iws-accent);
  outline-offset: 0;
  border-color: var(--text);
}
.iws-form-group textarea { resize: vertical; min-height: 72px; }

/* Saved confirmation */
.iws-saved-msg { font-size: 13px; color: var(--iws-sage); display: none; }

/* ── Footer ────────────────────────────────────────────────── */
.iws-footer {
  margin-top: 60px;
  border-top: 10px solid var(--iws-primary-dark);
  background: var(--iws-stone-light);
}
.iws-footer__inner {
  max-width: 1020px;
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-sec);
}
.iws-footer__org { font-weight: 500; }
.iws-footer__meta a {
  color: var(--iws-primary-mid);
  text-decoration: underline;
}
.iws-footer__meta a:hover { color: var(--iws-primary-dark); }

/* Let GOV.UK JS control conditional reveals via its own class */
.govuk-radios__conditional--hidden {
  display: none !important;
}
/* Remove yellow focus outline from error summary box */
.govuk-error-summary {
    border: 4px solid #d4351c !important;
    outline: none !important;
    box-shadow: none !important;
}
.govuk-error-summary:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Mobile-only elements — hidden on desktop so they don't render in page flow */
.iws-sheet-backdrop,
.iws-sheet,
.iws-mobile-header,
.iws-mobile-list,
.iws-mobile-nav,
.iws-mobile-detail-hero,
.iws-mobile-quick-actions,
.iws-mobile-edit-btn-wrap,
.iws-browser-tabs,
.iws-install-prompt,
.iws-mobile-adm-filter-row,
.iws-mob-tabs { display: none; }

/* GOV.UK mobile breakpoint — reduce side padding on small screens */
@media (max-width: 40.0525em) {
  .iws-container,
  .iws-container--wide {
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* ── Mobile (≤768px) ────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Hide desktop chrome */
  .iws-service-nav,
  .govuk-breadcrumbs { display: none !important; }
  .iws-header__user { display: none !important; }
  .iws-header__service-name-long { display: none !important; }
  .iws-header__service-name-short { display: inline !important; }
  .iws-filter-bar,
  .iws-bulk-bar,
  .iws-confirm-bar { display: none !important; }

  /* ── Bottom nav bar ─────────────────────────────── */
  .iws-mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: #00698b;
    border-top: none;
    flex-direction: column;
    padding-bottom: calc(env(safe-area-inset-bottom, 34px) + 10px);
  }

  /* Tab row */
  .iws-mobile-nav__tabs {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 10px 16px 4px;
  }
  .iws-mobile-nav__tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 12px;
    text-decoration: none;
    min-width: 80px;
  }
  .iws-mobile-nav__tab-label {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.1px;
  }
  .iws-mobile-nav__tab--active .iws-mobile-nav__tab-label {
    font-weight: 700;
    color: #ffffff;
  }
  .iws-mobile-nav__tab-indicator {
    width: 28px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.25);
  }
  .iws-mobile-nav__tab--active .iws-mobile-nav__tab-indicator {
    background: #ffce1f;
  }

  /* Action row: + · search · ⋯ */
  .iws-mobile-nav__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 8px;
  }
  .iws-mobile-nav__search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.92);
    border-radius: 999px;
    padding: 10px 14px;
    border: none;
    cursor: text;
    font-family: inherit;
    font-size: 15px;
    color: #626A6E;
  }
  .iws-mobile-nav__search svg circle { stroke: #626A6E !important; }
  .iws-mobile-nav__search svg path { stroke: #626A6E !important; }
  .iws-mobile-nav__search input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    color: #1D2021;
    outline: none;
  }
  .iws-mobile-nav__search input::placeholder { color: #626A6E; }
  .iws-mobile-nav__icon-btn {
    width: 44px; height: 44px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    border: 1.5px solid rgba(255,255,255,0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
  }
  .iws-mobile-nav__icon-btn svg path { stroke: #ffffff !important; }
  .iws-mobile-nav__icon-btn svg circle { fill: #ffffff !important; }
  .iws-mobile-nav__icon-btn:focus-visible {
    outline: 3px solid #FFDD00;
  }

  /* Mobile page header (replaces desktop iws-page-heading) */
  .iws-mobile-header {
    display: flex !important;
    align-items: center;
    padding: 12px 16px 8px;
    gap: 8px;
  }
  .iws-mobile-header__back {
    width: 36px; height: 36px;
    border-radius: 999px;
    background: #F0F0EE;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
  }
  .iws-mobile-header__back:focus-visible { outline: 3px solid #FFDD00; }
  .iws-mobile-header__title {
    flex: 1;
    font-size: 28px;
    font-weight: 700;
    color: #1D2021;
    letter-spacing: -0.5px;
    line-height: 1.1;
  }
  .iws-mobile-header__subtitle {
    font-size: 13px;
    color: #626A6E;
    margin-top: 2px;
  }
  .iws-mobile-header__filter-btn {
    position: relative;
    width: 36px; height: 36px;
    border-radius: 999px;
    background: #F0F0EE;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .iws-mobile-header__filter-btn:focus-visible { outline: 3px solid #FFDD00; }
  .iws-mobile-header__filter-badge {
    position: absolute;
    top: -2px; right: -2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #1D70B8;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }

  /* Hide desktop page heading and search bar on mobile */
  .iws-page-heading,
  .iws-search,
  .iws-search-break { display: none !important; }

  /* Content padding — top for desktop layout, bottom to clear fixed nav bar */
  .govuk-main-wrapper { padding-top: 16px; padding-bottom: 130px; }

  /* ── Mobile list rows ───────────────────────────── */
  /* Hide desktop table */
  .iws-table-wrap,
  #students-table { display: none !important; }

  .iws-mobile-list { display: block !important; }

  .iws-mobile-list__section-header {
    padding: 10px 20px 4px;
    font-size: 12px;
    font-weight: 700;
    color: #626A6E;
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  .iws-mobile-list__row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    background: #fff;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid #F0F0EE;
  }
  .iws-mobile-list__row:focus-visible { outline: 3px solid #FFDD00; outline-offset: -3px; }

  .iws-mobile-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
  }
  .iws-mobile-list__name {
    font-size: 16px;
    font-weight: 600;
    color: #1D2021;
  }
  .iws-mobile-list__meta {
    font-size: 14px;
    color: #626A6E;
    margin-top: 2px;
  }
  .iws-mobile-list__chevron { margin-left: auto; flex-shrink: 0; }

  /* ── Bottom sheet ───────────────────────────────── */
  .iws-sheet-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(11,12,12,0.4);
    z-index: 300;
  }
  .iws-sheet-backdrop.is-open { display: block; }

  .iws-sheet {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 301;
    background: #fff;
    border-radius: 20px 20px 0 0;
    max-height: 88vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 240ms cubic-bezier(0.2,0.8,0.2,1);
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }
  .iws-sheet.is-open { transform: translateY(0); }

  .iws-sheet__handle {
    display: flex; justify-content: center;
    padding: 10px 0 4px;
  }
  .iws-sheet__handle-bar {
    width: 40px; height: 4px;
    border-radius: 2px;
    background: #E4E4E2;
  }
  .iws-sheet__title {
    padding: 8px 20px 12px;
    font-size: 20px;
    font-weight: 700;
    color: #1D2021;
  }
  .iws-sheet__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #1D2021;
  }
  .iws-sheet__item:focus-visible { outline: 3px solid #FFDD00; }
  .iws-sheet__item-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: #FAFAF8;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }

  /* ── Student detail mobile ──────────────────────── */
  .iws-mobile-edit-btn-wrap { display: block !important; }
  .iws-mobile-detail-hero {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    padding: 8px 20px 20px;
    text-align: center;
  }
  .iws-mobile-detail-hero__name {
    font-size: 24px; font-weight: 700;
    color: #1D2021; letter-spacing: -0.3px;
    margin-top: 12px;
  }
  .iws-mobile-detail-hero__meta {
    font-size: 15px; color: #626A6E; margin-top: 4px;
  }
  .iws-mobile-quick-actions {
    display: flex !important;
    gap: 10px;
    padding: 0 16px 20px;
  }
  .iws-mobile-quick-actions__call {
    flex: 1;
    background: #F0F0EE;
    border-radius: 12px;
    padding: 14px 12px;
    text-align: center;
    text-decoration: none;
    display: block;
  }
  .iws-mobile-quick-actions__call:focus-visible { outline: 3px solid #FFDD00; }
  .iws-mobile-quick-actions__call-label {
    font-size: 12px; color: #626A6E; font-weight: 500;
  }
  .iws-mobile-quick-actions__call-number {
    font-size: 15px; font-weight: 600; color: #1D2021;
    margin-top: 2px;
  }
  .iws-mobile-section-card {
    background: #FAFAF8;
    border-radius: 12px;
    margin: 0 16px 16px;
    overflow: hidden;
  }
  .iws-mobile-section-card__header {
    font-size: 12px; font-weight: 700;
    color: #626A6E; text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 14px 4px;
  }
  .iws-mobile-section-card__row {
    display: flex;
    padding: 12px 14px;
    border-top: 1px solid #E4E4E2;
    font-size: 15px;
  }
  .iws-mobile-section-card__label {
    flex: 0 0 110px;
    color: #626A6E;
  }
  .iws-mobile-section-card__value { flex: 1; color: #1D2021; }

  /* Hide desktop record header on detail pages (mobile hero replaces it) */
  .iws-record-header { display: none !important; }

  /* Summary list: show on mobile with comfortable spacing */
  .govuk-summary-list { display: block; }
  .govuk-summary-list__row {
    display: grid;
    grid-template-columns: 1fr;
    padding: 8px 0;
  }
  .govuk-summary-list__key { font-weight: 600; color: #626A6E; font-size: 13px; margin-bottom: 2px; }
  .govuk-summary-list__value { font-size: 15px; }
  .govuk-summary-list__actions { margin-top: 4px; text-align: right; }
  .govuk-heading-m { padding: 0 0 4px; margin-top: 24px; }
  /* Section headings inside tab panels: stronger visual break */
  .govuk-tabs__panel .govuk-heading-m {
    font-size: 18px;
    font-weight: 700;
    padding: 14px 0 8px;
    margin-top: 28px;
    border-top: 2px solid #F0F0EE;
    color: #0b0c0c;
  }
  .govuk-tabs__panel .govuk-heading-m:first-child { margin-top: 0; border-top: none; }

  /* ── Install prompt ─────────────────────────────── */
  .iws-install-prompt {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 500;
    background: #1D70B8;
    color: #fff;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
  }
  .iws-install-prompt.is-visible { display: flex; align-items: flex-start; gap: 12px; }
  .iws-install-prompt__text { flex: 1; }
  .iws-install-prompt__close {
    background: none; border: none; color: #fff;
    font-size: 20px; cursor: pointer; padding: 0; flex-shrink: 0;
    line-height: 1;
  }

  /* ── In-browser top tab fallback ────────────────── */
  /* Shown when NOT in standalone PWA mode */
  .iws-browser-tabs {
    display: none;
    background: #fff;
    border-bottom: 1px solid #E4E4E2;
    padding: 8px 16px 0;
  }
  .iws-browser-tabs.is-visible { display: flex; gap: 0; }
  .iws-browser-tabs__tab {
    padding: 10px 16px;
    font-size: 14px; font-weight: 600;
    color: #626A6E;
    text-decoration: none;
    border-bottom: 3px solid transparent;
  }
  .iws-browser-tabs__tab--active {
    color: #0B0C0C;
    border-bottom-color: #0B0C0C;
  }

  /* ── Hide desktop admissions preset tabs ───────────── */
  .iws-preset-tabs { display: none !important; }

  /* ── Admissions list mobile filter pills ───────────── */
  .iws-mobile-adm-filter-row {
    display: flex !important;
    gap: 8px;
    padding: 8px 16px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: #fff;
    border-bottom: 1px solid #F0F0EE;
    flex-shrink: 0;
  }
  .iws-mobile-adm-filter-row::-webkit-scrollbar { display: none; }
  .iws-mobile-adm-filter-pill {
    padding: 6px 14px;
    background: #F0F0EE;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #626A6E;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .iws-mobile-adm-filter-pill.is-active {
    background: #003078;
    color: #fff;
  }

  /* ── Admissions detail mobile tab bar ───────────────── */
  .iws-mob-tabs {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 2px solid #F0F0EE;
  }
  .iws-mob-tab {
    flex: 1;
    padding: 12px 8px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: #626A6E;
    cursor: pointer;
  }
  .iws-mob-tab.is-active {
    color: #0b0c0c;
    font-weight: 700;
    border-bottom-color: #00698b;
  }

  /* ── Override GOV.UK tabs to use our mobile tab bar ─── */
  .govuk-tabs__title,
  .govuk-tabs__list { display: none !important; }
  .govuk-tabs__panel { display: none !important; }
  .govuk-tabs__panel.iws-tab-active { display: block !important; }

} /* end @media (max-width: 768px) */

/* ── Admissions checklist card ──────────────────────────────── */
.iws-checklist-card {
  padding: 0;
}

.iws-checklist-card > h2 {
  margin-bottom: 16px;
}

.iws-checklist-next-action {
  background: #f3f2f1;
  border-left: 4px solid #b1b4b6;
  padding: 8px 12px;
  margin-bottom: 20px;
  border-radius: 0 4px 4px 0;
}

.iws-checklist-next-action--staff {
  border-left-color: #00703c;
  background: #e8f5e9;
}

.iws-checklist-phase {
  border-top: 1px solid #b1b4b6;
  padding: 0;
  margin-bottom: 0;
}

.iws-checklist-phase:last-of-type {
  border-bottom: 1px solid #b1b4b6;
}

.iws-checklist-phase__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.iws-checklist-phase__summary::-webkit-details-marker { display: none; }

.iws-checklist-phase__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.iws-checklist-phase__name {
  font-weight: 700;
  font-size: 16px;
  color: #00698b;
}

.iws-checklist-phase__count {
  color: #505a5f;
  font-size: 14px;
}

.iws-checklist-phase__summary::after {
  content: '';
  display: inline-block;
  border-right: 2px solid #00698b;
  border-top: 2px solid #00698b;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-left: 12px;
  transition: transform 0.15s;
}

details[open] > .iws-checklist-phase__summary::after {
  transform: rotate(135deg);
}

.iws-checklist-phase__list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
}

.iws-checklist-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  padding: 8px 0;
  border-top: 1px solid #f3f2f1;
}

.iws-checklist-item--na { opacity: 0.4; }

.iws-checklist-item__icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: #0b0c0c;
}

.iws-checklist-item--done .iws-checklist-item__icon { color: #00703c; }
.iws-checklist-item--not_needed .iws-checklist-item__icon { color: #b1b4b6; }

.iws-checklist-item__label { flex: 1; margin-bottom: 0; }

.iws-checklist-item__meta,
.iws-checklist-item__actions { flex-shrink: 0; }

.iws-checklist-item__meta { margin-bottom: 0; }

.iws-checklist-item__actions { display: flex; gap: 4px; align-items: center; }
.iws-checklist-item__actions form { margin: 0; }
.iws-checklist-item__actions .govuk-button { margin-bottom: 0; }

/* Checkbox replacing the left icon on interactive items */
.iws-checklist-cb {
  width: 20px;
  height: 20px;
  border: 2px solid #505a5f;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  border-radius: 2px;
  color: transparent;
  font-family: inherit;
}
.iws-checklist-cb--checked {
  background: #00703c;
  border-color: #00703c;
  color: #fff;
}
.iws-checklist-cb--locked {
  background: #d3d3d3;
  border-color: #b1b4b6;
  color: #fff;
  cursor: default;
}
.iws-checklist-cb-wrap { margin: 0; display: flex; }

/* Note text displayed under the label */
.iws-checklist-item__note {
  flex-basis: 100%;
  padding-left: 28px;
  color: #505a5f;
  font-style: italic;
  margin-bottom: 0;
}

/* Add/Edit note link */
.iws-checklist-text-action {
  background: none;
  border: none;
  color: #1d70b8;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}
.iws-checklist-text-action:hover { color: #003078; }

/* Inline note editor */
.iws-checklist-note-editor {
  flex-basis: 100%;
  padding: 6px 0 4px 28px;
}
.iws-checklist-note-editor .govuk-textarea {
  display: block;
  width: 100%;
  margin-bottom: 8px;
}
.iws-checklist-note-editor__btns {
  display: flex;
  gap: 8px;
}
.iws-checklist-note-editor__btns .govuk-button { margin-bottom: 0; }

/* Inline override panel (⋯ menu) */
.iws-checklist-override-panel {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px 28px;
}
.iws-checklist-override-panel form {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.iws-checklist-override-panel .govuk-button { margin-bottom: 0; }
.iws-checklist-override-panel .govuk-input { width: auto; }
.iws-checklist-override-panel .govuk-label { margin-bottom: 0; }

/* ── Follow-up log ──────────────────────────────────────────── */
.iws-followup-log__add > summary::-webkit-details-marker { display: none; }
.iws-followup-log__form { margin-bottom: 16px; }

.iws-followup-log__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.iws-followup-log__entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  padding: 8px 0;
  border-bottom: 1px solid #b1b4b6;
}

.iws-followup-log__entry:first-child { border-top: 1px solid #b1b4b6; }

.iws-followup-log__meta {
  flex-shrink: 0;
  white-space: nowrap;
  color: #505a5f;
}

.iws-followup-log__sep {
  color: #b1b4b6;
  flex-shrink: 0;
}

.iws-followup-log__note {
  flex: 1;
  min-width: 160px;
  margin: 0;
  white-space: pre-line;
}

.iws-followup-log__entry--auto .iws-followup-log__meta { color: #b1b4b6; }
.iws-followup-log__entry--auto .iws-followup-log__note { color: #b1b4b6; }

.iws-followup-log__badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid #b1b4b6;
  border-radius: 3px;
  color: #b1b4b6;
  vertical-align: middle;
  margin-left: 4px;
}

.iws-followup-log__close-row {
  border-top: 1px solid #b1b4b6;
  padding: 12px 0 4px;
  list-style: none;
}

/* ── Admissions list preset tabs ────────────────────────────── */
.iws-preset-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #0b0c0c;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.iws-preset-tab {
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  color: #1d70b8;
  font-family: inherit;
}

.iws-preset-tab:hover { background: #f3f2f1; }

.iws-preset-tab--active {
  color: #0b0c0c;
  font-weight: 700;
  border-bottom-color: #0b0c0c;
}

/* ── Enquiry v2 prototype ──────────────────────────────────────────────── */

.iws-enquiry-v2-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.iws-enquiry-v2-actions .govuk-button {
  margin-bottom: 0;
}

#iws-ai-panel {
  background: #f3f2f1;
  border-left: 5px solid #1d70b8;
  padding: 16px 20px;
  margin-bottom: 24px;
}

#iws-ai-panel .govuk-heading-s {
  margin-top: 0;
}

.iws-section-heading {
  border-top: 1px solid #b1b4b6;
  padding-top: 24px;
  margin-top: 32px;
}

.iws-section-heading__note {
  color: #505a5f;
  font-weight: 400;
  font-size: 0.85em;
}

.iws-class-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.iws-class-grid--col-flow {
  grid-auto-flow: column;
  grid-template-rows: repeat(4, auto);
}

.iws-event-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
}

.iws-event-group-heading {
  margin-top: 16px;
  margin-bottom: 4px;
}

.iws-dob-part { /* used by JS hook only — no visual effect */ }

/* ── Bulk upload preview table ────────────────────────────────────────── */

.iws-upload-summary {
  font-size: 18px;
}

.iws-upload-summary__ok { color: #00703c; }
.iws-upload-summary__err { color: #d4351c; }

.iws-upload-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.iws-upload-actions .govuk-button {
  margin-bottom: 0;
}

.iws-upload-table-wrap {
  overflow-x: auto;
  border: 1px solid #b1b4b6;
}

.iws-upload-table {
  font-size: 14px;
  margin-bottom: 0;
  white-space: nowrap;
}

.iws-upload-table .govuk-table__header,
.iws-upload-table .govuk-table__cell {
  padding: 8px 10px;
  font-size: 14px;
  vertical-align: top;
}

.iws-upload-row--ok { background: #f3f9f1; }
.iws-upload-row--err { background: #fef1ee; }

.iws-upload-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 13px;
}

.iws-upload-status--ok { background: #00703c; color: #fff; }
.iws-upload-status--err { background: #d4351c; color: #fff; }

.iws-upload-row-errors {
  margin-top: 6px;
  white-space: normal;
  font-size: 13px;
  color: #d4351c;
}
