/* Portal login and Admin surfaces. Shared shell styles live in @atlantic-one/platform. */
.login-page {
  min-height: 100vh;
  background: var(--page);
}

.login-shell {
  display: grid;
  width: min(560px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  place-items: center;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.login-panel {
  width: 100%;
  padding: 38px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--sky);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 44px rgba(37, 45, 61, 0.12);
}

.login-logo {
  width: min(340px, 100%);
  height: auto;
  margin: 0 auto 28px;
}

.login-panel h1 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 30px;
  line-height: 1.1;
}

.muted {
  color: var(--muted);
  line-height: 1.45;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--navy);
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}

.secondary-button {
  border: 1px solid var(--line) !important;
  background: var(--white) !important;
  color: var(--navy) !important;
}

.danger-button {
  background: #9f3a3a !important;
  color: var(--white) !important;
}

.text-link {
  color: var(--navy);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-page {
  padding: 0;
}

.admin-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-head p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-head h1 {
  margin: 0;
  color: var(--navy);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.15;
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(180px, 1fr) 150px auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.inline-checkbox {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-weight: 700;
}

.inline-checkbox input {
  width: 18px;
  height: 18px;
  min-height: 0;
}

.inline-checkbox span {
  display: inline;
  margin-top: 0;
  color: inherit;
  font-size: inherit;
}

.action-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.admin-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 16px;
}

.settings-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.settings-panel h2 {
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.admin-index-panel {
  max-width: 760px;
}

.admin-index-list {
  display: grid;
  margin-top: 12px;
  border-top: 1px solid var(--soft-line);
}

.admin-index-row {
  display: grid;
  min-height: 62px;
  align-items: center;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--soft-line);
  color: var(--navy);
}

.admin-index-row:hover,
.admin-index-row:focus-visible {
  color: var(--green);
  outline: none;
}

.admin-index-icon {
  display: grid;
  place-items: center;
}

.admin-index-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.admin-index-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.admin-index-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-action-form {
  margin: 0;
}

.settings-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.status-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.status-list div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--soft-line);
}

.status-list dt {
  color: var(--muted);
  font-weight: 700;
}

.status-list dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-weight: 700;
}

.notice.success {
  border-color: rgba(59, 161, 134, 0.45);
  background: #edf8f4;
  color: #276f5d;
}

.notice.error {
  border-color: rgba(159, 58, 58, 0.35);
  background: #fff4f4;
  color: #8d2f2f;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--navy);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}

td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.user-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-actions form {
  margin: 0;
}

.user-summary strong {
  display: block;
  color: var(--navy);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
}

.user-summary-empty strong {
  color: var(--muted);
}

.whatsapp-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.whatsapp-summary span:last-child {
  margin-top: 0;
}

.purchasing-review-table th:first-child {
  width: 30%;
}

.purchasing-review-table th:nth-child(2) {
  width: 34%;
}

.purchasing-review-table th:nth-child(3) {
  width: 36%;
}

.review-email,
.review-suggestion,
.review-actions,
.recommendation-actions {
  min-width: 0;
}

.review-email strong,
.review-suggestion strong {
  display: block;
  color: var(--navy);
  font-family: Arial, Helvetica, sans-serif;
}

.review-email p {
  margin-top: 8px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.review-email small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.review-suggestion h3 {
  margin: 10px 0 0;
  color: var(--navy);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}

.review-suggestion ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.review-suggestion small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.recommendation-support {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--soft-line);
}

.recommendation-support summary {
  cursor: pointer;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-actions form {
  margin: 0;
}

.recommendation-actions {
  display: grid;
  gap: 10px;
}

.recommendation-action {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #f7fafc;
}

.recommendation-action strong {
  display: block;
  color: var(--navy);
}

.recommendation-action p {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.recommendation-action dl {
  display: grid;
  gap: 4px;
  margin: 4px 0 0;
}

.recommendation-action dl div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}

.recommendation-action dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.recommendation-action dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.recommendation-action ul {
  margin: 2px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.draft-message {
  display: grid;
  gap: 8px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--soft-line);
}

.draft-message strong {
  display: block;
  color: var(--navy);
  font-size: 13px;
}

.draft-message span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.draft-message pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

.user-edit-panel {
  max-width: 620px;
}

.user-edit-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--soft-line);
}

.user-edit-form {
  max-width: 520px;
}

.user-edit-checkbox {
  justify-self: start;
  width: auto;
  min-width: 220px;
  margin-top: 2px;
}

.user-edit-checkbox input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card-primary {
  border-top: 4px solid var(--green);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  color: var(--navy);
  font-size: 28px;
  line-height: 1.1;
}

.inline-admin-form {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.inline-admin-form input {
  width: 96px;
  min-height: 40px;
}

.inline-admin-form button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.compact-admin-form button {
  min-height: 34px;
  padding: 0 12px;
}

.row-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.error-text {
  color: #8d2f2f;
}

.settings-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-card {
  display: flex;
  min-height: 48px;
  align-items: center;
  grid-template-columns: none;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
}

.checkbox-card input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 auto;
  accent-color: var(--green);
}

.checkbox-card span {
  font-weight: 700;
}

.checkbox-card.danger-setting {
  border-color: rgba(159, 58, 58, 0.28);
  background: #fffafa;
}

.mode-pill,
.status-pill,
.inline-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.mode-pill,
.status-success,
.status-converted {
  border-color: rgba(59, 161, 134, 0.45);
  background: #edf8f4;
  color: #276f5d;
}

.status-blocked,
.status-failed,
.status-mismatch {
  border-color: rgba(159, 58, 58, 0.35);
  background: #fff4f4;
  color: #8d2f2f;
}

.status-analysed,
.status-shadow,
.status-unknown {
  border-color: rgba(161, 220, 238, 0.8);
  background: #edf8fb;
  color: var(--navy);
}

.inline-chip {
  margin: 0 4px 5px 0;
  background: #f7fafc;
  color: var(--muted);
}

.compact-table {
  margin-top: 0;
}

.section-subheading {
  margin: 22px 0 10px;
  color: var(--navy);
  font-size: 1rem;
  font-weight: 700;
}

.row-details {
  margin-top: 10px;
}

.row-details summary {
  color: var(--navy);
  cursor: pointer;
  font-weight: 700;
}

.row-details pre {
  max-width: 520px;
  max-height: 360px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #f7fafc;
  color: var(--ink);
  font: 12px/1.45 Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre-wrap;
}

@media (max-width: 840px) {
  .admin-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  #pwa-install {
    right: 10px;
    bottom: 10px;
    left: 10px;
    grid-template-columns: minmax(0, 1fr) 36px;
    grid-template-areas:
      "copy close"
      "action action";
    gap: 10px;
    width: auto;
    max-width: none;
    padding: 10px;
  }

  #pwa-install .pwa-install-copy {
    grid-area: copy;
  }

  #pwa-install .pwa-install-action {
    grid-area: action;
    justify-self: stretch;
    width: 100%;
    min-height: 40px;
  }

  #pwa-install .pwa-install-close {
    grid-area: close;
    width: 36px;
    height: 36px;
  }

  .login-panel {
    padding: 24px;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-panels {
    grid-template-columns: 1fr;
  }

  .settings-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-admin-form {
    width: 100%;
  }

  .inline-admin-form input {
    flex: 1 1 auto;
    width: auto;
  }

  .status-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
