:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #1a303a;
  background: #f3f5f1;
  --ink: #1a303a;
  --sub: #586a6e;
  --line: #dce3dc;
  --paper: #fff;
  --wash: #f3f5f1;
  --nav: #172e39;
  --green: #dceba6;
  --accent: #24586a;
  --tint: #e9efe5;
  --danger: #aa3f3a;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  color: #e5ebe5;
  background: #0f2028;
  --ink: #e5ebe5;
  --sub: #a3b4b5;
  --line: #33474e;
  --paper: #1a303a;
  --wash: #0f2028;
  --nav: #0b1c24;
  --accent: #b9da91;
  --tint: #253e41;
  --danger: #ffaaa2;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  display: block;
  max-width: 100%;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  letter-spacing: -0.035em;
  line-height: 1.18;
}
h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 610;
}
h2 {
  font-size: 1.14rem;
  font-weight: 650;
}
h3 {
  font-size: 1rem;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #4e98d0;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip {
  position: fixed;
  top: -80px;
  left: 12px;
  padding: 12px;
  z-index: 10;
  color: #172e39;
  background: white;
}
.skip:focus {
  top: 12px;
}
.loading,
.auth {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  padding: 24px;
}
.loading {
  justify-items: center;
  gap: 20px;
}
.loading img {
  width: 80px;
}
.auth {
  background:
    radial-gradient(ellipse at 10% 10%, #dbe3c9, transparent 60%), var(--wash);
}
.auth-card {
  width: min(460px, calc(100vw - 40px));
  padding: 38px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 80px #0b253414;
}
.auth-card img {
  width: 82px;
  margin-bottom: 36px;
}
:root[data-theme="dark"] .auth-card img,
:root[data-theme="dark"] .loading img {
  filter: brightness(0) invert(1);
}
.auth-card h1 {
  font-size: 2rem;
}
.auth-card p {
  color: var(--sub);
  line-height: 1.6;
  margin-top: 12px;
}
.auth-card form {
  margin-top: 28px;
}
.auth-card .button {
  width: 100%;
}
#auth-toggle {
  margin-top: 16px;
}
.setup-note {
  margin-top: 24px;
}
.space-top {
  margin-top: 20px;
}
.space-bottom {
  margin-bottom: 20px;
}
.auth-card .field {
  margin-bottom: 18px;
}
.shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 28px 16px 18px;
  background: var(--nav);
  color: #d9e4df;
  display: flex;
  flex-direction: column;
  z-index: 4;
}
.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 0 12px 28px;
  border-bottom: 1px solid #ffffff24;
}
.brand img {
  width: 45px;
  filter: brightness(0) invert(1);
}
.brand span {
  border-left: 1px solid #ffffff45;
  padding-left: 14px;
  font-size: 0.78rem;
  letter-spacing: 0.11em;
  font-weight: 650;
}
.nav {
  margin-top: 26px;
  display: grid;
  gap: 4px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  color: #bfcece;
  border-radius: 8px;
  font-size: 0.9rem;
}
.nav a:hover {
  background: #ffffff0c;
  color: white;
}
.nav a[aria-current] {
  background: var(--green);
  color: #1e3437;
  font-weight: 650;
}
.nav-symbol {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
}
.sidebar-end {
  margin-top: auto;
  padding: 22px 11px 0;
}
.owner {
  font-size: 0.76rem;
  color: #b7c7c7;
  overflow-wrap: anywhere;
  padding-bottom: 16px;
  border-bottom: 1px solid #ffffff24;
}
.owner strong {
  display: block;
  color: #e8efeb;
  font-weight: 500;
  margin-bottom: 5px;
}
.signout {
  color: #c8d5d2;
  margin-top: 14px;
  border: 0;
  padding: 0;
  background: none;
  font-size: 0.83rem;
}
.content {
  min-width: 0;
}
.topbar {
  min-height: 68px;
  padding: 13px clamp(20px, 4vw, 60px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.path {
  font-size: 0.8rem;
  color: var(--sub);
}
.path span {
  margin: 0 9px;
  color: var(--line);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.command-button,
.icon-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 7px;
  min-height: 35px;
  padding: 6px 10px;
  font-size: 0.8rem;
}
.command-button kbd {
  margin-left: 18px;
  font-size: 0.68rem;
  color: var(--sub);
}
.mobile-menu {
  display: none;
}
.workspace {
  width: min(1580px, 100%);
  margin: auto;
  padding: 34px clamp(20px, 4vw, 60px) 60px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.page-head p {
  color: var(--sub);
  margin-top: 9px;
  font-size: 0.9rem;
  line-height: 1.55;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 7px;
  min-height: 40px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.button.primary {
  color: white;
  background: #245164;
}
.button.primary:hover {
  background: #173b4c;
}
.button.secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}
.button.danger {
  background: #a23a35;
  color: white;
}
.button.danger:hover {
  background: #812b27;
}
.text-button {
  border: 0;
  background: none;
  padding: 5px 0;
  color: var(--accent);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}
.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.panel,
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
}
.panel {
  padding: 23px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}
.stat {
  padding: 18px 20px;
}
.stat span {
  font-size: 0.77rem;
  color: var(--sub);
}
.stat strong {
  display: block;
  margin-top: 13px;
  font-size: 1.8rem;
  font-weight: 590;
  letter-spacing: -0.055em;
  overflow-wrap: anywhere;
}
.stat small {
  display: block;
  font-size: 0.73rem;
  color: var(--sub);
  margin-top: 6px;
}
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.goal-panel {
  color: #e9f0df;
  background: #1c3742;
  border-color: #1c3742;
}
.goal-panel .caption {
  color: #becbc6;
}
.goal-value {
  font-size: clamp(2.2rem, 4.7vw, 4rem);
  font-weight: 550;
  letter-spacing: -0.065em;
  margin: 25px 0 10px;
}
.goal-value small {
  font-size: 0.85rem;
  letter-spacing: 0;
  margin-right: 8px;
}
.emergency-goal {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #ffffff30;
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.85rem;
}
.emergency-goal strong {
  white-space: nowrap;
  color: #dceba6;
  font-size: 1.8rem;
  font-weight: 550;
}
.caption {
  color: var(--sub);
  font-size: 0.78rem;
  line-height: 1.5;
}
.goal {
  display: grid;
  grid-template-columns: 80px 1fr 35px;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  margin-top: 17px;
}
progress {
  appearance: none;
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 5px;
  background: #4d636b;
}
progress::-webkit-progress-bar {
  background: #4d636b;
  border-radius: 5px;
}
progress::-webkit-progress-value {
  background: #c9e38d;
  border-radius: 5px;
}
.pipeline-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 150px;
  padding: 15px 0 0;
}
.chart-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.chart-col .bar {
  background: #9bbd8b;
  width: 100%;
  max-width: 55px;
  min-height: 2px;
  border-radius: 5px 5px 0 0;
}
.chart-col .number {
  color: var(--ink);
  font-size: 0.78rem;
}
.chart-col .name {
  font-size: 0.65rem;
  color: var(--sub);
  writing-mode: vertical-rl;
  min-height: 65px;
}
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}
.row strong {
  display: block;
  font-size: 0.87rem;
  font-weight: 600;
}
.row p {
  color: var(--sub);
  font-size: 0.78rem;
  margin-top: 4px;
  line-height: 1.5;
}
.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 0.69rem;
  color: var(--sub);
  white-space: nowrap;
}
.badge.good {
  background: #e5efce;
  border-color: #d2dfb8;
  color: #395631;
}
.badge.warn {
  background: #fff0d6;
  border-color: #e8d4a8;
  color: #7c5c21;
}
.badge.bad {
  background: #fae7e3;
  border-color: #e6c6bf;
  color: #934d40;
}
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.toolbar input {
  flex: 1 1 210px;
}
input,
select,
textarea {
  min-width: 0;
  max-width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  padding: 10px 11px;
  font-size: 0.87rem;
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 105px;
  line-height: 1.6;
}
.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  min-width: 0;
}
.field > span {
  font-size: 0.8rem;
  font-weight: 550;
}
.field > small {
  color: var(--sub);
  font-size: 0.73rem;
  line-height: 1.5;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.84rem;
  line-height: 1.6;
  margin-bottom: 20px;
}
.check input {
  flex: 0 0 auto;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}
th {
  font-size: 0.7rem;
  font-weight: 550;
  color: var(--sub);
  padding: 0 15px 13px 0;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 16px 15px 16px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td strong {
  display: block;
  font-weight: 600;
}
.subline {
  display: block;
  margin-top: 5px;
  font-size: 0.74rem;
  color: var(--sub);
}
.empty {
  padding: 42px 15px;
  text-align: center;
  max-width: 600px;
  margin: auto;
}
.empty h2 {
  font-size: 1.2rem;
  margin-bottom: 9px;
}
.empty p {
  color: var(--sub);
  line-height: 1.6;
  font-size: 0.88rem;
}
.empty .button {
  margin-top: 19px;
}
.notice {
  padding: 14px 16px;
  background: var(--tint);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--sub);
  line-height: 1.65;
  margin-bottom: 20px;
}
.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 250px;
  overflow-x: auto;
  gap: 14px;
  padding-bottom: 14px;
}
.lane {
  min-height: 320px;
  background: var(--tint);
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 10px;
}
.lane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.lane-head h2 {
  font-size: 0.83rem;
  letter-spacing: 0;
}
.lane-head span {
  font-size: 0.73rem;
  color: var(--sub);
}
.lead-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}
.lead-card h3 {
  font-size: 0.88rem;
  margin-bottom: 5px;
}
.lead-card p {
  color: var(--sub);
  font-size: 0.76rem;
  margin-bottom: 11px;
}
.lead-card select {
  width: 100%;
  font-size: 0.72rem;
  padding: 7px;
  margin-top: 12px;
}
.card-bottom {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.card-bottom span {
  color: var(--sub);
  font-size: 0.73rem;
}
.lane-empty {
  color: var(--sub);
  font-size: 0.78rem;
  padding: 30px 0;
  text-align: center;
}
.inbox {
  display: grid;
  grid-template-columns: minmax(220px, 0.4fr) minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
  min-height: 550px;
}
.threads {
  border-right: 1px solid var(--line);
}
.threads-title {
  padding: 21px;
  border-bottom: 1px solid var(--line);
}
.thread {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  color: var(--ink);
  padding: 18px 20px;
}
.thread[aria-pressed="true"] {
  background: var(--tint);
  box-shadow: inset 3px 0 var(--accent);
}
.thread strong {
  font-size: 0.84rem;
}
.thread span {
  display: block;
  color: var(--sub);
  font-size: 0.73rem;
  margin-top: 5px;
}
.conversation {
  padding: 24px;
}
.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.messages {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 24px 0;
  max-height: 500px;
  overflow-y: auto;
}
.message {
  max-width: 85%;
  padding: 13px 15px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 10px 10px 10px 2px;
}
.message.outgoing {
  align-self: flex-end;
  background: var(--tint);
  border-radius: 10px 10px 2px 10px;
}
.message p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  line-height: 1.6;
}
.message small {
  display: block;
  color: var(--sub);
  font-size: 0.66rem;
  margin-top: 8px;
}
.integration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.integration-card {
  padding: 24px;
}
.integration-card .badge {
  margin-bottom: 18px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.integration-card p {
  color: var(--sub);
  font-size: 0.85rem;
  line-height: 1.65;
  margin: 12px 0 0;
}
.draft-text {
  white-space: pre-wrap;
  font-size: 0.87rem;
  line-height: 1.7;
  margin: 18px 0;
  padding: 17px;
  background: var(--wash);
  border-radius: 7px;
}
.record-details {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px 18px;
  font-size: 0.85rem;
  line-height: 1.6;
}
.record-details dt {
  color: var(--sub);
}
.record-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.error {
  color: var(--danger);
  font-size: 0.83rem;
  line-height: 1.6;
  margin: 12px 0;
}
dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  padding: 28px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
}
dialog::backdrop {
  background: #06182280;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 25px;
}
.dialog-head h2 {
  font-size: 1.35rem;
}
.dialog-head .icon-button {
  font-size: 1.25rem;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}
.dialog-actions .button {
  white-space: normal;
}
.import-errors {
  color: var(--danger);
  padding-left: 20px;
  font-size: 0.8rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
#commands {
  width: min(480px, calc(100vw - 32px));
}
#command-search {
  width: 100%;
  margin-bottom: 15px;
}
#command-results a {
  display: block;
  padding: 12px;
  border-radius: 6px;
  font-size: 0.9rem;
}
#command-results a:hover {
  background: var(--tint);
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 13px 20px;
  border: 1px solid #45616b;
  border-radius: 9px;
  background: #173641;
  color: white;
  box-shadow: 0 8px 35px #102b3322;
  z-index: 9;
  font-size: 0.85rem;
  max-width: calc(100vw - 32px);
}
@media (prefers-reduced-motion: no-preference) {
  .button,
  .nav a,
  .thread {
    transition: background 0.16s;
  }
}
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shell {
    grid-template-columns: 205px minmax(0, 1fr);
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    left: -250px;
    width: 230px;
    box-shadow: 0 0 0 100vmax #0b182650;
    visibility: hidden;
  }
  .sidebar.open {
    left: 0;
    visibility: visible;
  }
  .mobile-menu {
    display: inline-flex;
  }
  .topbar {
    padding-inline: 18px;
  }
  .path {
    display: none;
  }
  .workspace {
    padding: 25px 18px 45px;
  }
  .page-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .command-button kbd {
    display: none;
  }
  .panel {
    padding: 18px;
  }
  .stat {
    padding: 16px;
  }
  .stat strong {
    font-size: 1.6rem;
  }
  .inbox {
    grid-template-columns: 1fr;
    padding: 0;
  }
  .threads {
    border-right: 0;
    max-height: 230px;
    overflow: auto;
    border-bottom: 1px solid var(--line);
  }
  .conversation {
    padding: 18px;
  }
  .integration-grid {
    grid-template-columns: 1fr;
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .record-details {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .record-details dd {
    margin-bottom: 12px;
  }
  dialog {
    padding: 21px;
  }
}
