:root {
  --bg: #0f0f0f;
  --bg-soft: #151515;
  --panel: rgba(26, 26, 26, 0.92);
  --panel-border: rgba(200, 217, 107, 0.15);
  --text: #f2f3eb;
  --muted: #a9ad97;
  --accent: #c8d96b;
  --accent-deep: #7f8d2f;
  --danger: #dd6b6b;
  --danger-bg: rgba(221, 107, 107, 0.14);
  --success: #8cd67c;
  --success-bg: rgba(140, 214, 124, 0.14);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 24px;
  --texture-line: rgba(114, 143, 132, 0.16);
  --texture-line-soft: rgba(166, 188, 132, 0.08);
  --texture-glow: rgba(111, 146, 128, 0.10);
  --texture-glow-strong: rgba(188, 201, 131, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(200, 217, 107, 0.1), transparent 32%),
    radial-gradient(circle at bottom right, rgba(127, 141, 47, 0.18), transparent 28%),
    linear-gradient(180deg, #0e0e0e 0%, #10110d 100%);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1200' fill='none'%3E%3Cg stroke='%23728f84' stroke-width='1.2' stroke-opacity='0.22' stroke-linecap='round'%3E%3Cpath d='M-40 250C110 180 240 315 390 255S670 160 840 220s300 76 430 6 232-54 410 28'/%3E%3Cpath d='M-20 316C132 246 268 384 420 324s274-97 444-37 286 73 416 3 230-58 404 16'/%3E%3Cpath d='M10 390C164 320 290 458 450 398s286-104 456-44 274 67 404-3 230-60 398 12'/%3E%3Cpath d='M-70 472C100 404 244 540 404 480s274-100 436-36 276 65 420 3 254-70 430 4'/%3E%3Cpath d='M-50 560C110 492 252 628 416 568s284-106 450-40 282 69 426 5 254-70 428 6'/%3E%3Cpath d='M0 654C162 584 294 720 456 660s286-104 452-38 280 69 420 3 246-68 414 8'/%3E%3Cpath d='M-90 756C74 690 218 824 384 764s292-112 464-46 294 75 446 9 258-70 434 8'/%3E%3Cpath d='M-30 858C138 790 276 926 440 866s284-108 454-42 286 71 432 7 256-70 430 8'/%3E%3C/g%3E%3Cg stroke='%23a6bc84' stroke-width='0.8' stroke-opacity='0.14' stroke-linecap='round'%3E%3Cpath d='M-120 212C28 148 172 270 324 214s278-102 450-38 292 76 440 12 254-66 430 8'/%3E%3Cpath d='M-90 612C56 548 202 670 356 612s280-106 458-36 300 78 450 12 258-66 428 8'/%3E%3Cpath d='M-110 934C44 866 188 994 344 938s284-108 456-38 296 76 446 10 256-66 432 8'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 26%);
  background-size: 1240px auto, 100% 100%;
  background-position: center top, center top;
  opacity: 0.78;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, var(--texture-glow) 0, transparent 24%),
    radial-gradient(circle at 82% 14%, rgba(255, 255, 255, 0.04) 0, transparent 18%),
    radial-gradient(circle at 74% 82%, var(--texture-glow-strong) 0, transparent 26%);
  filter: blur(16px);
  opacity: 0.72;
}

body.login-page .page-shell {
  min-height: 100vh;
  display: grid;
  align-content: center;
}

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

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  background: rgba(14, 14, 14, 0.8);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand span {
  display: grid;
}

.brand small {
  color: var(--muted);
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(200, 217, 107, 0.18), rgba(200, 217, 107, 0.04));
  border: 1px solid rgba(200, 217, 107, 0.2);
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.nav-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.nav-links a {
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--muted);
  transition: 160ms ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: rgba(200, 217, 107, 0.08);
}

.logout-form {
  margin: 0;
}

.topbar-button {
  padding: 10px 16px;
}

.content {
  display: grid;
  gap: 24px;
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 24px;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 26%, transparent 72%, rgba(114, 143, 132, 0.04) 100%),
    radial-gradient(circle at 88% 12%, rgba(166, 188, 132, 0.06) 0, transparent 26%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 600' fill='none'%3E%3Cg stroke='%23728f84' stroke-width='1' stroke-opacity='0.13' stroke-linecap='round'%3E%3Cpath d='M-40 156C74 110 170 214 286 170s208-76 334-26 218 58 326 10 192-46 322 16'/%3E%3Cpath d='M-20 226C94 180 192 284 310 240s212-78 338-28 216 58 322 10 190-46 320 16'/%3E%3Cpath d='M0 308C114 262 214 366 332 322s214-80 340-30 216 58 322 10 190-46 318 16'/%3E%3Cpath d='M-30 396C86 350 188 454 308 410s214-82 340-30 220 60 328 12 192-46 320 16'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, auto, 720px auto;
  background-position: center center, right top, center center;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
  gap: 24px;
}

.hero-panel h1,
.section-head h1,
.section-head h2,
.auth-card h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1;
}

.lead {
  color: var(--muted);
  max-width: 62ch;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--accent);
}

.inline-form,
.search-wrap,
.input-grid label,
.file-input,
.preview-panel,
.banner {
  display: grid;
  gap: 10px;
}

.inline-form-row,
.hero-actions,
.card-actions,
.company-panel-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.inline-form-row input,
.search-wrap input,
.input-grid input,
.input-grid select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

.inline-form-row input:focus,
.search-wrap input:focus,
.input-grid input:focus,
.input-grid select:focus {
  border-color: rgba(200, 217, 107, 0.5);
  box-shadow: 0 0 0 4px rgba(200, 217, 107, 0.12);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

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

.btn-primary {
  background: var(--accent);
  color: #111408;
  font-weight: 700;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-bg);
  color: #ffc6c6;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stats-grid article {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.stats-grid strong {
  display: block;
  font-size: 2rem;
  color: var(--accent);
}

.search-results {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.search-result-card,
.company-card,
.empty-state {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-card {
  gap: 6px;
  display: grid;
}

.search-result-card span,
.empty-state,
.company-card p,
.employee-copy span,
.employee-copy small {
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

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

.company-card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

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

.company-summary-item,
.company-kpi {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.company-summary-item span,
.company-kpi span {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.company-summary-item strong,
.company-kpi strong {
  font-size: 1rem;
}

.company-summary-item small,
.company-kpi small {
  color: var(--muted);
}

.company-summary-item-wide,
.company-kpi-span {
  grid-column: span 2;
}

.company-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.95fr);
  gap: 18px;
}

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

.company-meta-form {
  align-content: start;
}

.status-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status-success {
  background: rgba(140, 214, 124, 0.16);
  color: #d8ffd1;
  border-color: rgba(140, 214, 124, 0.32);
}

.status-warning {
  background: rgba(200, 217, 107, 0.14);
  color: #eef6b4;
  border-color: rgba(200, 217, 107, 0.26);
}

.status-danger {
  background: var(--danger-bg);
  color: #ffd7d7;
  border-color: rgba(221, 107, 107, 0.28);
}

.toggle-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-field input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.toggle-field strong {
  display: block;
  margin-bottom: 6px;
}

.toggle-field small {
  color: var(--muted);
  line-height: 1.45;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.employee-form,
.settings-form,
.auth-form {
  display: grid;
  gap: 24px;
}

.auth-shell {
  width: min(520px, 100%);
  margin: 0 auto;
}

.auth-card {
  display: grid;
  gap: 22px;
}

.auth-form label {
  display: grid;
  gap: 10px;
}

.auth-form span {
  color: var(--muted);
}

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

.form-section h2 {
  margin-top: 0;
}

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

.span-2 {
  grid-column: span 2;
}

.photo-upload {
  display: grid;
  gap: 18px;
}

.file-input {
  justify-items: start;
}

.file-input input {
  display: block;
}

.photo-preview {
  min-height: 220px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.preview-panel code {
  display: block;
  padding: 16px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.34);
  color: var(--accent);
  overflow-wrap: anywhere;
}

.legacy-preview {
  display: grid;
  gap: 10px;
}

.company-panel {
  display: grid;
  gap: 18px;
}

.employee-list {
  display: grid;
  gap: 14px;
}

.employee-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.avatar-wrap,
.avatar-wrap img,
.avatar-fallback,
.profile-image,
.profile-fallback {
  width: 72px;
  height: 72px;
  border-radius: 20px;
}

.avatar-wrap img,
.profile-image {
  object-fit: cover;
}

.avatar-fallback,
.profile-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(200, 217, 107, 0.26), rgba(200, 217, 107, 0.08));
  color: var(--accent);
  font-weight: 700;
}

.employee-copy {
  display: grid;
  gap: 4px;
}

.banner {
  padding: 16px 18px;
  border-radius: 18px;
}

.banner.warning {
  background: rgba(200, 217, 107, 0.1);
  color: var(--accent);
}

.banner.error {
  background: var(--danger-bg);
  color: #ffd7d7;
  border: 1px solid rgba(221, 107, 107, 0.24);
}

.hidden {
  display: none;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 30;
}

.toast {
  min-width: 240px;
  padding: 14px 16px;
  border-radius: 16px;
  transform: translateY(12px);
  opacity: 0;
  transition: 180ms ease;
  box-shadow: var(--shadow);
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success-bg);
  color: #d8ffd1;
  border: 1px solid rgba(140, 214, 124, 0.28);
}

.toast.error {
  background: var(--danger-bg);
  color: #ffd7d7;
  border: 1px solid rgba(221, 107, 107, 0.28);
}

@media (max-width: 880px) {
  .hero-grid,
  .company-meta-grid,
  .company-summary-grid,
  .company-kpi-grid,
  .input-grid,
  .employee-card {
    grid-template-columns: 1fr;
  }

  .company-summary-item-wide,
  .company-kpi-span {
    grid-column: auto;
  }

  .span-2 {
    grid-column: auto;
  }

  .topbar {
    border-radius: 28px;
  }

  .employee-card {
    justify-items: start;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 100%);
  }

  .panel {
    padding: 20px;
  }

  .hero-panel h1,
  .section-head h1,
  .section-head h2 {
    font-size: 2rem;
  }
}
