/*
 * 2026-27 additions on top of the 2025-26 styles (styles.css, superfish.css):
 * notices, simple stacked forms, field errors, and a phone layout for the header and menu.
 */

:root {
  --km-blue: #2660a4;      /* .title bar in styles.css */
  --km-link: #07408d;
  --km-gold: #e9c472;      /* .demo-header */
  --km-ok-bg: #e9efda;
  --km-ok-border: #b6cf7b;
  --km-error-bg: #f8edeb;
  --km-error-border: #dd5f4b;
  --km-info-bg: #eef4fb;
  --km-info-border: #9cbbe0;
  --km-muted: #5f6368;
}

body {
  background: #fff;
  margin: 0;
}

.demo-header {
  box-sizing: border-box;
  padding: 0.5em 5%;
}

.demo-header h1 {
  margin: 0.4em 0;
}

.demo-container.narrow {
  max-width: 460px;
}

.muted {
  color: var(--km-muted);
}

.small {
  font-size: 90%;
}

/* ---- Notices ---------------------------------------------------------------------------------- */
.notice {
  padding: 0.75em 1em;
  border: 1px solid var(--km-info-border);
  background: var(--km-info-bg);
  border-radius: 4px;
  margin: 1em 0;
}

.notice-ok {
  background: var(--km-ok-bg);
  border-color: var(--km-ok-border);
}

.notice-error {
  background: var(--km-error-bg);
  border-color: var(--km-error-border);
}

/* ---- Forms -------------------------------------------------------------------------------------- */
.stacked-form label {
  display: block;
  font-weight: 700;
  margin-top: 1em;
}

.stacked-form input[type="email"],
.stacked-form input[type="password"],
.stacked-form input[type="text"],
.stacked-form select {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  font-size: 16px; /* 16px stops phones zooming in on focus */
  border: 1px solid #ced4da;
  border-radius: 4px;
}

.stacked-form input[aria-invalid="true"] {
  border-color: var(--km-error-border);
}

.password-row {
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.password-row input {
  flex: 1;
}

.demo-errors:empty {
  display: none;
}

.demo-errors {
  margin-top: 0.25em;
}

.policy {
  font-size: 90%;
  color: var(--km-muted);
  margin: 0.25em 0 0;
}

.policy.policy-ok {
  color: #2e7d32;
}

.login-btn {
  margin-top: 1.5em;
}

.login-btn .btn {
  width: 100%;
  height: 44px;
  font-size: 16px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--km-link);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

/* ---- Header --------------------------------------------------------------------------------------- */
.tops {
  height: auto;
  min-height: 100px;
  overflow: hidden;
}

.tops .logo img {
  max-height: 140px;
  max-width: 100%;
}

.tops .user {
  width: auto;
  min-width: 15%;
  color: var(--km-blue);
}

.user-meta {
  color: var(--km-muted);
}

#sign-out-form {
  margin-top: 0.5em;
}

.title {
  box-sizing: border-box;
  height: auto;
  min-height: 38px;
}

.menu-toggle {
  display: none;
}

/* Menu items whose 2025-26 page has not been converted yet */
.sf-menu a.not-ready,
.not-ready-sample {
  color: #9aa0a6;
}

/* ---- Team pages: checkbox lists, filters, status badges, row actions, dialogs ---------------------- */
.stacked-form input[type="search"],
.filter-bar input,
.filter-bar select {
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 16px;
  border: 1px solid #ced4da;
  border-radius: 4px;
}

.checkbox-list {
  border: 1px solid #ced4da;
  border-radius: 4px;
  margin: 1em 0 0;
  padding: 0.5em 0.75em;
}

.checkbox-list legend {
  font-weight: 700;
  padding: 0 0.25em;
}

.checkbox-list input[type="search"] {
  width: 100%;
  margin-bottom: 0.5em;
}

.checkbox-list-items {
  max-height: 16em;
  overflow-y: auto;
}

.checkbox-row,
.stacked-form .checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0;
  padding: 6px 0;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.checkbox-row[hidden] {
  display: none;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em 1.5em;
  margin: 1em 0;
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  gap: 0.25em;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  background: #e8eaed;
}

.status-pending_onboarding { background: #fdf0d5; color: #7a5200; }
.status-active { background: var(--km-ok-bg); color: #2e5d0e; }
.status-suspended { background: var(--km-error-bg); color: #8c1d18; }

.error-text {
  color: #8c1d18;
  margin-top: 0.25em;
}

.row-actions {
  display: flex;
  gap: 0.4em;
}

.btn-danger {
  background: #b3261e;
  border-color: #b3261e;
  color: #fff;
}

.btn-danger:hover {
  background: #8c1d18;
}

.km-dialog {
  max-width: min(460px, calc(100vw - 32px));
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 1em 1.25em;
}

.km-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.km-dialog h3 {
  margin-top: 0;
}

.km-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5em;
  margin-top: 1.25em;
}

/* ---- Capture forms and lists ------------------------------------------------------------------------ */
.filter-extra {
  display: contents;
}

.demo-container.wide {
  max-width: 980px;
}

.stacked-form input[type="number"],
.stacked-form input[type="date"],
.stacked-form textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #ced4da;
  border-radius: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 1.5em;
}

.demo-group {
  border: 1px solid #ced4da;
  border-radius: 4px;
  margin: 1em 0 0;
  padding: 0.5em 0.75em;
  overflow-x: auto;
}

.demo-group legend {
  font-weight: 700;
  padding: 0 0.25em;
}

.demo-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 360px;
}

.demo-table th {
  text-align: left;
  font-weight: 700;
  padding: 4px 6px;
}

.demo-table td {
  padding: 3px 6px;
}

.demo-table input {
  width: 100%;
  min-width: 64px;
  padding: 8px;
  text-align: right;
}

.demo-total {
  font-weight: 700;
  margin: 0.75em 0 0;
}

.score-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1em;
}

.hint {
  color: var(--km-muted);
  font-size: 90%;
  margin: 0.25em 0 0;
  font-weight: 400;
}

/* ---- Phones --------------------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .tops .logo,
  .tops .user {
    float: none;
    width: auto;
    padding: 0.5em 16px;
  }

  .tops .logo img {
    max-height: 80px;
  }

  .demo-header {
    padding: 0.5em 16px;
  }

  .demo-container {
    margin: 1em 16px;
    width: calc(100% - 32px);
  }

  .title {
    padding: 0;
  }

  /* Sized to its text, not 100% wide: Chrome on phones sends a tap on a full-viewport-width button to
     its parent instead (checked with Playwright's Pixel 5). The blue .title bar already spans the width. */
  .menu-toggle {
    display: inline-block;
    width: auto;
    min-width: 44px;
    min-height: 44px;
    padding: 10px 16px;
    background: var(--km-blue);
    color: #fff;
    border: none;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }

  #nav-container {
    display: none;
  }

  body.menu-open #nav-container {
    display: block;
  }

  /* Superfish becomes a plain stacked list on phones */
  .sf-menu,
  .sf-menu > li {
    float: none;
    width: 100%;
    margin: 0;
  }

  .sf-menu ul,
  .sf-menu ul ul {
    position: static;
    display: block !important;
    box-shadow: none;
    padding-left: 1em;
  }

  .sf-menu a {
    padding: 0.6em 16px;
  }
}

/* normalize.css gives every button 5px 25px padding on :active, so a pressed .btn grew under the pointer and the
   click landed on its parent. Keep the .btn sizes while pressed. */
button.btn,
button.btn:active {
  padding: 8px 20px;
}

button.btn-sm,
button.btn-sm:active {
  padding: 4px 10px;
}

.total-row td {
  font-weight: 700;
  border-top: 2px solid #4a4a4a;
}

.bar-chart {
  margin: 1em 0;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 160px) 1fr minmax(60px, 90px);
  gap: 0.75em;
  align-items: center;
  margin: 4px 0;
}

.bar-label,
.bar-value {
  font-size: 90%;
}

.bar-value {
  text-align: right;
}

.bar-track {
  display: inline-block;
  min-width: 80px;
  height: 14px;
  background: #e8eaed;
  border-radius: 7px;
  overflow: hidden;
  vertical-align: middle;
}

.bar-row .bar-track {
  display: block;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--km-blue);
}

.evidence {
  margin-top: 2em;
  padding-top: 0.5em;
  border-top: 1px solid #ced4da;
}

.evidence-list,
.evidence-queue {
  list-style: none;
  padding: 0;
  margin: 0.5em 0 1em;
}

.evidence-list li,
.evidence-queue li {
  padding: 4px 0;
}

/* styles.css boxes every input; a file picker should look like a plain browse button */
.evidence input[type="file"] {
  display: block;
  width: auto;
  max-width: 100%;
  margin: 0.5em 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.filter-actions {
  display: flex;
  gap: 0.5em;
  align-items: flex-end;
}

.target-input {
  width: 6.5em;
  padding: 6px 8px;
  font-size: 16px;
  text-align: right;
  box-sizing: border-box;
}
