:root {
  --bg: #eef4ff;
  --bg-soft: #f6f9ff;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --text: #0f1b3d;
  --muted: #6d7891;
  --line: #dce6f6;
  --primary: #3167f4;
  --primary-dark: #17307f;
  --success: #16a36c;
  --danger: #e44747;
  --warning: #f1a208;
  --shadow: 0 20px 60px rgba(28, 58, 130, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(49, 103, 244, 0.16), transparent 34rem),
    linear-gradient(135deg, var(--bg-soft) 0%, var(--bg) 100%);
}

.top-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.top-progress.active {
  opacity: 1;
}

.top-progress span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #2f68ff, #72a2ff, transparent);
  animation: progress-slide 1.05s ease-in-out infinite;
}

@keyframes progress-slide {
  from { transform: translateX(-120%); }
  to { transform: translateX(360%); }
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(220, 230, 246, 0.8);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #fff;
  font-weight: 800;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 14px 32px rgba(49, 103, 244, 0.28);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  padding: 13px 15px;
  color: var(--muted);
  text-align: left;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: #edf3ff;
}

.nav-separator {
  display: block;
  height: 1px;
  margin: 8px 10px;
  background: var(--line);
}

.main {
  padding: 30px;
}

.section-actions,
.project-toolbar,
.quick-actions,
.card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.project-toolbar {
  justify-content: space-between;
  margin: -8px 0 18px;
}

.project-toolbar .input:first-child {
  min-width: min(100%, 340px);
}

.project-list {
  display: grid;
  gap: 10px;
}

.project-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(130px, auto) auto;
  align-items: center;
  gap: 16px;
  padding: 15px 18px;
  border: 1px solid rgba(220, 230, 246, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 28px rgba(28, 58, 130, 0.06);
}

.project-row:hover {
  border-color: #bfd0f7;
}

.project-row-main h3,
.project-row-main p,
.project-row-status small {
  margin: 0;
}

.project-row-main p,
.project-row small,
.project-row-status small {
  color: var(--muted);
}

.project-row-main small,
.project-row-status small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.project-row-status {
  display: grid;
  justify-items: start;
  gap: 5px;
}

.project-workspace {
  min-height: 520px;
}

.icon-theme-scope .project-nav,
.icon-theme-scope .workspace-panel,
.icon-theme-scope .editor-panel,
.icon-theme-scope .editor-sections,
.icon-theme-scope .editor-overview {
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
}

.icon-theme-scope .project-nav-item:hover,
.icon-theme-scope .project-nav-item.active,
.icon-theme-scope .editor-section-button:hover,
.icon-theme-scope .editor-section-button.active {
  background: color-mix(in srgb, var(--primary) 10%, #fff);
}

.create-project-head {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.create-project-head .ghost {
  justify-self: start;
}

.create-project-head h2,
.create-project-head p {
  margin-bottom: 4px;
}

.create-project-steps {
  display: flex;
  align-items: center;
  max-width: 460px;
  gap: 10px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.create-project-steps span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.create-project-steps span b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--muted);
  border-radius: 50%;
  background: #e3eaf8;
  font-size: 12px;
}

.create-project-steps span.active {
  color: var(--text);
}

.create-project-steps span.active b {
  color: #fff;
  background: var(--primary);
}

.create-project-steps i {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.create-project-content {
  max-width: 960px;
}

.create-template-step .section-head {
  align-items: end;
}

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

.create-template-card {
  display: flex;
  flex-direction: column;
  min-height: 232px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.create-template-card h3 {
  margin-top: 16px;
}

.create-template-card p {
  flex: 1;
  margin-bottom: 9px;
  font-size: 14px;
}

.create-template-card small {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
}

.create-template-card.unavailable {
  opacity: 0.66;
}

.create-template-card .primary {
  width: 100%;
}

.create-project-form {
  display: grid;
  gap: 20px;
}

.create-template-summary {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border: 1px solid #cbd9f5;
  border-radius: 16px;
  background: #f1f6ff;
}

.create-template-summary h3,
.create-template-summary p,
.create-template-summary small {
  margin: 0;
}

.create-template-summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.create-template-summary .secondary {
  margin-left: auto;
}

.create-advanced {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-soft);
}

.create-advanced summary {
  padding: 15px 16px;
  font-weight: 750;
  cursor: pointer;
}

.create-advanced > .form-grid {
  padding: 2px 16px 16px;
}

.create-actions {
  justify-content: space-between;
}

.create-actions > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-context-head {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

.project-context-head .ghost {
  justify-self: start;
}

.project-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.project-identity h2,
.project-identity p {
  margin-bottom: 4px;
}

.project-workspace-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}

.project-nav {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(220, 230, 246, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
}

.project-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px;
  color: var(--muted);
  text-align: left;
  border: 0;
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
}

.project-nav-item span {
  width: 14px;
  color: var(--primary);
  font-weight: 800;
  text-align: center;
}

.project-nav-item:hover,
.project-nav-item.active {
  color: var(--text);
  background: #edf3ff;
}

.project-workspace-main,
.workspace-overview {
  display: grid;
  gap: 16px;
}

.workspace-panel {
  padding: 22px;
  border: 1px solid rgba(220, 230, 246, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 34px rgba(28, 58, 130, 0.07);
}

.completion-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 260px);
  align-items: end;
  gap: 20px;
}

.completion-card h2 {
  margin-bottom: 2px;
  font-size: 42px;
}

.completion-card p:last-child {
  margin-bottom: 0;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7eefb;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.2s ease;
}

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

.checklist-item,
.attention-item,
.settings-shortcut {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  cursor: pointer;
}

.checklist-item:hover,
.attention-item:hover,
.settings-shortcut:hover {
  border-color: #bcd0fb;
  background: #f1f6ff;
}

.checklist-item > span,
.attention-item > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--muted);
  border-radius: 50%;
  background: #e5eaf3;
  font-size: 13px;
  font-weight: 900;
}

.checklist-item.complete > span {
  color: #086145;
  background: #d9f8e9;
}

.checklist-item.warning > span {
  color: #795800;
  background: #fff3d1;
}

.checklist-item.error > span {
  color: #a51f1f;
  background: #ffe2e2;
}

.checklist-item div,
.attention-item div,
.settings-shortcut div {
  min-width: 0;
}

.checklist-item strong,
.checklist-item small,
.attention-item strong,
.attention-item small,
.settings-shortcut strong,
.settings-shortcut small {
  display: block;
}

.checklist-item small,
.attention-item small,
.settings-shortcut small {
  margin-top: 3px;
  color: var(--muted);
}

.attention-panel {
  border-color: #f4d990;
  background: #fffdf7;
}

.attention-panel > .eyebrow {
  color: #a76f00;
}

.attention-item {
  margin-top: 8px;
  background: #fff;
}

.attention-item b,
.settings-shortcut b {
  margin-left: auto;
  color: var(--primary);
}

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

.key-value div {
  padding: 12px;
  border-radius: 12px;
  background: var(--panel-soft);
}

.key-value dt {
  color: var(--muted);
  font-size: 12px;
}

.key-value dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.build-preflight-summary {
  display: grid;
  gap: 7px;
  margin: 16px 0;
}

.build-preflight-summary p {
  margin: 0;
}

.build-preflight-summary .complete { color: #087050; }
.build-preflight-summary .error { color: #b12e2e; }
.build-preflight-summary .incomplete { color: #906400; }

.badge.archived {
  color: #586579;
  background: #e8edf5;
}

.archived-project-panel {
  max-width: 720px;
  border-color: #cad4e3;
  background: #f8fafc;
}

.project-action-list {
  display: grid;
  grid-template-columns: 1fr;
}

.danger-icon {
  color: #a51f1f;
  background: #ffe2e2;
}

.settings-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.settings-shortcut > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--primary);
  border-radius: 11px;
  background: #eaf1ff;
  font-weight: 800;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 6px;
  font-size: 17px;
}

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

.active-account,
.panel,
.hero-card,
.card,
.template-card,
.build-item {
  border: 1px solid rgba(220, 230, 246, 0.9);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.active-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 220px;
  padding: 14px 18px;
  border-radius: 18px;
}

.active-account span {
  display: block;
}

.active-account span {
  color: var(--muted);
  font-size: 12px;
}

.active-account-picker {
  max-width: 190px;
  margin-top: 3px;
  padding: 0;
  color: var(--text);
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.server-status {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 6px 9px;
  color: #086145 !important;
  border-radius: 999px;
  background: #ddf8ed;
  font-size: 11px !important;
  font-weight: 800;
}

.server-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a36c;
  box-shadow: 0 0 0 3px rgba(22, 163, 108, 0.12);
}

.server-status.loading {
  color: #795800 !important;
  background: #fff3d1;
}

.server-status.loading i {
  background: var(--warning);
  animation: status-pulse 1s ease-in-out infinite;
}

.server-status.offline {
  color: #9f1f1f !important;
  background: #ffe8e8;
}

.server-status.offline i {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(228, 71, 71, 0.12);
}

@keyframes status-pulse {
  50% { opacity: 0.35; }
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: page-in 0.18s ease-out;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  margin-bottom: 24px;
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(236, 243, 255, 0.88)),
    radial-gradient(circle at bottom right, rgba(49, 103, 244, 0.18), transparent 24rem);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.keystore-layout {
  margin-top: 22px;
}

.account-keystore-section {
  min-width: 0;
  margin: 20px 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8faff;
}

.account-keystore-section legend {
  padding: 0 7px;
  color: #293758;
  font-size: 13px;
  font-weight: 800;
}

.account-keystore-toggle {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.account-keystore-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
}

#accountKeystoreFields {
  margin-top: 16px;
}

.inline-select {
  display: block;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.inline-select .input {
  margin-top: 4px;
}

.panel {
  padding: 22px;
  border-radius: var(--radius);
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #293758;
  font-size: 13px;
  font-weight: 700;
}

.optional-label {
  display: inline-flex;
  margin-left: 5px;
  padding: 2px 7px;
  color: #65718b;
  border-radius: 999px;
  background: #edf2fa;
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

.field-help {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.input {
  width: 100%;
  padding: 13px 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #fbfdff;
  transition: 0.16s ease;
}

.input:focus {
  border-color: rgba(49, 103, 244, 0.72);
  box-shadow: 0 0 0 4px rgba(49, 103, 244, 0.12);
}

.input[readonly],
.locked-field {
  color: #52617d;
  background: #eef3fb;
  cursor: not-allowed;
}

.input.compact {
  max-width: 320px;
}

.primary,
.secondary,
.danger,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 11px 16px;
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

button.busy {
  pointer-events: none;
}

button.busy::before {
  content: "";
  width: 15px;
  height: 15px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin 0.7s linear infinite;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #2449c9);
  box-shadow: 0 12px 26px rgba(49, 103, 244, 0.26);
}

.secondary {
  color: var(--text);
  background: #edf3ff;
}

.danger {
  color: #fff;
  background: var(--danger);
}

.ghost {
  color: var(--primary);
  background: transparent;
}

.primary:hover,
.secondary:hover,
.danger:hover,
.ghost:hover {
  transform: translateY(-1px);
}

.primary:active,
.secondary:active,
.danger:active,
.ghost:active {
  transform: translateY(0) scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.card,
.template-card,
.build-item {
  padding: 18px;
  border-radius: var(--radius);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.app-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  color: #fff;
  font-weight: 900;
  border-radius: 15px;
  background: linear-gradient(135deg, #1e63ff, #17276f);
  overflow: hidden;
}

.app-icon.app-icon-image::before {
  content: attr(data-initials);
}

.app-icon.app-icon-image:has(img)::before {
  content: '';
}

.app-icon.app-icon-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 10px;
  color: #294062;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  background: #edf3ff;
}

.badge.success {
  color: #086145;
  background: #ddf8ed;
}

.badge.failed {
  color: #9f1f1f;
  background: #ffe8e8;
}

.badge.soon {
  color: #845b00;
  background: #fff3d1;
}

.card-actions,
.template-actions,
.build-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.list {
  display: grid;
  gap: 12px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.list-row.active {
  border-color: rgba(49, 103, 244, 0.6);
  background: #edf3ff;
}

.path-list {
  display: grid;
  gap: 10px;
}

.path-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.path-row code {
  overflow-wrap: anywhere;
  color: #233767;
}

.path-row .card-actions {
  margin-top: 0;
}

.build-list {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.build-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.release-summary {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(49, 103, 244, 0.22);
  border-radius: 10px;
  background: #f6f9ff;
  color: #294170;
  font-size: 0.82rem;
}

.release-summary strong {
  color: #1d54d8;
  letter-spacing: 0.04em;
}

#releasePreflight {
  white-space: pre-wrap;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.device-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.device-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.device-card h3,
.device-card p {
  margin: 0;
}

.device-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.device-card.active {
  border-color: rgba(49, 103, 244, 0.6);
  background: #edf3ff;
}

.device-tools {
  margin-bottom: 18px;
}

.log-view {
  min-height: 280px;
  max-height: 460px;
  padding: 18px;
  overflow: auto;
  color: #d9e6ff;
  border-radius: 20px;
  background: #0b1024;
  box-shadow: var(--shadow);
}

.toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 110;
  display: grid;
  width: min(420px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  max-width: 420px;
  padding: 14px 18px;
  color: #fff;
  border-radius: 16px;
  background: #17276f;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toast-in 0.22s ease-out;
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: #17276f;
  border-radius: 50%;
  background: #fff;
  font-size: 14px;
  font-weight: 900;
}

.toast-message {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.toast-close {
  width: 30px;
  height: 30px;
  padding: 0;
  color: rgba(255, 255, 255, 0.82);
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.toast.error {
  background: var(--danger);
}

.toast.info {
  background: #294062;
}

.toast.leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: 0.18s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hidden {
  display: none;
}

.dialog {
  width: min(760px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(5, 15, 45, 0.28);
}

.dialog.wide {
  width: min(1100px, calc(100vw - 32px));
}

.dialog::backdrop {
  background: rgba(10, 20, 45, 0.42);
  backdrop-filter: blur(4px);
}

.dialog form {
  padding: 24px;
}

.confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  text-align: center;
}

.confirm-dialog .dialog-actions {
  justify-content: center;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  color: #9f1f1f;
  border-radius: 17px;
  background: #ffe8e8;
  font-size: 24px;
  font-weight: 900;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-head {
  margin-bottom: 18px;
}

.dialog-actions {
  margin-top: 18px;
}

.dialog-actions.split {
  align-items: start;
}

.dialog-actions.split > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--text);
  border: 0;
  border-radius: 14px;
  background: #edf3ff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

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

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

.empty {
  padding: 26px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #c4d4ee;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
}

.loading-card {
  display: grid;
  gap: 12px;
  min-height: 160px;
  padding: 22px;
  border: 1px solid rgba(220, 230, 246, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.loading-card.compact-loader {
  min-height: 100px;
}

.loading-card span {
  display: block;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eef9;
}

.loading-card span:first-child {
  width: 58%;
  height: 24px;
}

.loading-card span:last-child {
  width: 78%;
}

.loading-card span::after {
  content: "";
  display: block;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  animation: skeleton-slide 1.2s ease-in-out infinite;
}

.editor-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.editor-app-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
}

.editor-app-summary strong {
  font-size: 18px;
}

.editor-app-summary small {
  grid-column: 2;
  margin-top: 3px;
  color: var(--success);
  font-weight: 700;
}

.editor-app-summary small.pending {
  color: #986800;
}

.editor-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.editor-sections {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.editor-section-button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px;
  color: var(--muted);
  text-align: left;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
}

.editor-section-button span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #edf3ff;
  font-size: 12px;
  font-weight: 900;
}

.editor-section-button strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-section-button:hover,
.editor-section-button.active {
  color: var(--text);
  background: #edf3ff;
}

.editor-section-button.active span {
  color: #fff;
  background: var(--primary);
}

.editor-panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.editor-section-head {
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.editor-section-head p:last-child {
  margin-bottom: 0;
}

.editor-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid #d8e4f5;
  border-radius: 17px;
  background: #f8fbff;
}

.editor-overview-item {
  min-width: 0;
}

.editor-overview-item span,
.asset-mode {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.editor-overview-item strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snapshot-controls .card-actions {
  margin-top: 8px;
}

.snapshot-controls .input.compact {
  min-width: 150px;
}

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

.editor-field.full-width {
  grid-column: 1 / -1;
}

.workspace-theme-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}

.workspace-theme-panel h3,
.workspace-theme-panel p {
  margin-bottom: 4px;
}

.workspace-theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-theme-swatches span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.workspace-theme-swatches i {
  width: 15px;
  height: 15px;
  border: 1px solid rgba(15, 27, 61, 0.14);
  border-radius: 50%;
}

.file-field {
  position: relative;
  min-height: 154px;
  padding: 14px;
  border: 1px dashed #b8c9e6;
  border-radius: 17px;
  background: #f8fbff;
}

.file-field input[type="file"] {
  padding: 9px;
  background: #fff;
}

.asset-current {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  margin-top: 10px;
  padding: 9px;
  border-radius: 13px;
  background: #edf3ff;
}

.asset-preview {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  margin-top: 10px;
}

.asset-preview img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid #d8e4f5;
  border-radius: 12px;
  background: #fff;
}

.asset-preview-copy {
  min-width: 0;
}

.asset-mode.custom {
  color: #086145;
}

.asset-mode.default {
  color: #526580;
}

.asset-reset {
  margin-top: 9px;
}

.asset-current img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 12px;
  background: #fff;
}

.asset-current span {
  min-width: 0;
  overflow: hidden;
  color: #40506d;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-input-wrap {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 9px;
}

.color-input-wrap input[type="color"] {
  width: 52px;
  height: 48px;
  padding: 4px;
}

.editor-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.editor-footer > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-build-actions {
  display: grid;
  gap: 14px;
}

.build-ready-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid #c9eedd;
  border-radius: 19px;
  background: #effcf6;
}

.build-ready-card h3,
.build-ready-card p {
  margin-bottom: 4px;
}

.build-icon {
  flex: 0 0 auto;
  margin: 0;
  color: #086145;
  background: #d9f8e9;
}

@keyframes skeleton-slide {
  from { transform: translateX(-130%); }
  to { transform: translateX(340%); }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .nav-separator {
    display: none;
  }

  .nav-item {
    min-width: 0;
    padding: 10px 4px;
    overflow: hidden;
    font-size: 11px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .hero-card,
  .section-head,
  .two-column,
  .editor-layout,
  .project-workspace-layout,
  .dialog-actions.split {
    display: grid;
    grid-template-columns: 1fr;
  }

  .active-account,
  .input.compact {
    max-width: none;
    width: 100%;
  }

  .section-actions,
  .project-toolbar {
    align-items: stretch;
  }

  .project-toolbar .input:first-child {
    min-width: 0;
    width: 100%;
  }

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

  .project-row-status,
  .project-row .card-actions {
    grid-column: 2;
  }

  .project-nav {
    position: static;
    display: flex;
    overflow-x: auto;
  }

  .project-nav-item {
    flex: 0 0 auto;
    width: auto;
  }

  .completion-card,
  .checklist,
  .settings-shortcuts,
  .key-value,
  .create-template-grid {
    grid-template-columns: 1fr;
  }

  .create-template-step .section-head,
  .create-template-summary,
  .create-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .create-template-summary .secondary {
    margin-left: 0;
  }

  .create-actions > div,
  .create-actions button {
    width: 100%;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
  }

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

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

  .editor-sections {
    position: static;
    display: flex;
    overflow-x: auto;
  }

  .editor-section-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 128px;
  }

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

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

  .editor-footer,
  .editor-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-footer > div,
  .editor-footer button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* APKFlow V1.1 — balanced operational workspace */
:root {
  --apkflow-navy: #0b1220;
  --apkflow-purple: #6366f1;
  --apkflow-blue: #3b82f6;
  --apkflow-teal: #14b8a6;
  --apkflow-surface: #f8fafc;
  --apkflow-border: #e5e7eb;
  --apkflow-text: #0f172a;
  --apkflow-muted: #64748b;
  --apkflow-gradient: linear-gradient(135deg, #6366f1 0%, #3b82f6 52%, #14b8a6 100%);
  --bg: var(--apkflow-surface);
  --panel: #fff;
  --panel-soft: #f8fafc;
  --text: var(--apkflow-text);
  --muted: var(--apkflow-muted);
  --line: var(--apkflow-border);
  --primary: var(--apkflow-purple);
  --primary-dark: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
  --radius: 16px;
}

body {
  font-family: Poppins, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--apkflow-surface);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.32);
  outline-offset: 2px;
}

.app-shell {
  grid-template-columns: 256px minmax(0, 1fr);
  background: var(--apkflow-surface);
  transition: grid-template-columns 0.18s ease;
}

.sidebar {
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  color: #d7e1f2;
  border-right: 0;
  background: var(--apkflow-navy);
  backdrop-filter: none;
  transition: width 0.18s ease, transform 0.18s ease;
}

.brand {
  min-height: 42px;
  margin: 0 8px 28px;
}

.brand-logo {
  display: block;
  width: min(168px, 100%);
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.brand-mark {
  display: none;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.sidebar-toggle {
  position: absolute;
  top: 24px;
  right: -14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #dce6f7;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: #18233a;
  cursor: pointer;
}

.sidebar-toggle span { font-size: 24px; line-height: 1; }

nav { gap: 5px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 10px 12px;
  color: #a9b8cf;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
}

.nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 18px;
  width: 18px;
  font-size: 16px;
  line-height: 1;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.2);
}

.nav-separator { margin: 10px 8px; background: rgba(229, 231, 235, 0.16); }

.sidebar-collapsed .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
.sidebar-collapsed .sidebar { padding-right: 12px; padding-left: 12px; }
.sidebar-collapsed .brand { justify-content: center; margin-right: 0; margin-left: 0; }
.sidebar-collapsed .brand-logo,
.sidebar-collapsed .nav-label { display: none; }
.sidebar-collapsed .brand-mark { display: block; }
.sidebar-collapsed .nav-item { justify-content: center; padding-right: 0; padding-left: 0; }
.sidebar-collapsed .sidebar-toggle span { transform: rotate(180deg); }

.main { padding: 24px; }

.topbar {
  gap: 16px;
  margin-bottom: 22px;
}

.topbar > div:first-of-type { min-width: 0; }

h1 { font-size: clamp(30px, 3vw, 32px); line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

.eyebrow { margin-bottom: 5px; color: var(--apkflow-blue); font-size: 11px; letter-spacing: 0.08em; }

.active-account,
.panel,
.card,
.template-card,
.build-item,
.workspace-panel,
.project-row {
  border-color: var(--apkflow-border);
  background: #fff;
  box-shadow: var(--shadow);
}

.active-account {
  min-width: 210px;
  padding: 10px 13px;
  border-radius: 14px;
}

.active-account-picker { max-width: 178px; }

.server-status { padding: 5px 8px; }

.primary,
.secondary,
.danger,
.ghost {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
}

.primary { background: var(--apkflow-gradient); box-shadow: 0 6px 14px rgba(99, 102, 241, 0.2); }
.secondary { color: #24324b; background: #eff4fb; }
.ghost { color: var(--apkflow-blue); }

/* Keep launcher-icon palettes inside the active project workspace/editor. */
.icon-theme-scope .primary { background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 6px 14px color-mix(in srgb, var(--primary) 24%, transparent); }
.icon-theme-scope .ghost,
.icon-theme-scope .eyebrow { color: var(--primary); }
.icon-theme-scope .input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }

.input {
  min-height: 40px;
  padding: 9px 12px;
  border-color: var(--apkflow-border);
  border-radius: 11px;
  background: #fff;
}

.input:focus { border-color: var(--apkflow-blue); box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16); }

.badge { min-height: 23px; padding: 4px 8px; font-size: 11px; }
.app-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--apkflow-gradient); }

.dashboard-welcome,
.continue-project-card,
.dashboard-empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--apkflow-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.dashboard-welcome { margin-bottom: 14px; }
.dashboard-welcome h2 { margin-bottom: 5px; }
.dashboard-welcome p:last-child { max-width: 680px; margin-bottom: 0; }
.dashboard-welcome .primary { background: var(--apkflow-gradient); }

.dashboard-continue { margin-bottom: 14px; }
.continue-project-copy { min-width: 0; }
.continue-project-title { display: flex; align-items: center; gap: 11px; }
.continue-project-title h2,
.continue-project-title p { margin-bottom: 2px; }
.compact-progress { width: min(460px, 100%); height: 7px; margin: 14px 0 6px; overflow: hidden; border-radius: 999px; background: #eaf0f8; }
.compact-progress span { display: block; height: 100%; border-radius: inherit; background: var(--apkflow-teal); }
.continue-project-card small { color: var(--muted); font-size: 12px; }

.quick-action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.quick-action { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 13px; color: var(--text); text-align: left; border: 1px solid var(--apkflow-border); border-radius: 14px; background: #fff; box-shadow: var(--shadow); cursor: pointer; }
.quick-action:hover { border-color: rgba(59, 130, 246, 0.5); }
.quick-action span:not(.quick-action-icon) { min-width: 0; }
.quick-action strong,
.quick-action small { display: block; }
.quick-action small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.quick-action b { margin-left: auto; color: var(--apkflow-blue); }
.quick-action-icon { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; color: #fff; border-radius: 10px; background: var(--apkflow-blue); font-size: 16px; }
.quick-action-icon.asset { background: var(--apkflow-teal); }
.quick-action-icon.listing { background: var(--warning); }
.quick-action-icon.build { background: var(--apkflow-purple); }

.dashboard-empty-state { justify-content: flex-start; min-height: 180px; }
.dashboard-empty-state img { width: 148px; height: 128px; object-fit: contain; }
.dashboard-empty-state h2 { margin-bottom: 5px; }
.dashboard-empty-state p { max-width: 520px; }
.compact-empty { padding: 18px; }

.section-head { gap: 14px; margin: 20px 0 12px; }
.recent-project-list,
.project-list { display: grid; gap: 8px; }
.recent-project-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--apkflow-border);
  border-radius: 14px;
  background: #fff;
}
.recent-project-main { min-width: 0; }
.recent-project-main h3,
.recent-project-main p { margin: 0; }
.recent-project-main p,
.recent-project-main small { color: var(--muted); font-size: 12px; }
.recent-project-main small { display: block; margin-top: 3px; }
.recent-project-row .card-actions { margin: 0; }
.compact-icon { width: 36px; height: 36px; font-size: 16px; }

.project-row { gap: 14px; padding: 12px 14px; border-radius: 14px; }
.project-row .card-actions { margin-top: 0; }

.create-project-head { gap: 12px; margin-bottom: 14px; }
.create-project-steps { margin-bottom: 16px; }
.create-template-grid { gap: 10px; margin-top: 12px; }
.create-template-card { min-height: 0; padding: 16px; border-radius: 14px; }
.create-template-card h3 { margin-top: 12px; }
.create-project-form { gap: 16px; }

.project-context-head { gap: 12px; margin-bottom: 16px; }
.project-workspace-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
.project-nav { top: 16px; padding: 7px; border-color: var(--apkflow-border); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.project-nav-item { min-height: 38px; padding: 9px; border-radius: 9px; font-size: 13px; }
.workspace-panel { padding: 18px; border-radius: 16px; }
.project-workspace-main,
.workspace-overview { gap: 12px; }
.completion-card { gap: 16px; }
.completion-card h2 { font-size: 32px; }
.workflow-stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.workflow-stages span { padding: 7px 8px; overflow: hidden; color: var(--muted); text-align: center; border: 1px solid var(--apkflow-border); border-radius: 9px; background: #fff; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.workflow-stages .complete { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.workflow-stages .warning { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.checklist-item,
.attention-item,
.settings-shortcut { gap: 10px; padding: 11px; border-radius: 12px; }

.template-card,
.build-item,
.card { padding: 16px; border-radius: 16px; }
.template-card { display: flex; flex-direction: column; min-height: 0; }
.template-card h2 { margin-top: 12px; }
.template-card p { margin-bottom: 10px; }
.template-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; color: var(--muted); font-size: 11px; }
.template-meta span { max-width: 100%; padding: 4px 7px; overflow: hidden; border-radius: 999px; background: #f1f5f9; text-overflow: ellipsis; white-space: nowrap; }
.template-actions,
.build-actions { margin-top: 12px; }

.build-item { box-shadow: none; }
.build-item .card-top { margin-bottom: 7px; }
.build-summary { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.build-pagination { margin-top: 0; }
.release-details { margin: 8px 0; border: 1px solid var(--apkflow-border); border-radius: 10px; background: #f8fafc; }
.release-details summary { padding: 9px 11px; color: #334155; cursor: pointer; font-size: 12px; font-weight: 700; }
.release-summary { margin: 0; border: 0; border-top: 1px solid var(--apkflow-border); border-radius: 0; background: transparent; font-size: 12px; }

.settings-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.settings-page-head h2 { margin-bottom: 5px; }
.settings-page-head p:last-child { margin-bottom: 0; }
.segmented-control { display: inline-flex; padding: 4px; border: 1px solid var(--apkflow-border); border-radius: 11px; background: #fff; }
.segment-button { min-height: 34px; padding: 7px 11px; color: var(--muted); border: 0; border-radius: 8px; background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.segment-button.active { color: #fff; background: var(--apkflow-blue); }
.settings-tab-panel[hidden] { display: none; }
.two-column { gap: 16px; }
.panel { padding: 18px; border-radius: 16px; }
.keystore-layout { margin-top: 0; }
.account-keystore-section { margin: 16px 0 12px; padding: 14px; border-radius: 13px; }
label { gap: 6px; margin-bottom: 11px; font-size: 12px; }
.path-row { grid-template-columns: 160px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; }

.editor-topbar { gap: 12px; margin-bottom: 14px; }
.editor-app-summary strong { font-size: 16px; }
.editor-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 14px; }
.editor-sections { top: 16px; gap: 4px; padding: 7px; border-radius: 14px; box-shadow: var(--shadow); }
.editor-section-button { grid-template-columns: 26px minmax(0, 1fr); gap: 8px; min-height: 42px; padding: 8px; border-radius: 10px; }
.editor-section-button span { width: 26px; height: 26px; border-radius: 8px; }
.editor-panel { padding: 20px; border-radius: 16px; box-shadow: var(--shadow); }
.editor-section-head { padding-bottom: 12px; margin-bottom: 14px; }
.editor-overview { gap: 8px; padding: 11px; margin-bottom: 14px; border-radius: 12px; }
.editor-fields { gap: 12px; }
.workspace-theme-panel { gap: 10px; padding: 14px; border-radius: 14px; }
.file-field { min-height: 132px; padding: 12px; border-radius: 14px; }
.editor-footer { padding-top: 12px; margin-top: 16px; }
.build-ready-card { gap: 12px; padding: 14px; border-radius: 14px; }

.settings-shortcuts { gap: 10px; margin-bottom: 14px; }
.settings-shortcut > span { width: 30px; height: 30px; border-radius: 9px; }
.device-card { padding: 12px 14px; border-radius: 12px; }
.log-view { min-height: 240px; padding: 14px; border-radius: 14px; box-shadow: none; }

.dialog { border-radius: 16px; box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22); }
.dialog form { padding: 20px; }
.dialog > .dialog-head,
.dialog > p,
.dialog > .dialog-actions { margin-right: 20px; margin-left: 20px; }
.dialog > .dialog-head { margin-top: 20px; }
.icon-button { width: 36px; height: 36px; border-radius: 10px; font-size: 22px; }
.confirm-icon { width: 46px; height: 46px; margin-bottom: 12px; border-radius: 14px; }

.mobile-menu-toggle,
.sidebar-backdrop { display: none; }

@media (min-width: 768px) and (max-width: 1099px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .brand { justify-content: center; margin-right: 0; margin-left: 0; }
  .brand-logo,
  .nav-label { display: none; }
  .brand-mark { display: block; }
  .nav-item { justify-content: center; padding-right: 0; padding-left: 0; }
  .sidebar-tablet-expanded .app-shell { grid-template-columns: 256px minmax(0, 1fr); }
  .sidebar-tablet-expanded .sidebar { padding-right: 14px; padding-left: 14px; }
  .sidebar-tablet-expanded .brand { justify-content: flex-start; margin-right: 8px; margin-left: 8px; }
  .sidebar-tablet-expanded .brand-logo,
  .sidebar-tablet-expanded .nav-label { display: block; }
  .sidebar-tablet-expanded .brand-mark { display: none; }
  .sidebar-tablet-expanded .nav-item { justify-content: flex-start; padding-right: 12px; padding-left: 12px; }
  .sidebar-collapsed .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .main { padding: 20px; }
  .quick-action-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  body { overflow-x: hidden; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 256px;
    height: 100dvh;
    transform: translateX(-100%);
  }
  .sidebar-toggle { display: none; }
  .brand-logo { display: block; }
  .brand-mark { display: none; }
  .nav-label { display: block; }
  .nav-item { justify-content: flex-start; padding-right: 12px; padding-left: 12px; }
  .mobile-menu-toggle { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; padding: 0; color: #fff; border: 0; border-radius: 10px; background: var(--apkflow-navy); font-size: 19px; }
  .mobile-navigation-open .sidebar { transform: translateX(0); }
  .mobile-navigation-open .sidebar-backdrop { position: fixed; inset: 0; z-index: 19; display: block; background: rgba(15, 23, 42, 0.42); }
  .main { padding: 16px; }
  .topbar { align-items: flex-start; gap: 10px; margin-bottom: 18px; }
  .topbar > div:first-of-type { flex: 1; }
  .topbar .eyebrow { display: none; }
  h1 { font-size: 28px; }
  .active-account { min-width: 0; padding: 9px 10px; }
  .active-account > div > span { font-size: 10px; }
  .active-account-picker { max-width: 135px; font-size: 12px; }
  .dashboard-welcome,
  .continue-project-card,
  .dashboard-empty-state { align-items: flex-start; flex-direction: column; gap: 14px; padding: 16px; }
  .dashboard-welcome .primary,
  .continue-project-card .primary { width: 100%; }
  .dashboard-empty-state img { width: 112px; height: 96px; }
  .quick-action-grid { grid-template-columns: 1fr; gap: 8px; margin-bottom: 18px; }
  .recent-project-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
  .recent-project-status { grid-column: 2; }
  .recent-project-row .card-actions { grid-column: 3; grid-row: 1 / span 2; }
  .recent-project-row .secondary { display: none; }
  .project-row { grid-template-columns: auto minmax(0, 1fr); }
  .project-row-status,
  .project-row .card-actions { grid-column: 2; }
  .create-template-grid { grid-template-columns: 1fr; }
  .project-workspace-layout,
  .editor-layout { grid-template-columns: 1fr; }
  .project-nav,
  .editor-sections { position: static; display: flex; overflow-x: auto; box-shadow: none; }
  .project-nav-item,
  .editor-section-button { flex: 0 0 auto; width: auto; min-width: 118px; }
  .workflow-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-stages span:last-child { grid-column: span 2; }
  .completion-card { grid-template-columns: 1fr; }
  .settings-page-head { align-items: flex-start; flex-direction: column; }
  .settings-page-head .segmented-control { width: 100%; }
  .segment-button { flex: 1; }
  .path-row { grid-template-columns: 1fr; gap: 5px; }
  .path-row .card-actions { margin-top: 4px; }
  .dialog { width: min(100% - 24px, 760px); }
  .dialog form { padding: 18px; }
  .dialog > .dialog-head,
  .dialog > p,
  .dialog > .dialog-actions { margin-right: 18px; margin-left: 18px; }
  .dialog > .dialog-head { margin-top: 18px; }
}

/* ==========================================================================
   STORAGE MANAGER & CACHE CLEANER WIDGET
   ========================================================================== */
.storage-panel {
  margin-bottom: 24px;
}
.storage-summary-widget {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}
.storage-bar-track {
  display: flex;
  height: 16px;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(220, 230, 246, 0.6);
}
.storage-bar-segment {
  height: 100%;
  transition: width 0.3s ease;
}
.storage-bar-segment.projects { background: #3167f4; }
.storage-bar-segment.outputs { background: #16a36c; }
.storage-bar-segment.logs { background: #f1a208; }
.storage-bar-segment.uploads { background: #8b5cf6; }
.storage-bar-segment.backups { background: #64748b; }

.storage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.storage-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.storage-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.storage-legend-dot.projects { background: #3167f4; }
.storage-legend-dot.outputs { background: #16a36c; }
.storage-legend-dot.logs { background: #f1a208; }
.storage-legend-dot.uploads { background: #8b5cf6; }
.storage-legend-dot.backups { background: #64748b; }

.storage-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 6px;
}
.storage-stat-card {
  padding: 14px 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.storage-stat-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.storage-stat-card strong {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

/* ==========================================================================
   STORE LISTING PLAY STORE MODULE
   ========================================================================== */
.store-listing-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.store-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.store-field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.store-char-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.store-char-count.warning {
  color: #d97706;
}
.store-char-count.danger {
  color: var(--danger);
}

/* ==========================================================================
   VISUAL BUILD STEP PROGRESS BAR
   ========================================================================== */
.build-progress-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  padding: 14px;
  background: rgba(49, 103, 244, 0.05);
  border: 1px solid rgba(49, 103, 244, 0.15);
  border-radius: 16px;
  margin-bottom: 18px;
}
.build-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
}
.build-step.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(49, 103, 244, 0.12);
  border: 1px solid rgba(49, 103, 244, 0.3);
}
.build-step.completed {
  background: rgba(22, 163, 108, 0.1);
  color: var(--success);
}
.build-step-num {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  font-size: 11px;
}
.build-step.active .build-step-num {
  background: var(--primary);
  color: #fff;
}
.build-step.completed .build-step-num {
  background: var(--success);
  color: #fff;
}

/* ==========================================================================
   QR CODE DIALOG & BUTTONS
   ========================================================================== */
.qr-dialog {
  max-width: 420px;
  text-align: center;
}
.qr-container {
  display: grid;
  place-items: center;
  padding: 20px;
  margin: 14px 0;
  background: #ffffff;
  border: 2px dashed var(--line);
  border-radius: 16px;
}
.qr-container svg {
  width: 200px;
  height: 200px;
}
.qr-url-box {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.qr-url-box input {
  font-family: monospace;
  font-size: 12px;
}
.btn-qr {
  padding: 6px 10px;
  font-size: 12px;
}

/* ==========================================================================
   BUILD FILTER CHIPS
   ========================================================================== */
.build-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 8px;
}
.filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.filter-chip:hover {
  color: var(--text);
  border-color: rgba(49, 103, 244, 0.4);
}
.filter-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(49, 103, 244, 0.25);
}

/* Managed BUSSID content library */
.content-library { position: relative; }
.content-library-head { align-items: flex-start; gap: 16px; }
.content-library-head > div { min-width: 0; }
.content-library-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.content-cache-status { display: block; margin-top: 6px; color: var(--muted); }
.content-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.content-stat-grid > div { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft, #f8fafc); }
.content-stat-grid small, .content-stat-grid strong { display: block; }
.content-stat-grid small { color: var(--muted); font-size: 12px; }
.content-stat-grid strong { margin-top: 4px; font-size: 20px; }
.content-library-controls { display: grid; grid-template-columns: minmax(180px, 1.6fr) minmax(130px, .8fr) minmax(140px, .8fr) auto auto; align-items: center; gap: 9px; margin-bottom: 16px; }
.content-library-controls input, .content-library-controls select { min-width: 0; height: 40px; }
.content-search { display: block; }
.content-catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; min-height: 190px; }
.content-catalog-card { position: relative; display: grid; grid-template-rows: 112px auto; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); cursor: pointer; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.content-catalog-card:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); box-shadow: var(--shadow); }
.content-catalog-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 16%, transparent); }
.content-card-image { position: relative; display: grid; place-items: center; background: #edf2f7; overflow: hidden; color: var(--muted); }
.content-card-image img { width: 100%; height: 100%; object-fit: cover; }
.content-card-image > span { display: none; font-size: 26px; }
.content-card-image.image-fallback > span { display: block; }
.content-card-body { display: grid; gap: 3px; padding: 10px; min-width: 0; }
.content-card-body strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.content-card-body small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 11px; }
.content-catalog-card input { position: absolute; top: 9px; right: 9px; width: 18px; height: 18px; accent-color: var(--primary); }
.content-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 66px; color: var(--muted); font-size: 12px; }
.content-selection-summary { position: sticky; bottom: 10px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 92%, white); box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.content-selection-summary.has-draft { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.content-selection-summary strong, .content-selection-summary small { display: block; }
.content-selection-summary small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.content-library-loading { display: grid; min-height: 230px; place-items: center; color: var(--muted); }
.content-library-warning { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 16px; padding: 10px 12px; border: 1px solid #f59e0b; border-radius: 12px; background: #fffbeb; color: #92400e; font-size: 13px; }
.content-library-warning span { flex: 1 1 220px; }
.button-link.disabled { pointer-events: none; opacity: .5; }

@media (max-width: 900px) {
  .content-library-controls { grid-template-columns: 1fr 1fr; }
  .content-library-controls .content-search { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .content-library-head, .content-selection-summary { align-items: stretch; flex-direction: column; }
  .content-library-head-actions { justify-content: stretch; }
  .content-stat-grid { grid-template-columns: 1fr 1fr; }
  .content-library-controls { grid-template-columns: 1fr 1fr; }
  .content-library-controls select { width: 100%; }
  .content-catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .content-catalog-card { grid-template-rows: 96px auto; }
  .content-pagination { flex-wrap: wrap; margin-bottom: 78px; }
  .content-selection-summary .card-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .content-selection-summary .card-actions .primary { grid-column: 1 / -1; }
}

/* ==========================================================================
   DEFAULT JSON MODAL & BUTTONS
   ========================================================================== */
.json-modal {
  width: min(100% - 32px, 600px);
  max-width: 600px;
}
.json-code-container {
  position: relative;
  margin: 14px 0 16px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}
.json-code-view {
  margin: 0;
  padding: 16px;
  max-height: 340px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: #38bdf8;
  white-space: pre;
  tab-size: 2;
}
.json-code-view .json-key { color: #93c5fd; }
.json-code-view .json-string { color: #86efac; }
.json-code-view .json-number { color: #fde047; }
.json-code-view .json-boolean { color: #f472b6; }
.json-code-view .json-null { color: #cbd5e1; }

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.btn-text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  color: var(--primary);
  background: rgba(49, 103, 244, 0.08);
  border: 1px solid rgba(49, 103, 244, 0.2);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-text-link:hover {
  background: rgba(49, 103, 244, 0.15);
  border-color: var(--primary);
}
.btn-default-json {
  font-size: 11.5px;
}
.copy-hint {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
  transition: opacity 0.2s ease;
}
