:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #eef2f6;
  --text: #17202a;
  --muted: #647182;
  --line: #d7dee8;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --warning: #b45309;
  --danger: #b91c1c;
  --success: #15803d;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: var(--bg);
}

.login-hero {
  padding: 56px;
  color: white;
  background: #12343b;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-hero h1 {
  margin: 0;
  font-size: 46px;
  line-height: 1.05;
  letter-spacing: 0;
  max-width: 620px;
}

.login-hero p {
  max-width: 560px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.86);
}

.login-panel {
  align-self: center;
  justify-self: center;
  width: min(420px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-panel h2,
.view-title h1 {
  margin: 0;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea,
.toolbar input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.btn.secondary {
  background: #e7edf3;
  color: var(--text);
}

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

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.error {
  color: var(--danger);
  min-height: 20px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: #111827;
  color: #f9fafb;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #0f766e;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand strong {
  display: block;
}

.brand small {
  color: #9ca3af;
}

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

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: #d1d5db;
  text-align: left;
}

.nav svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav button.active,
.nav button:hover {
  background: #243244;
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  color: #9ca3af;
  font-size: 13px;
  line-height: 1.5;
}

.content {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

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

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

.view-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}

.view-title p {
  color: var(--muted);
  margin: 6px 0 0;
}

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

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

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

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.metric strong {
  font-size: 28px;
}

.two-col {
  grid-template-columns: 1.2fr 0.8fr;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title h2 {
  font-size: 18px;
  margin: 0;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 100px;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
}

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

.bar i {
  display: block;
  height: 100%;
  background: var(--accent-2);
}

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

.list-item {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item small,
.muted {
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
}

td {
  font-size: 14px;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e7edf3;
  color: #344255;
  font-size: 12px;
  font-weight: 700;
}

.chip.good {
  background: #dcfce7;
  color: #166534;
}

.chip.warn {
  background: #fef3c7;
  color: #92400e;
}

.chip.bad {
  background: #fee2e2;
  color: #991b1b;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
}

.lane {
  background: #e9eef4;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 380px;
}

.lane h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.deal-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 30;
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal-head,
.modal-actions {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.modal-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

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

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

@media (max-width: 980px) {
  .login-page,
  .shell,
  .two-col {
    grid-template-columns: 1fr;
  }

  .login-page {
    background: var(--bg);
  }

  .login-hero {
    padding: 32px 20px;
    background: #12343b;
  }

  .login-hero h1 {
    font-size: 34px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px;
  }

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

  .nav button {
    justify-content: center;
    font-size: 12px;
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

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

  .toolbar,
  .view-title,
  .topbar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 16px;
  }

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

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