:root {
  --bg: #f8f8f6;
  --surface: #ffffff;
  --surface-2: #f0f0ee;
  --silver: #ecece9;
  --text: #20201f;
  --muted: #71706c;
  --line: #deddd8;
  --accent: #ff6a1a;
  --accent-dark: #d9520e;
  --success: #287a4f;
  --shadow: 0 16px 40px rgba(33, 31, 28, .08);
  --radius: 8px;
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid rgba(255, 106, 26, .45);
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 18px 16px 96px;
  background:
    linear-gradient(180deg, #fff 0%, var(--bg) 38%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  margin-bottom: 14px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: #fff;
  background: #20201f;
  font-size: 15px;
  font-weight: 760;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.15;
  font-weight: 760;
}

.brand p {
  margin-top: 3px;
  color: var(--success);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 650;
}

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

.icon-button,
.quick-button {
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(33, 31, 28, .05);
}

.icon-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.setup-panel,
.pro-panel,
.access-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.setup-panel {
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(238, 238, 235, .88)),
    var(--surface);
}

.setup-panel h2,
.pro-panel h2,
.access-card h2 {
  font-size: 23px;
  line-height: 1.1;
  font-weight: 780;
}

.setup-panel p,
.pro-panel p,
.access-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.42;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.primary-action,
.secondary-action,
.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 720;
  text-align: center;
  text-decoration: none;
}

.primary-action {
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 12px 24px rgba(255, 106, 26, .25);
}

.primary-action:active {
  background: var(--accent-dark);
}

.text-action {
  padding: 0 4px;
  color: var(--muted);
  background: transparent;
}

.pro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
}

.pro-panel h2 {
  font-size: 20px;
}

.secondary-action {
  flex: 0 0 auto;
  width: 112px;
  padding: 0 13px;
  color: var(--text);
  background: var(--silver);
}

.priorities,
.content-section,
.quick-actions,
.tab-panel {
  margin-top: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h2 {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 760;
}

.section-title button {
  color: var(--accent-dark);
  background: transparent;
  font-size: 13px;
  font-weight: 680;
}

.chip-row,
.segment-control {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.chip-row::-webkit-scrollbar,
.segment-control::-webkit-scrollbar {
  display: none;
}

.search-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-field svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.chip,
.segment-control button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.chip.active,
.segment-control button.active {
  color: var(--text);
  border-color: rgba(255, 106, 26, .35);
  background: rgba(255, 106, 26, .09);
}

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

.material-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.material-card.locked {
  background: rgba(255, 255, 255, .62);
}

.material-card.locked h3,
.material-card.locked p {
  color: var(--muted);
}

.material-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.18;
  font-weight: 760;
}

.material-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

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

.package-list.compact {
  grid-template-columns: 1fr;
}

.package-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.package-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
}

.package-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.18;
  font-weight: 760;
}

.package-card p,
.package-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.package-actions {
  display: grid;
  align-content: space-between;
  justify-items: end;
  gap: 10px;
  min-width: 86px;
}

.package-actions span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 106, 26, .1);
  color: #9c3e08;
  font-size: 11px;
  font-weight: 760;
}

.package-actions button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 720;
}

.empty-state {
  min-height: 76px;
  padding: 18px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .62);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.status {
  align-self: start;
  min-width: 54px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-weight: 760;
  text-transform: lowercase;
}

.status.new {
  color: #9c3e08;
  background: rgba(255, 106, 26, .12);
}

.status.pro {
  color: #fff;
  background: #20201f;
}

.status.locked-status {
  color: #7b4a2f;
  background: rgba(123, 74, 47, .1);
}

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

.quick-button {
  gap: 7px;
  min-height: 66px;
  border-radius: var(--radius);
  color: var(--muted);
}

.quick-button span {
  max-width: 100%;
  color: inherit;
  font-size: 11px;
  font-weight: 680;
  line-height: 1.1;
}

.quick-button.accent {
  color: var(--accent-dark);
  border-color: rgba(255, 106, 26, .24);
  background: rgba(255, 106, 26, .08);
}

.tab-panel {
  padding-bottom: 10px;
}

.hidden {
  display: none;
}

.expanded {
  margin-top: 12px;
}

.access-card {
  padding: 18px;
}

.label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.access-card .primary-action {
  width: 100%;
}

.access-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.access-actions .primary-action,
.access-actions .secondary-action {
  width: 100%;
}

.route-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.route-summary strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  line-height: 1;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

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

.route-list,
.request-list {
  display: grid;
  gap: 10px;
}

.route-step,
.request-row {
  display: grid;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.route-step {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.route-step.locked {
  background: rgba(255, 255, 255, .62);
}

.route-step h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
}

.route-step p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.check-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.route-step.done .check-button {
  color: #fff;
  border-color: var(--success);
  background: var(--success);
}

.step-open {
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.request-row {
  display: block;
}

.request-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.request-row h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.request-row p,
.request-row small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.request-row .request-reply {
  color: var(--text);
}

.request-status {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.request-answered .request-status,
.request-in_work .request-status {
  color: #fff;
  background: var(--success);
}

.request-closed {
  opacity: .74;
}

.request-sheet input,
.request-sheet textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.copy-output {
  min-height: 220px;
  margin-bottom: 12px;
  padding: 12px;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.back-button {
  min-height: 38px;
  margin-bottom: 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.material-detail {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-kicker {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.material-detail h2 {
  font-size: 24px;
  line-height: 1.08;
  font-weight: 780;
}

.material-detail p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.detail-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-block h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 760;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.detail-tags span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 650;
}

.source-block code {
  display: block;
  margin-top: 10px;
  padding: 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.material-body h3 {
  margin-top: 0;
  font-size: 15px;
}

.material-body ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.material-body li + li {
  margin-top: 6px;
}

.material-body pre {
  margin: 12px 0 0;
  padding: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.material-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.detail-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.detail-actions .primary-action,
.detail-actions .secondary-action {
  width: 100%;
}

.secondary-action.wide {
  width: 100%;
}

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

.access-facts div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.access-facts dt,
.access-facts dd {
  margin: 0;
}

.access-facts dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.access-facts dd {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 760;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
  min-height: 74px;
  padding: 8px 12px 12px;
  transform: none;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 7px 4px;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
}

.bottom-nav svg {
  width: 19px;
  height: 19px;
}

.bottom-nav button.active {
  color: var(--accent-dark);
  background: rgba(255, 106, 26, .08);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 14px;
  transform: translateX(-50%) translateY(20px);
  border-radius: var(--radius);
  background: #20201f;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.request-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  padding: 16px;
  background: rgba(32, 32, 31, .32);
}

.request-sheet.hidden {
  display: none;
}

.sheet-panel {
  width: min(390px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  margin: 0 auto;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(33, 31, 28, .24);
}

.request-sheet label {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.request-sheet input {
  min-height: 42px;
  padding: 0 12px;
}

.request-sheet textarea {
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.35;
}

.request-sheet .primary-action {
  width: 100%;
  margin-top: 14px;
}

.request-output {
  min-height: 76px;
  margin: 12px 0 0;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (min-width: 700px) {
  body {
    display: grid;
    place-items: start center;
    padding: 24px 0;
  }

  .app-shell {
    max-width: 390px;
    min-height: 844px;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(33, 31, 28, .14);
  }

  .bottom-nav {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: 390px;
    bottom: 24px;
  }
}
