:root {
  color-scheme: light;
  --crew-canvas: #f5f7fa;
  --crew-surface: #ffffff;
  --crew-surface-soft: #f6f8fb;
  --crew-surface-accent: #edf1ff;
  --crew-ink: #172033;
  --crew-ink-on-dark: #ffffff;
  --crew-muted: #697386;
  --crew-line: #dfe4ec;
  --crew-line-strong: #cdd5e1;
  --crew-accent: #3559e0;
  --crew-accent-hover: #2545bd;
  --crew-accent-border: #aebbed;
  --crew-success: #17785d;
  --crew-success-soft: #e9f7f1;
  --crew-warning: #8b5b10;
  --crew-warning-soft: #fff5dc;
  --crew-danger: #a14434;
  --crew-danger-soft: #fff0ec;
  --crew-special: #6844ad;
  --crew-special-soft: #f0eaff;
  --crew-hero: #172342;
  --crew-hero-line: #273862;
  --crew-focus: rgba(53, 89, 224, 0.28);
  --crew-shadow-card: 0 18px 60px rgba(37, 50, 84, 0.08);
  --crew-shadow-menu: 0 15px 38px rgba(24, 36, 66, 0.18);
  --crew-font-display: Georgia, "Times New Roman", serif;
  --crew-font-ui:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  --crew-space-1: 4px;
  --crew-space-2: 8px;
  --crew-space-3: 12px;
  --crew-space-4: 16px;
  --crew-space-5: 24px;
  --crew-space-6: 32px;
  --crew-space-7: 48px;
  --crew-space-8: 64px;
  --crew-radius-compact: 10px;
  --crew-radius-control: 12px;
  --crew-radius-panel: 18px;
  --crew-radius-card: 24px;
  --crew-radius-hero: 28px;
  --crew-radius-pill: 999px;
  --crew-soft: var(--crew-canvas);
  --crew-panel: var(--crew-surface);
  --crew-bg: var(--crew-canvas);
  --crew-panel-soft: var(--crew-surface-soft);
  --crew-border: var(--crew-line);
  --crew-border-strong: var(--crew-line-strong);
  --crew-text: var(--crew-ink);
  --crew-text-muted: var(--crew-muted);
  --crew-focus-ring: var(--crew-focus);
  --crew-accent-dark: var(--crew-accent-hover);
  --crew-accent-soft: var(--crew-surface-accent);
  --crew-shadow: var(--crew-shadow-card);
}

.crew-workspace {
  width: min(1420px, 100%);
  min-width: 0;
  margin: 0 auto;
  color: var(--crew-ink);
  font-family: var(--crew-font-ui);
}

.crew-workspace,
.crew-workspace *,
.crew-workspace *::before,
.crew-workspace *::after {
  box-sizing: border-box;
}

.crew-page {
  min-height: 100vh;
  padding: clamp(20px, 4vw, 56px);
  background:
    radial-gradient(
      circle at 78% 0%,
      rgba(53, 89, 224, 0.08),
      transparent 28rem
    ),
    var(--crew-canvas);
}

.crew-hero {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--crew-space-5);
  padding: clamp(28px, 5vw, 56px);
  overflow: hidden;
  border: 1px solid var(--crew-hero-line);
  border-radius: var(--crew-radius-hero);
  color: var(--crew-ink-on-dark);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 56%),
    var(--crew-hero);
  box-shadow: var(--crew-shadow-card);
}

.crew-hero__identity {
  min-width: 0;
}

.crew-kicker {
  margin: 0 0 var(--crew-space-3);
  color: #bdc9ff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.crew-hero h1,
.crew-page-title {
  margin: 0;
  font-family: var(--crew-font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.crew-hero h1 {
  color: #ffffff;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1;
}

.crew-page-title {
  color: var(--crew-ink);
  font-size: clamp(1.65rem, 3.2vw, 2.35rem);
  line-height: 1.05;
}

.crew-hero__subtitle {
  max-width: 64ch;
  margin: var(--crew-space-3) 0 0;
  color: #d8def5;
  font-size: 1rem;
  line-height: 1.5;
}

.crew-hero__tools {
  flex: 0 0 auto;
}

.crew-stack {
  display: grid;
  gap: var(--crew-space-5);
  margin-top: var(--crew-space-5);
}

.crew-module {
  width: 100%;
  min-width: 0;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--crew-line);
  border-radius: var(--crew-radius-card);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--crew-shadow-card);
}

.crew-module-header {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 var(--crew-space-5);
}

.crew-module-header__copy {
  min-width: 0;
  flex: 1 1 auto;
}

.crew-module-icon {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: grid;
  place-items: center;
  border-radius: var(--crew-radius-panel);
  color: var(--crew-accent);
  background: var(--crew-surface-accent);
  font-size: 24px;
}

.crew-module-title {
  min-width: 0;
  margin: 0;
  color: var(--crew-ink);
  font-family: var(--crew-font-display);
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.crew-module-subtitle {
  margin: var(--crew-space-2) 0 0;
  color: var(--crew-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.crew-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
  gap: var(--crew-space-3);
}

.crew-field {
  min-width: 0;
  display: grid;
  gap: var(--crew-space-2);
  margin: 0;
  color: var(--crew-ink);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.crew-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--crew-line-strong);
  border-radius: var(--crew-radius-control);
  outline: none;
  color: var(--crew-ink);
  background: #ffffff;
  font-family: var(--crew-font-ui);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.25;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.crew-input:focus-visible {
  border-color: var(--crew-accent);
  box-shadow: 0 0 0 3px rgba(53, 89, 224, 0.14);
}

.crew-input:disabled,
.crew-input[readonly] {
  color: var(--crew-muted);
  background: var(--crew-surface-soft);
}

.crew-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--crew-space-2);
  padding: 10px 16px;
  border: 1px solid var(--crew-accent);
  border-radius: var(--crew-radius-control);
  color: #ffffff;
  background: var(--crew-accent);
  font-family: var(--crew-font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.crew-button:hover {
  border-color: var(--crew-accent-hover);
  background: var(--crew-accent-hover);
}

.crew-button:active {
  transform: translateY(1px);
}

.crew-button:focus-visible,
.crew-icon-button:focus-visible {
  outline: 3px solid var(--crew-focus);
  outline-offset: 2px;
}

.crew-button:disabled,
.crew-icon-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.crew-button--secondary {
  border-color: var(--crew-line-strong);
  color: var(--crew-ink);
  background: #ffffff;
}

.crew-button--secondary:hover {
  border-color: var(--crew-accent-border);
  color: var(--crew-accent-hover);
  background: var(--crew-surface-accent);
}

.crew-button--danger {
  border-color: #e4b4aa;
  color: var(--crew-danger);
  background: var(--crew-danger-soft);
}

.crew-button--danger:hover {
  border-color: var(--crew-danger);
  color: #7f3024;
  background: #ffe4de;
}

.crew-icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  padding: 0;
  border: 1px solid var(--crew-line);
  border-radius: var(--crew-radius-compact);
  color: var(--crew-ink);
  background: #ffffff;
  font-size: 18px;
  text-decoration: none;
  cursor: pointer;
}

.crew-icon-button:hover {
  border-color: var(--crew-accent-border);
  color: var(--crew-accent-hover);
  background: var(--crew-surface-accent);
}

.crew-icon-button--danger {
  color: var(--crew-danger);
  background: var(--crew-danger-soft);
}

.crew-flashes {
  display: grid;
  gap: var(--crew-space-2);
  margin: 0 0 var(--crew-space-4);
}

.crew-flash {
  padding: 12px 14px;
  border: 1px solid var(--crew-accent-border);
  border-radius: var(--crew-radius-control);
  color: var(--crew-accent-hover);
  background: var(--crew-surface-accent);
  font-size: 0.875rem;
  line-height: 1.45;
}

.crew-flash.success {
  border-color: rgba(23, 120, 93, 0.22);
  color: var(--crew-success);
  background: var(--crew-success-soft);
}

.crew-flash.error {
  border-color: rgba(161, 68, 52, 0.22);
  color: var(--crew-danger);
  background: var(--crew-danger-soft);
}

.crew-flash.warning,
.crew-notice {
  border-color: rgba(139, 91, 16, 0.22);
  color: var(--crew-warning);
  background: var(--crew-warning-soft);
}

.crew-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 10px;
  border: 1px solid var(--crew-line);
  border-radius: var(--crew-radius-pill);
  color: var(--crew-muted);
  background: var(--crew-surface-soft);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.crew-empty-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--crew-space-3);
  padding: var(--crew-space-5);
  border: 1px dashed var(--crew-line-strong);
  border-radius: var(--crew-radius-panel);
  color: var(--crew-muted);
  background: var(--crew-surface-soft);
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: center;
}

.crew-dialog {
  width: min(100% - 32px, 560px);
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--crew-line);
  border-radius: var(--crew-radius-card);
  color: var(--crew-ink);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(18, 27, 48, 0.24);
}

.crew-dialog::backdrop {
  background: rgba(18, 27, 48, 0.58);
  backdrop-filter: blur(3px);
}

.crew-dialog__body {
  padding: var(--crew-space-5);
}

.crew-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--crew-space-4);
  margin-bottom: var(--crew-space-5);
}

.crew-dialog__title {
  margin: 0;
  color: var(--crew-ink);
  font-family: var(--crew-font-display);
  font-size: 1.5rem;
  line-height: 1.15;
}

.crew-dialog__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--crew-space-3);
  margin-top: var(--crew-space-5);
}

@media (max-width: 1080px) {
  .crew-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 900px) {
  .crew-page {
    min-height: calc(100vh - var(--crew-mobile-header-height, 88px));
    padding-top: 20px;
  }
}

@media (max-width: 680px) {
  .crew-page {
    padding: 16px;
  }

  .crew-hero {
    padding: 28px 20px;
    border-radius: var(--crew-radius-card);
  }

  .crew-hero__tools,
  .crew-hero__tools .crew-button {
    width: 100%;
  }

  .crew-module {
    padding: 20px 16px;
    border-radius: 18px;
  }

  .crew-module-header {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  .crew-dialog {
    width: min(100% - 20px, 560px);
    border-radius: 18px;
  }

  .crew-dialog__body {
    padding: 20px 16px;
  }

  .crew-dialog__actions {
    flex-direction: column;
  }

  .crew-dialog__actions .crew-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
