:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #15202b;
  --muted: #637487;
  --line: #dce3ea;
  --brand: #147d64;
  --brand-2: #0b5c85;
  --danger: #b42318;
  --warn: #a15c00;
  --hover: #eef3f6;
  --row-odd: #ffffff;
  --row-even: #f4f7fa;
  --code-bg: #f8fafc;
  --overlay: rgba(12, 22, 32, 0.42);
  --log-bg: #071017;
  --log-text: #d5f8de;
  --success-bg: #e7f7ef;
  --success-text: #116149;
  --warn-bg: #fff4d8;
  --danger-bg: #fde8e7;
  --link-soft: #eaf4f8;
  --link-soft-hover: #d9edf5;
  --shadow: rgba(12, 22, 32, 0.22);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111418;
  --panel: #181d23;
  --panel-2: #20262e;
  --text: #e7edf3;
  --muted: #9caab8;
  --line: #313a45;
  --brand: #22a985;
  --brand-2: #38a7d5;
  --danger: #e05a50;
  --warn: #d8922d;
  --hover: #252d36;
  --row-odd: #181d23;
  --row-even: #20262e;
  --code-bg: #11161c;
  --overlay: rgba(0, 0, 0, 0.62);
  --log-bg: #05080b;
  --log-text: #bff3cf;
  --success-bg: #123329;
  --success-text: #8ee6c5;
  --warn-bg: #3b2b12;
  --danger-bg: #3a1716;
  --link-soft: #173140;
  --link-soft-hover: #1d4054;
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: white;
  background: var(--brand);
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

nav a {
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

nav a:hover {
  color: var(--text);
  background: var(--hover);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.language-switch {
  display: inline-flex;
  align-items: center;
}

.language-switch select {
  min-width: 70px;
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background-color: var(--panel-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-switch button {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.theme-switch button[aria-pressed="true"] {
  color: #fff;
  background: var(--brand-2);
}

.shell {
  width: min(980px, calc(100% - 28px));
  margin: 34px auto 70px;
}

.shell.wide {
  width: min(1220px, calc(100% - 28px));
}

h1 {
  margin: 0 0 20px;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 21px;
}

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

.panel,
.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel + .panel,
.panel + form.panel,
form.panel + .panel {
  margin-top: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1.1;
}

.metric span {
  color: var(--muted);
  font-size: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
}

.filter-bar input {
  min-height: 38px;
}

.count-link {
  display: inline-flex;
  min-width: 32px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--brand-2);
  background: var(--link-soft);
  font-weight: 800;
}

.count-link:hover {
  background: var(--link-soft-hover);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
 /* 
.license-admin-table {
 min-width: 1280px; 
}
*/
th,
td {
  padding: 5px 5px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

th {
  color: var(--muted);
  background: var(--panel-2);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:nth-child(odd) {
  background: var(--row-odd);
}

tbody tr:nth-child(even) {
  background: var(--row-even);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 12px;
  font-weight: 800;
}

.status.pending,
.status.draft,
.status.paused {
  background: var(--warn-bg);
  color: var(--warn);
}

.status.expired,
.status.revoked,
.status.failed,
.status.blocked,
.status.disabled {
  background: var(--danger-bg);
  color: var(--danger);
}

.keybox {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.keybox code {
  display: block;
  max-width: 520px;
  overflow: hidden;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--code-bg);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.license-details {
  margin: 0;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 0;
}

.license-details dt {
  padding: 9px 4px;
  color: var(--muted);
  /* font-weight: 800; */
}

.license-details dd {
  min-width: 0;
  margin: 0;
  padding: 9px 10px;
  overflow-wrap: anywhere;
}

.license-details dt:nth-of-type(odd),
.license-details dd:nth-of-type(odd) {
  background: var(--row-odd);
}

.license-details dt:nth-of-type(even),
.license-details dd:nth-of-type(even) {
  background: var(--row-even);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: var(--overlay);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 70px var(--shadow);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
}

.modal-close {
  flex: 0 0 auto;
}

.button,
button {
  min-height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: white;
  background: var(--brand);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  border-color: var(--line);
  color: var(--text);
  background: var(--panel);
}

button.danger {
  background: var(--danger);
}

form {
  display: grid;
  gap: 14px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 15px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.full {
  grid-column: 1 / -1;
}

.flash {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--success-bg);
  color: var(--success-text);
  font-weight: 700;
}

.flash.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.inline-notice {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--success-text);
  background: var(--success-bg);
  font-size: 13px;
  font-weight: 800;
}

.inline-notice[hidden] {
  display: none;
}

.login {
  width: min(420px, calc(100% - 28px));
  margin: 70px auto;
}

.login .panel {
  display: grid;
  gap: 16px;
}

.logbox {
  max-height: 560px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--log-bg);
  color: var(--log-text);
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.deploy-log-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.deploy-progress {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.deploy-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.deploy-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.deploy-progress-track div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
  transition: width 240ms ease;
}

.release-archives {
  margin-bottom: 18px;
}

.release-archives table {
  min-width: 640px;
}

.docker-status {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.docker-status h2 {
  margin-bottom: 0;
}

.docker-status .button-row {
  margin-bottom: 0;
}

.docker-status-table table {
  min-width: 520px;
}

.deploy-targets {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.deploy-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.deploy-main-grid .panel {
  margin-top: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  nav {
    justify-content: flex-start;
  }

  .grid,
  .fields {
    grid-template-columns: 1fr;
  }

  .deploy-main-grid {
    grid-template-columns: 1fr;
  }

  .modal-head {
    flex-direction: column;
  }

  .license-details {
    grid-template-columns: 1fr;
  }

  .license-details dd {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
}
