:root {
  color: #1d2a2e;
  background: #f3f6f5;
}

body {
  background: #f3f6f5;
}

header {
  height: 60px;
  padding: 0 36px;
  border-bottom-color: #d5dfdc;
  box-shadow: 0 1px 0 rgba(28, 55, 52, 0.03);
}

header strong {
  font-size: 20px;
}

main {
  max-width: 1440px;
  padding-top: 22px;
}

.sidebar {
  border-color: #d5dfdc;
  box-shadow: 0 8px 24px rgba(24, 54, 50, 0.055);
}

.section-context {
  padding-bottom: 12px;
  border-bottom: 1px solid #dce5e2;
}

button {
  border-color: #b9c9c5;
  border-radius: 4px;
  font-weight: 550;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

button[type="submit"],
#add {
  box-shadow: 0 1px 1px rgba(12, 71, 66, 0.16);
}

input,
select,
textarea {
  min-height: 40px;
  padding: 9px 10px;
  border-color: #b7c8c4;
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(21, 47, 44, 0.025);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #92aaa4;
}

textarea {
  min-height: 116px;
  line-height: 1.4;
}

small {
  color: #68777a;
  font-size: 12px;
  line-height: 1.35;
}

dialog {
  width: min(880px, calc(100% - 40px));
  padding: 26px 28px 24px;
  border: 1px solid #c6d2cf;
  border-radius: 7px;
  box-shadow: 0 20px 48px rgba(22, 39, 39, 0.22), 0 2px 8px rgba(22, 39, 39, 0.08);
}

dialog::backdrop {
  background: rgba(27, 37, 39, 0.48);
}

dialog.wide-editor {
  width: min(1180px, calc(100% - 32px));
}

dialog.permission-editor {
  width: 80vw;
  max-width: none;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

dialog.permission-editor form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
  min-height: 0;
}

dialog.permission-editor #fields {
  min-height: 0;
  overflow: auto;
  padding-right: 8px;
}

.dialog-heading {
  margin-bottom: 24px;
}

.dialog-heading h2 {
  font-size: 21px;
  font-weight: 650;
}

.editor-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.model-enabled {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 550;
}

.model-enabled input[type="checkbox"] {
  min-height: 0;
  margin: 0;
  accent-color: #176a65;
}

dialog.model-editor {
  width: min(860px, calc(100% - 32px));
  max-width: 860px;
  overflow: hidden;
}

.model-editor form {
  display: flex;
  flex-direction: column;
  max-height: calc(90vh - 52px);
  min-height: 0;
}

.model-editor .dialog-heading,
.model-editor .dialog-actions,
.model-editor #edit-error {
  flex-shrink: 0;
}

.model-editor #fields {
  min-height: 0;
  overflow: auto;
  padding: 2px 6px 2px 2px;
}

.model-editor .fields > .json-field {
  grid-row: auto;
}

.json-field textarea {
  min-height: 128px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  tab-size: 2;
}

.json-field small {
  font-weight: 400;
}

.fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
  align-items: start;
}

.fields > label {
  align-content: start;
  align-self: start;
  gap: 7px;
  color: #405357;
  font-weight: 550;
}

.fields > label:has(textarea) {
  grid-row: span 2;
}

.fields > label:has(input[type="checkbox"]) {
  grid-column: 1 / -1;
  gap: 8px;
}

.fields input[type="number"] {
  height: 40px;
}

@media (min-width: 701px) {
  .fields > label:has(textarea[name="efforts"]) {
    align-self: stretch;
    grid-template-rows: auto 1fr;
  }

  .fields textarea[name="efforts"] {
    height: 100%;
  }
}

.upstream-parameters {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid #d7e1df;
  border-radius: 4px;
}

.upstream-parameters legend {
  padding: 0 4px;
  color: #405357;
  font-size: 13px;
  font-weight: 550;
}

.upstream-parameters > label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upstream-parameters input[type="checkbox"] {
  flex-shrink: 0;
  margin: 0;
}

.upstream-parameters small {
  color: #68777a;
  font-size: 12px;
  line-height: 1.4;
}

.password-field input {
  padding-right: 44px;
}

.password-toggle {
  width: 40px;
  border-left-color: #d7e1df;
}

#edit-error:not(:empty) {
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid #e2b6b2;
  border-radius: 4px;
  background: #fff4f3;
  color: #9c332f;
}

.dialog-actions {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid #e0e8e5;
}

.dialog-actions button {
  min-width: 76px;
}

.account-summary {
  grid-column: 1 / -1;
  color: #405357;
}

.account-summary h3,
.account-history h3 {
  margin: 0 0 8px;
  color: #1d2a2e;
  font-size: 16px;
  font-weight: 650;
}

.account-summary p,
.account-history p {
  margin: 6px 0;
  line-height: 1.45;
}

.account-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin-top: 16px;
}

.account-detail-grid > div {
  display: grid;
  gap: 3px;
}

.account-detail-grid span {
  color: #68777a;
  font-size: 12px;
}

.account-detail-grid strong {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-history {
  grid-column: 1 / -1;
  padding-top: 16px;
  border-top: 1px solid #e0e8e5;
}

.account-history ul {
  max-height: 180px;
  margin: 10px 0 0;
  padding-left: 18px;
  overflow: auto;
  color: #52616b;
  font-size: 12px;
  line-height: 1.55;
}

button.danger {
  border-color: #b85b56;
  color: #963f3b;
}

button.danger:hover {
  background: #fff4f3;
}

#notice.success {
  color: #176a65;
  font-weight: 550;
}

@media (max-width: 700px) {
  header {
    padding: 0 18px;
  }

  dialog {
    width: min(100% - 24px, 760px);
    padding: 22px 18px 18px;
  }

  dialog.wide-editor {
    width: calc(100% - 24px);
  }

  .fields {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .fields > label:has(textarea),
  .fields > label:has(input[type="checkbox"]) {
    grid-column: auto;
    grid-row: auto;
  }

  .account-detail-grid {
    grid-template-columns: 1fr;
  }
}
.permission-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; }
.permission-meta label:last-child { display: flex; grid-template-columns: auto auto; align-items: center; gap: 8px; }
.permission-meta label:last-child input { width: auto; }
.permission-intro,
.permission-meta,
.permission-description,
.permission-matrix { grid-column: 1 / -1; }
.permission-editor .fields > label:has(textarea) { grid-row: auto; }
.permission-matrix { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 18px; align-items: start; }
.permission-matrix fieldset { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px 14px; min-width: 0; align-content: start; align-items: start; padding: 14px; border: 1px solid #dbe5f4; border-radius: 10px; }
.permission-matrix legend { grid-column: 1 / -1; padding: 0 5px; color: #26337f; font-weight: 750; }
.permission-option { display: flex; min-width: 0; align-items: center; gap: 8px; margin: 0; color: #17212b; font-size: 13px; }
.permission-option span { overflow-wrap: anywhere; }
.permission-option input { width: auto; min-height: 0; flex: 0 0 auto; margin: 0; }
.account-access-intro,
.account-access-note { grid-column: 1 / -1; }
.account-access-edit { margin: 12px 0 2px; width: fit-content; }
.guide-settings-card { padding: 22px; border: 1px solid #dbe5f4; border-radius: 12px; background: #fff; }
.guide-settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.guide-settings-heading h2 { color: #26337f; }
.guide-settings-heading button { width: auto; }
.guide-settings-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.guide-settings-metrics > div:not(.guide-settings-cooldowns) { display: grid; gap: 5px; padding: 14px; border-radius: 9px; background: #f5f8ff; }
.guide-settings-metrics > div:not(.guide-settings-cooldowns) span { color: #657174; font-size: 12px; }
.guide-settings-metrics > div:not(.guide-settings-cooldowns) strong { color: #26337f; font-size: 20px; }
.guide-settings-cooldowns { grid-column: 1 / -1; display: grid; gap: 7px; padding-top: 8px; }
.guide-settings-cooldowns div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #edf1f1; }
.guide-settings-cooldowns div:last-child { border-bottom: 0; }
@media (max-width: 720px) { dialog.permission-editor { width: calc(100% - 24px); } .permission-meta { grid-template-columns: 1fr; } }

/* Payments stay within the existing teal administration theme. */
.payment-workspace #payment-filters,
.payment-workspace #refund-filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 14px 16px;
  margin: 0 0 20px;
  padding: 20px;
  border: 1px solid #d5dfdc;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(24, 54, 50, .025);
}
.payment-workspace #payment-filters button,
.payment-workspace #refund-filters button { min-height: 40px; }
.payment-workspace .totals { gap: 14px; padding: 0; margin: 0 0 20px; }
.payment-workspace .metric { min-width: 180px; gap: 8px; padding: 16px 20px; border: 1px solid #d5dfdc; border-radius: 7px; background: #fff; }
.payment-workspace .metric strong { color: #176a65; font-size: 25px; }
.payment-workspace .table-wrap { border: 1px solid #d5dfdc; border-radius: 7px; box-shadow: 0 3px 12px rgba(24, 54, 50, .025); }
.payment-orders-table { min-width: 1060px; table-layout: fixed; white-space: normal; }
.payment-orders-table th { padding: 13px 12px; white-space: normal; line-height: 1.5; background: #eef4f2; }
.payment-orders-table td { padding: 17px 12px; vertical-align: middle; }
.payment-orders-table tbody tr:hover { background: #f8fbfa; }
.payment-orders-table th:nth-child(1) { width: 20%; }
.payment-orders-table th:nth-child(2) { width: 13%; }
.payment-orders-table th:nth-child(3) { width: 12%; }
.payment-orders-table th:nth-child(4) { width: 13%; }
.payment-orders-table th:nth-child(5) { width: 15%; }
.payment-orders-table th:nth-child(6) { width: 11%; }
.payment-orders-table th:nth-child(7) { width: 16%; }
.payment-primary { display: block; max-width: 200px; color: #26383c; font-size: 13px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.payment-reference { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; font-weight: 500; }
.payment-orders-table .payment-primary { max-width: 100%; }
.payment-orders-table td:nth-child(2) .payment-reference { max-width: 100%; }
.payment-secondary { display: block; margin-top: 5px; color: #68777a; font-size: 11px; line-height: 1.5; }
.payment-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.payment-amount .payment-primary { font-size: 13px; }
.payment-amount .payment-secondary { font-size: 10px; }
.payment-state-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.payment-state-line + .payment-state-line { margin-top: 7px; }
.payment-state-label { color: #68777a; font-size: 11px; }
.payment-badge { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border-radius: 4px; color: #52616b; background: #eef2f1; font-size: 11px; font-weight: 600; line-height: 1.4; text-transform: capitalize; white-space: nowrap; }
.payment-badge-success { color: #14665d; background: #e5f2ed; }
.payment-badge-warning { color: #90601d; background: #fff3df; }
.payment-badge-error { color: #a44440; background: #fceeed; }
.payment-environment { text-transform: capitalize; }
.payment-error-reference { display: block; max-width: 180px; margin-top: 7px; color: #a44440; overflow-wrap: anywhere; font-size: 10px; }
.payment-action-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.payment-action-group button { min-height: 31px; margin: 0; padding: 5px 9px; font-size: 11px; }
.payment-action-group button:nth-child(3) { grid-column: 1 / -1; }
.payment-action-group button:first-child { color: #14665d; border-color: #bed5ce; background: #edf6f2; }
.payment-action-group button:first-child:hover { background: #e0efe8; }
.payment-reason { min-width: 180px; }
dialog.wide-editor.payment-detail-editor { width: min(1020px, calc(100% - 32px)); max-width: 1020px; max-height: calc(100vh - 48px); }
.payment-detail-editor .fields { gap: 18px; }
.payment-detail-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; grid-column: 1 / -1; padding: 20px; border: 1px solid #d5e4de; border-radius: 6px; background: #f1f7f4; }
.payment-detail-product .payment-primary { max-width: none; font-size: 19px; }
.payment-detail-product .payment-secondary { font-size: 12px; }
.payment-detail-total { color: #176a65; font-size: 27px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.payment-detail-status { display: flex; flex-wrap: wrap; gap: 10px 24px; grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid #d5e4de; }
.payment-detail-status .payment-state-line + .payment-state-line { margin-top: 0; }
.payment-detail-section { min-width: 0; padding: 18px; border: 1px solid #dce5e2; border-radius: 6px; }
.payment-detail-section h3 { margin: 0 0 18px; color: #26383c; font-size: 14px; font-weight: 650; }
.payment-detail-facts { display: grid; gap: 14px; margin: 0; }
.payment-detail-facts > div { display: grid; grid-template-columns: 95px minmax(0, 1fr); align-items: baseline; gap: 14px; }
.payment-detail-facts dt { color: #68777a; font-size: 12px; }
.payment-detail-facts dd { margin: 0; color: #26383c; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.payment-detail-facts code { font-size: 11px; }
.payment-detail-wide, .payment-technical-details { grid-column: 1 / -1; }
.payment-detail-table { overflow-x: auto; border: 1px solid #e0e8e5; border-radius: 4px; }
.payment-detail-table table { min-width: 650px; font-size: 12px; }
.payment-detail-table th, .payment-detail-table td { padding: 10px 12px; }
.payment-detail-table td.wrap { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.payment-refund-record { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #e0e8e5; }
.payment-refund-record .payment-secondary { margin: 0 auto 0 0; }
.payment-technical-details { padding: 14px 18px; border: 1px solid #dce5e2; border-radius: 6px; }
.payment-technical-details summary { color: #52616b; font-size: 12px; font-weight: 600; cursor: pointer; }
.payment-technical-details pre { max-height: 320px; overflow: auto; margin: 18px 0 0; padding: 14px; border: 1px solid #e0e8e5; border-radius: 4px; background: #f6f9f7; line-height: 1.6; }
.payment-action-editor #fields > p { grid-column: 1 / -1; margin: 0; padding: 14px 16px; border: 1px solid #d5e4de; border-radius: 5px; color: #52665f; background: #f1f7f4; font-size: 13px; line-height: 1.6; }
.payment-action-editor .fields > label { grid-column: 1 / -1; }
.payment-action-editor .fields > label:has(textarea) { grid-row: auto; }
.payment-action-editor input[readonly] { max-width: 260px; color: #52616b; background: #f6f9f7; }
.payment-workspace #table > div:not(.payment-detail-table) { padding: 16px; }
.payment-workspace #table > p:not(.empty), .payment-workspace #table > pre { margin: 16px; line-height: 1.6; }

.downloads-table { min-width: 920px; table-layout: fixed; white-space: normal; }
.downloads-table th { padding: 13px 10px; line-height: 1.4; }
.downloads-table td { padding: 15px 10px; vertical-align: top; }
.downloads-table th:nth-child(1) { width: 11%; }
.downloads-table th:nth-child(2) { width: 16%; }
.downloads-table th:nth-child(3) { width: 17%; }
.downloads-table th:nth-child(4) { width: 21%; }
.downloads-table th:nth-child(5) { width: 16%; }
.downloads-table th:nth-child(6) { width: 9%; }
.downloads-table th:nth-child(7) { width: 10%; }
.download-primary, .download-preview, .download-secondary { display: block; line-height: 1.45; overflow-wrap: anywhere; }
.download-primary { color: #26383c; font-weight: 600; }
.download-version { display: flex; align-items: baseline; min-width: 0; }
.download-version-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.download-build { flex-shrink: 0; white-space: pre; }
.download-secondary { margin-top: 5px; color: #68777a; font-size: 11px; }
.download-preview { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; white-space: pre-wrap; }
.download-url { -webkit-line-clamp: 2; color: #52616b; font-size: 12px; }
.download-status { display: block; margin-top: 6px; }
.download-status.disabled { color: #657174; }
.download-details-button { min-height: 0; margin: 7px 0 0; padding: 0; border: 0; color: #176a65; background: transparent; font-size: 12px; }
.download-details-button:hover { background: transparent; text-decoration: underline; }
.download-row-actions { display: grid; justify-items: start; gap: 6px; }
.download-row-actions button { min-height: 31px; margin: 0; padding: 5px 9px; font-size: 12px; }
.download-detail-editor { overflow: hidden; }
.download-detail-editor form { display: flex; flex-direction: column; max-height: calc(90vh - 52px); min-height: 0; }
.download-detail-editor .dialog-heading, .download-detail-editor .dialog-actions { flex-shrink: 0; }
.download-detail-editor #fields { display: block; min-height: 0; overflow: auto; }
.download-detail-editor section + section { margin-top: 20px; }
.download-detail-editor h3 { margin: 0 0 8px; color: #405357; font-size: 13px; }
.download-detail-editor pre { margin: 0; color: #26383c; font: inherit; line-height: 1.55; }

@media (max-width: 1100px) {
  .payment-workspace #payment-filters, .payment-workspace #refund-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .downloads-table { display: block; min-width: 0; }
  .downloads-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .downloads-table tbody { display: grid; gap: 10px; padding: 10px; }
  .downloads-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 14px; border: 1px solid #dbe1e3; border-radius: 6px; }
  .downloads-table td { display: block; min-width: 0; padding: 0; border: 0; }
  .downloads-table td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: #68777a; font-size: 11px; font-weight: 600; }
  .downloads-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .downloads-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .downloads-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .downloads-table td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
  .downloads-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 4; }
  .downloads-table td:nth-child(6) { grid-column: 2; grid-row: 1; }
  .downloads-table td:nth-child(7) { grid-column: 1 / -1; grid-row: 5; }
  .downloads-table td:nth-child(7)::before { display: none; }
  .download-row-actions { display: flex; }
  .payment-workspace #payment-filters, .payment-workspace #refund-filters { padding: 16px; gap: 14px; }
  .payment-workspace .metric { flex: 1 1 140px; min-width: 0; padding: 14px 16px; }
  .payment-detail-summary { grid-template-columns: 1fr; padding: 16px; }
  .payment-detail-status { grid-column: auto; }
  .payment-detail-facts > div { grid-template-columns: 82px minmax(0, 1fr); gap: 10px; }
  .payment-detail-section { padding: 16px; }
  .payment-detail-total { font-size: 24px; }
}
@media (max-width: 380px) {
  .payment-workspace #payment-filters, .payment-workspace #refund-filters { grid-template-columns: 1fr; }
}
