:root {
  --sq-font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --sq-radius-sm: 12px;
  --sq-radius-md: 18px;
  --sq-radius-lg: 24px;
  --sq-shadow-1: 0 14px 34px rgba(17, 36, 51, 0.06);
  --sq-shadow-2: 0 18px 46px rgba(17, 36, 51, 0.12);
  --sq-focus: 0 0 0 4px rgba(11, 91, 152, 0.14);
}

body {
  font-family: var(--sq-font-sans) !important;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: 1320px;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 18px;
  border-radius: var(--sq-radius-md);
  backdrop-filter: blur(10px);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--sq-radius-md);
  background:
    radial-gradient(circle at top left, rgba(11, 91, 152, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.68));
  border: 1px solid rgba(17, 36, 51, 0.08);
  box-shadow: 0 16px 44px rgba(17, 36, 51, 0.08);
  z-index: -1;
}

.topbar h1 {
  letter-spacing: -0.04em;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(11, 91, 152, 0.08);
  border: 1px solid rgba(11, 91, 152, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.topbar-logo img {
  width: 26px;
  height: 26px;
  display: block;
}

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

.smarthub-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 16px 10px 12px;
  border-radius: 999px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0;
  background: linear-gradient(135deg, #0b5b98, #179c98);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: 0 14px 30px rgba(11, 91, 152, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.smarthub-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 18px 36px rgba(11, 91, 152, 0.28);
}

.smarthub-btn__icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  flex: 0 0 auto;
}

.smarthub-btn__icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ticket-system-title {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.missing-info-list {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.missing-info-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(17, 36, 51, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(17, 36, 51, 0.04);
}

.missing-info-main {
  min-width: 0;
}

.missing-info-key {
  font-weight: 900;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.missing-info-label {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.missing-info-badges,
.missing-info-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.missing-info-badges .status-pill {
  margin: 0;
}

.missing-info-empty {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px dashed rgba(17, 36, 51, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
}

.missing-info-empty strong {
  color: var(--ink);
}

.card {
  box-shadow: var(--sq-shadow-1);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sq-shadow-2);
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--sq-focus) !important;
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 18px;
}

.section-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.92rem;
  color: rgba(17, 36, 51, 0.78);
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(17, 36, 51, 0.10);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.section-tabs a:hover {
  transform: translateY(-1px);
  border-color: rgba(11, 91, 152, 0.22);
}

.section-tabs a.active {
  color: #0b5b98;
  background: rgba(11, 91, 152, 0.10);
  border-color: rgba(11, 91, 152, 0.22);
}

.section-tabs.side-tabs {
  margin: 10px 0 0;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
}

.section-tabs.side-tabs a {
  width: 100%;
  justify-content: flex-start;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255,255,255,0.88);
}

.section-tabs.side-tabs a:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.22);
  transform: none;
}

.section-tabs.side-tabs a.active {
  background: rgba(125, 199, 242, 0.16);
  border-color: rgba(125, 199, 242, 0.28);
  color: #ffffff;
}

.portal-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 18px 0 4px;
  padding: 5px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
}

.portal-mode-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 12px;
  color: rgba(255,255,255,0.68);
  text-decoration: none;
  font-weight: 900;
  transition: background 0.15s ease, color 0.15s ease;
}

.portal-mode-switch a:hover {
  color: #ffffff;
  background: rgba(125,199,242,0.12);
}

.portal-mode-switch a.active {
  color: #ffffff;
  background: rgba(125,199,242,0.20);
}

.platform-switch-panel {
  display: grid;
  gap: 14px;
  margin: 14px 0 18px;
}

.platform-switch-title {
  margin: 0;
  color: rgba(17, 36, 51, 0.70);
  font-size: 0.92rem;
  font-weight: 700;
}

.platform-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(17, 36, 51, 0.10);
  background: rgba(255,255,255,0.72);
}

.platform-switch__item {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 14px;
  color: rgba(17, 36, 51, 0.82);
  text-decoration: none;
  background: rgba(17, 36, 51, 0.035);
  border: 1px solid rgba(17, 36, 51, 0.08);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.platform-switch__item:hover {
  transform: translateY(-1px);
  border-color: rgba(11, 91, 152, 0.24);
  background: #ffffff;
}

.platform-switch__item.is-primary {
  color: #ffffff;
  background: linear-gradient(135deg, #0b5b98, #1b9aa6);
  border-color: rgba(11, 91, 152, 0.32);
}

.platform-switch__body {
  display: grid;
  gap: 4px;
}

.platform-switch__label {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0;
}

.platform-switch__meta {
  font-size: 0.86rem;
  line-height: 1.35;
  color: inherit;
  opacity: 0.78;
}

.platform-switch__status {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0f5132;
  background: rgba(27, 168, 111, 0.14);
}

.platform-switch__item.is-primary .platform-switch__status {
  color: #ffffff;
  background: rgba(255,255,255,0.16);
}

@media (max-width: 760px) {
  .platform-switch {
    grid-template-columns: 1fr;
  }

  .platform-switch__item {
    min-height: 82px;
  }
}

.workflow-rule-list {
  display: grid;
  gap: 12px;
}

.workflow-rule-card {
  border: 1px solid rgba(17, 36, 51, 0.10);
  border-radius: var(--sq-radius-md);
  background: #ffffff;
  overflow: hidden;
}

.workflow-rule-card.is-editing {
  border-color: rgba(11, 91, 152, 0.28);
  box-shadow: 0 12px 34px rgba(11, 91, 152, 0.10);
}

.workflow-rule-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(250, 245, 236, 0.78), rgba(255, 255, 255, 1));
  border-bottom: 1px solid rgba(17, 36, 51, 0.08);
}

.workflow-rule-name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 2px;
}

.workflow-rule-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  color: rgba(17, 36, 51, 0.68);
  font-size: 0.9rem;
}

.workflow-rule-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(17, 36, 51, 0.14);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workflow-rule-pill.on {
  background: rgba(16, 127, 78, 0.10);
  color: #0e6d45;
  border-color: rgba(16, 127, 78, 0.22);
}

.workflow-rule-pill.off {
  background: rgba(154, 79, 29, 0.10);
  color: #8b3f13;
  border-color: rgba(154, 79, 29, 0.22);
}

.workflow-rule-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workflow-rule-body {
  padding: 14px;
}

.workflow-rule-pre {
  margin: 8px 0 0;
  background: rgba(11, 91, 152, 0.04);
  border: 1px solid rgba(11, 91, 152, 0.10);
  border-radius: 14px;
  padding: 12px;
  max-height: 220px;
  overflow: auto;
}

@media (max-width: 980px) {
  .workflow-rule-head {
    flex-direction: column;
    align-items: stretch;
  }

  .workflow-rule-actions {
    justify-content: flex-start;
  }

  .missing-info-row {
    grid-template-columns: minmax(180px, 1fr) auto;
  }

  .missing-info-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--sq-radius-md);
  border: 1px solid rgba(17, 36, 51, 0.10);
  background: #ffffff;
}

thead th {
  position: sticky;
  top: 84px;
  z-index: 2;
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(17, 36, 51, 0.62);
  background: #faf5ec;
  border-bottom: 1px solid rgba(17, 36, 51, 0.10);
  padding: 12px 14px;
  box-shadow: 0 1px 0 rgba(17, 36, 51, 0.06);
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(17, 36, 51, 0.08);
  vertical-align: top;
  background: #ffffff;
}

tbody tr:hover td {
  background: rgba(11, 91, 152, 0.04);
}

tbody tr:last-child td {
  border-bottom: 0;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .logout,
  .submit,
  .section-tabs a,
  .smarthub-btn {
    transition: none !important;
  }
  .card:hover {
    transform: none;
  }
}

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

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .smarthub-btn {
    flex: 1 1 170px;
  }

  .missing-info-row {
    grid-template-columns: 1fr;
  }

  .missing-info-badges,
  .missing-info-actions {
    justify-content: flex-start;
  }
}
