:root {
  --bg: #080b10;
  --panel: #101722;
  --panel-strong: #151f2d;
  --line: #253247;
  --text: #f3f7fb;
  --muted: #94a5ba;
  --primary: #2f8cff;
  --primary-dark: #0f62cc;
  --primary-soft: #132b49;
  --accent: #c7a86b;
  --success: #4bd2a2;
  --warning: #e2b65e;
  --danger: #ff7066;
  --sidebar: #080c13;
  --sidebar-soft: #111a27;
  --surface: #0d141e;
  --field: #0c121b;
  --field-strong: #111a26;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #111a25 0%, var(--bg) 310px),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(47, 140, 255, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47, 140, 255, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(47, 140, 255, 0.18), transparent 34%),
    linear-gradient(145deg, #070a0f 0%, #0d1520 58%, #070a0f 100%);
  background-size:
    56px 56px,
    56px 56px,
    auto,
    auto;
  overflow: hidden;
  position: relative;
}

.auth-shell::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 38%, rgba(199, 168, 107, 0.12) 50%, transparent 62%);
  animation: loginSweep 8s linear infinite;
}

.auth-shell::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 32%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.auth-card {
  width: min(480px, 100%);
  background: rgba(16, 23, 34, 0.86);
  border: 1px solid rgba(143, 170, 202, 0.2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(18px);
  animation: loginCardIn 0.62s ease both;
  z-index: 1;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--primary), #87c6ff);
}

.auth-card::after {
  content: "";
  position: absolute;
  inset: 4px 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.46), transparent);
  animation: headerPulse 3.2s ease-in-out infinite;
}

.brand-mark,
.company-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #07101d, var(--primary-dark) 48%, var(--primary));
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow:
    0 12px 28px rgba(47, 140, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation: brandFloat 4s ease-in-out infinite;
}

.auth-card h1,
.topbar h2 {
  margin: 4px 0 10px;
  letter-spacing: 0;
}

.auth-copy,
.auth-note,
.muted,
.sidebar-brand span,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.auth-note {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(19, 43, 73, 0.52);
  font-size: 0.92rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 18px 0 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 12, 19, 0.78);
}

.auth-tabs button {
  border: 0;
  border-radius: 6px;
  padding: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tabs button.active {
  background: linear-gradient(180deg, #17273a, #101b2a);
  color: #f7fbff;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.eye-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 75% 0;
  transform: rotate(45deg);
}

.eye-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.password-toggle[aria-pressed="true"] .eye-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -4px;
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translateY(-50%) rotate(90deg);
}

.caps-warning {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 2px;
  padding: 5px 8px;
  border: 1px solid rgba(226, 182, 94, 0.42);
  border-radius: 6px;
  background: rgba(226, 182, 94, 0.12);
  color: #f6d58b;
  font-size: 0.78rem;
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background:
    linear-gradient(180deg, #0b1018 0%, var(--sidebar) 64%, #05070b 100%);
  color: #fff;
  overflow-y: auto;
  border-right: 1px solid rgba(143, 170, 202, 0.12);
  box-shadow: 16px 0 40px rgba(0, 0, 0, 0.18);
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(143, 170, 202, 0.12);
}

.sidebar-brand span {
  display: block;
  margin-top: 3px;
  font-size: 0.85rem;
}

.company-logo.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-list button {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(234, 242, 252, 0.7);
  text-align: left;
  font-weight: 700;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.nav-list svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: rgba(135, 198, 255, 0.78);
}

.nav-list button:hover,
.nav-list button.active {
  background: rgba(47, 140, 255, 0.11);
  border-color: rgba(135, 198, 255, 0.18);
  color: #fff;
  transform: translateX(2px);
}

.nav-list button.active {
  box-shadow:
    inset 3px 0 0 var(--accent),
    0 10px 24px rgba(0, 0, 0, 0.14);
}

.nav-list button.active svg {
  color: #f2c878;
}

.main-panel {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(47, 140, 255, 0.07), transparent 260px),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 24px;
  background: rgba(8, 12, 18, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

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

.view-root {
  padding: 24px;
}

.view-root > * {
  animation: contentIn 0.32s ease both;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card,
.table-card,
.form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card,
.table-card,
.form-card,
.status-column,
.mini-card {
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.card:hover,
.form-card:hover,
.status-column:hover {
  border-color: rgba(135, 198, 255, 0.22);
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.card,
.form-card {
  padding: 20px;
}

.metric {
  display: grid;
  gap: 8px;
  border-top: 3px solid var(--accent);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 52%),
    var(--panel);
}

.metric strong {
  font-size: 1.78rem;
  letter-spacing: 0;
}

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

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

.section-head h3 {
  margin: 0;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.success-btn {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-weight: 700;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.primary-btn {
  background: linear-gradient(180deg, #3a9aff, var(--primary-dark));
  color: #fff;
  box-shadow:
    0 12px 28px rgba(47, 140, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.primary-btn:hover {
  background: linear-gradient(180deg, #65adff, #105fc1);
  transform: translateY(-1px);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--line);
}

.ghost-btn:hover {
  background: rgba(47, 140, 255, 0.12);
  border-color: rgba(135, 198, 255, 0.24);
  transform: translateY(-1px);
}

.danger-btn {
  background: rgba(255, 112, 102, 0.1);
  color: var(--danger);
  border-color: rgba(255, 112, 102, 0.25);
}

.success-btn {
  background: rgba(75, 210, 162, 0.1);
  color: var(--success);
  border-color: rgba(75, 210, 162, 0.25);
}

.compact {
  padding: 8px 11px;
  font-size: 0.92rem;
}

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

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--text);
  background: var(--field);
  outline: 0;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: var(--field-strong);
  box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.16);
}

input::placeholder,
textarea::placeholder {
  color: #68788d;
}

.table-card {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #0c131d;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(47, 140, 255, 0.05);
}

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

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--primary-soft);
  color: #9fcbff;
  border: 1px solid rgba(47, 140, 255, 0.2);
}

.tag.success {
  background: rgba(75, 210, 162, 0.1);
  color: var(--success);
  border-color: rgba(75, 210, 162, 0.2);
}

.tag.warning {
  background: rgba(226, 182, 94, 0.12);
  color: var(--warning);
  border-color: rgba(226, 182, 94, 0.2);
}

.tag.danger {
  background: rgba(255, 112, 102, 0.1);
  color: var(--danger);
  border-color: rgba(255, 112, 102, 0.2);
}

.empty-state {
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.modal-card {
  width: min(780px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px;
}

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

.modal-head h3 {
  margin: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: #111b28;
  color: #fff;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

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

.split-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.split-line:last-child {
  border-bottom: 0;
}

.total-line {
  font-size: 1.2rem;
  font-weight: 800;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.status-column {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.status-column h4 {
  margin: 0 0 10px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 8px;
  background: #0d141e;
}

.mini-card strong {
  display: block;
  margin-bottom: 4px;
}

.print-area {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  .print-area,
  .print-area * {
    visibility: visible;
  }

  .print-area {
    display: block;
    position: absolute;
    inset: 0;
    padding: 24px;
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
  }

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

  .topbar {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
    background: #0b1018;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .view-root,
  .topbar,
  .sidebar,
  .auth-card {
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .button-row {
    width: 100%;
  }

  .topbar-actions button,
  .button-row button {
    flex: 1 1 auto;
  }

  .auth-card {
    padding: 24px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }
}

@keyframes loginCardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes loginSweep {
  from {
    transform: translateX(-18%) rotate(0deg);
  }

  to {
    transform: translateX(18%) rotate(0deg);
  }
}

@keyframes headerPulse {
  0%,
  100% {
    opacity: 0.28;
  }

  50% {
    opacity: 0.82;
  }
}

@keyframes brandFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

@keyframes contentIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

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