:root {
  --yj-blue: #1a3a8f;
  --yj-blue-deep: #0f2557;
  --yj-red: #e53935;
  --yj-red-dark: #c72421;
  --orange: #fb8c00;
  --yellow: #fdd835;
  --green: #43a047;
  --purple: #8e24aa;
  --ink: #11214a;
  --muted: #64708d;
  --line: #dce6f6;
  --surface: #ffffff;
  --soft: #f3f7ff;
  --shadow: 0 22px 54px rgba(12, 35, 90, 0.16);
  --shadow-soft: 0 12px 30px rgba(12, 35, 90, 0.1);
  --radius: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #eff5ff 0%, #f8fbff 45%, #eef5ff 100%);
  font-family: "Inter", "Prompt", "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid rgba(220, 230, 246, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

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

.yj-logo-icon {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  flex: 0 0 auto;
  overflow: visible;
  border: 3px solid #ffffff;
  border-radius: 14px 14px 18px 18px;
  background: linear-gradient(135deg, var(--yj-blue) 0 49%, var(--yj-red) 50% 100%);
  box-shadow: 0 14px 28px rgba(26, 58, 143, 0.24);
}

.yj-logo-icon::before {
  position: absolute;
  top: -16px;
  left: 10px;
  width: 22px;
  height: 20px;
  border: 5px solid #ffffff;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  content: "";
}

.yj-logo-icon span {
  position: relative;
  z-index: 1;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.2;
}

.brand strong {
  font-size: 1.08rem;
  font-weight: 950;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--yj-blue);
  font-weight: 900;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: #e8efff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 950;
  line-height: 1.2;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover,
.button:focus-visible,
.route-card:hover,
.route-card:focus-visible {
  transform: translateY(-2px);
}

.button-primary {
  color: #ffffff;
  background: var(--yj-red);
  box-shadow: 0 16px 30px rgba(229, 57, 53, 0.28);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--yj-red-dark);
}

.button-secondary,
.button-outline {
  color: var(--yj-blue);
  background: #ffffff;
  border-color: var(--line);
}

.button-secondary-on-dark {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.12);
}

.button-large {
  min-height: 52px;
  padding-inline: 26px;
}

.brand-hero {
  position: relative;
  overflow: hidden;
  color: #ffffff;
  background:
    radial-gradient(circle at 86% 18%, rgba(255, 255, 255, 0.18), transparent 22rem),
    linear-gradient(135deg, var(--yj-blue-deep) 0%, var(--yj-blue) 56%, #244fb6 100%);
}

.hero-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.42;
  background:
    linear-gradient(115deg, transparent 0 34%, rgba(255, 255, 255, 0.08) 34% 35%, transparent 35% 100%),
    radial-gradient(circle at 8% 18%, rgba(255, 255, 255, 0.18) 0 2px, transparent 2px 100%);
  background-size: 100% 100%, 22px 22px;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  gap: 28px;
  align-items: stretch;
}

.hub-hero .hero-inner {
  grid-template-columns: minmax(0, 1fr) 390px;
  min-height: 430px;
  padding: 56px 0 48px;
}

.role-hero .hero-inner {
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 290px;
  padding: 44px 0;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--yj-red);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow.light {
  color: #ffffff;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.15rem, 5vw, 4.8rem);
  line-height: 1.02;
}

h2 {
  color: var(--yj-blue-deep);
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}

.hero-text {
  max-width: 700px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.72;
}

.hero-text.light {
  color: rgba(255, 255, 255, 0.82);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.brand-showcase {
  align-self: center;
  min-height: 290px;
  padding: 30px;
  border-radius: 28px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.brand-showcase.compact {
  min-height: 210px;
}

.showcase-icon {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, #eef5ff, #ffffff);
  box-shadow: inset 0 -10px 18px rgba(26, 58, 143, 0.09), var(--shadow-soft);
  font-size: 3.2rem;
}

.brand-showcase h2 {
  color: var(--yj-blue);
  font-size: 2.2rem;
  line-height: 1.05;
}

.brand-showcase p {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.55;
}

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

.showcase-stats span {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: 16px;
  background: #edf4ff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.showcase-stats strong {
  color: var(--yj-blue);
  font-size: 1.28rem;
}

.page-section {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-note {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.card-grid {
  display: grid;
  gap: 18px;
}

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

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

.route-card,
.ticket-card,
.side-panel > section {
  border: 1px solid rgba(220, 230, 246, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

.route-card {
  display: grid;
  gap: 10px;
  min-height: 210px;
  padding: 24px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.route-card:hover,
.route-card:focus-visible {
  box-shadow: var(--shadow);
}

.role-card {
  position: relative;
  overflow: hidden;
}

.role-card::after {
  position: absolute;
  right: -34px;
  bottom: -38px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  opacity: 0.14;
  content: "";
}

.affiliate-card::after {
  background: var(--yj-blue);
}

.seller-card::after {
  background: var(--yj-red);
}

.customer-card::after {
  background: var(--green);
}

.card-icon {
  font-size: 3.4rem;
}

.card-kicker {
  color: var(--yj-red);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.route-card strong {
  color: var(--yj-blue-deep);
  font-size: 1.35rem;
  line-height: 1.2;
}

.route-card small {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.58;
}

.card-arrow {
  align-self: end;
  color: var(--yj-red);
  font-weight: 950;
}

.admin-card {
  min-height: 148px;
}

.mini-team {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  color: #ffffff;
  font-weight: 950;
}

.mini-team.blue {
  background: var(--yj-blue);
}

.mini-team.red {
  background: var(--yj-red);
}

.mini-team.green {
  background: var(--green);
}

.mini-team.gold {
  background: var(--orange);
}

.mini-team.purple {
  background: var(--purple);
}

.mini-team.navy {
  background: var(--yj-blue-deep);
}

.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.ticket-card {
  display: grid;
  gap: 22px;
  padding: clamp(20px, 3vw, 34px);
}

.form-section-heading,
.side-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.step-badge {
  display: grid;
  min-width: 42px;
  height: 38px;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--yj-blue);
  font-size: 0.82rem;
  font-weight: 950;
}

.role-chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.category-chip {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--yj-blue);
  background: #edf4ff;
  font-size: 0.86rem;
  font-weight: 900;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--yj-blue-deep);
  font-weight: 950;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input,
.field select {
  min-height: 50px;
  padding: 0 14px;
}

.field textarea {
  min-height: 146px;
  padding: 14px;
  resize: vertical;
  line-height: 1.7;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--yj-blue);
  box-shadow: 0 0 0 4px rgba(26, 58, 143, 0.12);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--yj-red);
  box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.1);
}

.field-error {
  min-height: 18px;
  margin: 0;
  color: var(--yj-red);
  font-size: 0.82rem;
  font-weight: 900;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.file-pick-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #ffffff !important;
  background: var(--yj-blue);
  cursor: pointer;
  font-weight: 950;
}

.file-name {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.priority-section {
  display: grid;
  gap: 14px;
}

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

.priority-option {
  position: relative;
}

.priority-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.priority-body {
  display: grid;
  gap: 8px;
  min-height: 152px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.priority-option input:checked + .priority-body {
  border-color: var(--priority-color);
  box-shadow: 0 14px 30px rgba(12, 35, 90, 0.13);
  transform: translateY(-1px);
}

.priority-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--yj-blue-deep);
  font-weight: 950;
}

.priority-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--priority-color);
  box-shadow: 0 0 0 5px rgba(26, 58, 143, 0.08);
}

.priority-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.priority-sla {
  color: var(--yj-blue);
  font-weight: 950;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.side-panel {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 94px;
}

.side-panel > section {
  padding: 22px;
}

.summary-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

.summary-list div {
  display: grid;
  gap: 4px;
}

.summary-list dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.summary-list dd {
  margin: 0;
  color: var(--yj-blue-deep);
  font-weight: 950;
}

.success-card {
  border-color: rgba(67, 160, 71, 0.32) !important;
  background: linear-gradient(180deg, rgba(67, 160, 71, 0.12), #ffffff) !important;
}

.success-card h2 {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 1.45rem;
}

.success-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.icon-button {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--yj-red);
  background: #ffffff;
  cursor: pointer;
  font-weight: 950;
}

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

.local-ticket {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
}

.local-ticket strong {
  color: var(--yj-blue-deep);
}

.local-ticket span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 980px) {
  .hub-hero .hero-inner,
  .role-hero .hero-inner,
  .ticket-layout,
  .role-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .hero-inner,
  .page-section {
    width: min(100% - 28px, 1180px);
  }

  .hub-hero .hero-inner,
  .role-hero .hero-inner {
    padding: 30px 0;
  }

  .brand-showcase {
    min-height: 0;
  }

  .section-header,
  .field-grid,
  .priority-grid {
    grid-template-columns: 1fr;
  }

  .section-header,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}
