:root {
  --bg: #f6f5f0;
  --panel: #ffffff;
  --panel-soft: #faf9f5;
  --ink: #1c2024;
  --muted: #6a7078;
  --line: #d8d3c7;
  --line-strong: #c3bbad;
  --accent: #2368a2;
  --accent-strong: #174d79;
  --green: #207453;
  --green-soft: #e7f2eb;
  --amber: #9a6918;
  --amber-soft: #f7ead1;
  --red: #a03a32;
  --red-soft: #f6dddd;
  --cyan: #dff0f3;
  --violet: #ece6f4;
  --shadow: 0 14px 34px rgba(35, 35, 32, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 224px minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 224px minmax(220px, 1fr) auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 245, 240, 0.96);
  padding: 0 22px;
  backdrop-filter: blur(12px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark,
.app-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.brand-mark {
  background: #202429;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
}

.brand-meta {
  overflow: hidden;
  max-width: 150px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  padding: 0 12px;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 0 0 9px;
}

.top-actions,
.head-actions,
.detail-actions,
.panel-toolbar,
.section-row,
.qr-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions {
  justify-content: flex-end;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.server-pill,
.status-badge,
.platform-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.server-pill {
  gap: 7px;
  border: 1px solid #b7d5c4;
  background: var(--green-soft);
  color: var(--green);
  padding: 0 10px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-ok {
  background: var(--green);
}

.dot-warn {
  background: #c78720;
}

.dot-cold {
  background: #6b7d87;
}

.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.nav-glyph {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  background: #ece9df;
  font-size: 11px;
  font-weight: 800;
}

.sidebar-status {
  position: absolute;
  right: 14px;
  bottom: 18px;
  left: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.side-label,
.side-value,
small {
  color: var(--muted);
  font-size: 12px;
}

.meter {
  overflow: hidden;
  height: 8px;
  margin: 9px 0;
  border-radius: 999px;
  background: #e8e3d8;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2368a2, #207453);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  letter-spacing: 0;
}

h3 {
  font-size: 14px;
  letter-spacing: 0;
}

.page-head p {
  margin-top: 4px;
  color: var(--muted);
}

.primary-button,
.secondary-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 8px;
  font-weight: 750;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid var(--accent-strong);
  background: var(--accent);
  color: #ffffff;
  padding: 0 14px;
}

.secondary-button,
.small-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.secondary-button {
  padding: 0 14px;
}

.small-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.apps-layout,
.release-layout,
.install-layout,
.settings-grid {
  display: grid;
  gap: 16px;
}

.apps-layout {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
}

.release-layout {
  grid-template-columns: minmax(0, 1fr) 330px;
}

.install-layout {
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.app-list-panel,
.app-detail-panel,
.release-side,
.install-config,
.install-phone-panel,
.settings-grid .panel {
  padding: 16px;
}

.panel-toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.segmented {
  display: inline-flex;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 3px;
}

.segmented button {
  min-height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 750;
}

.segmented button.is-selected {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(29, 28, 24, 0.11);
}

.app-list {
  display: grid;
  gap: 8px;
}

.app-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 66px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 9px;
  text-align: left;
}

.app-row:hover,
.app-row.is-selected {
  border-color: #9eb6c9;
  background: #f3f8fb;
}

.app-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.app-main strong,
.artifact-row strong,
.audit-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-icon-atlas {
  background: linear-gradient(145deg, #2368a2, #4aa67a);
}

.app-icon-forge {
  background: linear-gradient(145deg, #684f9e, #bd6f44);
}

.app-icon-field {
  background: linear-gradient(145deg, #1d7771, #c49837);
}

.app-icon-ledger {
  background: linear-gradient(145deg, #293644, #8a704f);
}

.app-icon-large {
  width: 52px;
  height: 52px;
  font-size: 15px;
}

.status-badge {
  padding: 0 9px;
}

.status-live {
  background: var(--green-soft);
  color: var(--green);
}

.status-beta {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-hold {
  background: var(--red-soft);
  color: var(--red);
}

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

.app-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.app-title p {
  overflow: hidden;
  max-width: 560px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-grid,
.channel-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric,
.channel-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.metric {
  display: grid;
  gap: 4px;
}

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

.metric strong {
  font-size: 23px;
}

.section-row {
  justify-content: space-between;
  margin: 18px 0 10px;
}

.channel-box {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 6px 9px;
}

.channel-box small {
  grid-column: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

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

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

.check-text {
  font-size: 13px;
  font-weight: 800;
}

.check-ok {
  color: var(--green);
}

.check-warn {
  color: var(--amber);
}

.artifact-list,
.audit-list,
.settings-list,
.check-list {
  display: grid;
  gap: 10px;
}

.artifact-row,
.audit-row {
  display: grid;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px 12px;
}

.artifact-row {
  grid-template-columns: 62px minmax(0, 1fr) auto;
}

.audit-row {
  grid-template-columns: 74px minmax(0, 1fr) auto;
}

.artifact-row div,
.audit-row div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.platform-badge {
  min-width: 54px;
  padding: 0 9px;
  text-transform: uppercase;
}

.ios {
  background: #e6edf6;
  color: #29496b;
}

.apk {
  background: var(--green-soft);
  color: var(--green);
}

.mac {
  background: var(--violet);
  color: #604c7e;
}

.linux {
  background: var(--amber-soft);
  color: var(--amber);
}

.win {
  background: var(--cyan);
  color: #235f6b;
}

.code-card {
  overflow: hidden;
  border: 1px solid #2e363f;
  border-radius: 8px;
  background: #202429;
  color: #f6f5f0;
  padding: 14px;
  word-break: break-word;
}

.code-card code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
}

.definition-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

.definition-list div {
  display: grid;
  gap: 3px;
}

.definition-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.definition-list dd {
  margin: 0;
  color: var(--ink);
}

.timeline-panel {
  margin-top: 16px;
  padding: 16px;
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.timeline li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.phone-frame {
  width: min(100%, 310px);
  margin: 0 auto;
  border: 9px solid #202429;
  border-radius: 34px;
  background: #202429;
  box-shadow: 0 22px 42px rgba(31, 31, 30, 0.22);
}

.phone-speaker {
  width: 84px;
  height: 5px;
  margin: 9px auto;
  border-radius: 999px;
  background: #454c55;
}

.mobile-page {
  display: grid;
  min-height: 520px;
  align-content: start;
  justify-items: center;
  gap: 12px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(246, 245, 240, 0.92), rgba(246, 245, 240, 0.98)),
    repeating-linear-gradient(45deg, #f2efe6 0, #f2efe6 12px, #ffffff 12px, #ffffff 24px);
  padding: 48px 22px 22px;
  text-align: center;
}

.mobile-page h2 {
  font-size: 22px;
}

.mobile-primary {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.mobile-platforms {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mobile-platforms span,
.mobile-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 9px;
  font-size: 12px;
  font-weight: 750;
}

.mobile-note {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}

.method-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px;
}

.method-detail.is-hidden {
  display: none;
}

.method-detail p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

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

.form-grid label,
.settings-list label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input[type="text"],
.form-grid input,
.settings-list input,
.search input {
  min-height: 36px;
}

.form-grid input,
.settings-list input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
}

.qr-row {
  align-items: center;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.qr-row div:last-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.qr-code {
  display: grid;
  flex: 0 0 auto;
  width: 86px;
  height: 86px;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  border: 8px solid #ffffff;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.qr-code span {
  background: #202429;
}

.qr-code span:nth-child(2),
.qr-code span:nth-child(6),
.qr-code span:nth-child(8),
.qr-code span:nth-child(12),
.qr-code span:nth-child(16),
.qr-code span:nth-child(18),
.qr-code span:nth-child(22) {
  background: #ffffff;
}

.audit-kind {
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #ece9df;
  color: #4c5359;
  font-size: 12px;
  font-weight: 800;
}

.settings-list {
  margin-top: 14px;
}

.check-list {
  margin-top: 14px;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 0 10px;
  color: var(--ink);
}

@media (max-width: 1080px) {
  .apps-layout,
  .release-layout,
  .install-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .app-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .release-side {
    order: -1;
  }
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 4px;
    min-height: 54px;
    padding: 6px;
    text-align: center;
    font-size: 12px;
  }

  .sidebar-status {
    position: static;
    margin-top: 10px;
  }

  .workspace {
    padding: 16px 14px 28px;
  }

  .page-head,
  .detail-top {
    display: grid;
  }

  .head-actions,
  .detail-actions {
    flex-wrap: wrap;
  }

  .app-list,
  .metric-grid,
  .channel-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .artifact-row,
  .audit-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .audit-kind,
  .platform-badge {
    justify-self: start;
  }

  .timeline li {
    grid-template-columns: 12px minmax(0, 1fr);
  }

  .timeline time {
    grid-column: 2;
  }

  .phone-frame {
    max-width: 290px;
  }
}

@media (max-width: 430px) {
  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
    min-width: 0;
    padding: 0 6px;
  }

  .qr-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
