:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #162024;
  --muted: #66747b;
  --line: #d9e0e4;
  --brand: #1167b1;
  --brand-dark: #0d4d86;
  --danger: #b42318;
  --warning: #9a6700;
  --shadow: 0 16px 36px rgba(22, 32, 36, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button,
.file-action {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-header {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 24px clamp(16px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

main {
  display: grid;
  gap: 18px;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
}

[hidden] {
  display: none !important;
}

.login-screen {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

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

.header-actions,
.dialog-actions,
.dialog-actions > div {
  align-items: center;
  display: flex;
  gap: 10px;
}

.primary,
.secondary,
.danger,
.file-action {
  align-items: center;
  display: inline-flex;
  font-weight: 750;
  justify-content: center;
  padding: 0 14px;
}

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

.primary:hover {
  background: var(--brand-dark);
}

.secondary,
.file-action {
  background: #e9eef1;
  color: var(--ink);
}

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

.file-action input {
  display: none;
}

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

.summary article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.summary-filter {
  cursor: pointer;
}

.summary-filter:hover,
.summary-filter.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 103, 177, 0.12);
}

.summary-filter.active span,
.summary-filter.active strong {
  color: var(--brand);
}

.summary span,
label span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
}

.summary strong {
  display: block;
  font-size: 26px;
}

.toolbar {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) 220px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 103, 177, 0.14);
}

.board {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  overflow-x: auto;
  padding-bottom: 8px;
}

.column {
  background: #eef3f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 420px;
  min-width: 220px;
  padding: 10px;
}

.column.stage-new {
  background: #f6fbff;
  border-color: #bfd9ef;
}

.column.stage-new h2 {
  color: #0d4d86;
}

.column.stage-discovery {
  background: #f6fff9;
  border-color: #b9e2c8;
}

.column.stage-discovery h2 {
  color: #166534;
}

.column.stage-proposal {
  background: #fffaf2;
  border-color: #ead3a6;
}

.column.stage-proposal h2 {
  color: #805200;
}

.column.stage-won {
  background: #f3fff3;
  border-color: #a7d7a7;
}

.column.stage-won h2 {
  color: #237a2d;
}

.column.stage-lost {
  background: #fff7f7;
  border-color: #efc0c0;
}

.column.stage-lost h2 {
  color: #9f1f1f;
}

.column header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 4px 4px 10px;
}

.column h2 {
  font-size: 15px;
}

.column header span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
}

.column.drag-over {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px rgba(17, 103, 177, 0.16);
}

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

.card {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(22, 32, 36, 0.05);
  color: var(--ink);
  display: grid;
  gap: 8px;
  min-height: 138px;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.card:hover {
  border-color: var(--brand);
}

.card-topline {
  align-items: start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.company {
  overflow-wrap: anywhere;
}

.value {
  color: var(--brand);
  flex: 0 0 auto;
  font-weight: 800;
}

.contact,
.services,
.next-action,
.card-meta {
  color: var(--muted);
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.next-action.due {
  color: var(--warning);
  font-weight: 800;
}

.card-meta {
  border-top: 1px solid var(--line);
  font-weight: 800;
  padding-top: 8px;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 760px;
  padding: 0;
  width: calc(100vw - 28px);
}

dialog::backdrop {
  background: rgba(22, 32, 36, 0.36);
}

form {
  background: #fbfdfe;
  display: grid;
  gap: 18px;
  padding: 24px;
}

.dialog-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
}

.icon-button {
  background: #eef3f5;
  color: var(--ink);
  height: 36px;
  width: 36px;
}

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

.detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.link-section {
  background: #f6fbff;
  border-color: #bfd9ef;
}

.notes-section {
  background: #fffaf2;
  border-color: #ead3a6;
}

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

.section-title h3 {
  font-size: 16px;
  margin: 0;
}

.section-title span,
.helper-text,
.empty-state {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.link-section .section-title h3 {
  color: #0d4d86;
}

.notes-section .section-title h3 {
  color: #805200;
}

.note-list,
.link-list {
  display: grid;
  gap: 8px;
}

.note-item,
.link-item {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  padding: 12px;
}

.link-item {
  border-color: #c9e0f3;
}

.note-item {
  border-color: #ead8b7;
}

.note-item time,
.link-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.link-item {
  color: var(--ink);
  text-decoration: none;
}

.link-item:hover {
  border-color: var(--brand);
}

.note-item p {
  margin: 0;
  white-space: pre-wrap;
}

.dialog-actions {
  justify-content: space-between;
  margin-top: 6px;
}

@media (max-width: 920px) {
  .app-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .app-header {
    position: static;
  }

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

@media (max-width: 620px) {
  .summary,
  .toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions > div {
    align-items: stretch;
    flex-direction: column;
  }
}
