:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #10213d;
  --muted: #6c7890;
  --line: #dce3ee;
  --navy: #10284c;
  --blue: #1f65d8;
  --green: #19bb5f;
  --amber: #d98b12;
  --red: #d83d3d;
  --shadow: 0 22px 60px rgba(16, 33, 61, 0.13);
  --soft-shadow: 0 12px 34px rgba(16, 33, 61, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(31, 101, 216, 0.12), transparent 34vw),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 52%, #eef4fb 100%);
  color: var(--text);
}

body.locked {
  overflow: hidden;
}

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

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

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 25% 15%, rgba(25, 187, 95, 0.22), transparent 34%),
    radial-gradient(circle at 80% 10%, rgba(31, 101, 216, 0.24), transparent 34%),
    #0d1f3b;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24);
}

.login-card .brand-mark {
  margin: 0 auto 18px;
  width: 64px;
  height: 64px;
}

.login-card h1 {
  font-size: 34px;
  margin-bottom: 18px;
}

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

.login-error {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--red);
  font-weight: 800;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(18, 42, 79, 0.98), rgba(8, 24, 48, 0.98)),
    radial-gradient(circle at 20% 0%, rgba(25, 187, 95, 0.28), transparent 32%);
  color: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: 16px 0 44px rgba(16, 33, 61, 0.08);
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #07111d;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  flex: 0 0 auto;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand span,
.sidebar-card p {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  margin: 3px 0 0;
  line-height: 1.45;
}

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

.nav-item {
  border: 0;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateX(2px);
}

.nav-item span:last-child {
  display: grid;
  gap: 1px;
}

.nav-item strong {
  font-size: 14px;
  line-height: 1.1;
}

.nav-item small {
  color: rgba(255, 255, 255, 0.54);
  font-size: 11px;
  line-height: 1.2;
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.11);
  display: grid;
  place-items: center;
  flex: 0 0 24px;
}

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 22px;
  min-width: 0;
}

.topbar,
.panel-header,
.task-card-top,
.task-meta,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 24px;
}

.section-label,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin: 0 0 6px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 46px);
  margin-bottom: 0;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

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

.integration-status {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.integration-pill {
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6f7c91;
  background: #eef3fa;
  border: 1px solid #dce5f1;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.integration-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.integration-pill.active {
  color: #08793b;
  background: #e8f7ef;
  border-color: #b7ebce;
}

.integration-pill.inactive {
  color: #9a610c;
  background: #fff4df;
  border-color: #f3d7a8;
}

.integration-pill.pending {
  color: #53627a;
}

.search {
  position: relative;
}

.search span {
  position: absolute;
  left: 14px;
  top: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.search input {
  width: min(360px, 34vw);
  min-height: 52px;
  padding: 22px 14px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

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

.avatar-row button {
  border: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #e9eef8;
  color: var(--navy);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(16, 33, 61, 0.04);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.avatar-row button:hover,
.avatar-row button.active {
  background: #dceaff;
  box-shadow: inset 0 0 0 2px rgba(31, 101, 216, 0.42);
  transform: translateY(-1px);
}

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

.metrics article,
.andy-focus,
.board-panel,
.detail-card,
.intake-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
}

.metrics article {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.metrics span {
  color: var(--muted);
  font-weight: 700;
}

.metrics strong {
  display: block;
  font-size: 34px;
  margin-top: 8px;
}

.team-focus {
  padding: 18px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  border-left: 5px solid var(--green);
  background:
    linear-gradient(90deg, rgba(25, 187, 95, 0.08), transparent 46%),
    #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
}

.focus-copy h2 {
  font-size: 24px;
}

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

.focus-item {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 10px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 33, 61, 0.06);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.focus-item:hover {
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.focus-status {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e8f7ef;
  color: #08793b;
  font-weight: 900;
  font-size: 12px;
}

.focus-item strong,
.focus-item small {
  display: block;
}

.focus-item strong {
  font-size: 15px;
  line-height: 1.25;
}

.focus-item small {
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.35;
}

.focus-item em {
  grid-column: 2;
  align-self: end;
  color: var(--amber);
  font-style: normal;
  font-weight: 900;
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.board-panel {
  padding: 18px;
  min-width: 0;
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header.compact {
  margin-bottom: 12px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segment {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}

.segment.active {
  background: var(--navy);
  color: #fff;
}

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

.column {
  min-height: 420px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  transition: background 160ms ease;
}

.column-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.task-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(16, 33, 61, 0.06);
  margin-bottom: 10px;
  outline: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.task-card:hover,
.task-card.selected {
  border-color: var(--blue);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.task-card.andy-owned {
  border-left: 4px solid var(--green);
}

.task-card.fabian-decision {
  box-shadow: inset 0 0 0 1px rgba(217, 139, 18, 0.28), 0 4px 18px rgba(16, 33, 61, 0.06);
}

.task-card-top {
  justify-content: space-between;
  margin-bottom: 10px;
}

.pill,
.priority,
.meta-chip {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.pill {
  background: #e8f7ef;
  color: #08793b;
}

.pill.red {
  background: #fdeaea;
  color: #a82424;
}

.pill.amber {
  background: #fff4df;
  color: #975c00;
}

.priority {
  background: #eef3fb;
  color: var(--navy);
}

.task-meta {
  gap: 6px;
  flex-wrap: wrap;
}

.meta-chip {
  background: var(--surface-soft);
  color: var(--muted);
}

.meta-chip.due {
  background: #fff4df;
  color: #975c00;
}

.detail-panel {
  display: grid;
  gap: 14px;
}

.detail-card {
  padding: 18px;
}

.selected-task ul {
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.selected-task a {
  color: var(--blue);
  font-weight: 800;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
}

.status-dot.green {
  background: var(--green);
}

.telegram-feed {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
}

.calendar-feed {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.calendar-event {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: var(--radius);
  background: #f7fbff;
  border: 1px solid #dceaff;
}

.calendar-event time {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.calendar-event strong {
  color: var(--text);
  line-height: 1.25;
}

.calendar-event span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.telegram-message {
  padding: 12px;
  border-radius: var(--radius);
  background: #eef8f3;
  border: 1px solid #ccefdc;
  color: #244736;
  font-size: 14px;
  line-height: 1.45;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
  font-size: 14px;
}

.primary-button {
  border: 0;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.ghost-button {
  border: 1px solid var(--line);
  min-height: 38px;
  padding: 0 13px;
  border-radius: var(--radius);
  background: #fff;
  color: var(--navy);
  font-weight: 900;
  cursor: pointer;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--navy);
  font-weight: 900;
  cursor: pointer;
}

.ghost-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.icon-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.ghost-button.full-width {
  width: 100%;
  margin-top: 8px;
}

.primary-button:hover {
  background: #183761;
  box-shadow: 0 10px 22px rgba(16, 40, 76, 0.18);
  transform: translateY(-1px);
}

.intake-panel {
  padding: 18px;
  display: grid;
  gap: 16px;
}

#intakeForm {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr auto;
  gap: 12px;
  align-items: end;
}

#intakeForm .wide {
  grid-column: 1 / 3;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

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

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 14px;
  }

  .nav-list {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    overflow-x: auto;
  }

  .sidebar-card {
    display: none;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .team-focus {
    grid-template-columns: 1fr;
  }

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

}

@media (max-width: 760px) {
  .workspace {
    padding: 16px;
  }

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

  .search input {
    width: 100%;
  }

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

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

  .kanban {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .column {
    min-height: auto;
  }

  #intakeForm {
    grid-template-columns: 1fr;
  }

  #intakeForm .wide {
    grid-column: auto;
  }
}
