:root {
  --color-bg: #f8fafc;
  --color-card: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-primary: #1f3a5f;
  --color-accent: #2e5aac;
  --color-accent-hover: #264c91;
  --color-accent-tint: rgba(46, 90, 172, 0.12);
  --color-accent-soft: rgba(46, 90, 172, 0.06);
  --color-accent-ring: rgba(46, 90, 172, 0.2);
  --color-success: #22c55e;
  --color-warning: #eab308;
  --color-danger: #ef4444;
  --color-success-tint: rgba(34, 197, 94, 0.14);
  --color-warning-tint: rgba(234, 179, 8, 0.16);
  --color-danger-tint: rgba(239, 68, 68, 0.14);
  --color-overlay: rgba(15, 23, 42, 0.35);
  --color-placeholder: rgba(100, 116, 139, 0.8);
  --color-noise-light: rgba(255, 255, 255, 0.06);
  --color-noise-clear: rgba(255, 255, 255, 0);
  --color-noise-dark: rgba(0, 0, 0, 0.02);
  --color-page-bg: #eef4ff;
  --color-nav-bg: #1f3a5f;
  --color-nav-text: #eaf0fa;
  --color-nav-hover: #ffffff;
  --color-nav-pill-bg: rgba(255, 255, 255, 0.14);
  --color-nav-border: rgba(255, 255, 255, 0.1);
  --color-nav-button-border: rgba(255, 255, 255, 0.35);
  --color-nav-button-hover: rgba(255, 255, 255, 0.1);
  --color-panel-bg: #f3f7ff;
  --shadow-card: 0 8px 20px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 12px 24px rgba(15, 23, 42, 0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 12px 24px rgba(15, 23, 42, 0.14);
  --surface: var(--color-card);
  --surface-muted: var(--color-panel-bg);
  --border: var(--color-border);
  --text: var(--color-text);
  --muted: var(--color-muted);
  --navy: var(--color-primary);
  --blue: var(--color-accent);
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-page-bg);
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

body.auth-mode {
  /* Keep layering predictable for pseudo-elements. */
  isolation: isolate;
  --auth-bg-intensity: 1;
  --auth-particle-opacity-mult: 1;
  --auth-scanline-opacity: 0.1;
  /* Fallback in case JS doesn't mount the animated auth background. */
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 28%, #c7dcff 58%, #3a70ff 84%, #0b2cff 100%);
}

body.auth-mode.auth-bg-debug {
  --auth-bg-intensity: 1.25;
  --auth-particle-opacity-mult: 1.25;
  --auth-scanline-opacity: 0.16;
}

body.auth-mode .layout,
body.auth-mode .topbar {
  position: relative;
  z-index: 3;
}

body.auth-mode .noise {
  /* Keep auth background crisp and prevent overlays from hiding animation. */
  display: none;
}

/* Dedicated auth background container (JS mounts/unmounts this). */
.auth-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
  display: none;
  transform: translateZ(0);
}

body.auth-mode .auth-bg {
  display: block;
}

.auth-bg::before {
  content: '';
  position: absolute;
  inset: -16%;
  z-index: 0;
  /* Base gradient + soft mesh blobs layered together. */
  background-image:
    linear-gradient(180deg, #ffffff 0%, #eef5ff 25%, #c7dcff 52%, #3a70ff 82%, #0b2cff 100%),
    radial-gradient(circle at 18% 62%, rgba(60, 140, 255, 0.22), transparent 62%),
    radial-gradient(circle at 78% 42%, rgba(120, 180, 255, 0.18), transparent 64%),
    radial-gradient(circle at 44% 78%, rgba(20, 70, 210, 0.18), transparent 66%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  transform: translate3d(0, 0, 0) scale(1.08);
  animation: authBgDrift 16s ease-in-out infinite alternate;
  will-change: transform;
}

.auth-bg::after {
  content: '';
  position: absolute;
  inset: -22%;
  z-index: 1;
  background-image:
    repeating-linear-gradient(
      20deg,
      rgba(255, 255, 255, 0) 0px,
      rgba(255, 255, 255, 0.7) 1px,
      rgba(255, 255, 255, 0) 11px
    ),
    repeating-linear-gradient(
      -20deg,
      rgba(0, 0, 0, 0) 0px,
      rgba(40, 120, 255, 0.4) 1px,
      rgba(0, 0, 0, 0) 17px
    );
  background-size: 220px 220px;
  opacity: calc(var(--auth-scanline-opacity) * var(--auth-bg-intensity));
  mix-blend-mode: soft-light;
  transform: translate3d(0, 0, 0);
  animation: authScanMove 12s linear infinite;
  will-change: transform;
}

.auth-bg-icons {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.auth-icon {
  position: absolute;
  left: var(--x);
  top: 0;
  width: var(--size);
  height: var(--size);
  color: var(--icon-color);
  opacity: 0;
  transform: translate3d(0, var(--startY), 0) rotate(var(--rot0));
  transform-origin: center;
  filter: drop-shadow(0 0 10px var(--icon-glow));
  animation: authIconFloatUp var(--dur) linear infinite;
  animation-delay: var(--delay);
  will-change: transform, opacity;
}

.auth-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes authBgDrift {
  0% {
    transform: translate3d(-1.5%, -1.2%, 0) scale(1.08);
  }
  100% {
    transform: translate3d(1.6%, 1.2%, 0) scale(1.12);
  }
}

@keyframes authScanMove {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-160px, 160px, 0);
  }
}

@keyframes authIconFloatUp {
  0% {
    transform: translate3d(0, var(--startY), 0) rotate(var(--rot0));
    opacity: 0;
  }
  12% {
    opacity: calc(var(--opacity) * var(--auth-particle-opacity-mult));
  }
  86% {
    opacity: calc(var(--opacity) * var(--auth-particle-opacity-mult));
  }
  100% {
    transform: translate3d(var(--driftX), var(--endY), 0) rotate(var(--rot1));
    opacity: 0;
  }
}

body.auth-bg-debug-flash .auth-icon {
  outline: 1px solid rgba(0, 0, 0, 0.16);
}

@media (prefers-reduced-motion: reduce) {
  body:not(.force-auth-animation) .auth-bg::before,
  body:not(.force-auth-animation) .auth-bg::after {
    animation: none;
  }

  body:not(.force-auth-animation) .auth-icon {
    animation: none;
    opacity: calc(var(--opacity) * 0.35);
    transform: translate3d(0, var(--startY), 0) rotate(var(--rot0));
  }
}

.noise {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, var(--color-noise-light) 0%, var(--color-noise-clear) 60%),
    repeating-linear-gradient(
      45deg,
      var(--color-noise-dark),
      var(--color-noise-dark) 1px,
      transparent 1px,
      transparent 4px
    );
  pointer-events: none;
  opacity: 0.4;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 40px;
  background: var(--color-nav-bg);
  border-bottom: 1px solid var(--color-nav-border);
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-link {
  color: var(--color-nav-text);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
  color: var(--color-nav-hover);
  background: var(--color-nav-pill-bg);
  transform: translateY(-1px);
}

.nav-link.active {
  color: var(--color-nav-hover);
  background: var(--color-nav-pill-bg);
  font-weight: 600;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: #e7f0ff;
  border: 1px solid #cddffc;
  color: #1d3b73;
  font-weight: 600;
  display: grid;
  place-items: center;
  letter-spacing: 1px;
}

.logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.logo-wrap img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-wrap.logo-ready img {
  display: block;
}

.logo-wrap.logo-ready .logo-fallback {
  display: none;
}

.logo-wrap.logo-failed img {
  display: none;
}

.logo-fallback {
  font-weight: 600;
  letter-spacing: 1px;
}

.brand-logo {
  width: 70%;
  height: 70%;
}

.brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 12px;
  color: var(--color-muted);
}

.layout {
  padding: 20px 40px 80px;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 28px;
  /* Prevent single-row grids from stretching children to fill viewport height (auth card whitespace). */
  align-content: start;
  align-items: start;
  flex: 1 0 auto;
  width: 100%;
}

.app-footer {
  position: relative;
  z-index: 5;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
}

.app-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--color-muted);
  font-size: 12px;
}

.app-footer-copy {
  line-height: 1.4;
}

.app-footer-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.app-footer-link {
  color: inherit;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 10px;
  letter-spacing: 0.06em;
  font-weight: 600;
  font-size: 11px;
}

.app-footer-link:hover {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-footer-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.app-footer-sep {
  opacity: 0.5;
}

@media (max-width: 640px) {
  .app-footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    padding: 14px 18px;
  }
}

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

.topbar .brand-name,
.topbar .brand {
  color: var(--color-nav-hover);
}

.topbar .brand-sub {
  color: rgba(234, 240, 250, 0.75);
}

.topbar .brand-mark {
  border-color: var(--color-nav-button-border);
  background: var(--color-card);
  color: var(--color-text);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.avatar-mark {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.avatar-icon {
  width: 100%;
  height: 100%;
}

.avatar .logo-fallback {
  color: var(--color-text);
  font-size: 12px;
}

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

.avatar.active {
  background: var(--color-accent-tint);
  color: var(--color-primary);
  border-color: var(--color-border);
}

.topbar .ghost {
  background: transparent;
  color: var(--color-nav-hover);
  border: 1px solid var(--color-nav-button-border);
}

.topbar .ghost:hover {
  background: var(--color-nav-button-hover);
  box-shadow: none;
}

.topbar .avatar {
  background: transparent;
  border-color: var(--color-nav-button-border);
  color: var(--color-nav-hover);
  box-shadow: none;
}

.topbar .avatar-mark {
  border-color: var(--color-nav-button-border);
}

.topbar .avatar:hover {
  background: var(--color-nav-button-hover);
  box-shadow: none;
  transform: translateY(-2px);
}

.topbar .avatar.active {
  background: var(--color-nav-pill-bg);
  border-color: var(--color-nav-button-border);
  color: var(--color-nav-hover);
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(6px);
}

.auth {
  max-width: 520px;
  margin: 40px auto 0;
  animation: rise 0.6s ease both;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.auth-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #e7f0ff;
  border: 1px solid #cddffc;
  color: #1d3b73;
}

.auth-logo-image {
  width: 70%;
  height: 70%;
}

.auth-social {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.google-btn {
  background: #ffffff;
  color: #3c4043;
  border: 1px solid #dadce0;
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  box-shadow: none;
  transform: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.google-btn:hover {
  background: #f5f5f5;
  transform: none;
  box-shadow: none;
}

.google-btn:active {
  background: #f0f0f0;
  transform: none;
  box-shadow: none;
}

.google-btn:focus-visible {
  transform: none;
  box-shadow: none;
}

.google-btn:disabled {
  opacity: 0.65;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.google-btn .google-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-divider {
  font-size: 12px;
  color: var(--color-muted);
  text-align: center;
}

.auth-switch {
  margin-top: 4px;
  text-align: center;
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.5;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--color-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transform: none;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
  text-decoration: none;
}

.link-button:hover {
  background: transparent;
  box-shadow: none;
  transform: none;
  color: var(--color-accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:active {
  transform: none;
}

.link-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.auth-panel {
  display: grid;
  gap: 8px;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.6s ease both;
  width: 100%;
  min-width: 0;
}

.dashboard > .card {
  width: 100%;
  min-width: 0;
}

.view {
  display: grid;
  gap: 20px;
  animation: fadeIn 0.6s ease both;
  /* When the main layout grows to fill the viewport (sticky footer), keep view content packed at the top. */
  align-content: start;
  align-items: start;
}

.page-header {
  display: grid;
  gap: 6px;
}

.dash-top {
  display: grid;
  gap: 10px;
}

.dash-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-title h2 {
  margin: 0;
}

.dash-title .small {
  margin: 2px 0 0;
}

.dash-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.page-header h2 {
  font-size: 22px;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.page-header p {
  margin-bottom: 0;
  font-weight: 400;
  line-height: 1.5;
}

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

h2,
h3 {
  margin: 0 0 8px;
  font-weight: 600;
}

p {
  margin: 0 0 16px;
}

.legal h3 {
  margin-top: 18px;
}

.legal h3:first-child {
  margin-top: 0;
}

.legal ul {
  margin: 8px 0 16px;
  padding-left: 18px;
}

.legal li {
  margin: 6px 0;
  line-height: 1.5;
}

.about-header {
  align-items: flex-start;
  gap: 12px;
}

.about-subtitle {
  margin: 8px 0 0;
  max-width: 680px;
}

.about-section {
  padding: 18px 0;
  border-top: 1px solid var(--color-border);
}

.about-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.about-section h3 {
  margin-bottom: 10px;
}

.about-team {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.profile-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--color-panel-bg);
  border: 1px solid var(--color-border);
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 14px;
  background: rgba(59, 103, 255, 0.08);
  border: 1px solid rgba(59, 103, 255, 0.25);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.profile-headshot {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-fallback {
  display: none;
  width: 100%;
  height: 100%;
  font-weight: 600;
  color: var(--color-primary);
  align-items: center;
  justify-content: center;
}

.profile-avatar.missing-image .profile-headshot {
  display: none;
}

.profile-avatar.missing-image .profile-avatar-fallback {
  display: flex;
}

.profile-meta {
  display: grid;
  gap: 4px;
}

.profile-name {
  font-weight: 600;
  font-size: 16px;
}

.profile-badge {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(59, 103, 255, 0.12);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
}

.about-list {
  margin: 0;
  padding-left: 18px;
}

.about-list li {
  margin: 6px 0;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .about-header {
    flex-direction: column;
  }

  .profile-card {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .profile-avatar {
    width: 80px;
    height: 80px;
  }
}

.muted {
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 400;
}

.muted.small {
  font-size: 12px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--color-muted);
}

input {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-family: inherit;
  background: var(--color-card);
  color: var(--color-text);
}

select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-family: inherit;
  background: var(--color-card);
  color: var(--color-text);
}

textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-family: inherit;
  resize: vertical;
  background: var(--color-card);
  color: var(--color-text);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-placeholder);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-ring);
}

.input-with-toggle {
  position: relative;
  display: block;
}

.input-with-toggle input {
  width: 100%;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 10px;
}

.password-toggle:hover {
  color: var(--color-text);
  background: var(--color-accent-soft);
  transform: translateY(-50%);
  box-shadow: none;
}

.password-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  transform: translateY(-50%);
}

.password-toggle:active {
  transform: translateY(-50%);
  box-shadow: none;
}

.password-toggle:disabled {
  opacity: 0.55;
  cursor: default;
  background: transparent;
  transform: translateY(-50%);
  box-shadow: none;
}

.password-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle[data-password-visible='1'] .icon-eye {
  display: none;
}

.password-toggle[data-password-visible='1'] .icon-eye-off {
  display: inline-flex;
}

button {
  border: none;
  background: var(--color-accent);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-sm);
}

button:active {
  transform: scale(0.98);
  box-shadow: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary.loading {
  position: relative;
  pointer-events: none;
}

.btn-primary.loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
button.ghost {
  background: var(--color-card);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  box-shadow: none;
}

button.ghost:hover {
  background: var(--color-accent-tint);
  box-shadow: none;
}

button.ghost:active,
button.btn-primary:active {
  transform: scale(0.98);
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
  background: var(--color-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:focus-visible,
.ghost-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.sync-band {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow-xs);
  display: grid;
  gap: 8px;
}

.sync-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  line-height: 1.4;
}

.sync-strip-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-right: auto;
}

.sync-strip-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-muted);
}

.sync-strip-range input {
  width: 88px;
  padding: 6px 8px;
}

.sync-inline-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.sync-connect-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.sync-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 10px;
  width: 100%;
}

.sync-banner-row {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr 1fr auto;
  gap: 16px;
  align-items: center;
}

.sync-banner-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.sync-banner-info {
  display: grid;
  gap: 4px;
  line-height: 1.5;
}

.sync-banner-input {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--color-muted);
}

.sync-banner-input input {
  width: 100%;
}

.sync-banner-actions {
  display: inline-flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.sync-banner-connection {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-progress {
  margin-top: 6px;
  display: grid;
  gap: 6px;
}

.sync-progress.hidden {
  display: none;
}

.sync-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-muted);
}

.progress-track {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.sync-error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-error-detail {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 8px;
  margin: 8px 0 0;
  line-height: 1.5;
  font-size: 12px;
}

.sync-connect-cta {
  display: grid;
  gap: 8px;
}

.sync-summary {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.sync-summary-status {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sync-summary-metrics {
  font-size: 13px;
  line-height: 1.4;
}

.sync-summary-main .chevron {
  font-size: 11px;
  transition: transform 0.15s ease;
}

.sync-summary-main.open .chevron {
  transform: rotate(180deg);
}

.sync-summary-main.clickable {
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.sync-summary-main.clickable:hover {
  background: rgba(0, 0, 0, 0.035);
}

.sync-summary-main.clickable:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.sync-summary .link {
  padding: 0;
  border: none;
  background: none;
  color: var(--color-accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sync-summary .link:hover {
  color: var(--color-accent-hover);
}

.sync-details {
  margin-top: 6px;
}

.sync-details-block {
  background: rgba(15, 23, 42, 0.04);
  border-radius: 10px;
  padding: 10px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
}

.progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--blue, #2563eb), #4f46e5);
  transition: width 200ms ease, background-color 180ms ease;
}

.progress-fill.error {
  background: linear-gradient(90deg, #f97316, #ef4444);
}

.sync-error-detail {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--color-panel-bg);
  color: var(--color-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 16px;
  padding: 14px 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 8px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.1);
}

.kpi-label {
  font-size: 12px;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
}

.kpi-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--color-text);
}

.kpi-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}
.kpi-dot.neutral {
  background: var(--color-muted);
}
.kpi-dot.warning {
  background: var(--color-warning);
  box-shadow: 0 0 0 4px var(--color-warning-tint);
}
.kpi-dot.success {
  background: var(--color-success);
  box-shadow: 0 0 0 4px var(--color-success-tint);
}
.kpi-dot.danger {
  background: var(--color-danger);
  box-shadow: 0 0 0 4px var(--color-danger-tint);
}

.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
}

.kpi-card.status-applied {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.14), #fff);
  border-color: rgba(234, 179, 8, 0.3);
  color: #854d0e;
}

.kpi-card.status-applied .kpi-label,
.kpi-card.status-applied .kpi-value {
  color: #854d0e;
}

.kpi-card.status-offer {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), #fff);
  border-color: rgba(34, 197, 94, 0.28);
  color: #166534;
}

.kpi-card.status-offer .kpi-label,
.kpi-card.status-offer .kpi-value {
  color: #166534;
}

.kpi-card.status-rejected {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), #fff);
  border-color: rgba(239, 68, 68, 0.3);
  color: #991b1b;
}

.kpi-card.status-rejected .kpi-label,
.kpi-card.status-rejected .kpi-value {
  color: #991b1b;
}

.kpi-card.status-total {
  background: linear-gradient(135deg, rgba(46, 90, 172, 0.08), #fff);
}

.ghost-link:hover {
  transform: translateY(-2px);
  background: var(--color-accent-tint);
  box-shadow: none;
}

button.danger,
.ghost.danger {
  color: #b91c1c;
  border: 1px solid #fca5a5;
  background: #fef2f2;
}

.ghost.danger:hover {
  background: #fee2e2;
}

.ghost.danger:active {
  transform: scale(0.98);
}

.danger-panel {
  background: #fef2f2;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.danger-panel-title {
  font-weight: 700;
  color: #991b1b;
}

.danger-panel-body {
  color: #7f1d1d;
  font-size: 14px;
}

.danger-panel-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.filter-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin: 0;
}

.header-actions .filter-inline {
  margin-left: 10px;
}

.filter-inline label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--color-muted);
}

.filter-inline select,
.filter-inline input {
  min-width: 180px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--color-text);
}

.filter-company-inline .input-with-clear {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 260px;
}

.filter-company-inline input {
  width: 100%;
  padding-right: 32px;
}

.clear-input {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}

.clear-input:hover {
  color: var(--color-text);
}

.stack {
  display: grid;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--color-accent-tint);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  width: fit-content;
}

.pill[data-state='connected'] {
  background: var(--color-success-tint);
  color: var(--color-success);
}

.pill[data-state='warning'] {
  background: var(--color-warning-tint);
  color: var(--color-warning);
}

.pill[data-state='idle'] {
  background: var(--color-accent-soft);
  color: var(--color-primary);
}

.callout {
  margin: 12px 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed var(--color-border);
  background: var(--color-warning-tint);
  display: grid;
  gap: 6px;
}

.callout-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-warning);
}

.policy {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

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

.header-left .header-actions {
  justify-content: flex-start;
}

.btn-primary {
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  color: white;
}

.btn-compact {
  padding: 8px 12px;
  font-size: 13px;
  min-height: 34px;
}

.icon-btn-circle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.icon-btn-circle:hover {
  background: var(--color-surface);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.icon-btn-circle:active {
  transform: scale(0.97);
}

.icon-btn-circle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
}

#filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.count-badge {
  background: var(--color-accent-tint);
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.filters-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 12px;
}

.summary-chip {
  font-size: 12px;
  color: var(--color-muted);
  background: var(--color-accent-soft);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 10px;
}

.panel {
  background: var(--color-panel-bg);
  border: 1px dashed var(--color-border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.view-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.view-toggle.compact button {
  padding: 8px 12px;
  font-size: 12px;
}

.view-toggle button.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.view-toggle.segmented {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px;
  gap: 4px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.02);
}

.view-toggle.segmented button {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--color-muted);
  box-shadow: none;
  transform: none;
}

.view-toggle.segmented button:hover {
  background: var(--color-accent-soft);
  color: var(--color-primary);
  box-shadow: none;
  transform: none;
}

.view-toggle.segmented button.active {
  background: var(--color-accent-tint);
  color: var(--color-primary);
  font-weight: 600;
}

.table {
  display: grid;
  gap: 12px;
}

.empty-state {
  border: 1px dashed var(--color-border);
  border-radius: 16px;
  padding: 20px;
  background: var(--color-panel-bg);
  display: grid;
  gap: 12px;
  text-align: center;
}

.cta-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.empty-state-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.table-header,
.table-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.9fr 1fr 0.6fr 0.8fr;
  gap: 12px;
  align-items: center;
}

#applications-table .table-header,
#applications-table .table-row {
  grid-template-columns: 1.4fr 1.2fr 0.9fr 1fr;
}

#unsorted-table .table-header,
#unsorted-table .table-row {
  grid-template-columns: 1.1fr 1.4fr 0.8fr 0.6fr 1fr 0.9fr;
}

#unsorted-table .table-row {
  cursor: default;
}

#email-events-table .table-row {
  cursor: default;
}

#unsorted-table .table-row:hover,
#email-events-table .table-row:hover {
  box-shadow: none;
  transform: none;
}

#unsorted-table .suggestion-actions {
  justify-content: flex-end;
}

.table-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  gap: 8px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.025);
  padding: 10px 12px;
  border-radius: 12px;
}

.table-header.sortable button {
  border: none;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
  padding: 6px 8px;
  border-radius: 10px;
  transition: color 120ms ease, background 120ms ease;
}

.table-header.sortable button:hover,
.table-header.sortable button:focus-visible {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.04);
  outline: none;
}

.table-header.sortable .arrow {
  font-size: 10px;
}

.table-row {
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--color-card);
  animation: rise 0.5s ease both;
  animation-delay: calc(var(--stagger, 0) * 60ms);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.table-row:hover {
  border-color: rgba(46, 90, 172, 0.25);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
  background: rgba(0, 0, 0, 0.02);
}

.cell-company {
  font-weight: 700;
  color: var(--color-text);
}

.cell-role {
  font-size: 13px;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

#applications-table .table-row:nth-child(even) {
  background: rgba(15, 23, 42, 0.02);
}

#archived-table .table-row:nth-child(even) {
  background: rgba(15, 23, 42, 0.02);
}

.status {
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  transition: opacity 180ms ease, transform 180ms ease;
}

.status.animate {
  opacity: 0;
  transform: translateY(4px);
  animation: fadeStatus 180ms ease forwards;
}

@keyframes fadeStatus {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--color-accent-soft);
  color: var(--color-primary);
}

.explanation {
  font-size: 12px;
  color: var(--color-muted);
}

details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.suggestion-callout {
  margin-top: 8px;
  background: var(--color-warning-tint);
  border: 1px solid var(--color-warning);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.suggestion-actions {
  display: flex;
  gap: 8px;
}

.suggestion-actions button {
  padding: 6px 10px;
  font-size: 12px;
}

.status-cell {
  display: inline-flex;
  align-items: center;
}

.appl-statusPill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
}

.appl-statusPill[data-status] {
  position: relative;
}

.appl-statusPill .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
}

.appl-status-applied {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.appl-status-offer_received {
  background: #d1fae5;
  border-color: #34d399;
  color: #065f46;
}

.appl-status-rejected {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.appl-status-unknown {
  background: #e5e7eb;
  border-color: #d1d5db;
  color: #374151;
}

.pipeline-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pipeline-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-group button {
  padding: 8px 12px;
  font-size: 12px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.filter-bar .filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.filter-bar .filter-checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 24px;
  font-size: 13px;
  color: var(--color-muted);
}

.pipeline-view {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: minmax(220px, auto);
  gap: 16px;
  margin-bottom: 16px;
  max-width: 100%;
  min-width: 0;
}

.pipeline-view:empty {
  min-height: 0;
  height: auto;
}

.pipeline-column {
  background: var(--color-panel-bg);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  height: 100%;
}

.pipeline-column-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pipeline-column-body {
  display: grid;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  min-height: 0;
}

.pipeline-empty {
  color: var(--color-muted);
  font-size: 12px;
  text-align: center;
  padding: 8px 0;
}

.pipeline-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--color-border);
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.pipeline-card .meta {
  font-size: 12px;
  color: var(--color-muted);
}

.pipeline-card .badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .pipeline-view {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .pipeline-view {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .pipeline-view {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 40;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
}

.modal-dialog {
  width: min(640px, 92vw);
  background: var(--color-card);
  border-radius: 20px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  padding: 24px;
  position: relative;
  display: grid;
  gap: 16px;
  max-height: 90vh;
  overflow: auto;
  z-index: 1;
}

.modal-header h3 {
  margin: 0 0 6px;
}

.modal-header p {
  margin: 0;
}

.modal-body {
  display: grid;
  gap: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.modal-form {
  display: grid;
  gap: 12px;
}

.form-error {
  background: var(--color-danger-tint);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.form-success {
  background: var(--color-success-tint);
  color: var(--color-success);
  border: 1px solid var(--color-success);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.form-help {
  font-size: 12px;
  color: var(--color-muted);
}

.modal-note {
  font-size: 12px;
  color: var(--color-muted);
  margin: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-muted);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.drawer {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr minmax(320px, 520px);
  z-index: 20;
}

.drawer.hidden {
  display: none;
}

.drawer-backdrop {
  background: var(--color-overlay);
}

.drawer-panel {
  background: var(--color-card);
  padding: 0;
  overflow-y: auto;
  border-left: 1px solid var(--color-border);
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  padding: 18px 20px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-left: 4px solid var(--drawer-accent, var(--color-accent));
}

.drawer-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.drawer-subtitle {
  font-size: 14px;
  color: var(--color-muted);
  margin-top: 2px;
}

.drawer-header-text {
  flex: 1;
  min-width: 0;
}

.drawer-close {
  border: 1px solid var(--color-border);
  background: #f8fafc;
  color: #111827;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.drawer-close:hover {
  background: var(--color-surface);
}

.drawer-close:active {
  transform: scale(0.97);
}

.drawer-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pill.subtle {
  background: var(--color-accent-soft);
  color: var(--color-primary);
}
.pill-status {
  font-weight: 700;
}
.pill-applied {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.pill-offer_received {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #34d399;
}
.pill-rejected {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.pill-under_review {
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #7dd3fc;
}
.pill-unknown {
  background: #e5e7eb;
  color: #374151;
  border: 1px solid #d1d5db;
}

.drawer-panel[data-status='applied'] .drawer-header {
  --drawer-accent: #f59e0b;
}
.drawer-panel[data-status='offer_received'] .drawer-header {
  --drawer-accent: #16a34a;
}
.drawer-panel[data-status='rejected'] .drawer-header {
  --drawer-accent: #ef4444;
}
.drawer-panel[data-status='under_review'] .drawer-header {
  --drawer-accent: #0ea5e9;
}

.drawer-body {
  padding: 16px 20px 100px;
}

.drawer-card {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-panel-bg);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

.drawer-card-title {
  font-weight: 600;
  margin-bottom: 10px;
}

.details-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  font-size: 13px;
}

.details-label {
  color: var(--color-muted);
}

.details-value {
  color: var(--color-text);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-card {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--color-card);
  box-shadow: var(--shadow-xs);
}

.timeline-card-top {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-muted);
}

.timeline-type {
  font-weight: 600;
  color: var(--color-text);
}

.timeline-confidence {
  font-size: 12px;
}

.timeline-date {
  justify-self: end;
  font-size: 12px;
}

.timeline-subject {
  margin-top: 6px;
  font-weight: 600;
}

.timeline-meta {
  font-size: 12px;
  color: var(--color-muted);
}

.drawer-footer {
  position: sticky;
  bottom: 0;
  padding: 12px 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  z-index: 2;
}

.drawer-disclosure {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}

.drawer-disclosure:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.drawer-disclosure-body.collapsed {
  display: none;
}

.drawer-disclosure .chevron {
  transition: transform 0.2s ease;
}

.ghosted {
  background: var(--color-warning-tint);
  color: var(--color-warning);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 10px;
}

.gmail {
  max-width: 640px;
  margin: 40px auto 0;
}

.gmail-panel {
  display: flex;
  gap: 16px;
  align-items: center;
}

.sync-panel {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.events-panel {
  margin-top: 24px;
}

.events-panel .table-header,
.events-panel .table-row {
  grid-template-columns: 1.2fr 1.2fr 0.8fr 0.8fr;
}

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

.account-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.account-panel-header h3 {
  margin: 0;
}

.account-panel-body {
  display: grid;
  gap: 14px;
}

.account-section + .account-section {
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.account-email-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-copy {
  font-size: 12px;
  padding: 6px 10px;
}

.account-email {
  font-weight: 600;
  font-size: 16px;
}

.account-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.method-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 600;
  background: var(--color-panel-bg);
  color: var(--color-muted);
}

.method-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.6;
}

.method-chip[data-state='on'] {
  background: var(--color-accent-tint);
  border-color: rgba(46, 90, 172, 0.28);
  color: var(--color-accent);
}

.method-chip[data-state='off'] {
  background: rgba(100, 116, 139, 0.06);
  border-color: rgba(100, 116, 139, 0.18);
  color: var(--color-muted);
}

.account-password-success {
  color: var(--color-success);
}

.form-grid.inline {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  margin-bottom: 16px;
}

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

.board-col {
  background: var(--color-panel-bg);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--color-border);
}

.board-col h4 {
  margin: 0 0 12px;
  font-size: 14px;
}

.board-card {
  background: var(--color-card);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--color-border);
}

.hidden {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

  #applications-table .table-header,
  #applications-table .table-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'company role'
      'status activity';
  }

  #archived-table .table-header,
  #archived-table .table-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'company role'
      'status activity'
      'confidence source';
  }

  #applications-table .table-header,
  #archived-table .table-header {
    display: none;
  }

  #applications-table .table-row > div:nth-child(1),
  #archived-table .table-row > div:nth-child(1) {
    grid-area: company;
  }

  #applications-table .table-row > div:nth-child(2),
  #archived-table .table-row > div:nth-child(2) {
    grid-area: role;
  }

  #applications-table .table-row > div:nth-child(3),
  #archived-table .table-row > div:nth-child(3) {
    grid-area: status;
  }

  #applications-table .table-row > div:nth-child(4),
  #archived-table .table-row > div:nth-child(4) {
    grid-area: activity;
  }

  #archived-table .table-row > div:nth-child(5) {
    grid-area: confidence;
  }

  #archived-table .table-row > div:nth-child(6) {
    grid-area: source;
  }
}

@media (max-width: 900px) {
  .layout {
    padding: 12px 24px 80px;
  }

  .topbar {
    padding: 12px 24px;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .nav {
    flex-wrap: wrap;
  }

  .sync-banner-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .sync-banner-actions {
    justify-content: flex-start;
  }

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

  .account-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.inline {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .sync-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .drawer {
    grid-template-columns: 1fr;
  }

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

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}


.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.ats-panel {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-muted);
  display: grid;
  gap: 8px;
}

.ats-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  margin: 6px 0 8px;
  overflow: hidden;
}

.ats-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  width: 0%;
  transition: width 0.25s ease;
}

.list button {
  width: 100%;
  justify-content: flex-start;
}
.preview {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
}

#rc-suggestions .card {
  border: 1px solid var(--color-border);
  background: var(--surface);
}
#rc-suggestions .inline {
  justify-content: space-between;
  align-items: center;
}
#rc-preview-block .card-header {
  justify-content: space-between;
  align-items: center;
}
