:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --text: #172033;
  --muted: #65748b;
  --line: #dce4ee;
  --primary: #2563eb;
  --primary-2: #0f766e;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
  --shadow: 0 18px 50px rgba(21, 30, 48, 0.1);
}

[data-theme="dark"] {
  --bg: #10141d;
  --surface: #171d29;
  --surface-2: #202839;
  --text: #edf3fb;
  --muted: #9aa8bb;
  --line: #2d3748;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: linear-gradient(135deg, #172033 0%, #0f766e 100%);
}

.login-hero {
  color: #fff;
  padding: 72px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #0f766e;
  font-weight: 900;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex: 0 0 auto;
}

.hero-logo {
  width: 86px;
  height: 86px;
}

.login-copy h1 {
  max-width: 760px;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: 1;
  margin: 0 0 24px;
  letter-spacing: 0;
}

.login-copy p {
  max-width: 680px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.12rem;
  line-height: 1.7;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-card {
  width: min(430px, 100%);
  padding: 34px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.auth-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.88rem;
}

.field input,
.field select,
.field textarea,
.search {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 750;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

.ghost-btn,
.icon-btn {
  background: var(--surface-2);
  color: var(--text);
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px;
  border-radius: 8px;
  text-align: left;
  font-weight: 750;
}

.nav button.active {
  background: var(--surface-2);
  color: var(--primary);
}

.main {
  min-width: 0;
  padding: 26px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 1.55rem;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

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

.metrics {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.card,
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.04);
}

.metric-card {
  padding: 18px;
  animation: rise 0.36s ease both;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  margin-top: 16px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search {
  min-width: 260px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.column {
  min-height: 560px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.column h3 {
  display: flex;
  justify-content: space-between;
  margin: 4px 4px 12px;
  font-size: 0.95rem;
}

.task-card {
  padding: 14px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.06);
}

.task-card[draggable="true"] {
  cursor: grab;
}

.task-card h4 {
  margin: 0 0 8px;
}

.task-card p,
.small {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.74rem;
  font-weight: 850;
  background: var(--surface-2);
  color: var(--muted);
}

.urgent {
  color: #fff;
  background: var(--danger);
}

.high {
  color: #fff;
  background: var(--warning);
}

.done {
  color: #fff;
  background: var(--success);
}

.charts {
  grid-template-columns: 1.25fr 0.75fr;
  margin-top: 16px;
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1rem;
}

.bar {
  display: grid;
  grid-template-columns: 115px 1fr 42px;
  align-items: center;
  gap: 10px;
  margin: 13px 0;
}

.bar-track {
  height: 12px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.calendar,
.timeline {
  display: grid;
  gap: 10px;
}

.calendar {
  grid-template-columns: repeat(7, 1fr);
}

.day {
  min-height: 106px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  padding: 13px;
  border-left: 3px solid var(--primary);
  background: var(--surface);
  border-radius: 8px;
}

.person-score {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.person-score:last-child {
  border-bottom: 0;
}

.traffic {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: 0 0 0 5px var(--surface-2);
}

.traffic.green {
  background: var(--success);
}

.traffic.yellow {
  background: var(--warning);
}

.traffic.red {
  background: var(--danger);
}

.traffic.black {
  background: #111827;
}

.toast-stack {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 50;
  display: grid;
  gap: 14px;
  width: min(520px, calc(100vw - 36px));
}

.toast {
  position: relative;
  padding: 22px 56px 22px 22px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #172033, #0f766e);
  box-shadow: var(--shadow);
  animation: slide 0.25s ease both;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 1rem;
}

.toast strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.toast p {
  margin: 0;
  line-height: 1.5;
}

.toast-close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 14, 25, 0.62);
  z-index: 15;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(740px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

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

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

@keyframes slide {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 1180px) {
  .workspace,
  .charts {
    grid-template-columns: 1fr;
  }

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

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

  .login-hero {
    padding: 34px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .form-grid,
  .calendar {
    grid-template-columns: 1fr;
  }

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