:root {
  --ink: #12292f;
  --ink-2: #28434a;
  --muted: #687a7f;
  --muted-2: #8e9da0;
  --paper: #f4f7f6;
  --surface: #ffffff;
  --line: #dde6e4;
  --line-strong: #cdd9d6;
  --navy: #102a31;
  --navy-2: #173740;
  --accent: #197c68;
  --accent-dark: #116553;
  --accent-soft: #e7f4f0;
  --orange: #c46c2b;
  --orange-soft: #fff1e5;
  --red: #bd4a4a;
  --red-soft: #fcecec;
  --blue: #376da1;
  --blue-soft: #eaf2fb;
  --yellow: #a57417;
  --yellow-soft: #fbf3dc;
  --shadow-sm: 0 1px 2px rgba(19, 44, 50, 0.05), 0 8px 22px rgba(19, 44, 50, 0.035);
  --shadow-md: 0 20px 55px rgba(13, 37, 43, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-width: 248px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

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

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-sprite {
  display: none;
}

.is-hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow.light {
  color: #8ad5c4;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: #d7fff5;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 65%),
    #1f8d74;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 8px 20px rgba(4, 23, 28, 0.2);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 25px;
  font-weight: 700;
}

.brand-mark-large {
  width: 60px;
  height: 60px;
  border-radius: 19px;
  font-size: 35px;
}

/* Login */

.login-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(480px, 1.25fr) minmax(420px, 0.75fr);
  background: #f7f9f8;
}

.login-visual {
  position: relative;
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  padding: 52px clamp(48px, 7vw, 108px);
  flex-direction: column;
  justify-content: space-between;
  color: white;
  background:
    radial-gradient(circle at 18% 82%, rgba(47, 158, 128, 0.32), transparent 33%),
    radial-gradient(circle at 88% 12%, rgba(97, 190, 166, 0.14), transparent 30%),
    linear-gradient(145deg, #0e272e 10%, #123a3e 56%, #0d282e 100%);
}

.login-visual::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  mask-image: linear-gradient(to bottom, transparent, #000 32%, #000 75%, transparent);
}

.login-orbit {
  position: absolute;
  border: 1px solid rgba(135, 218, 197, 0.12);
  border-radius: 50%;
}

.orbit-one {
  right: -250px;
  bottom: -310px;
  width: 780px;
  height: 780px;
}

.orbit-two {
  right: -90px;
  bottom: -145px;
  width: 460px;
  height: 460px;
  border-style: dashed;
}

.login-mark,
.login-statement,
.login-flow {
  position: relative;
  z-index: 1;
}

.login-mark {
  display: flex;
  align-items: center;
  gap: 17px;
}

.login-brand {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.login-brand-sub {
  margin-top: 2px;
  color: #a9c7c4;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.login-statement {
  max-width: 670px;
}

.login-statement h1 {
  margin: 0;
  color: #f1fbf8;
  font-family: "STSong", "Songti SC", serif;
  font-size: clamp(35px, 4vw, 58px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.login-statement > p:last-child {
  max-width: 520px;
  margin: 22px 0 0;
  color: #c2d7d4;
  font-size: 15px;
}

.login-flow {
  display: flex;
  max-width: 560px;
  align-items: center;
  gap: 13px;
  color: #8fb2ae;
  font-size: 12px;
}

.login-flow span {
  display: grid;
  min-width: 62px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(145, 211, 196, 0.2);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.045);
}

.login-flow i {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(138, 213, 196, 0.18), rgba(138, 213, 196, 0.62));
}

.login-panel {
  display: grid;
  min-height: 100vh;
  padding: 32px;
  place-items: center;
}

.login-card {
  display: flex;
  width: min(420px, 100%);
  flex-direction: column;
  gap: 20px;
}

.login-card h2 {
  margin: 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: 31px;
  font-weight: 700;
}

.login-help {
  margin: 8px 0 0;
}

.login-submit {
  width: 100%;
  height: 48px;
  margin-top: 4px;
  font-size: 15px;
}

.first-login {
  display: flex;
  padding: 12px 14px;
  align-items: center;
  justify-content: space-between;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.first-login code {
  color: var(--ink-2);
  font-family: "Cascadia Mono", Consolas, monospace;
}

/* Application shell */

.app-shell {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(circle at 94% 2%, rgba(31, 141, 116, 0.04), transparent 22%),
    var(--paper);
}

.sidebar {
  position: fixed;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: var(--sidebar-width);
  padding: 22px 16px 16px;
  flex-direction: column;
  color: #dbe9e7;
  background:
    radial-gradient(circle at 20% 93%, rgba(30, 125, 104, 0.2), transparent 32%),
    #102a31;
  box-shadow: 6px 0 24px rgba(15, 37, 42, 0.08);
}

.brand {
  display: flex;
  padding: 2px 10px 25px;
  align-items: center;
  gap: 12px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-copy strong {
  color: #f2faf8;
  font-size: 19px;
  letter-spacing: 0.08em;
}

.brand-copy span {
  color: #8ca9a5;
  font-size: 10px;
  letter-spacing: 0.11em;
}

.main-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 45px;
  padding: 0 13px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 11px;
  color: #a8bfbb;
  background: transparent;
  text-align: left;
  transition: 160ms ease;
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  color: #eff8f6;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: #f2fffb;
  background: linear-gradient(90deg, rgba(35, 146, 119, 0.36), rgba(35, 146, 119, 0.13));
  box-shadow: inset 0 0 0 1px rgba(103, 191, 170, 0.12);
}

.nav-item.active::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: -16px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #43b99d;
  content: "";
}

.nav-badge {
  display: none;
  min-width: 19px;
  height: 19px;
  margin-left: auto;
  padding: 0 5px;
  place-items: center;
  border-radius: 20px;
  color: white;
  background: #c46c2b;
  font-size: 10px;
  font-weight: 800;
}

.nav-badge:not(:empty) {
  display: grid;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-ai {
  display: grid;
  width: 100%;
  padding: 13px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(117, 193, 176, 0.15);
  border-radius: 13px;
  color: #ddeee9;
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
}

.sidebar-ai:hover {
  border-color: rgba(117, 193, 176, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-ai > svg {
  width: 15px;
  height: 15px;
}

.sidebar-ai div {
  display: flex;
  flex-direction: column;
}

.sidebar-ai strong {
  font-size: 12px;
}

.sidebar-ai div span {
  color: #8da9a5;
  font-size: 10px;
}

.ai-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #65d3b7;
  box-shadow: 0 0 0 5px rgba(101, 211, 183, 0.1);
}

.sidebar-user {
  display: grid;
  padding: 12px 10px 4px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #0f5c4c;
  background: #c9eee5;
  font-weight: 800;
}

.sidebar-user > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.sidebar-user strong,
.sidebar-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user strong {
  color: #edf8f5;
  font-size: 12px;
}

.sidebar-user > div span {
  color: #88a5a0;
  font-size: 10px;
}

.workspace {
  display: flex;
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  flex: 1;
  flex-direction: column;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 81px;
  padding: 0 32px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid rgba(216, 226, 224, 0.85);
  background: rgba(244, 247, 246, 0.91);
  backdrop-filter: blur(14px);
}

.page-heading h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.global-search {
  display: flex;
  width: min(320px, 26vw);
  height: 40px;
  padding: 0 10px 0 13px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.8);
}

.global-search svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.global-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.global-search input::placeholder {
  color: #93a2a4;
}

kbd {
  padding: 2px 6px;
  border: 1px solid #d7e0de;
  border-bottom-width: 2px;
  border-radius: 5px;
  color: #889699;
  background: #f6f8f7;
  font-family: inherit;
  font-size: 9px;
  white-space: nowrap;
}

.page-content {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 26px 32px 60px;
  outline: 0;
}

/* Common controls */

.button {
  display: inline-flex;
  min-height: 40px;
  padding: 0 16px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-2);
  background: white;
  font-weight: 700;
  transition: 150ms ease;
}

.button:hover {
  border-color: #c2cfcc;
  box-shadow: 0 4px 14px rgba(18, 44, 50, 0.06);
  transform: translateY(-1px);
}

.button svg {
  width: 17px;
  height: 17px;
}

.button.primary {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

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

.button.danger {
  border-color: #eccccc;
  color: var(--red);
  background: var(--red-soft);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
}

.button.small {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

.ai-button {
  border-color: #cee8e1;
  color: #106a56;
  background: var(--accent-soft);
}

.icon-button {
  position: relative;
  display: inline-grid;
  width: 39px;
  height: 39px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-2);
  background: white;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button:hover {
  border-color: #bccac7;
}

.icon-button.inverse {
  width: 31px;
  height: 31px;
  border-color: transparent;
  color: #8ea7a2;
  background: transparent;
}

.icon-button.inverse:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}

.notice-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border: 1.5px solid var(--paper);
  border-radius: 50%;
  background: #d77939;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span,
.field-label {
  color: #425b61;
  font-size: 12px;
  font-weight: 700;
}

.field em {
  color: var(--red);
  font-style: normal;
}

.field input,
.field select,
.field textarea,
.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: white;
  transition: 150ms ease;
}

.field textarea,
.textarea {
  min-height: 88px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus,
.select:focus,
.textarea:focus {
  border-color: #6bb5a4;
  box-shadow: 0 0 0 3px rgba(31, 141, 116, 0.11);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  color: #7e8b8d;
  background: #f4f6f5;
}

.field small {
  color: var(--muted-2);
  font-size: 10px;
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

/* Page components */

.page-enter {
  animation: page-enter 260ms ease both;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.page-toolbar {
  display: flex;
  margin-bottom: 20px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.page-toolbar h2 {
  margin: 0 0 4px;
  font-size: 21px;
}

.page-toolbar p {
  margin: 0;
  color: var(--muted);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.filter-search {
  display: flex;
  width: 230px;
  height: 38px;
  padding: 0 12px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.filter-search svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.filter-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.panel {
  border: 1px solid rgba(215, 226, 223, 0.95);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  min-height: 62px;
  padding: 16px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 15px;
}

.panel-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.panel-body {
  padding: 20px;
}

.text-link {
  display: inline-flex;
  padding: 0;
  align-items: center;
  gap: 3px;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.text-link:hover {
  color: var(--accent-dark);
}

.code-link {
  display: inline;
  width: max-content;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(25, 124, 104, 0.25);
  text-underline-offset: 3px;
}

.code-link:hover {
  color: var(--accent-dark);
  text-decoration-color: currentColor;
}

.detail-hero {
  display: flex;
  padding: 18px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #dce8e5;
  border-radius: 14px;
  background:
    linear-gradient(110deg, rgba(31, 141, 116, 0.08), transparent 52%),
    #f9fcfb;
}

.detail-hero h3 {
  margin: 4px 0 5px;
  font-size: 19px;
}

.detail-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.detail-grid {
  display: grid;
  margin-top: 17px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  display: flex;
  min-height: 74px;
  padding: 13px 14px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
}

.detail-item span {
  color: var(--muted);
  font-size: 9px;
}

.detail-item strong {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
}

.detail-section {
  margin-top: 19px;
  padding-top: 17px;
  border-top: 1px solid #edf2f1;
}

.detail-section h4 {
  margin: 0 0 10px;
  font-size: 12px;
}

.detail-section p {
  margin: 0;
  color: var(--ink-2);
  font-size: 11px;
  white-space: pre-wrap;
}

.detail-project-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.detail-project-row {
  display: flex;
  padding: 11px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.detail-project-row > div {
  min-width: 0;
}

.detail-project-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.detail-project-row span {
  color: var(--muted);
  font-size: 9px;
}

/* Dashboard */

.welcome-strip {
  position: relative;
  display: flex;
  min-height: 130px;
  overflow: hidden;
  margin-bottom: 20px;
  padding: 27px 30px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-radius: 19px;
  color: white;
  background:
    radial-gradient(circle at 82% 20%, rgba(88, 194, 167, 0.22), transparent 28%),
    linear-gradient(105deg, #102c33, #17423f);
  box-shadow: var(--shadow-sm);
}

.welcome-strip::after {
  position: absolute;
  right: -58px;
  bottom: -135px;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(132, 211, 193, 0.14);
  border-radius: 50%;
  box-shadow:
    0 0 0 46px rgba(132, 211, 193, 0.035),
    0 0 0 94px rgba(132, 211, 193, 0.025);
  content: "";
}

.welcome-copy,
.welcome-action {
  position: relative;
  z-index: 1;
}

.welcome-copy .eyebrow {
  color: #77cdb8;
}

.welcome-copy h2 {
  margin: 0 0 8px;
  font-family: "STSong", "Songti SC", serif;
  font-size: clamp(24px, 2.5vw, 32px);
  font-weight: 600;
}

.welcome-copy p {
  margin: 0;
  color: #b8d1cc;
}

.welcome-action {
  display: flex;
  min-width: 205px;
  padding: 16px 18px;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(159, 220, 206, 0.15);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
}

.welcome-action span {
  color: #a9c8c2;
  font-size: 11px;
}

.welcome-action strong {
  color: #f5fffc;
  font-size: 18px;
}

.welcome-action button {
  width: max-content;
  padding: 0;
  border: 0;
  color: #75d5be;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

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

.stat-card {
  position: relative;
  min-height: 124px;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.stat-card::after {
  position: absolute;
  top: -22px;
  right: -22px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--stat-tint, var(--accent-soft));
  content: "";
}

.stat-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  color: var(--stat-color, var(--accent));
  background: var(--stat-tint, var(--accent-soft));
}

.stat-icon svg {
  width: 17px;
  height: 17px;
}

.stat-value {
  margin: 12px 0 3px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.stat-note {
  color: var(--muted-2);
  font-size: 10px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.75fr);
  gap: 18px;
}

.dashboard-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
}

.mini-table th {
  padding: 0 10px 10px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
}

.mini-table td {
  padding: 12px 10px;
  border-top: 1px solid #edf2f1;
  vertical-align: middle;
}

.mini-table tr:first-child td {
  border-top: 0;
}

.mini-table .project-name {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.mini-table .project-name strong {
  overflow: hidden;
  max-width: 280px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.mini-table .project-name span {
  color: var(--muted);
  font-size: 10px;
}

.delivery-list {
  display: flex;
  flex-direction: column;
}

.delivery-item {
  display: grid;
  padding: 13px 0;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #edf2f1;
}

.delivery-item:first-child {
  border-top: 0;
}

.date-tile {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 11px;
  color: var(--orange);
  background: var(--orange-soft);
  line-height: 1;
}

.date-tile strong {
  font-size: 16px;
}

.date-tile span {
  font-size: 9px;
}

.delivery-item-copy {
  min-width: 0;
}

.delivery-item-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.delivery-item-copy span {
  color: var(--muted);
  font-size: 10px;
}

.source-chart {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.source-row {
  display: grid;
  grid-template-columns: 72px 1fr 28px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.source-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 10px;
  background: #edf2f1;
}

.source-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f8d74, #64bea9);
}

.source-row:nth-child(2) .source-bar span {
  background: linear-gradient(90deg, #c98a42, #e1b66e);
}

.empty-state {
  display: grid;
  min-height: 180px;
  padding: 30px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  color: #9cafac;
}

/* Data tables */

.table-wrap {
  overflow: auto;
  border-radius: 0 0 var(--radius) var(--radius);
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.data-table thead {
  background: #f8faf9;
}

.data-table th {
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  color: #708185;
  font-size: 10px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 14px 15px;
  border-bottom: 1px solid #edf2f1;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 120ms ease;
}

.data-table tbody tr:hover {
  background: #fafcfb;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .primary-cell {
  display: flex;
  min-width: 160px;
  flex-direction: column;
  gap: 2px;
}

.data-table .primary-cell strong {
  color: var(--ink);
  font-size: 12px;
}

.data-table .primary-cell span,
.secondary {
  color: var(--muted);
  font-size: 10px;
}

.money {
  color: var(--ink-2);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.money.positive {
  color: var(--accent);
}

.money.negative {
  color: var(--red);
}

.pill {
  display: inline-flex;
  min-height: 23px;
  padding: 2px 8px;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  color: #5d6b6e;
  background: #eef2f1;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

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

.pill.green {
  color: #13725d;
  background: var(--accent-soft);
}

.pill.orange {
  color: #ad6227;
  background: var(--orange-soft);
}

.pill.red {
  color: var(--red);
  background: var(--red-soft);
}

.pill.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.pill.yellow {
  color: var(--yellow);
  background: var(--yellow-soft);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.row-action {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.row-action:hover {
  border-color: var(--line);
  color: var(--accent);
  background: white;
}

.row-action svg {
  width: 15px;
  height: 15px;
}

.mobile-cards {
  display: none;
}

/* Sub cards */

.entity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.entity-card {
  position: relative;
  display: flex;
  min-height: 188px;
  padding: 20px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.entity-card:hover {
  border-color: #c5d6d2;
  box-shadow: 0 12px 30px rgba(17, 45, 51, 0.07);
}

.entity-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.entity-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  color: #126855;
  background: #e2f3ee;
  font-weight: 800;
}

.entity-card h3 {
  margin: 15px 0 2px;
  font-size: 15px;
}

.entity-card .entity-meta {
  color: var(--muted);
  font-size: 10px;
}

.entity-numbers {
  display: grid;
  margin-top: auto;
  padding-top: 17px;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-top: 1px solid #edf2f1;
}

.project-query-panel {
  display: flex;
  margin-bottom: 16px;
  padding: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow-sm);
}

.project-type-tabs {
  display: flex;
  overflow-x: auto;
  gap: 5px;
}

.project-type-tabs button {
  display: flex;
  min-width: max-content;
  height: 38px;
  padding: 0 11px;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.project-type-tabs button strong {
  display: grid;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  place-items: center;
  border-radius: 20px;
  color: var(--muted);
  background: #edf2f1;
  font-size: 9px;
}

.project-type-tabs button:hover {
  color: var(--accent);
  background: #f5faf8;
}

.project-type-tabs button.active {
  border-color: #c9e4dd;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.project-type-tabs button.active strong {
  color: white;
  background: var(--accent);
}

.project-code-query {
  display: flex;
  min-width: 430px;
  height: 42px;
  padding-left: 12px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbfa;
}

.project-code-query > svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.project-code-query input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.entity-query-result {
  display: flex;
  margin-bottom: 15px;
  padding: 14px 17px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #cee4de;
  border-radius: 12px;
  background: #f5faf8;
}

.entity-query-result > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.entity-query-result span {
  color: var(--muted);
  font-size: 10px;
}

.entity-query-result strong {
  color: var(--accent-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.entity-query-result p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.entity-number {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.entity-number strong {
  font-size: 15px;
}

.entity-number span {
  color: var(--muted-2);
  font-size: 9px;
}

/* Delivery board */

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

.summary-chip {
  display: flex;
  min-height: 76px;
  padding: 15px 17px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
}

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

.summary-chip span {
  color: var(--muted);
  font-size: 10px;
}

.summary-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.summary-dot.orange {
  background: var(--orange);
  box-shadow: 0 0 0 5px var(--orange-soft);
}

.summary-dot.red {
  background: var(--red);
  box-shadow: 0 0 0 5px var(--red-soft);
}

.summary-dot.blue {
  background: var(--blue);
  box-shadow: 0 0 0 5px var(--blue-soft);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(270px, 1fr));
  gap: 15px;
  overflow-x: auto;
}

.kanban-column {
  min-height: 420px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #eef3f1;
}

.kanban-column-head {
  display: flex;
  padding: 2px 2px 12px;
  align-items: center;
  justify-content: space-between;
}

.kanban-column-head strong {
  font-size: 12px;
}

.kanban-column-head span {
  display: grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
  font-size: 10px;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.task-card {
  padding: 14px;
  border: 1px solid #dce6e3;
  border-radius: 12px;
  background: white;
  box-shadow: 0 3px 12px rgba(23, 48, 53, 0.035);
}

.task-card:hover {
  border-color: #bad2cc;
}

.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-code {
  color: var(--muted-2);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
}

.task-card h4 {
  margin: 10px 0 5px;
  font-size: 12px;
  line-height: 1.45;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.task-card-foot {
  display: flex;
  margin-top: 13px;
  padding-top: 11px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #edf2f1;
  color: var(--muted);
  font-size: 9px;
}

.task-due {
  color: var(--muted);
}

.task-due.overdue {
  color: var(--red);
  font-weight: 700;
}

/* Finance */

.finance-banner {
  display: grid;
  margin-bottom: 18px;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow-sm);
}

.finance-banner > div {
  padding: 22px;
  background: white;
}

.finance-banner .finance-title {
  background:
    linear-gradient(120deg, rgba(29, 133, 111, 0.08), transparent),
    #fff;
}

.finance-title h3 {
  margin: 4px 0 6px;
  font-size: 16px;
}

.finance-title p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.finance-banner strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.finance-banner span {
  color: var(--muted);
  font-size: 10px;
}

/* AI drawer */

.ai-drawer {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  width: min(410px, 100vw);
  flex-direction: column;
  border-left: 1px solid #d6e4e1;
  background: #f8fbfa;
  box-shadow: -18px 0 55px rgba(13, 38, 44, 0.15);
  transform: translateX(102%);
  transition: transform 230ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ai-drawer.is-open {
  transform: translateX(0);
}

.ai-head {
  display: flex;
  min-height: 76px;
  padding: 15px 17px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
}

.ai-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.ai-avatar {
  display: grid;
  width: 41px;
  height: 41px;
  place-items: center;
  border-radius: 13px;
  color: #dffff7;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.17), transparent),
    #197c68;
  box-shadow: 0 7px 18px rgba(25, 124, 104, 0.2);
}

.ai-avatar svg {
  width: 21px;
  height: 21px;
}

.ai-identity > div {
  display: flex;
  flex-direction: column;
}

.ai-identity strong {
  font-size: 14px;
}

.ai-identity span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
}

.ai-identity span i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #46b495;
}

.ai-messages {
  display: flex;
  overflow-y: auto;
  padding: 18px 16px 10px;
  flex: 1;
  flex-direction: column;
  gap: 13px;
}

.ai-message {
  display: flex;
  max-width: 90%;
  flex-direction: column;
  gap: 5px;
  animation: message-in 180ms ease both;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.ai-message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message-bubble {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  color: var(--ink-2);
  background: white;
  font-size: 12px;
  white-space: pre-wrap;
}

.ai-message.user .message-bubble {
  border-color: #1d806a;
  border-radius: 14px 4px 14px 14px;
  color: white;
  background: #1d806a;
}

.message-meta {
  color: var(--muted-2);
  font-size: 8px;
}

.message-card {
  margin-top: 4px;
  padding: 12px;
  border: 1px solid #dbe7e4;
  border-radius: 12px;
  background: #fff;
}

.message-card strong {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
}

.message-card dl {
  display: grid;
  margin: 0 0 10px;
  grid-template-columns: 74px 1fr;
  gap: 5px 8px;
  font-size: 10px;
}

.message-card dt {
  color: var(--muted);
}

.message-card dd {
  overflow: hidden;
  margin: 0;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-table {
  width: 100%;
  margin: 8px 0;
  border-collapse: collapse;
  font-size: 9px;
}

.ai-table th {
  padding: 6px;
  color: var(--muted);
  background: #f4f7f6;
  text-align: left;
}

.ai-table td {
  padding: 6px;
  border-bottom: 1px solid #edf2f1;
}

.ai-prompts {
  display: flex;
  overflow-x: auto;
  padding: 0 16px 9px;
  gap: 6px;
}

.ai-prompts button {
  padding: 6px 9px;
  border: 1px solid #d5e4e0;
  border-radius: 20px;
  color: #3e6d64;
  background: #fff;
  font-size: 9px;
  white-space: nowrap;
}

.ai-compose {
  margin: 0 12px 12px;
  padding: 10px 11px 8px;
  border: 1px solid #ccdcd8;
  border-radius: 15px;
  background: white;
  box-shadow: 0 7px 22px rgba(18, 46, 52, 0.06);
}

.ai-compose:focus-within {
  border-color: #72b6a6;
  box-shadow: 0 0 0 3px rgba(31, 141, 116, 0.09);
}

.ai-compose textarea {
  width: 100%;
  padding: 2px 1px 7px;
  border: 0;
  outline: 0;
  resize: none;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
}

.ai-compose-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-compose-foot span {
  color: var(--muted-2);
  font-size: 8px;
}

.send-button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: white;
  background: var(--accent);
}

.send-button svg {
  width: 15px;
  height: 15px;
}

.typing {
  display: inline-flex;
  gap: 3px;
}

.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8ca9a4;
  animation: typing 900ms infinite;
}

.typing i:nth-child(2) {
  animation-delay: 130ms;
}

.typing i:nth-child(3) {
  animation-delay: 260ms;
}

@keyframes typing {
  0%,
  70%,
  100% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(-3px);
  }
}

.floating-ai {
  position: fixed;
  z-index: 60;
  right: 24px;
  bottom: 24px;
  display: flex;
  height: 48px;
  padding: 0 17px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(112, 202, 180, 0.24);
  border-radius: 24px;
  color: #eafffa;
  background: #123d3d;
  box-shadow: 0 14px 32px rgba(12, 40, 43, 0.22);
  font-size: 12px;
  font-weight: 700;
  transition: 160ms ease;
}

.floating-ai:hover {
  background: #195149;
  transform: translateY(-2px);
}

.floating-ai svg {
  width: 19px;
  height: 19px;
}

body.ai-open .floating-ai {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

/* Modal */

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(8, 28, 33, 0.48);
  backdrop-filter: blur(4px);
  animation: fade-in 150ms ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.modal {
  display: flex;
  width: min(820px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-md);
  animation: modal-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
}

.modal-head {
  display: flex;
  padding: 20px 23px 17px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.modal-body {
  overflow-y: auto;
  padding: 22px 23px;
}

.modal-footer {
  display: flex;
  padding: 15px 23px;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #fbfcfc;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

.form-section {
  margin: 4px 0 -1px;
  padding-top: 17px;
  border-top: 1px solid #edf2f1;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 800;
}

.form-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.form-hint {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid #d9e9e4;
  border-radius: 10px;
  color: #416f65;
  background: #f3faf7;
  font-size: 10px;
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3f6f5;
}

.segmented label {
  flex: 1;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 33px;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.segmented input:checked + span {
  color: var(--accent-dark);
  background: white;
  box-shadow: 0 2px 7px rgba(22, 54, 60, 0.08);
}

.derived-box {
  display: grid;
  padding: 13px;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-radius: 11px;
  background: #f3f7f5;
}

.derived-box div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.derived-box strong {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

.derived-box span {
  color: var(--muted);
  font-size: 9px;
}

.subchannel-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subchannel-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
}

.subchannel-row input {
  min-height: 38px;
}

.remove-sub {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: white;
}

/* Settings and empty */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}

.settings-list {
  display: flex;
  flex-direction: column;
}

.settings-item {
  display: flex;
  padding: 16px 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid #edf2f1;
}

.settings-item:first-child {
  border-top: 0;
}

.settings-item strong {
  display: block;
  font-size: 12px;
}

.settings-item span {
  color: var(--muted);
  font-size: 10px;
}

.role-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.role-row {
  display: grid;
  padding: 11px 12px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  background: #f7f9f8;
}

.role-row i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.role-row strong {
  font-size: 11px;
}

.role-row span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.audit-list {
  display: flex;
  flex-direction: column;
}

.audit-row {
  display: grid;
  padding: 12px 0;
  grid-template-columns: 130px 1fr 150px;
  gap: 12px;
  border-top: 1px solid #edf2f1;
  font-size: 10px;
}

.audit-row:first-child {
  border-top: 0;
}

.audit-row span:last-child {
  color: var(--muted-2);
  text-align: right;
}

/* Command palette */

.command-backdrop {
  position: fixed;
  z-index: 120;
  inset: 0;
  padding-top: 12vh;
  background: rgba(8, 28, 33, 0.42);
  backdrop-filter: blur(4px);
}

.command-panel {
  width: min(620px, calc(100vw - 36px));
  max-height: 70vh;
  overflow: hidden;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 17px;
  background: white;
  box-shadow: var(--shadow-md);
}

.command-input {
  display: flex;
  height: 60px;
  padding: 0 17px;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line);
}

.command-input svg {
  color: var(--muted);
}

.command-input input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 15px;
}

.command-results {
  max-height: calc(70vh - 60px);
  overflow-y: auto;
  padding: 8px;
}

.command-result {
  display: flex;
  width: 100%;
  padding: 11px 12px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
}

.command-result:hover {
  background: #f3f7f6;
}

.command-result > span:first-child {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 800;
}

.command-result div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.command-result strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.command-result small {
  color: var(--muted);
  font-size: 9px;
}

/* Toast and loading */

.toast-region {
  position: fixed;
  z-index: 150;
  right: 22px;
  bottom: 22px;
  display: flex;
  width: min(360px, calc(100vw - 32px));
  flex-direction: column;
  gap: 9px;
}

.toast {
  display: flex;
  padding: 12px 14px;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 11px;
  color: white;
  background: #15363c;
  box-shadow: 0 12px 35px rgba(13, 36, 42, 0.22);
  font-size: 11px;
  animation: toast-in 180ms ease;
}

.toast.error {
  background: #8c3b3b;
}

.toast.success {
  background: #176a59;
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.loading-overlay {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(244, 247, 246, 0.6);
  backdrop-filter: blur(2px);
}

.loader {
  width: 30px;
  height: 30px;
  border: 3px solid #cee3dd;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */

@media (max-width: 1120px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .finance-banner {
    grid-template-columns: repeat(2, 1fr);
  }

  .finance-title {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  :root {
    --sidebar-width: 76px;
  }

  .sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .brand {
    padding: 2px 7px 25px;
  }

  .brand-copy,
  .nav-item span,
  .sidebar-ai div,
  .sidebar-ai > svg,
  .sidebar-user > div,
  .sidebar-user .icon-button {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-item.active::before {
    left: -10px;
  }

  .sidebar-ai {
    display: grid;
    padding: 15px;
    place-items: center;
  }

  .sidebar-user {
    display: grid;
    padding: 13px 0 4px;
    place-items: center;
  }

  .topbar {
    padding: 0 18px;
  }

  .page-content {
    padding: 20px 18px 60px;
  }

  .global-search {
    width: 190px;
  }

  .global-search kbd {
    display: none;
  }

  .login-view {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }
}

@media (max-width: 660px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    top: auto;
    right: 0;
    width: 100%;
    height: 67px;
    padding: 7px 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .brand,
  .sidebar-foot {
    display: none;
  }

  .main-nav {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 0;
  }

  .nav-item {
    min-width: 0;
    min-height: 51px;
    padding: 0 1px;
    flex-direction: column;
    gap: 2px;
    font-size: 8px;
  }

  .nav-item span {
    display: block;
  }

  .nav-item.active::before {
    top: -7px;
    right: 16px;
    bottom: auto;
    left: 16px;
    width: auto;
    height: 2px;
    border-radius: 0 0 3px 3px;
  }

  .workspace {
    padding-bottom: 67px;
  }

  .topbar {
    min-height: 68px;
    padding: 0 14px;
  }

  .page-heading h1 {
    font-size: 18px;
  }

  .global-search,
  .ai-button {
    display: none;
  }

  .page-content {
    padding: 16px 14px 78px;
  }

  .welcome-strip {
    padding: 21px;
    align-items: flex-start;
    flex-direction: column;
  }

  .welcome-action {
    width: 100%;
  }

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

  .stat-card {
    min-height: 112px;
    padding: 16px;
  }

  .stat-value {
    font-size: 23px;
  }

  .table-wrap {
    display: none;
  }

  .mobile-cards {
    display: flex;
    padding: 12px;
    flex-direction: column;
    gap: 9px;
  }

  .mobile-card {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
  }

  .mobile-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-card h4 {
    margin: 0 0 2px;
    font-size: 12px;
  }

  .mobile-card p {
    margin: 0;
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-card-grid {
    display: grid;
    margin-top: 11px;
    padding-top: 10px;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    border-top: 1px solid #edf2f1;
    font-size: 10px;
  }

  .mobile-card-grid span {
    color: var(--muted);
  }

  .toolbar-actions .filter-search {
    display: none;
  }

  .project-query-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .project-type-tabs {
    width: 100%;
  }

  .project-code-query {
    min-width: 0;
    height: auto;
    min-height: 42px;
    flex-wrap: wrap;
    padding: 6px 7px 6px 12px;
  }

  .project-code-query input {
    min-width: 150px;
  }

  .entity-query-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-toolbar {
    align-items: flex-start;
  }

  .page-toolbar h2 {
    font-size: 18px;
  }

  .page-toolbar p {
    font-size: 10px;
  }

  .finance-banner,
  .settings-grid {
    grid-template-columns: 1fr;
  }

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

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

  .modal-backdrop {
    padding: 0;
    place-items: end center;
  }

  .modal {
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }

  .subchannel-row {
    grid-template-columns: 1fr;
  }

  .subchannel-row .remove-sub {
    width: 100%;
  }

  .floating-ai {
    right: 15px;
    bottom: 80px;
  }

  .toast-region {
    right: 15px;
    bottom: 82px;
  }

  .audit-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
