:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #f9faf7;
  --ink: #202421;
  --muted: #68706a;
  --line: #d9ded5;
  --accent: #167c6b;
  --accent-ink: #ffffff;
  --blue: #2f6fbd;
  --amber: #b86e00;
  --red: #b42318;
  --green: #198754;
  --shadow: 0 18px 48px rgba(31, 41, 35, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(22, 124, 107, 0.08), transparent 34%),
    linear-gradient(180deg, #faf8f1 0%, var(--bg) 38%, #eff3f1 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

button:hover {
  border-color: rgba(22, 124, 107, 0.48);
  transform: translateY(-1px);
}

button:disabled {
  cursor: progress;
  opacity: 0.62;
  transform: none;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.browser-gate {
  display: grid;
  min-height: calc(100vh - 40px);
  place-items: center;
  padding: 24px;
}

.browser-gate-panel {
  display: grid;
  justify-items: center;
  width: min(520px, 100%);
  gap: 18px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  text-align: center;
}

.browser-gate-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  background: #202421;
  color: #f4c95d;
  font-size: 24px;
  font-weight: 800;
}

.browser-gate-panel h1 {
  font-size: 24px;
}

.browser-gate-panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.primary-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.browser-gate-meta {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-install-panel {
  align-content: center;
}

.share-install-meta {
  display: grid;
  width: 100%;
  gap: 10px;
  margin: 0;
  text-align: left;
}

.share-install-meta div {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.share-install-meta dt {
  color: var(--muted);
  font-size: 12px;
}

.share-install-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 650;
}

.share-content-section {
  width: 100%;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.share-content-section h2 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.share-content-section ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 10px 0 18px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #202421;
  color: #f4c95d;
  font-weight: 800;
  flex: 0 0 auto;
}

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

h1 {
  font-size: 23px;
  line-height: 1.15;
}

.brand p,
.section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.topbar-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 21px;
}

.primary-button {
  padding: 0 14px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}

.secondary-button {
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
}

.share-install-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  gap: 10px;
}

.share-install-actions button {
  min-width: 136px;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.overview-strip div {
  min-width: 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.86);
}

.overview-strip span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.overview-strip strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-feedback {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(22, 124, 107, 0.2);
  border-radius: 8px;
  background: rgba(230, 242, 238, 0.72);
  color: var(--ink);
}

.action-feedback strong {
  font-size: 13px;
}

.action-feedback span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.action-feedback.warning {
  border-color: rgba(184, 110, 0, 0.3);
  background: rgba(255, 246, 223, 0.76);
}

.action-feedback.error {
  border-color: rgba(172, 61, 42, 0.28);
  background: rgba(255, 237, 232, 0.76);
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  margin-top: 18px;
}

.main-column,
.side-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.main-column,
.status-panel,
.waitpoint-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.main-column {
  padding: 16px;
}

.status-panel,
.waitpoint-panel {
  padding: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.section-heading h2 {
  font-size: 16px;
  line-height: 1.25;
}

.compact-heading {
  margin-top: 2px;
  padding-top: 4px;
}

.inline-heading span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.segmented {
  display: flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: #203b35;
  color: white;
}

.task-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px 88px;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.task-title {
  min-width: 0;
}

.task-title strong {
  display: block;
  overflow: hidden;
  margin-bottom: 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-title span,
.task-meta {
  color: var(--muted);
  font-size: 12px;
}

.task-meta {
  display: grid;
  justify-items: start;
  gap: 5px;
}

.task-hint {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.task-hint.running {
  color: var(--blue);
}

.task-hint.warning {
  color: var(--amber);
}

.task-hint.done {
  color: var(--green);
}

.task-hint.failed {
  color: var(--red);
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e7ebe4;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.status-pill.running {
  background: rgba(47, 111, 189, 0.12);
  color: var(--blue);
}

.status-pill.waiting,
.status-pill.warning {
  background: rgba(184, 110, 0, 0.13);
  color: var(--amber);
}

.status-pill.done,
.status-pill.ready {
  background: rgba(25, 135, 84, 0.12);
  color: var(--green);
}

.status-pill.muted {
  background: rgba(104, 112, 106, 0.12);
  color: var(--muted);
}

.status-pill.failed {
  background: rgba(180, 35, 24, 0.1);
  color: var(--red);
}

.waitpoint-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  background: #fffaf1;
}

.waitpoint-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.waitpoint-main h3 {
  font-size: 15px;
  line-height: 1.35;
}

.waitpoint-main p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.waitpoint-reply {
  display: grid;
  gap: 10px;
}

.waitpoint-reply textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid rgba(184, 110, 0, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
}

.waitpoint-reply textarea:focus {
  border-color: rgba(22, 124, 107, 0.65);
  outline: 2px solid rgba(22, 124, 107, 0.14);
}

.priority-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(184, 110, 0, 0.12);
  flex: 0 0 auto;
}

.status-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.status-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-height: 42px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.status-row:first-child {
  border-top: 0;
}

.status-row strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.status-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.status-row em {
  display: block;
  margin-top: 3px;
  color: #7b857d;
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

.status-actions {
  display: flex;
  grid-column: 2;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}

.status-actions button {
  min-height: 30px;
  max-width: 100%;
  padding: 0 10px;
  font-size: 12px;
  white-space: normal;
}

.status-actions select {
  min-height: 32px;
  max-width: 100%;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}

.reuse-share {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.reuse-share label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.reuse-share textarea,
.reuse-share input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font:
    13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  padding: 10px 12px;
}

.reuse-share textarea {
  min-height: 180px;
  resize: vertical;
}

.inline-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}

.status-dot.warning,
.status-dot.waiting {
  background: var(--amber);
}

.status-dot.failed {
  background: var(--red);
}

.status-dot.muted {
  background: #b9c3ba;
}

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

.resource-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.resource-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.resource-list strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.resource-list em {
  display: block;
  margin-top: 3px;
  color: #7b857d;
  font-size: 11px;
  font-style: normal;
}

.resource-list button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.content-drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 36, 33, 0.22);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(640px, 100vw);
  height: 100%;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -18px 0 48px rgba(31, 41, 35, 0.14);
}

.drawer-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-panel header span {
  color: var(--muted);
  font-size: 12px;
}

.drawer-panel header h2 {
  margin-top: 4px;
  font-size: 18px;
}

.drawer-panel header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.drawer-panel pre {
  margin: 0;
  overflow: auto;
  padding: 18px;
  color: var(--ink);
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(22, 124, 107, 0.28);
  border-radius: 8px;
  background: rgba(32, 36, 33, 0.96);
  color: white;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 960px) {
  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .overview-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .section-heading,
  .waitpoint-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .button-row,
  .share-install-actions,
  .segmented {
    width: 100%;
  }

  .primary-button,
  .button-row button,
  .share-install-actions button,
  .segmented button {
    flex: 1;
  }

  .overview-strip {
    grid-template-columns: 1fr;
  }

  .task-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

}

.empty-row {
  padding: 18px;
  border: 1px dashed rgba(108, 122, 113, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
}

.error-row {
  border-color: rgba(172, 61, 42, 0.28);
  color: #9c3325;
}

.priority-dot.muted {
  background: #b9c3ba;
  box-shadow: none;
}
