:root {
  --blue: #157a68;
  --blue-soft: #e7f7f3;
  --green: #20a67f;
  --nav: #10201f;
  --bg: #f5f8f7;
  --line: #e2e9e7;
  --shadow: 0 12px 32px rgba(20, 69, 59, 0.08);
}

button:focus,
input:focus,
select:focus,
textarea:focus {
  outline-color: rgba(21, 122, 104, 0.16);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.login-shell {
  background: var(--nav);
}

.login-shell::before {
  background: linear-gradient(125deg, rgba(32, 166, 127, 0.2), transparent 58%);
}

.brand-mark {
  color: #157a68;
  background: #dff4ee;
  box-shadow: 0 10px 28px rgba(21, 122, 104, 0.2);
}

.sidebar-brand .brand-mark {
  display: none;
}

.panel-kicker,
.accent,
.text-button,
.table-actions button {
  color: #157a68;
}

.primary {
  background: #157a68;
  box-shadow: 0 8px 18px rgba(21, 122, 104, 0.2);
}

.primary:hover {
  background: #116655;
}

.secondary:hover {
  color: #157a68;
  border-color: #7db9ab;
  background: #f2faf8;
}

.sidebar {
  width: 232px;
  background: #10201f;
}

.side-link:hover,
.side-link.active {
  color: #fff;
  background: rgba(47, 174, 142, 0.16);
}

.side-link.active {
  box-shadow: inset 3px 0 #2fae8e;
}

.side-link.active .side-icon,
.side-icon {
  color: #65c9b2;
}

.support-card {
  border-color: #29433e;
  background: #172e2b;
}

.topbar {
  height: 88px;
  padding: 17px 28px;
}

.view-panel {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 30px 28px 48px;
}

.avatar,
.tenant-logo {
  color: #157a68;
  background: #dff4ee;
}

.welcome-row {
  border-color: #cde9e1;
  background: linear-gradient(115deg, #e7f7f3, #f5fbf9 68%, #fff);
}

.stat-icon.blue,
.security-mark.blue {
  color: #157a68;
  background: #e2f4ef;
}

.stat-icon.green,
.security-mark.green {
  color: #168a6d;
  background: #e4f8f1;
}

.mini-status.bound,
.setup-tab.active {
  color: #157a68;
}

.setup-tab.active {
  border-bottom-color: #157a68;
}

.security-hint {
  color: #527268;
  background: #eff8f5;
}

.login-panel,
.welcome-row,
.stat-card,
.tenant-table-wrap,
.security-grid article,
.modal {
  border-radius: 8px;
}

.detail-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.detail-back {
  flex: 0 0 auto;
  margin-top: 2px;
  color: #157a68;
  background: #e7f7f3;
}

.detail-page-head h1 {
  margin: 8px 0 6px;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 0;
}

.detail-page-head p {
  margin: 0;
  color: #7c8a85;
  font-size: 13px;
}

.detail-actions,
.detail-bottom-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.detail-surface {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(16, 31, 53, 0.025);
}

.detail-section {
  display: block;
  padding: 28px;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child {
  border-bottom: 0;
}

.detail-section-head {
  position: relative;
  align-self: start;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 22px;
}

.detail-section-head > div {
  min-width: 0;
}

.detail-section-head h2 {
  margin: 1px 0 6px;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: 0;
}

.section-title-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-title-line h2 {
  margin-bottom: 6px;
}

.super-admin-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  margin-bottom: 5px;
  padding: 0 7px;
  border: 1px solid #f0d4a5;
  border-radius: 4px;
  color: #9a5b12;
  background: #fff7e8;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
}

.detail-section-head p {
  margin: 0;
  color: #82908b;
  font-size: 12px;
  line-height: 1.65;
}

.section-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: #157a68;
  background: #e7f7f3;
  font-size: 11px;
  font-weight: 800;
}

.config-state {
  margin: 2px 0 0 auto;
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 4px;
  color: #7b8984;
  background: #f0f3f2;
  font-size: 11px;
  font-weight: 700;
}

.config-state.configured {
  color: #157a68;
  background: #e7f7f3;
}

.table-actions button:disabled {
  color: #a8b3af;
  cursor: not-allowed;
}

.mini-code-modal {
  width: min(520px, 100%);
}

.mini-code-content {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.mini-code-image-wrap {
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
  overflow: hidden;
  border: 1px solid #dce7e4;
  border-radius: 8px;
  color: #7c8b86;
  background: #f7faf9;
  font-size: 12px;
  text-align: center;
}

.mini-code-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mini-code-hint {
  margin: 9px 0 0;
  color: #71817c;
  font-size: 12px;
  text-align: center;
}

.mini-code-meta {
  min-width: 0;
  margin: 0;
}

.mini-code-meta > div {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.mini-code-meta > div:last-child {
  border-bottom: 0;
}

.mini-code-meta dt {
  margin-bottom: 5px;
  color: #84918d;
  font-size: 11px;
}

.mini-code-meta dd {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.mini-code-original {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.detail-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
  min-width: 0;
}

.detail-fields label {
  display: block;
  position: relative;
  min-width: 0;
  color: #536277;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
}

.detail-fields label em {
  color: #c54747;
  font-style: normal;
}

.detail-fields input,
.detail-fields select,
.detail-fields textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #dbe2e0;
  border-radius: 7px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fbfcfc;
  font: inherit;
  font-weight: 400;
  resize: vertical;
}

.detail-fields label > input,
.detail-fields label > select,
.detail-fields label > textarea,
.detail-fields label > .upload-line {
  display: block;
  margin-top: 8px;
}

.detail-fields input,
.detail-fields select {
  height: 44px;
}

.detail-fields input:focus,
.detail-fields select:focus,
.detail-fields textarea:focus {
  border-color: #66ad9f;
  outline: 3px solid rgba(21, 122, 104, 0.12);
}

.detail-fields .span-2 {
  grid-column: span 2;
}

.detail-fields .upload-line {
  min-width: 0;
}

.detail-fields .upload-line input:first-child {
  min-width: 120px;
}

.status-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.status-field legend {
  padding: 0;
  color: #536277;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
}

.status-choice {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 44px;
  margin-top: 8px;
}

.status-choice label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #536277;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.status-choice input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #157a68;
}

.logo-uploader {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 94px;
  margin-top: 8px;
  padding: 12px;
  border: 1px dashed #b9d8d0;
  border-radius: 8px;
  background: #f7fbfa;
}

.logo-preview {
  display: grid;
  place-items: center;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid #d7e8e3;
  border-radius: 8px;
  color: #82908b;
  background: #edf7f4;
  font-size: 11px;
  text-align: center;
}

.logo-preview img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-preview img.visible {
  display: block;
}

.logo-upload-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.logo-upload-main button {
  white-space: nowrap;
}

.logo-upload-main span {
  color: #74837e;
  font-size: 12px;
  font-weight: 400;
}

#logoFile {
  display: none;
}

.field-hint,
.detail-section > .security-hint {
  margin: 14px 0 0;
}

.field-hint {
  color: #74837e;
  font-size: 12px;
}

.detail-error {
  min-height: 0;
  margin: 14px 0 0;
  padding: 0 2px;
  font-weight: 700;
}

.detail-error:empty {
  display: none;
}

.detail-bottom-actions {
  padding-top: 18px;
}

.tenant-detail-form.is-loading .detail-surface {
  opacity: 0.52;
  pointer-events: none;
}

@media (max-width: 900px) {
  .sidebar {
    width: 210px;
  }

  .topbar,
  .view-panel {
    padding-left: 20px;
    padding-right: 20px;
  }

  .detail-section {
    padding: 24px;
  }

  .field-hint,
  .detail-section > .security-hint {
    margin-top: 18px;
  }
}

@media (max-width: 620px) {
  .view-panel {
    padding: 24px 14px 40px;
  }

  .detail-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-actions {
    display: none;
  }

  .detail-section {
    gap: 18px;
    padding: 20px 16px;
  }

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

  .detail-fields .span-2 {
    grid-column: span 1;
  }

  .detail-fields .upload-line {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-fields .upload-line button {
    height: 42px;
  }

  .detail-bottom-actions button {
    flex: 1;
  }

  .mini-code-content {
    grid-template-columns: 1fr;
  }

  .mini-code-image-wrap {
    width: min(220px, 100%);
    margin: 0 auto;
  }
}
