/* Warm, colorful operations UI built on the existing compact admin layout. */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/admin/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  --apple-blue: #0066cc;
  --apple-focus: #0071e3;
  --apple-ink: #1d1d1f;
  --apple-muted: #7a7a7a;
  --apple-canvas: #ffffff;
  --apple-parchment: #f5f5f7;
  --apple-pearl: #fafafc;
  --apple-hairline: #e0e0e0;
  --release-workspace-height: clamp(680px, calc(100vh - 132px), 920px);
  font-family: "Inter Variable", "Microsoft YaHei UI", "PingFang SC", system-ui, -apple-system, sans-serif;
  color: var(--apple-ink);
  background: var(--apple-parchment);
  font-synthesis: none;
}

* {
  letter-spacing: 0 !important;
}

[hidden] {
  display: none !important;
}

body {
  color: var(--apple-ink);
  background: var(--apple-parchment);
  font-size: 14px;
  line-height: 1.43;
}

button,
input,
select {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--apple-focus);
  outline-offset: 2px;
}

button:active,
.primary:active,
.release-actions a:active {
  transform: scale(.95);
}

.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;
}

.brand {
  gap: 12px;
}

.brand > img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.brand strong {
  color: var(--apple-ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.24;
}

.brand small {
  margin-top: 4px;
  color: var(--apple-muted);
  font-size: 12px;
  line-height: 1;
}

.app-view {
  min-height: 100vh;
  grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 17px 12px;
  color: #fff8f3;
  background: linear-gradient(180deg, #4a2d26 0%, #37231f 56%, #281a18 100%);
  border-right: 1px solid rgba(65, 35, 29, .7);
  box-shadow: 8px 0 28px rgba(54, 31, 26, .12);
}

.sidebar .brand {
  padding: 0 8px 17px;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
}

.sidebar .brand > img {
  box-shadow: 0 7px 18px rgba(10, 7, 6, .28);
}

.sidebar .brand strong {
  color: #ffffff;
}

.sidebar .brand small {
  color: rgba(255, 244, 237, .68);
}

.sidebar nav {
  margin-top: 17px;
  gap: 8px;
}

.sidebar nav button {
  height: 44px;
  padding: 0 12px;
  gap: 12px;
  color: rgba(255, 248, 243, .88);
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 11px;
  font-size: 14px;
  font-weight: 400;
}

.sidebar nav button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .26);
}

.sidebar nav button.active {
  color: #321c17;
  background: linear-gradient(135deg, #ffb65f 0%, #ff8268 100%);
  border-color: rgba(255, 221, 178, .92);
  box-shadow: 0 8px 20px rgba(15, 8, 6, .2);
  font-weight: 600;
}

.sidebar nav button.active .nav-icon {
  color: #321c17;
}

.sidebar nav button.active .nav-label {
  color: #321c17;
}

.sidebar nav button:not(.active) .nav-icon {
  color: rgba(255, 244, 237, .72);
}

.sidebar nav button .nav-label {
  display: inline;
  color: inherit;
  font: inherit;
}

.nav-icon,
.footer-icon,
.icon-button::before,
.search-shell::before,
.select-shell::after {
  display: block;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.nav-icon {
  width: 19px;
  height: 19px;
  color: rgba(255, 244, 237, .72);
}

.icon-dashboard { -webkit-mask-image: url("/admin/icons/layout-dashboard.svg"); mask-image: url("/admin/icons/layout-dashboard.svg"); }
.icon-license { -webkit-mask-image: url("/admin/icons/key-round.svg"); mask-image: url("/admin/icons/key-round.svg"); }
.icon-release { -webkit-mask-image: url("/admin/icons/package-check.svg"); mask-image: url("/admin/icons/package-check.svg"); }
.icon-audit { -webkit-mask-image: url("/admin/icons/scroll-text.svg"); mask-image: url("/admin/icons/scroll-text.svg"); }
.icon-security { -webkit-mask-image: url("/admin/icons/shield-check.svg"); mask-image: url("/admin/icons/shield-check.svg"); }
.icon-external { -webkit-mask-image: url("/admin/icons/external-link.svg"); mask-image: url("/admin/icons/external-link.svg"); }
.icon-logout { -webkit-mask-image: url("/admin/icons/log-out.svg"); mask-image: url("/admin/icons/log-out.svg"); }

.sidebar footer {
  padding: 17px 4px 0;
  gap: 4px;
  border-top-color: rgba(255, 255, 255, .15);
}

.sidebar footer a,
.sidebar footer button {
  height: 36px;
  gap: 8px;
  padding: 0 8px;
  color: rgba(255, 248, 243, .82);
  font-size: 13px;
}

.footer-icon {
  width: 16px;
  height: 16px;
  color: rgba(255, 244, 237, .62);
}

.workspace {
  padding: 24px 32px 40px;
}

.topbar {
  min-height: 64px;
  border-bottom-color: var(--apple-hairline);
}

.topbar small,
.login-copy p,
dialog header small {
  color: var(--apple-blue);
  font-size: 12px;
  font-weight: 600;
}

.topbar h1 {
  margin: 4px 0 0;
  color: var(--apple-ink);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.19;
}

.server-state {
  color: var(--apple-muted);
  font-size: 12px;
}

.server-state i {
  background: #1f9d73;
}

.view {
  padding-top: 17px;
}

.global-message,
.form-error {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.43;
}

.global-message {
  color: #174f86;
  background: #eef6ff;
  border-color: #bad7f2;
}

.metric-grid {
  gap: 12px;
}

.metric,
.panel,
.table-panel {
  color: var(--apple-ink);
  background: var(--apple-canvas);
  border: 1px solid var(--apple-hairline);
  border-radius: 8px;
  box-shadow: none;
}

.metric {
  min-height: 112px;
  padding: 17px;
  border-top-width: 3px;
  box-shadow: 0 9px 22px rgba(35, 29, 46, .065);
  transition: transform .18s ease, box-shadow .18s ease;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 13px 28px rgba(35, 29, 46, .1);
}

.metric span,
.metric small {
  color: var(--apple-muted);
  font-size: 12px;
}

.metric strong {
  margin-top: 12px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.14;
}

.metric-coral {
  background: linear-gradient(135deg, #fff8f8 0%, #ffe6ea 100%);
  border-color: #ffc6cf;
  border-top-color: #ff6b7a;
}

.metric-coral strong { color: #bc3148; }

.metric-green {
  background: linear-gradient(135deg, #f5fff9 0%, #dcf8e8 100%);
  border-color: #b9e9cb;
  border-top-color: #29a96b;
}

.metric-green strong { color: #167a4a; }

.metric-purple {
  background: linear-gradient(135deg, #fbf8ff 0%, #eee4ff 100%);
  border-color: #d9c8fa;
  border-top-color: #8a5be0;
}

.metric-purple strong { color: #6840b2; }

.metric-yellow {
  background: linear-gradient(135deg, #fffdf5 0%, #fff0bd 100%);
  border-color: #f1da87;
  border-top-color: #e0a516;
}

.metric-yellow strong { color: #966b00; }

.dashboard-grid,
.release-layout {
  gap: 12px;
}

.panel {
  padding: 17px;
}

.panel > header {
  min-height: 44px;
}

.panel h2 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.24;
}

.panel header p {
  margin-top: 4px;
  color: var(--apple-muted);
  font-size: 12px;
  line-height: 1.43;
}

.panel header button,
.panel header a {
  color: var(--apple-blue);
  font-size: 14px;
  font-weight: 400;
}

.compact-list > article,
.audit-list > article,
.release-summary > article,
.release-list > article {
  min-height: 64px;
  padding: 12px 0;
  gap: 12px;
  border-top-color: #f0f0f0;
}

.compact-list strong,
.release-summary strong,
.release-list strong {
  font-size: 14px;
  font-weight: 600;
}

.compact-list small,
.release-summary small,
.release-list small {
  margin-top: 4px;
  color: var(--apple-muted);
  font-size: 12px;
  line-height: 1.43;
}

.audit-list > article {
  grid-template-columns: 160px minmax(0, 1fr) 140px;
  font-size: 13px;
}

.audit-list time,
.audit-list small {
  color: var(--apple-muted);
  font-size: 12px;
}

.tag {
  padding: 4px 8px;
  color: #125d45;
  background: #e9f7f2;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.tag.expired,
.tag.revoked {
  color: #9b2c2c;
  background: #fff0f0;
}

.primary,
.login-form button {
  height: 44px;
  padding: 0 22px;
  color: #ffffff;
  background: var(--apple-blue);
  border: 1px solid var(--apple-blue);
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
}

.primary:hover,
.login-form button:hover {
  background: var(--apple-focus);
}

input,
select {
  height: 44px;
  padding: 0 14px;
  color: var(--apple-ink);
  background: var(--apple-canvas);
  border: 1px solid var(--apple-hairline);
  border-radius: 11px;
  font-size: 14px;
  outline: 0;
}

input:focus,
select:focus {
  border-color: var(--apple-focus);
  box-shadow: none;
}

.actionbar {
  margin-bottom: 12px;
  align-items: center;
  gap: 12px;
}

.filters {
  gap: 8px;
}

.filters input {
  width: min(380px, 34vw);
}

.search-shell,
.select-shell {
  position: relative;
  display: block;
}

.search-shell::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 14px;
  left: 15px;
  width: 16px;
  height: 16px;
  color: var(--apple-muted);
  -webkit-mask-image: url("/admin/icons/search.svg");
  mask-image: url("/admin/icons/search.svg");
  pointer-events: none;
}

.search-shell input {
  padding-left: 42px;
  border-radius: 9999px;
}

.select-shell select {
  width: 132px;
  padding-right: 38px;
  appearance: none;
  cursor: pointer;
}

.select-shell::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 16px;
  height: 16px;
  color: var(--apple-muted);
  -webkit-mask-image: url("/admin/icons/chevron-down.svg");
  mask-image: url("/admin/icons/chevron-down.svg");
  pointer-events: none;
}

.table-panel {
  overflow: auto;
}

.license-table-panel,
.audit-table-panel {
  max-height: calc(100vh - 165px);
}

table {
  font-size: 14px;
}

thead {
  position: sticky;
  z-index: 2;
  top: 0;
}

th {
  height: 44px;
  padding: 0 12px;
  color: #333333;
  background: var(--apple-parchment);
  font-size: 12px;
  font-weight: 600;
}

td {
  height: 72px;
  padding: 12px;
  border-top-color: #f0f0f0;
  font-size: 14px;
  line-height: 1.43;
}

td strong {
  font-size: 14px;
  font-weight: 600;
}

td small {
  margin-top: 4px;
  color: var(--apple-muted);
  font-size: 12px;
  line-height: 1.43;
}

td code,
.release-list > article code {
  color: #333333;
  font: 600 12px ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.license-table-panel table {
  min-width: 1380px;
}

.license-table-panel th:nth-child(1) { width: 150px; }
.license-table-panel th:nth-child(2) { width: 180px; }
.license-table-panel th:nth-child(3) { width: 290px; }
.license-table-panel th:nth-child(4) { width: 90px; }
.license-table-panel th:nth-child(5) { width: 230px; }
.license-table-panel th:nth-child(6) { width: 230px; }
.license-table-panel th:nth-child(7) { width: 110px; }
.license-table-panel th:nth-child(8) { width: 210px; }

.copy-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-field > span,
.copy-field > code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-field > code {
  max-width: 230px;
}

.entitlement-cell {
  color: #333333;
  white-space: nowrap;
}

.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: #333333;
  background: var(--apple-pearl);
  border: 1px solid var(--apple-hairline);
  border-radius: 8px;
}

.icon-button::before {
  content: "";
  width: 16px;
  height: 16px;
}

.copy-button::before {
  -webkit-mask-image: url("/admin/icons/copy.svg");
  mask-image: url("/admin/icons/copy.svg");
}

.copy-button.copied {
  color: #125d45;
  background: #e9f7f2;
  border-color: #b9dfd2;
}

.copy-button.copied::before {
  -webkit-mask-image: url("/admin/icons/check.svg");
  mask-image: url("/admin/icons/check.svg");
}

td .actions {
  gap: 6px;
  flex-wrap: wrap;
}

td button {
  height: 32px;
  padding: 0 10px;
  color: #333333;
  background: var(--apple-canvas);
  border: 1px solid var(--apple-hairline);
  border-radius: 8px;
  font-size: 12px;
}

td button.danger,
.delete-button {
  color: #9b2c2c;
}

.audit-table-panel table {
  min-width: 960px;
}

.audit-table-panel th:nth-child(1) { width: 190px; }
.audit-table-panel th:nth-child(2) { width: 180px; }
.audit-table-panel th:nth-child(4) { width: 160px; }
.audit-table-panel th:nth-child(5) { width: 170px; }

#audit-table td,
#audit-table td strong {
  font-size: 14px;
  line-height: 1.5;
}

#audit-table td code {
  font-size: 12px;
}

.release-layout {
  margin-top: 0;
  grid-template-columns: minmax(380px, .9fr) minmax(460px, 1.1fr);
  align-items: stretch;
  min-height: var(--release-workspace-height);
}

.release-upload-stack {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px;
  height: var(--release-workspace-height);
}

.release-panel {
  height: var(--release-workspace-height);
  align-self: stretch;
  overflow: hidden;
}

.upload-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-top-width: 3px;
}

.upload-panel-installer {
  background: linear-gradient(145deg, #ffffff 0%, #f1f7ff 100%);
  border-color: #cbdcf3;
  border-top-color: #3f82e5;
}

.upload-panel-portable {
  background: linear-gradient(145deg, #ffffff 0%, #f7f2ff 100%);
  border-color: #ddd0f3;
  border-top-color: #8b5acb;
}

.release-kind-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  margin-bottom: 7px;
  padding: 0 9px;
  color: #255c9e;
  background: #e7f1ff;
  border: 1px solid #c8dcf7;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
}

.upload-panel-portable .release-kind-badge {
  color: #68409b;
  background: #f0e8ff;
  border-color: #d8c7f1;
}

.upload-panel form {
  margin-top: 8px;
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 10px;
}

.upload-panel form .primary {
  width: 100%;
  margin-top: auto;
}

.upload-panel progress {
  width: 100%;
  height: 6px;
  accent-color: var(--apple-blue);
}

.upload-panel label > span,
.form-grid label > span,
.security-panel label > span,
.login-form label > span {
  color: #333333;
  font-size: 14px;
  font-weight: 600;
}

.file-field input {
  padding: 8px;
  border-radius: 11px;
}

.file-field em {
  color: var(--apple-muted);
  font-size: 12px;
}

.release-panel {
  display: flex;
  flex-direction: column;
}

.release-panel > header {
  flex: 0 0 auto;
}

.release-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  grid-auto-rows: minmax(84px, auto);
  align-content: start;
}

.release-list > article {
  grid-template-columns: minmax(0, 1fr) auto;
}

.release-details {
  min-width: 0;
}

.release-details strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.release-details small,
.release-details code {
  overflow-wrap: anywhere;
}

.release-details code {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latest-badge {
  padding: 3px 7px;
  color: var(--apple-blue);
  background: #eef6ff;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.release-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.release-actions .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  line-height: 1;
}

.release-actions .icon-button::before {
  margin: 0;
}

.release-summary a {
  height: 32px;
  padding: 0 12px;
  color: var(--apple-blue);
  background: var(--apple-pearl);
  border: 1px solid var(--apple-hairline);
  border-radius: 9999px;
  font-size: 12px;
}

.release-list .release-actions a {
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--apple-blue);
  background: var(--apple-pearl);
  border: 1px solid var(--apple-hairline);
  border-radius: 8px;
}

.download-button::before {
  -webkit-mask-image: url("/admin/icons/download.svg");
  mask-image: url("/admin/icons/download.svg");
}

.delete-button::before {
  -webkit-mask-image: url("/admin/icons/trash-2.svg");
  mask-image: url("/admin/icons/trash-2.svg");
}

.security-panel {
  max-width: 680px;
}

.security-panel form {
  margin-top: 12px;
}

.login-view {
  grid-template-columns: minmax(440px, 560px) minmax(360px, 1fr);
  background: #272729;
}

.login-panel {
  background: var(--apple-canvas);
}

.login-copy h1 {
  color: var(--apple-ink);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.47;
}

.login-copy > span,
.login-aside > p {
  font-size: 14px;
  line-height: 1.43;
}

.login-aside {
  color: #ffffff;
  background: #272729;
}

.login-aside h2 {
  font-size: 28px;
  font-weight: 600;
}

.login-aside dt,
.login-aside dd,
.login-panel > footer {
  font-size: 12px;
}

dialog {
  border: 1px solid var(--apple-hairline);
  border-radius: 11px;
  box-shadow: none;
}

dialog::backdrop {
  background: rgba(0, 0, 0, .42);
  backdrop-filter: saturate(180%) blur(20px);
}

dialog form,
dialog > section {
  padding: 24px;
}

dialog h2 {
  font-size: 21px;
  font-weight: 600;
}

dialog header > button {
  width: 32px;
  height: 32px;
  background: var(--apple-parchment);
  border-radius: 9999px;
}

dialog form > p,
dialog section > p,
.generated-keys small {
  color: var(--apple-muted);
  font-size: 12px;
  line-height: 1.43;
}

dialog footer button {
  height: 36px;
  padding: 0 15px;
  border-radius: 8px;
  font-size: 14px;
}

.generated-keys article {
  padding: 12px;
  background: var(--apple-parchment);
  border-color: var(--apple-hairline);
  border-radius: 8px;
}

.generated-keys code {
  color: var(--apple-blue);
  font-size: 13px;
}

@media (max-width: 1050px) {
  .app-view {
    grid-template-columns: 196px minmax(0, 1fr);
  }

  .workspace {
    padding-inline: 20px;
  }

  .release-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .release-upload-stack {
    height: auto;
    grid-template-rows: repeat(2, minmax(340px, auto));
  }

  .upload-panel {
    min-height: 340px;
  }

  .release-panel {
    height: 600px;
  }
}

@media (max-width: 700px) {
  .app-view {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(65, 35, 29, .7);
  }

  .sidebar .brand {
    padding-bottom: 12px;
  }

  .sidebar nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    overflow-x: visible;
  }

  .sidebar nav button {
    height: 58px;
    padding: 6px 4px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
  }

  .sidebar nav button .nav-icon {
    display: block;
  }

  .sidebar nav button .nav-label {
    display: block;
  }

  .sidebar footer {
    display: none;
  }

  .workspace {
    padding: 17px 9px 32px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .server-state {
    margin-top: 4px;
  }

  .server-state time {
    display: none;
  }

  .metric-grid {
    gap: 8px;
  }

  .filters {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .search-shell {
    grid-column: 1 / -1;
  }

  .filters input,
  .filters .select-shell select {
    width: 100%;
  }

  .actionbar {
    align-items: flex-end;
    flex-wrap: wrap;
  }

  .table-panel {
    max-width: calc(100vw - 18px);
  }

  .release-upload-stack {
    grid-template-rows: repeat(2, minmax(350px, auto));
  }

  .upload-panel {
    min-height: 350px;
  }

  .release-panel {
    height: min(620px, calc(100vh - 110px));
  }

  .release-list > article {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  dialog .form-grid {
    grid-template-columns: 1fr;
  }
}
