:root {
  --bg: #f5f0e8;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --line: #ded5c8;
  --line-strong: #c8bbab;
  --text: #2e2a25;
  --muted: #766d62;
  --accent: #6f5537;
  --accent-strong: #533d25;
  --ok: #42754a;
  --warn: #9a6a21;
  --danger: #a34032;
  --shadow: 0 1px 2px rgba(52, 42, 31, 0.08);
  font-family:
    "Inter", "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #eee6da;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--surface);
  font-weight: 800;
}

.brand-logo {
  overflow: hidden;
  padding: 0;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.metric p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.main-nav {
  display: grid;
  gap: 4px;
  padding: 14px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: var(--line-strong);
  background: var(--surface);
}

.nav-badge,
.notify-btn span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  color: white;
  background: var(--danger);
  font-size: 11px;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  color: var(--accent);
}

.sidebar-foot {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.sidebar-foot strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 22px;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 280px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-strong);
}

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

select,
input,
textarea {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-strong);
}

select,
input {
  height: 38px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  padding: 10px;
}

.primary-btn,
.secondary-btn,
.text-btn,
.icon-btn {
  border-radius: 6px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.primary-btn {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent-strong);
  color: white;
  background: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.secondary-btn {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: var(--surface-strong);
}

.text-btn {
  border: 0;
  color: var(--accent-strong);
  background: transparent;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  font-size: 20px;
  line-height: 1;
}

.route-panel {
  display: none;
  padding: 18px 22px 28px;
}

.route-panel.is-active {
  display: block;
}

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

.metric,
.panel,
.agent-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric span,
.muted {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 30px;
  line-height: 1;
}

.metric p {
  color: var(--muted);
  font-size: 13px;
}

.split-layout,
.component-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  overflow: hidden;
}

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

.panel-head h3 {
  font-size: 16px;
}

.task-list,
.agent-load,
.log-preview,
.timeline,
.permission-grid {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.task-row,
.load-row,
.timeline-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.task-row-head,
.load-row,
.timeline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-title {
  font-weight: 700;
}

.task-meta,
.timeline-meta,
.small-text {
  color: var(--muted);
  font-size: 12px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ded1;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.status,
.priority,
.log-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #f8f2e9;
  font-size: 12px;
  white-space: nowrap;
}

.status.running {
  color: var(--ok);
  border-color: rgba(66, 117, 74, 0.45);
}

.status.blocked {
  color: var(--danger);
  border-color: rgba(163, 64, 50, 0.45);
}

.status.review {
  color: var(--warn);
  border-color: rgba(154, 106, 33, 0.45);
}

.status.done {
  color: var(--ok);
  border-color: rgba(66, 117, 74, 0.45);
  background: #f1f7ef;
}

button.status {
  cursor: pointer;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.task-toolbar {
  align-items: center;
}

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

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  overflow: hidden;
}

.segmented button {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: var(--surface-strong);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented .is-selected {
  color: white;
  background: var(--accent);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  height: 50px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #eee6da;
  font-size: 12px;
  font-weight: 700;
}

.sort-btn {
  border: 0;
  color: inherit;
  background: transparent;
  font-weight: 700;
}

.sort-btn::after {
  content: "";
  display: inline-block;
  width: 0;
  margin-left: 4px;
}

.sort-btn[data-active="asc"]::after {
  content: "↑";
}

.sort-btn[data-active="desc"]::after {
  content: "↓";
}

tbody tr:hover {
  background: #fffdf8;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination div {
  display: flex;
  gap: 8px;
}

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

.collab-room {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 12px;
  min-height: calc(100vh - 124px);
}

.room-sidebar,
.chat-panel,
.context-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.room-sidebar,
.context-panel {
  overflow: hidden;
}

.room-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.room-title h3,
.chat-head h3,
.context-block h4 {
  margin: 0;
}

.room-task-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.room-task {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-strong);
  text-align: left;
}

.room-task.is-active,
.room-task:hover {
  border-color: var(--accent);
}

.room-task strong {
  white-space: normal;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.chat-head-actions {
  display: flex;
  gap: 8px;
}

.agent-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7f0e6;
}

.agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  font-size: 12px;
}

.agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 14px;
}

.message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  max-width: 82%;
}

.message.is-self {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.message-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: white;
  background: var(--accent);
  font-weight: 800;
}

.message.is-self .message-avatar {
  order: 2;
}

.message-bubble {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.message.is-self .message-bubble {
  background: #f2e8d9;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.message-text {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-composer {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 82px;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #eee6da;
}

.chat-composer textarea {
  min-height: 38px;
  max-height: 110px;
}

.context-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.context-list div {
  display: grid;
  gap: 4px;
}

.context-list dt {
  color: var(--muted);
  font-size: 12px;
}

.context-list dd {
  margin: 0;
}

.context-block {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.context-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.quick-actions {
  display: grid;
  gap: 8px;
}

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

.agent-card {
  padding: 16px;
}

.agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.agent-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: white;
  background: var(--accent);
  font-weight: 800;
}

.agent-name {
  margin: 0;
  font-size: 17px;
}

.agent-role {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.agent-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.agent-stats div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.agent-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.agent-stats strong {
  display: block;
  margin-top: 3px;
}

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

.kanban-column {
  min-height: 580px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eee6da;
}

.kanban-title {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.kanban-cards {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.kanban-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.standard-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.standard-form label,
.inline-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.standard-form label input,
.standard-form label select,
.standard-form label textarea {
  color: var(--text);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  justify-content: flex-end;
}

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

.permission-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.permission-card h4 {
  margin: 0 0 10px;
}

.permission-card label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.permission-card input {
  width: 16px;
  height: 16px;
}

.component-actions {
  align-items: flex-start;
  padding: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(46, 42, 37, 0.32);
}

.modal-backdrop.is-open {
  display: grid;
}

.modal {
  width: min(640px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(52, 42, 31, 0.18);
}

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

.modal-head h3 {
  margin: 0;
  font-size: 17px;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(520px, 100vw);
  height: 100vh;
  border-left: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: -14px 0 32px rgba(52, 42, 31, 0.14);
  transform: translateX(100%);
  transition: transform 0.18s ease;
}

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

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

.drawer-head h3 {
  margin: 0;
}

.drawer-body {
  overflow: auto;
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 36px));
}

.toast {
  padding: 11px 12px;
  border: 1px solid rgba(66, 117, 74, 0.35);
  border-radius: 6px;
  color: var(--text);
  background: #f7fbf4;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.toast.error {
  border-color: rgba(163, 64, 50, 0.4);
  background: #fff4f1;
}

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

.agent-exec-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
}

.exec-toolbar {
  align-items: end;
  padding: 12px 14px 0;
}

.exec-side {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 620px;
}

.exec-detail-summary {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.exec-summary-card {
  display: grid;
  gap: 8px;
}

.exec-summary-card strong {
  font-size: 16px;
}

.log-stream {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  min-height: 220px;
  max-height: 380px;
  padding: 14px;
  background: #f7f0e6;
}

.log-stream.tall {
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.stream-line {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.exec-side-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.is-selected-row {
  background: #fffdf8;
}

.wide-drawer {
  width: min(760px, 100vw);
}

.exec-drawer-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.io-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.io-grid section,
.exec-drawer-body section {
  display: grid;
  gap: 8px;
}

.io-grid h4,
.exec-drawer-body h4 {
  margin: 0;
}

.io-grid pre {
  min-height: 180px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  line-height: 1.55;
  white-space: pre-wrap;
}

.permission-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
}

.role-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.role-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  text-align: left;
}

.role-card.is-active {
  border-color: var(--accent);
}

.permission-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.permission-section h4 {
  margin: 0 0 10px;
}

.permission-section label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: var(--muted);
}

.log-toolbar,
.notify-toolbar {
  padding: 12px 0;
}

.log-keyword {
  min-width: 220px;
}

.timeline-item {
  cursor: pointer;
}

.notification-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.notification-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.notification-item.unread {
  border-color: var(--accent);
}

.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.settings-danger {
  grid-column: 1 / -1;
}

.maintenance-actions {
  display: flex;
  gap: 10px;
  padding: 16px;
}

.compact-mode .route-panel {
  padding: 12px 16px 20px;
}

.compact-mode td,
.compact-mode th {
  height: 42px;
}

.log-detail-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.detail-row {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

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

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .topbar,
  .topbar-actions,
  .toolbar,
  .toolbar-actions,
  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .metric-grid,
  .agent-monitor-grid,
  .split-layout,
  .component-grid,
  .agent-exec-layout,
  .io-grid,
  .permission-layout,
  .settings-grid,
  .collab-room,
  .agent-grid,
  .kanban,
  .permission-grid,
  .form-row,
  .chat-composer {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }
}

/* Fourth-step readability and mobile layout pass */
body {
  min-width: 0;
  color: #3d3933;
  font-size: 16px;
  line-height: 1.55;
}

:root {
  --text: #3d3933;
  --muted: #716a60;
  --accent: #7a6042;
  --accent-strong: #624b31;
  --danger: #984b42;
  --shadow: none;
}

.mobile-menu-btn,
.sidebar-backdrop {
  display: none;
}

.admin-shell {
  grid-template-columns: 268px minmax(0, 1fr);
}

.brand {
  padding: 28px 24px;
}

.main-nav {
  gap: 8px;
  padding: 18px 14px;
}

.nav-item {
  min-height: 48px;
  padding: 0 16px;
  font-size: 16px;
}

.topbar {
  min-height: 92px;
  padding: 22px 28px;
}

.route-panel {
  padding: 28px 32px 40px;
}

.metric-grid,
.agent-monitor-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.split-layout,
.component-grid,
.agent-exec-layout,
.permission-layout,
.settings-grid {
  gap: 22px;
  margin-top: 22px;
}

.split-layout {
  grid-template-columns: 1fr;
}

.metric,
.panel,
.agent-card,
.room-sidebar,
.chat-panel,
.context-panel {
  border-color: transparent;
  background: #fffaf2;
}

.metric {
  padding: 22px;
}

.metric strong {
  font-size: 34px;
  font-weight: 650;
}

.panel-head,
.room-title {
  min-height: 64px;
  padding: 0 22px;
}

.panel-head h3,
.room-title h3,
.chat-head h3 {
  font-size: 18px;
  font-weight: 650;
}

.task-list,
.agent-load,
.log-preview,
.timeline,
.permission-grid,
.notification-list {
  gap: 14px;
  padding: 20px;
}

.task-row,
.load-row,
.timeline-item,
.notification-item,
.permission-section,
.kanban-card,
.room-task {
  padding: 16px;
  border-color: #e7ded1;
}

.small-text,
.task-meta,
.timeline-meta,
.agent-role,
.brand p,
.eyebrow {
  font-size: 14px;
}

button,
select,
input {
  min-height: 44px;
}

.primary-btn,
.secondary-btn {
  height: 44px;
  padding: 0 18px;
}

.icon-btn {
  width: 44px;
  height: 44px;
}

textarea {
  min-height: 88px;
}

th,
td {
  height: 70px;
  padding: 0 18px;
  border-bottom-color: #eadfd1;
}

th {
  font-size: 14px;
  font-weight: 650;
}

.status,
.priority,
.log-type {
  min-height: 28px;
  border-color: transparent;
  background: #f1e8db;
  font-size: 14px;
}

.progress {
  height: 7px;
  background: #e9dfd1;
}

.progress span {
  background: #7a6042;
}

.toolbar {
  margin-bottom: 18px;
}

.standard-form {
  gap: 18px;
  padding: 22px;
}

.form-row {
  gap: 18px;
}

.collab-room {
  gap: 18px;
}

.chat-feed {
  gap: 16px;
  padding: 20px;
}

.message-bubble {
  padding: 14px 16px;
}

.kanban {
  gap: 18px;
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: inline-grid;
    flex: 0 0 auto;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(82vw, 320px);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(46, 42, 37, 0.28);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .workspace {
    width: 100%;
  }

  .topbar {
    align-items: flex-start;
    gap: 14px;
    min-height: auto;
    padding: 16px;
  }

  .topbar > div:first-of-type {
    flex: 1;
  }

  .topbar-actions {
    width: 100%;
  }

  .route-panel {
    padding: 18px 14px 28px;
  }

  .metric-grid,
  .agent-monitor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .metric {
    padding: 18px;
  }

  .metric strong {
    font-size: 28px;
  }

  .split-layout,
  .component-grid,
  .agent-exec-layout,
  .permission-layout,
  .settings-grid,
  .collab-room,
  .agent-grid,
  .kanban,
  .io-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table {
    min-width: 0;
  }

  #taskTable tr,
  #execTable tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid #eadfd1;
  }

  #taskTable td,
  #execTable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    height: auto;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  #taskTable td:nth-child(2),
  #taskTable td:nth-child(5),
  #taskTable td:nth-child(6),
  #taskTable td:nth-child(7),
  #execTable td:nth-child(1),
  #execTable td:nth-child(3),
  #execTable td:nth-child(6),
  #execTable td:nth-child(7) {
    display: none;
  }

  thead {
    display: none;
  }

  .row-actions,
  .toolbar-actions,
  .drawer-actions,
  .exec-side-actions,
  .maintenance-actions {
    flex-wrap: wrap;
  }

  .row-actions button,
  .toolbar-actions button,
  .segmented button {
    min-height: 44px;
  }

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

  .segmented button {
    border-bottom: 1px solid var(--line-strong);
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }

  .drawer,
  .wide-drawer {
    width: 100vw;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

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

  .metric p {
    display: none;
  }

  .panel-head,
  .room-title,
  .chat-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
  }

  .search-box {
    width: 100%;
  }
}
