:root {
  --brand-gold: #fab400;
  --brand-blue: #16325b;
  --white: #ffffff;
  --ink: #172033;
  --muted: #647083;
  --line: #dfe5ee;
  --soft: #f5f7fb;
  --success: #0d8065;
  --danger: #b42318;
  --shadow: 0 14px 36px rgba(22, 50, 91, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--soft);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--brand-blue) 0, var(--brand-blue) 190px, var(--soft) 190px);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 14px 156px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  color: var(--white);
  padding: 10px 2px 20px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 5px;
  color: var(--brand-gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-header h1,
.section-heading h2,
.result-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: 1.55rem;
  line-height: 1.15;
}

.status-pill,
.selected-count,
.quote-code {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--brand-blue);
  background: var(--brand-gold);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.is-ready {
  background: #eaf7ef;
  color: var(--success);
}

.status-pill.is-error {
  background: #fff0ed;
  color: var(--danger);
}

.panel,
.result-card,
.action-bar {
  margin-top: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.panel,
.result-card {
  border: 1px solid rgba(22, 50, 91, 0.08);
  border-radius: 8px;
  padding: 16px;
}

.section-heading,
.result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-heading h2,
.result-heading h2 {
  color: var(--brand-blue);
  font-size: 1.1rem;
  line-height: 1.25;
}

.selected-count,
.quote-code {
  min-height: 28px;
  padding: 5px 9px;
  background: rgba(250, 180, 0, 0.18);
  color: var(--brand-blue);
}

.filter-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-blue);
  background: var(--white);
  font-weight: 800;
  white-space: nowrap;
}

.filter-tab.is-active {
  border-color: var(--brand-gold);
  background: var(--brand-gold);
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  margin-top: 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.search-box span,
.field-label,
.input-grid span,
.reason-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.search-box input,
.select-input,
.input-grid input,
.reason-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

.search-box input {
  min-height: 44px;
  border: 0;
  background: transparent;
  outline: 0;
}

.field-label {
  display: block;
  margin-bottom: 7px;
}

.select-input {
  padding: 0 12px;
}

.policy-info {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(22, 50, 91, 0.12);
  border-radius: 8px;
  background: #fffaf0;
}

.policy-info h3 {
  margin: 0;
  color: var(--brand-blue);
  font-size: 1rem;
  line-height: 1.25;
}

.policy-meta-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.88rem;
  list-style: none;
}

.best-policy-hint {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 34px;
  margin-top: 10px;
  padding: 0 11px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: #9ca5b4;
  background: #f1f4f8;
  font-size: 0.8rem;
  font-weight: 800;
}

.course-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.course-card {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.course-card.is-selected {
  border-color: var(--brand-gold);
  background: #fffaf0;
}

.course-card input {
  width: 22px;
  height: 22px;
  accent-color: var(--brand-gold);
}

.course-name {
  margin: 0 0 5px;
  color: var(--brand-blue);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.25;
}

.course-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.course-price {
  color: var(--brand-blue);
  font-weight: 900;
  white-space: nowrap;
}

.manual-discount {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.manual-discount summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 14px;
  color: var(--brand-blue);
  background: var(--soft);
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.manual-discount summary::-webkit-details-marker {
  display: none;
}

.summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: var(--brand-blue);
  background: var(--brand-gold);
  font-weight: 900;
}

.manual-discount[open] .summary-icon {
  transform: rotate(45deg);
}

.manual-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.manual-course-list {
  display: grid;
  gap: 12px;
}

.manual-course-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.manual-course-row h3,
.order-discount h3 {
  margin: 0 0 10px;
  color: var(--brand-blue);
  font-size: 0.95rem;
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.input-grid label,
.reason-field {
  display: grid;
  gap: 6px;
}

.input-grid input,
.reason-field input {
  padding: 0 10px;
}

.reason-field {
  margin-top: 10px;
}

.order-discount {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.preset-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.preset-row::-webkit-scrollbar {
  display: none;
}

.preset-row button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(22, 50, 91, 0.16);
  border-radius: 999px;
  color: var(--brand-blue);
  background: var(--white);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.preset-row button:active {
  background: var(--brand-gold);
}

.empty-note,
.message {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.message {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #fff7df;
  color: var(--brand-blue);
}

.message.is-error {
  background: #fff0ed;
  color: var(--danger);
}

.action-bar {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(22, 50, 91, 0.1);
  border-radius: 8px;
}

.primary-button,
.secondary-button {
  min-height: 50px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  color: var(--brand-blue);
  background: var(--brand-gold);
}

.primary-button:disabled {
  opacity: 0.7;
}

.calc-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.calc-status.is-working {
  color: var(--brand-blue);
  font-weight: 800;
}

.calc-status.is-ready {
  color: var(--success);
}

.calc-status.is-error {
  color: var(--danger);
}

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

.secondary-button {
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid var(--line);
  color: var(--brand-blue);
  background: var(--white);
  font-size: 0.82rem;
}

.secondary-button:not(:disabled) {
  border-color: var(--brand-blue);
}

.secondary-button:disabled {
  color: #9ca5b4;
  background: #edf1f6;
}

.view-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 8px;
  background: var(--soft);
}

.view-toggle-button {
  min-height: 40px;
  border-radius: 7px;
  color: var(--brand-blue);
  background: transparent;
  font-weight: 900;
}

.view-toggle-button.is-active {
  background: var(--brand-gold);
}

.result-items {
  display: grid;
  gap: 10px;
}

.result-item {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.result-item-top,
.summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-item h3 {
  margin: 0;
  color: var(--brand-blue);
  font-size: 0.96rem;
}

.result-price {
  color: var(--brand-blue);
  font-weight: 900;
  white-space: nowrap;
}

.discount-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.86rem;
  list-style: none;
}

.summary-box {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  color: var(--brand-blue);
  background: #fff7df;
}

.summary-line {
  font-size: 0.94rem;
}

.summary-line strong {
  font-size: 1.1rem;
}

.summary-line.final {
  padding-top: 8px;
  border-top: 1px solid rgba(22, 50, 91, 0.18);
  font-weight: 900;
}

.student-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.sticky-summary {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 15;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  width: min(calc(100% - 20px), 760px);
  min-height: 70px;
  padding: 11px 12px;
  border: 1px solid rgba(250, 180, 0, 0.46);
  border-radius: 8px;
  color: var(--white);
  background: var(--brand-blue);
  box-shadow: 0 18px 42px rgba(22, 50, 91, 0.28);
  transform: translateX(-50%);
}

.sticky-label,
.sticky-subtext {
  margin: 0;
  line-height: 1.25;
}

.sticky-label {
  font-size: 0.98rem;
  font-weight: 900;
}

.sticky-subtext {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
}

.sticky-copy {
  min-height: 46px;
  padding: 0 13px;
  border-radius: 8px;
  color: var(--brand-blue);
  background: var(--brand-gold);
  font-size: 0.86rem;
  font-weight: 900;
  white-space: nowrap;
}

.sticky-copy:disabled {
  color: #9ca5b4;
  background: #edf1f6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 20;
  width: min(calc(100% - 28px), 420px);
  padding: 13px 14px;
  border-radius: 8px;
  color: var(--white);
  background: var(--brand-blue);
  box-shadow: var(--shadow);
  font-weight: 800;
  text-align: center;
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.is-hidden {
  display: none !important;
}

@media (min-width: 700px) {
  .app-shell {
    padding-top: 26px;
    padding-bottom: 150px;
  }

  .app-header h1 {
    font-size: 2rem;
  }

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

  .action-bar {
    grid-template-columns: minmax(180px, 220px) 1fr;
    align-items: center;
  }

  .secondary-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
