:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --ink: #18201f;
  --muted: #62706d;
  --line: #dbe2e0;
  --panel: #ffffff;
  --soft: #eef3f1;
  --accent: #176b5d;
  --accent-strong: #0f4e45;
  --warn: #b44721;
  --done: #476a2b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(98, 216, 182, 0.18), rgba(126, 167, 255, 0.13)),
    var(--bg);
}

.login-card,
.inline-form,
.settings-section,
.toolbar-panel,
.task-row,
.dashboard-card,
.compact-item,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(100%, 440px);
  padding: 30px;
  box-shadow: 0 24px 70px rgba(16, 35, 31, 0.12);
}

.login-logo {
  width: min(100%, 300px);
  height: auto;
  margin-bottom: 8px;
}

.login-card h1,
.page-header h1,
.task-content h3 {
  margin: 0;
  letter-spacing: 0;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--warn);
  font-weight: 700;
}

.form-error.neutral {
  color: var(--muted);
}

.app-root {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100vh;
}

.app-root.sidebar-is-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: #fff;
  transition: padding 160ms ease;
}

.sidebar.collapsed {
  padding: 14px 10px;
}

.sidebar.collapsed .brand-row strong,
.sidebar.collapsed .eyebrow,
.sidebar.collapsed .brand-lockup > div,
.sidebar.collapsed .side-text,
.sidebar.collapsed .side-chevron,
.sidebar.collapsed #currentUserLabel,
.sidebar.collapsed .sidebar-footer button {
  display: none;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}

.brand-row strong {
  font-size: 20px;
}

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

.side-nav,
.nav-primary,
.nav-lower,
.side-submenu,
.sidebar-footer,
.task-form,
.compact-list {
  display: grid;
  gap: 6px;
}

.side-nav {
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.nav-primary {
  align-content: start;
}

.nav-lower {
  align-content: end;
  align-self: end;
  margin-top: auto;
}

.side-link,
.side-section-toggle {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  min-height: 38px;
  padding: 4px 8px;
  text-align: left;
}

.side-link.active,
.side-section-toggle.active {
  background: var(--soft);
  color: var(--accent-strong);
}

.side-link:hover,
.side-section-toggle:hover {
  background: #f3f7f5;
  color: var(--accent-strong);
}

.side-submenu {
  display: none;
  gap: 6px;
  margin: 0 0 4px 10px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.side-submenu.is-open {
  display: grid;
}

.side-sub-link {
  grid-template-columns: 26px minmax(0, 1fr);
  min-height: 34px;
  padding: 3px 7px;
}

.side-sub-link .side-icon {
  width: 26px;
  height: 26px;
}

.side-chevron {
  color: var(--muted);
  font-size: 11px;
  transform: rotate(-90deg);
  transition: transform 160ms ease;
}

.side-section-toggle[aria-expanded="true"] .side-chevron {
  transform: rotate(0deg);
}

.side-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
  background: #f5f8f7;
  color: var(--accent-strong);
  font-size: 14px;
  line-height: 1;
}

.side-icon img,
.icon-button img {
  width: 18px;
  height: 18px;
  display: block;
}

.side-link.active .side-icon,
.side-section-toggle.active .side-icon {
  background: #dfeae6;
}

.side-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-beta {
  color: #c43131;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.sidebar-footer {
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer #currentUserLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer button {
  grid-column: 1 / -1;
  min-height: 34px;
  padding: 8px 10px;
}

.user-dot {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.main-area {
  min-width: 0;
  padding: 28px clamp(18px, 5vw, 56px);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-header h1 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 11px 14px;
}

button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.icon-button,
.drag-handle {
  background: #e8eeea;
  color: var(--ink);
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
}

.sidebar.collapsed .brand-row {
  justify-content: center;
}

.sidebar.collapsed .brand-lockup {
  display: none;
}

.sidebar.collapsed .icon-button,
.sidebar.collapsed .side-link,
.sidebar.collapsed .side-section-toggle {
  width: 42px;
}

.sidebar.collapsed .side-link,
.sidebar.collapsed .side-section-toggle {
  grid-template-columns: 30px;
  justify-content: center;
  padding-inline: 6px;
}

.sidebar.collapsed .side-submenu {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}

.inline-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.task-template-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

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

.section-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.template-list,
.quick-template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-button {
  display: grid;
  gap: 4px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.template-button:hover {
  border-color: var(--accent);
  background: #eef7f3;
}

.template-button span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.template-button strong {
  font-size: 15px;
}

.dashboard-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.dashboard-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-card strong {
  font-size: 28px;
  line-height: 1;
}

.dashboard-card.warning strong {
  color: var(--warn);
}

.portal-dashboard {
  display: grid;
  gap: 14px;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-metric {
  display: grid;
  gap: 6px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.dashboard-metric strong {
  font-size: 30px;
  line-height: 1;
}

.dashboard-metric p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.dashboard-metric.warning {
  border-color: #efc8b7;
  background: #fffaf7;
}

.dashboard-metric.warning strong {
  color: var(--warn);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.dashboard-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.dashboard-panel-wide {
  grid-column: auto;
}

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

.dashboard-panel h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.dashboard-task-list,
.dashboard-status-list {
  display: grid;
  gap: 8px;
}

.dashboard-task-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.dashboard-task-item:hover {
  background: #eef6f3;
  color: var(--ink);
}

.dashboard-task-item strong,
.dashboard-task-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-task-item small {
  grid-column: 2;
  color: var(--muted);
}

.status-dot {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
}

.status-dot.open {
  background: #d98b2b;
}

.status-dot.in_progress {
  background: #2d6cdf;
}

.status-dot.done {
  background: var(--done);
}

.dashboard-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.dashboard-split span,
.dashboard-status-list span,
.system-status-grid span,
.dashboard-backup {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  background: #f7faf9;
  padding: 10px;
}

.dashboard-split strong {
  font-size: 24px;
  line-height: 1;
}

.dashboard-status-list strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

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

.system-status-grid strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.dashboard-status-list em {
  font-style: normal;
  font-weight: 800;
}

.dashboard-status-list .ok {
  color: var(--done);
}

.dashboard-status-list .warn {
  color: var(--warn);
}

.dashboard-backup span {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px;
  gap: 12px;
  padding: 14px;
}

.beta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid #cfe4dd;
  border-radius: 999px;
  background: #f7fbfa;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  padding: 7px 12px;
  white-space: nowrap;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: start;
}

.chat-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.chat-timeline {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 420px;
  max-height: calc(100vh - 270px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 250, 249, 0.92)),
    #fff;
  padding: 14px;
}

.chat-empty {
  display: grid;
  gap: 6px;
  justify-items: start;
  border: 1px dashed #cbd8d4;
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
  padding: 16px;
}

.chat-empty strong {
  color: var(--ink);
}

.chat-message {
  display: grid;
  gap: 8px;
  width: min(100%, 680px);
  border: 1px solid #d8e2df;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(21, 41, 37, 0.05);
}

.chat-message.system {
  border-color: #e6d6bd;
  background: #fffaf1;
}

.chat-bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.chat-bubble-head strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.chat-message p {
  margin: 0;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-recipient {
  justify-self: start;
  border-radius: 999px;
  background: #edf7f4;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  padding: 4px 9px;
}

.chat-image {
  display: block;
  width: min(100%, 320px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f7;
}

.chat-audio {
  width: min(100%, 360px);
}

.chat-created {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-self: start;
  border-radius: 999px;
  background: #eaf3ff;
  color: #1e5480;
  font-size: 12px;
  font-weight: 850;
  padding: 4px 9px;
}

.compact-link-button {
  min-height: 0;
  padding: 4px 9px;
  font-size: 12px;
}

.chat-composer {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.chat-mode-row,
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-mode {
  min-height: 32px;
  background: #edf3f0;
  color: var(--accent-strong);
  font-size: 12px;
  padding: 7px 10px;
}

.chat-mode:hover,
.chat-mode.active {
  background: var(--accent);
  color: #fff;
}

.chat-target-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chat-attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-suggestion {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #b9d8cf;
  border-radius: 8px;
  background: #f3fbf7;
  padding: 10px;
}

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

.chat-suggestion span {
  color: var(--muted);
  font-weight: 750;
}

.chat-attachment-preview span {
  border-radius: 999px;
  background: #f1f4ff;
  color: #2c458a;
  font-size: 12px;
  font-weight: 850;
  padding: 5px 9px;
}

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

#chatVoiceButton.recording {
  background: #fff1ea;
  color: var(--warn);
}

#chatVoiceButton.recording:hover {
  background: #ffd8c7;
}

.chat-side {
  display: grid;
  gap: 10px;
}

.chat-side article {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.chat-side strong {
  color: var(--accent-strong);
}

.chat-side p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-section {
  display: grid;
  gap: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.settings-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  border-radius: 7px;
  background: #fff;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 16px;
  font-weight: 850;
  list-style: none;
  padding: 14px 18px;
  text-align: left;
  user-select: none;
}

.settings-section summary::-webkit-details-marker {
  display: none;
}

.settings-section summary:hover {
  background: #f7faf9;
  color: var(--accent-strong);
}

.settings-chevron {
  color: var(--muted);
  font-size: 13px;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.settings-section:not([open]) .settings-chevron {
  transform: rotate(-90deg);
}

.settings-section-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.template-editor {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  padding: 14px;
}

.template-admin-item strong {
  color: var(--accent-strong);
}

.section-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

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

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

.form-actions,
.task-actions,
.mini-actions,
.backup-actions,
.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.check-row {
  min-height: 42px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
  padding: 10px 12px;
}

.check-row input {
  width: auto;
}

.form-section-title {
  margin: 8px 0 0;
  color: var(--accent-strong);
  font-weight: 850;
}

.inline-status {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
}

.push-beta-box {
  display: grid;
  gap: 12px;
  border: 1px solid #b9d8cf;
  border-radius: 8px;
  background: #f5fbf8;
  padding: 14px;
}

.push-beta-box strong {
  color: var(--accent-strong);
  font-size: 15px;
}

.push-beta-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: start;
}

.report-page {
  display: grid;
  gap: 14px;
}

.report-panel,
.security-policy {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

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

.report-stat {
  display: grid;
  gap: 4px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  padding: 14px;
}

.report-stat strong {
  color: var(--accent-strong);
  font-size: 24px;
  line-height: 1.1;
}

.report-stat span,
.security-policy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

.file-download-link {
  width: fit-content;
  text-decoration: none;
}

.device-management {
  display: grid;
  gap: 14px;
}

.device-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.device-stat-card {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.device-stat-card strong {
  color: var(--accent-strong);
  font-size: 28px;
  line-height: 1;
}

.device-stat-card span {
  color: var(--muted);
  font-weight: 750;
}

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

.device-status,
.status-ok,
.status-warn,
.status-muted {
  font-weight: 850;
}

.status-ok {
  color: var(--done);
}

.status-warn {
  color: var(--warn);
}

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

.compact-item .status-ok {
  color: var(--done);
}

.compact-item .status-warn {
  color: var(--warn);
}

.compact-item .status-muted {
  color: var(--muted);
}

.settings-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

.role-matrix {
  display: grid;
  gap: 10px;
}

.role-matrix article {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 12px;
}

.role-matrix strong {
  color: var(--accent-strong);
}

.role-matrix span {
  color: var(--muted);
}

.danger-button {
  background: #fff1ea;
  color: var(--warn);
}

.danger-button:hover {
  background: #ffd8c7;
}

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

.task-detail-panel {
  display: grid;
  gap: 14px;
  border: 1px solid #cfdcda;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 18px 48px rgba(19, 38, 35, 0.08);
}

.task-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.task-detail-header h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
}

.task-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.task-detail-description {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}

.task-comment-form {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

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

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

.task-detail-grid span {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  background: #f7faf9;
  color: var(--ink);
  padding: 10px;
}

.task-detail-grid strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.task-detail-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.detail-note-section {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.detail-note-section h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 15px;
}

.detail-timeline {
  display: grid;
  gap: 8px;
}

.detail-timeline span {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  background: #f7faf9;
  color: var(--muted);
  padding: 10px;
}

.detail-timeline strong {
  color: var(--ink);
}

.detail-note,
.detail-photo {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}

.detail-note p,
.detail-photo p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-wrap;
}

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

.detail-note audio {
  width: 100%;
}

.detail-photo {
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: start;
}

.detail-photo img {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--soft);
}

.task-row {
  display: grid;
  grid-template-columns: 44px 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.task-row.overdue {
  border-color: #efc8b7;
  background: #fffaf7;
}

.task-row.dragging {
  opacity: 0.55;
  outline: 2px solid var(--accent);
}

.drag-handle {
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: grab;
}

.task-number {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.task-content {
  min-width: 0;
}

.task-content h3 {
  font-size: 18px;
  line-height: 1.3;
}

.task-content p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.task-meta span {
  border-radius: 999px;
  background: var(--soft);
  padding: 3px 9px;
}

.task-meta .priority-high,
.task-meta .status-overdue {
  background: #fff1ea;
  color: var(--warn);
}

.task-meta .status-done {
  background: #edf5e8;
  color: var(--done);
}

.compact-item,
.empty-state {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.compact-item span,
.empty-state {
  color: var(--muted);
}

.audit-item strong {
  color: var(--accent-strong);
}

@media (max-width: 860px) {
  .app-root {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar.collapsed {
    width: auto;
  }

  .app-root.sidebar-is-collapsed {
    grid-template-columns: 1fr;
  }

  .page-header,
  .task-detail-header,
  .task-row {
    grid-template-columns: 1fr;
  }

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

  .form-row.two-columns,
  .toggle-grid,
  .system-status-grid,
  .chat-layout,
  .push-beta-page,
  .device-stats,
  .dashboard-layout,
  .dashboard-metrics,
  .report-summary,
  .dashboard-grid,
  .toolbar-panel {
    grid-template-columns: 1fr;
  }

  .dashboard-panel-wide {
    grid-column: auto;
  }

  .dashboard-panel-head {
    display: grid;
  }

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

  .chat-timeline {
    max-height: none;
    min-height: 320px;
  }

  .chat-actions {
    justify-content: stretch;
  }

  .chat-actions button {
    flex: 1 1 150px;
  }

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

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

  .task-detail-header {
    display: grid;
  }

  .task-detail-actions {
    justify-content: stretch;
  }

  .task-detail-actions button {
    flex: 1 1 140px;
  }

  .task-detail-grid,
  .task-detail-notes {
    grid-template-columns: 1fr;
  }

  .detail-photo {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .detail-photo img {
    width: 72px;
    height: 72px;
  }

  .beta-pill {
    white-space: normal;
  }

  .task-actions {
    justify-content: stretch;
  }

  .task-actions button {
    flex: 1;
  }
}
