:root {
  font:
    15px/1.5 "Segoe UI",
    system-ui,
    sans-serif;
  color: #1d2943;
  background: #f7f8fc;
  --ink: #1c2a43;
  --accent: #2849a5;
  --line: #d8dfea;
  --muted: #56637a;
  --pale: #e6edfc;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea,
summary {
  outline-offset: 4px;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: white;
  border-radius: 9px;
  padding: 8px 12px;
}
button:hover,
a:hover {
  filter: brightness(0.95);
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
a {
  color: var(--accent);
}
.loading {
  padding: 32px;
}
.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  height: 100dvh;
}
.side {
  background: #192948;
  color: #f0f4ff;
  padding: 27px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}
.brand {
  padding: 0 8px;
}
.brand img {
  display: block;
  width: min(164px, 100%);
  height: auto;
}
.side button {
  display: flex;
  gap: 11px;
  align-items: center;
  text-align: left;
  width: 100%;
  background: transparent;
  border: 0;
  color: #dbe5f8;
}
.side button:hover,
.side .current {
  background: #2c4064;
}
.side .newchat {
  background: #d1dfff;
  color: #192e59;
  font-weight: 650;
  border-radius: 10px;
  min-height: 43px;
}
.side .newchat:hover {
  background: #e1eaff;
}
.nav {
  display: grid;
  gap: 3px;
}
.history {
  overflow: auto;
  flex: 1;
  border-top: 1px solid #354767;
  padding-top: 17px;
}
.side h2 {
  font-size: 12px;
  margin: 0 9px 9px;
  color: #c2cee3;
  font-weight: 600;
}
.history .empty {
  font-size: 13px;
  color: #afbfda;
  padding: 0 9px;
}
.history button span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.profile {
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid #354767;
  padding: 16px 4px 0;
}
.avatar {
  width: 35px;
  height: 35px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #d5e1ff;
  color: #233f86;
  font-size: 13px;
  font-weight: bold;
}
.profile strong,
.profile small {
  display: block;
}
.profile small {
  color: #bacbe9;
}
.profile .logout {
  margin-left: auto;
  width: auto;
  padding: 8px;
}
.icon {
  width: 19px;
  height: 19px;
  flex: none;
  vertical-align: middle;
}
.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.top {
  height: 69px;
  flex: none;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(14px, 3.6vw, 56px);
  background: #fcfdff;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.crumb span {
  color: var(--muted);
}
.mobile {
  display: none;
}
.viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}
.home {
  max-width: 850px;
  margin: 0 auto;
  padding: clamp(34px, 8vh, 90px) 32px 24px;
}
.sigil {
  width: 56px;
  height: 56px;
  background: #e9efff;
  border: 1px solid #d4dff7;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #2648a0;
  margin-bottom: 20px;
}
.sigil img {
  width: 36px;
  height: auto;
}
.home h1,
.work h1,
.login h1 {
  font-weight: 580;
  letter-spacing: -0.055em;
  line-height: 1.12;
  font-size: clamp(36px, 4.3vw, 64px);
  margin: 0 0 12px;
}
.home p,
.work > p,
.login p {
  color: var(--muted);
  margin: 0;
}
.suggest {
  margin-top: clamp(24px, 4.6vh, 48px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.card {
  border-radius: 15px;
  background: #fff;
  text-align: left;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 9px;
  min-height: 130px;
}
.card .tile {
  padding: 7px;
  border-radius: 9px;
  color: #335743;
  background: #e7eedf;
}
.card:nth-child(2) .tile {
  background: #ece6f4;
  color: #655274;
}
.card:nth-child(3) .tile {
  background: #f7ebda;
  color: #7e5b31;
}
.card strong {
  font-size: 15px;
}
.card small {
  color: var(--muted);
  line-height: 1.4;
}
.compose-wrap {
  width: min(850px, 100%);
  margin: 0 auto;
  padding: 14px 32px 16px;
}
.composer {
  position: relative;
  background: white;
  border: 1px solid #c3cfe1;
  border-radius: 19px;
  padding: 21px 14px 10px;
  box-shadow: 0 5px 18px #203e3010;
}
.composer textarea {
  display: block;
  width: 100%;
  resize: none;
  min-height: 51px;
  max-height: 52dvh;
  padding: 4px;
  border: 0;
  background: transparent;
}
.composer textarea:focus {
  outline: none;
}
.resize-composer {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 68px;
  height: 21px;
  border-radius: 10px;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}
.resize-composer::before {
  content: "";
  width: 32px;
  height: 4px;
  border-radius: 4px;
  background: #8a9bb4;
}
.resize-composer:hover::before,
.resize-composer:active::before {
  background: var(--accent);
}
.controls,
.row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.controls {
  justify-content: space-between;
}
.plain {
  border: 0;
  background: transparent;
}
.send,
.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.send {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  height: 39px;
  min-width: 42px;
}
.muted,
small {
  font-size: 13px;
  color: var(--muted);
}
.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 8px 4px 0;
}
.foot button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
}
.foot small {
  font-size: 12px;
}
.chip {
  background: var(--pale);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.messages,
.work {
  width: min(960px, 100%);
  padding: 30px clamp(16px, 4vw, 52px);
  margin: auto;
}
.turn {
  margin: 20px 0;
}
.bubble {
  background: #e7edff;
  border-radius: 17px 17px 4px 17px;
  padding: 14px 18px;
  max-width: 83%;
  width: fit-content;
  margin-left: auto;
}
.answer {
  margin: 18px 0;
  padding: 0 6px;
}
.answer strong {
  font-size: 13px;
  color: var(--accent);
}
.text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 5px 0;
}
.work h1 {
  font-size: 36px;
}
.work h2 {
  font-size: 20px;
  margin: 26px 0 12px;
  letter-spacing: -0.04em;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.metric,
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 17px;
}
.metric strong {
  display: block;
  font-size: 25px;
}
.tablebox {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
td,
th {
  padding: 9px 6px;
  text-align: left;
  border-bottom: 1px solid #e6ebf3;
}
.badge,
.notice {
  background: #f5eacf;
  color: #665126;
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 14px;
}
.field {
  display: grid;
  gap: 4px;
  margin: 10px 0;
  font-size: 14px;
}
.field input,
.field select,
.field textarea,
select,
input[type="month"],
input[type="date"] {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 14px;
  margin: 8px 0;
}
.check input {
  margin-top: 5px;
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 17px;
  align-items: center;
}
.actions .err {
  margin-right: auto;
}
.err {
  color: #962d30;
  font-size: 14px;
}
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(ellipse at 85% 25%, #dce7ff, transparent 42%), #f7f8fc;
}
.login section {
  max-width: 530px;
}
.login .primary {
  display: inline-block;
  text-decoration: none;
  border-radius: 10px;
  padding: 11px 18px;
  margin-top: 24px;
}
.login .brand {
  padding: 0;
  margin-bottom: 29px;
}
dialog {
  max-height: 86dvh;
  max-width: min(700px, 95vw);
  width: 570px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  background: #fcfdff;
  color: var(--ink);
}
dialog::backdrop {
  background: #10242280;
}
dialog h2 {
  margin: 0 0 12px;
  font-size: 23px;
}
.previewparts {
  max-height: 43vh;
  overflow: auto;
}
.part {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.part pre,
details pre {
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 3px 0;
}
.part pre {
  max-height: 125px;
  overflow: auto;
  font-size: 13px;
}
.hidden,
[hidden] {
  display: none !important;
}
#toast:not(:empty) {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  background: #192948;
  color: #fff;
  border-radius: 10px;
  z-index: 4;
  max-width: 90vw;
}
.mobile-close {
  display: none !important;
}
@media (max-width: 800px) {
  .layout {
    grid-template-columns: 205px minmax(0, 1fr);
  }
  .side {
    padding: 20px 10px;
  }
  .home,
  .compose-wrap {
    padding-left: 17px;
    padding-right: 17px;
  }
  .suggest {
    gap: 6px;
  }
  .card {
    padding: 11px;
  }
  .card small {
    font-size: 12px;
  }
}
@media (max-width: 650px) {
  .layout {
    display: flex;
  }
  .main {
    width: 100%;
  }
  .side {
    display: none;
  }
  .layout.open .side {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(285px, 90vw);
    z-index: 3;
    box-shadow: 12px 0 45px #18382c38;
  }
  .mobile-close {
    display: block !important;
  }
  .mobile {
    display: inline-flex;
  }
  .top {
    height: 52px;
  }
  .home {
    padding-top: 30px;
  }
  .suggest {
    grid-template-columns: 1fr;
  }
  .card {
    display: grid;
    grid-template-columns: auto 1fr;
    min-height: 0;
    gap: 0 10px;
  }
  .card .tile {
    grid-row: span 2;
  }
  .sigil {
    margin-bottom: 12px;
  }
  .foot {
    align-items: start;
  }
  .crumb span:first-of-type {
    display: none;
  }
  .home h1 {
    font-size: 36px;
  }
  .work {
    padding: 20px 13px;
  }
}
@media (max-height: 600px) {
  .top {
    height: 46px;
  }
  .home {
    padding-top: 16px;
  }
  .compose-wrap {
    padding-top: 5px;
    padding-bottom: 5px;
  }
  .composer textarea {
    min-height: 34px;
  }
}
