:root {
  font-family: Arial, Helvetica, sans-serif;
  --bg: #0e2432;
  --panel: #163343;
  --panel2: #1b3b4d;
  --text: #e7eff2;
  --muted: #8ca4b2;
  --border: #35505f;
  --accent: #4c92f7;
  --green: #42c39a;
  --red: #ec729a;
  --input: #112c3c;
}
.muted {
  color: var(--muted);
}
.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.danger {
  color: var(--red);
}
.success {
  color: var(--green);
}
.rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 72px;
  background: #0a1c27;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  font-size: 28px;
  font-weight: bold;
  color: #e1f5ff;
  padding: 13px 0;
  text-align: center;
  letter-spacing: -3px;
  border-bottom: 1px solid var(--border);
}
.rail a {
  height: 65px;
  color: #a4b7c3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 10px;
  gap: 5px;
  border-left: 3px solid transparent;
}
.rail a:hover,
.rail a.active {
  background: var(--panel);
  color: white;
  border-left-color: var(--accent);
  text-decoration: none;
}
.rail svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.4;
}
.rail .bottom {
  margin-top: auto;
}
.workspace {
  margin-left: 72px;
  min-height: 100vh;
}
.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 {
  margin: 0;
  white-space: nowrap;
}
.topbar .search {
  flex: 1;
  max-width: 360px;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
}
.topbar .spacer {
  flex: 1;
}
.topbar select {
  max-width: 220px;
}
.summary {
  color: var(--muted);
  white-space: nowrap;
}
.summary strong {
  color: var(--text);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tabs {
  display: flex;
  gap: 5px;
}
.tabs button {
  background: transparent;
  border-color: transparent;
}
.tabs button.active {
  border-bottom: 2px solid var(--accent);
  color: white;
}
.content {
  padding: 22px;
}
.board {
  display: flex;
  gap: 10px;
  overflow: auto;
  height: calc(100vh - 121px);
  padding: 0 20px 20px;
}
.stage {
  min-width: 265px;
  width: 285px;
  flex-shrink: 0;
}
.stage-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  padding: 16px 8px 10px;
  text-align: center;
  border-bottom: 3px solid var(--stage);
  margin-bottom: 12px;
}
.stage-head h3 {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  margin-bottom: 7px;
}
.stage-head small {
  color: var(--muted);
}
.lead {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin: 6px 0;
  padding: 10px;
  min-height: 82px;
  cursor: pointer;
}
.lead:hover {
  border-color: #7193a7;
}
.lead .meta {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.lead .title {
  color: #58aafa;
  line-height: 1.4;
}
.lead .price {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}
.quick {
  border: 1px dashed var(--border);
  width: 100%;
  background: transparent;
  color: var(--muted);
  margin: 6px 0;
}
.table-wrap {
  overflow: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  color: var(--muted);
  font-weight: normal;
  padding: 12px;
  background: var(--panel);
  position: sticky;
  top: 0;
}
.table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table tbody tr:hover {
  background: var(--panel);
}
.table .record {
  cursor: pointer;
  color: #60b0f2;
}
.pager {
  display: flex;
  justify-content: space-between;
  margin: 18px 0;
  align-items: center;
}
.empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}
.loading {
  height: 4px;
  background: linear-gradient(90deg, var(--bg), var(--accent), var(--bg));
  background-size: 200%;
  animation: load 1s infinite;
}
@keyframes load {
  to {
    background-position: 200%;
  }
}
.card-page {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: calc(100vh - 62px);
}
.properties {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 22px;
  max-height: calc(100vh - 62px);
  overflow: auto;
}
.properties h2 {
  line-height: 1.4;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 16px;
}
.field label {
  color: var(--muted);
  font-size: 12px;
}
.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fields-grid .field {
  margin: 0;
}
.section {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 20px;
}
.link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  gap: 10px;
}
.feed {
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.feed-list {
  flex: 1;
  max-height: 65vh;
  overflow: auto;
}
.event {
  border-bottom: 1px solid var(--border);
  padding: 16px 8px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.event .meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
.composer {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 4px;
  margin-top: 20px;
}
.composer textarea {
  width: 100%;
  background: transparent;
  border: 0;
}
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.actions.end {
  justify-content: flex-end;
}
.pill {
  display: inline-block;
  border-radius: 4px;
  background: #29495d;
  color: #bad1df;
  padding: 4px 7px;
  font-size: 11px;
  margin: 2px;
}
.task-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}
.task-item input {
  width: 20px;
  height: 20px;
}
.task-item .task-body {
  flex: 1;
}
.task-item.completed .task-text {
  text-decoration: line-through;
  color: var(--muted);
}
.overdue {
  color: var(--red);
}
.day-title {
  padding: 16px;
  background: var(--panel2);
  margin: 0;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
}
.calendar .day {
  background: var(--bg);
  min-height: 120px;
  padding: 10px;
}
.calendar .day .task-chip {
  display: block;
  padding: 7px;
  background: var(--panel2);
  margin-top: 6px;
  border-left: 2px solid var(--accent);
  font-size: 11px;
  cursor: pointer;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.stat strong {
  display: block;
  font-size: 30px;
  margin-bottom: 8px;
}
.bar {
  height: 24px;
  background: var(--accent);
  min-width: 2px;
  border-radius: 2px;
}
.chart-row {
  display: grid;
  grid-template-columns: 200px 1fr 70px;
  gap: 15px;
  align-items: center;
  margin: 18px 0;
}
.settings-grid {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 24px;
}
.settings-nav button {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
}
.box {
  background: var(--panel);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 18px;
}
.box textarea.json {
  width: 100%;
  height: 300px;
  font-family: monospace;
  font-size: 12px;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 30%, #224b60, var(--bg) 70%);
}
.login form {
  width: 390px;
  max-width: 90vw;
  padding: 38px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.login h1 {
  font-size: 28px;
}
.login button {
  width: 100%;
  margin-top: 8px;
}
.error {
  color: var(--red);
  padding: 8px 0;
  white-space: pre-wrap;
}
dialog {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  padding: 26px;
}
dialog::backdrop {
  background: #0009;
}
dialog .close {
  float: right;
  padding: 4px 10px;
}
dialog h2 {
  margin-bottom: 24px;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #264d63;
  border: 1px solid var(--border);
  padding: 14px 24px;
  border-radius: 4px;
  z-index: 100;
  display: none;
  box-shadow: 0 4px 30px #0006;
}
.chat-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 62px);
}
.chat-list {
  border-right: 1px solid var(--border);
  overflow: auto;
}
.chat-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 18px;
  background: var(--bg);
}
.chat-row.active {
  background: var(--panel2);
}
.chat-row strong {
  display: block;
  margin-bottom: 7px;
}
.chat-row small {
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px;
}
.messages {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px 0;
}
.bubble {
  align-self: flex-start;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 15px;
  max-width: 75%;
  min-width: 150px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.mine {
  align-self: flex-end;
  background: #254a60;
}
.bubble .meta {
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 5px;
}
.bubble .message-actions {
  margin-top: 10px;
  display: flex;
  gap: 5px;
}
.bubble button {
  font-size: 10px;
  padding: 3px 6px;
  background: transparent;
}
.reply {
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  color: var(--muted);
  margin-bottom: 7px;
}
.badge {
  border-radius: 10px;
  padding: 2px 6px;
  background: var(--accent);
  color: white;
  float: right;
}
.mobile-title {
  display: none;
}
.file {
  display: block;
  margin: 8px 0;
}
.notice {
  padding: 15px;
  background: #3b3420;
  color: #e2cf91;
  border: 1px solid #655839;
  line-height: 1.6;
}
.light {
  color-scheme: light;
  --bg: #f5f6f7;
  --panel: white;
  --panel2: #f0f4f7;
  --text: #263849;
  --muted: #82929c;
  --border: #dbe1e5;
  --input: white;
}
.light .rail {
  background: #223b4b;
}
.light .bubble.mine {
  background: #e2efff;
}
.light .login {
  background: #eaf1f7;
}
.light .login form {
  background: white;
}
.light .tabs button.active {
  color: #263849;
}
.light .notice {
  background: #fff7e0;
  color: #66511b;
}
.light .lead .title,
.light a {
  color: #2782c5;
}
@media (max-width: 900px) {
  .summary {
    display: none;
  }
  .topbar {
    padding: 10px;
    gap: 8px;
  }
  .topbar h1 {
    font-size: 16px;
  }
  .topbar .search {
    min-width: 80px;
  }
  .card-page {
    grid-template-columns: 300px 1fr;
  }
  .properties {
    padding: 15px;
  }
  .chat-layout {
    grid-template-columns: 240px 1fr;
  }
  .content {
    padding: 14px;
  }
}
@media (max-width: 650px) {
  .rail {
    width: 52px;
  }
  .rail a {
    height: 58px;
    font-size: 8px;
  }
  .rail svg {
    width: 22px;
  }
  .brand {
    font-size: 20px;
  }
  .workspace {
    margin-left: 52px;
  }
  .topbar {
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
  }
  .topbar .search {
    order: 5;
    flex-basis: 100%;
    max-width: none;
  }
  .topbar .primary {
    font-size: 11px;
  }
  .toolbar {
    padding: 8px;
    gap: 5px;
  }
  .board {
    height: calc(100vh - 160px);
    padding: 0 10px;
  }
  .stage {
    min-width: 250px;
  }
  .card-page {
    display: block;
  }
  .properties {
    max-height: none;
    border-right: 0;
  }
  .feed {
    padding: 12px;
  }
  .chat-layout {
    display: block;
    height: auto;
  }
  .chat-list {
    max-height: 220px;
  }
  .chat-main {
    height: 70vh;
  }
  .settings-grid {
    display: block;
  }
  .settings-nav {
    display: flex;
    overflow: auto;
  }
  .settings-nav button {
    min-width: 130px;
  }
  .fields-grid {
    grid-template-columns: 1fr;
  }
  .calendar {
    grid-template-columns: repeat(2, 1fr);
  }
  .bubble {
    max-width: 95%;
  }
  .chart-row {
    grid-template-columns: 110px 1fr 35px;
  }
  button {
    padding: 8px;
  }
}
