:root {
  --primary: #d3142a;
  --primary-strong: #f33a4e;
  --primary-soft: rgba(211, 20, 42, 0.14);
  --bg: #040404;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --surface-dark: rgba(10, 10, 11, 0.84);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text-primary: rgba(255, 255, 255, 0.96);
  --text-secondary: rgba(255, 255, 255, 0.66);
  --text-muted: rgba(255, 255, 255, 0.42);
  --nav-bg: rgba(8, 8, 9, 0.78);
  --sidebar-bg: rgba(10, 10, 11, 0.96);
  --header-bg: rgba(11, 11, 12, 0.76);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(211, 20, 42, 0.18), transparent 28%),
    radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.07), transparent 24%),
    linear-gradient(180deg, #050505 0%, #080809 48%, #050505 100%);
  color: var(--text-primary);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.68), transparent 92%);
  opacity: 0.55;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(211, 20, 42, 0.65);
  border-radius: 999px;
}

.orb-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(110px);
}

.orb-1 {
  top: -180px;
  right: -120px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(211, 20, 42, 0.34), transparent 70%);
}

.orb-2 {
  bottom: -160px;
  left: -120px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 72%);
}

.orb-3 {
  top: 32%;
  left: 42%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(211, 20, 42, 0.14), transparent 72%);
}

#nav,
#outlet {
  position: relative;
  z-index: 1;
}

#nav {
  position: sticky;
  top: 0;
  z-index: 40;
}

#outlet > * {
  animation: page-in 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.font-display {
  font-family: Syne, system-ui, sans-serif;
}

.glass {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: 24px;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.28);
}

.glass-dark {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 18px;
}

.glass-hover {
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.glass-hover:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.04));
}

.btn-primary,
.btn-ghost,
.nav-link,
.sidebar-link,
.role-chip {
  font-family: "DM Sans", system-ui, sans-serif;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(211, 20, 42, 0.4);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #8f0f22 100%);
  color: white;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(211, 20, 42, 0.24);
  opacity: 0.96;
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.glass-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.glass-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  padding: 12px 14px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.glass-input::placeholder {
  color: var(--text-muted);
}

.glass-input:focus {
  border-color: rgba(211, 20, 42, 0.42);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(211, 20, 42, 0.12);
}

textarea.glass-input {
  resize: vertical;
}

.glass-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

nav.main-nav {
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 160ms ease, background 160ms ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: none;
  background: rgba(0, 0, 0, 0.62);
}

.mobile-menu-overlay.open {
  display: block;
}

.mobile-menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 88vw);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 1px solid var(--border);
  background: var(--sidebar-bg);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}

.mobile-menu-panel.open {
  transform: translateX(0);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-red {
  color: #ffb8c0;
  background: rgba(211, 20, 42, 0.15);
  border: 1px solid rgba(211, 20, 42, 0.24);
}

.badge-ghost {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.avatar {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, #840e20 100%);
  color: white;
  font-weight: 700;
  font-family: Syne, system-ui, sans-serif;
}

.error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(211, 20, 42, 0.24);
  border-radius: 14px;
  background: rgba(211, 20, 42, 0.08);
  color: #ffb8c0;
  font-size: 0.9rem;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 50;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.sidebar-link.active {
  color: white;
  border-color: rgba(211, 20, 42, 0.24);
  background: linear-gradient(135deg, rgba(211, 20, 42, 0.18), rgba(255, 255, 255, 0.04));
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(0, 0, 0, 0.62);
  z-index: 49;
}

.sidebar-overlay.open {
  display: block;
}

.dashboard-main {
  margin-left: 256px;
}

.workspace-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.workspace-tab:hover,
.workspace-tab.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(211, 20, 42, 0.24);
}

.workspace-stat__value {
  font-family: Syne, system-ui, sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.role-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.role-chip.active,
.role-chip:hover {
  border-color: rgba(211, 20, 42, 0.3);
  background: rgba(211, 20, 42, 0.12);
  color: white;
}

.chat-scroller {
  max-height: 520px;
  overflow-y: auto;
}

.chat-row {
  display: flex;
}

.chat-bubble {
  max-width: min(92%, 640px);
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  opacity: 1;
}

.chat-bubble-assistant {
  background: rgba(255, 255, 255, 0.04);
}

.chat-bubble-user {
  background: rgba(211, 20, 42, 0.16);
  border-color: rgba(211, 20, 42, 0.24);
}

.draft-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  padding: 18px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.draft-card:hover,
.draft-card.active {
  border-color: rgba(211, 20, 42, 0.24);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.cv-editor {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  padding: 16px 18px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.92rem;
  line-height: 1.7;
  outline: none;
  resize: vertical;
}

.cv-editor:focus {
  border-color: rgba(211, 20, 42, 0.36);
  box-shadow: 0 0 0 4px rgba(211, 20, 42, 0.12);
}

.paper-preview {
  min-height: 560px;
  border: 1px solid rgba(17, 17, 17, 0.16);
  border-radius: 24px;
  background: #faf7f2;
  color: #121212;
  padding: 36px 34px 44px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 18px 50px rgba(0, 0, 0, 0.16);
}

.paper-preview__content {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.7;
}

.paper-preview__content h1,
.paper-preview__content h2,
.paper-preview__content h3 {
  color: #111111;
}

.paper-preview__content h1 {
  margin: 0 0 14px;
  padding-bottom: 14px;
  border-bottom: 2px solid #111111;
  font-size: 2rem;
  line-height: 1.05;
}

.paper-preview__content h2 {
  margin: 28px 0 12px;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.paper-preview__content p,
.paper-preview__content li {
  font-size: 0.96rem;
  color: #252525;
}

.paper-preview__content ul {
  padding-left: 20px;
}

.paper-preview__content strong {
  color: #111111;
}

.toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 48px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(11, 11, 12, 0.94);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.toast-msg {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.toast-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.toast-success {
  border-left: 3px solid #34d399;
}

.toast-error {
  border-left: 3px solid #fb7185;
}

.toast-info {
  border-left: 3px solid #60a5fa;
}

.toast-warn {
  border-left: 3px solid #facc15;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .dashboard-main {
    margin-left: 0;
  }
}

@media (min-width: 640px) {
  .workspace-header {
    padding-left: 32px;
    padding-right: 32px;
  }
}
