/* ============================================================
   Material Design 3 tokens
   ============================================================ */
:root,
:root[data-theme='light'] {
  --primary: #0061a4;
  --on-primary: #ffffff;
  --primary-container: #d1e4ff;
  --on-primary-container: #001d36;
  --secondary: #535f70;
  --secondary-container: #d7e3f7;
  --on-secondary-container: #101c2b;
  --tertiary: #6b5778;
  --tertiary-container: #f2daff;
  --on-tertiary-container: #251431;
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #410002;
  --background: #fdfcff;
  --on-background: #1a1c1e;
  --surface: #fdfcff;
  --on-surface: #1a1c1e;
  --surface-variant: #dfe2eb;
  --on-surface-variant: #43474e;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f7f9fc;
  --surface-container: #f1f3fa;
  --surface-container-high: #ebeef4;
  --surface-container-highest: #e5e8ef;
  --outline: #73777f;
  --outline-variant: #c3c6cf;
  --inverse-surface: #2f3033;
  --inverse-on-surface: #f1f0f4;
  --success: #146c2e;
  --success-container: #c4eed0;
  --on-success-container: #072711;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --shadow-3: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.3);
}

:root[data-theme='dark'] {
  --primary: #9ecaff;
  --on-primary: #003258;
  --primary-container: #00497d;
  --on-primary-container: #d1e4ff;
  --secondary: #bbc7db;
  --secondary-container: #3b4858;
  --on-secondary-container: #d7e3f7;
  --tertiary: #d6bee4;
  --tertiary-container: #52425f;
  --on-tertiary-container: #f2daff;
  --error: #ffb4ab;
  --error-container: #93000a;
  --on-error-container: #ffdad6;
  --background: #1a1c1e;
  --on-background: #e2e2e6;
  --surface: #1a1c1e;
  --on-surface: #e2e2e6;
  --surface-variant: #43474e;
  --on-surface-variant: #c3c6cf;
  --surface-container-lowest: #0f1113;
  --surface-container-low: #1a1c1e;
  --surface-container: #1e2023;
  --surface-container-high: #282a2d;
  --surface-container-highest: #333538;
  --outline: #8d9199;
  --outline-variant: #43474e;
  --inverse-surface: #e2e2e6;
  --inverse-on-surface: #2f3033;
  --success: #7fe0a0;
  --success-container: #0c3d1f;
  --on-success-container: #c4eed0;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 3px 1px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 6px 2px rgba(0, 0, 0, 0.3);
  --shadow-3: 0 4px 8px 3px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   Base
   ============================================================ */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--on-surface);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

a {
  color: var(--primary);
}

.muted {
  color: var(--on-surface-variant);
}

.small {
  font-size: 12.5px;
}

code {
  background: var(--surface-container-high);
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 12px;
}

/* ============================================================
   Animated background
   ============================================================ */
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

:root[data-motion='off'] .animated-bg {
  opacity: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.3;
  will-change: transform;
}

.blob.b1 {
  width: 46vmax;
  height: 46vmax;
  top: -14vmax;
  left: -10vmax;
  background: var(--primary);
  animation: blob-float-1 var(--blob-dur-1, 26s) ease-in-out infinite;
}

.blob.b2 {
  width: 38vmax;
  height: 38vmax;
  bottom: -14vmax;
  right: -8vmax;
  background: var(--tertiary);
  opacity: 0.24;
  animation: blob-float-2 var(--blob-dur-2, 32s) ease-in-out infinite;
}

.blob.b3 {
  width: 30vmax;
  height: 30vmax;
  top: 38%;
  left: 52%;
  background: var(--secondary);
  opacity: 0.2;
  animation: blob-float-3 var(--blob-dur-3, 24s) ease-in-out infinite;
}

@keyframes blob-float-1 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(7vmax, 5vmax) scale(1.15);
  }
}

@keyframes blob-float-2 {
  0%,
  100% {
    transform: translate(0, 0) scale(1.05);
  }
  50% {
    transform: translate(-6vmax, -7vmax) scale(0.92);
  }
}

@keyframes blob-float-3 {
  0%,
  100% {
    transform: translate(0, 0) scale(0.95);
  }
  50% {
    transform: translate(-8vmax, 6vmax) scale(1.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob {
    animation: none !important;
  }
}

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

/* ============================================================
   Top app bar
   ============================================================ */
.top-app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface-container);
  border-bottom: 1px solid var(--outline-variant);
  backdrop-filter: blur(8px);
}

.app-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-container);
  box-shadow: var(--shadow);
  flex-shrink: 0;
  display: block;
}

.brand-text h1 {
  font-size: 18px;
  color: var(--on-surface);
}

.brand-text p {
  margin: 0;
  font-size: 11.5px;
  color: var(--on-surface-variant);
}

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

.connection-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--outline-variant);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--outline);
  transition: background 0.2s ease;
}

.connection-chip.online .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 22%, transparent);
}

.connection-chip.online {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 35%, var(--outline-variant));
}

/* Nav tabs */
.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: auto;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--on-surface-variant);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 14px 18px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
  border-radius: 12px 12px 0 0;
}

.nav-tab .material-symbols-rounded {
  font-size: 20px;
}

.nav-tab:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.nav-tab.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 400;
}

/* ============================================================
   Layout
   ============================================================ */
.content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.view {
  display: none;
  animation: fade-in 0.25s ease;
}

.view.active {
  display: block;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-head p {
  margin: 2px 0 0;
}

.head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: 20px;
  padding: 20px;
  transition: box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

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

.card-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head h3 .material-symbols-rounded {
  color: var(--primary);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface-container);
}

.stat-card:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 26px;
  color: var(--primary);
  background: var(--primary-container);
  border-radius: 16px;
  padding: 12px;
  font-variation-settings: 'FILL' 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--on-surface);
}

.stat-label {
  color: var(--on-surface-variant);
  font-size: 12.5px;
}

/* Activity */
.activity-card {
  padding: 20px 20px 8px;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 380px;
  overflow-y: auto;
}

.log-item {
  display: flex;
  gap: 12px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--outline-variant);
  align-items: flex-start;
}

.log-item:last-child {
  border-bottom: none;
}

.log-icon {
  font-size: 18px;
  padding: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.log-item.success .log-icon {
  color: var(--success);
  background: var(--success-container);
  font-variation-settings: 'FILL' 1;
}

.log-item.error .log-icon {
  color: var(--error);
  background: var(--error-container);
}

.log-item.warn .log-icon {
  color: var(--tertiary);
  background: var(--tertiary-container);
}

.log-item.info .log-icon,
.log-item.debug .log-icon {
  color: var(--primary);
  background: var(--primary-container);
}

.log-body {
  flex: 1;
  min-width: 0;
}

.log-message {
  word-break: break-word;
}

.log-time {
  font-size: 11.5px;
  color: var(--on-surface-variant);
}

/* ============================================================
   Buttons
   ============================================================ */
button {
  font-family: inherit;
}

.filled-button,
.tonal-button,
.outlined-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 100px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.filled-button .material-symbols-rounded,
.tonal-button .material-symbols-rounded,
.outlined-button .material-symbols-rounded,
.text-button .material-symbols-rounded {
  font-size: 18px;
}

.filled-button {
  background: var(--primary);
  color: var(--on-primary);
}

.filled-button:hover {
  box-shadow: var(--shadow-2);
}

.tonal-button {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.tonal-button:hover {
  box-shadow: var(--shadow);
}

.outlined-button {
  background: transparent;
  color: var(--primary);
  border-color: var(--outline);
}

.text-button {
  background: transparent;
  color: var(--primary);
  padding: 10px 12px;
}

.text-button:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.danger-text {
  color: var(--error);
}

.danger-text:hover {
  background: color-mix(in srgb, var(--error) 8%, transparent);
}

.filled-button:disabled,
.tonal-button:disabled,
.outlined-button:disabled,
.text-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.icon-button {
  border: none;
  background: transparent;
  color: var(--on-surface-variant);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.icon-button:hover {
  background: color-mix(in srgb, var(--on-surface) 10%, transparent);
  color: var(--on-surface);
}

/* Theme picker */
.theme-picker {
  position: relative;
}

.theme-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface-container-high);
  border: 1px solid var(--outline-variant);
  border-radius: 16px;
  padding: 8px;
  min-width: 220px;
  box-shadow: var(--shadow-3);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: menu-in 0.16s cubic-bezier(0.2, 0, 0, 1);
}

.theme-menu[hidden] {
  display: none;
}

.theme-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--on-surface);
  font-family: inherit;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.theme-item:hover {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.theme-item .material-symbols-rounded {
  font-size: 20px;
  color: var(--primary);
}

.theme-item .theme-check {
  margin-left: auto;
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.theme-item.selected .theme-check {
  opacity: 1;
}

.menu-divider {
  height: 1px;
  background: var(--outline-variant);
  margin: 6px 4px;
}

.speed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 10px;
}

.speed-row > .material-symbols-rounded {
  font-size: 20px;
  color: var(--primary);
}

.speed-control {
  flex: 1;
  min-width: 0;
}

.speed-control label {
  display: block;
  font-size: 12px;
  color: var(--on-surface-variant);
  margin-bottom: 2px;
}

.speed-control input[type='range'] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ============================================================
   Text fields
   ============================================================ */
.text-field {
  position: relative;
  display: block;
  margin-bottom: 18px;
}

.text-field input,
.text-field textarea,
.text-field select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--on-surface);
  background: var(--surface-container-high);
  border: 1px solid var(--outline-variant);
  border-radius: 12px;
  padding: 18px 16px 8px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.text-field textarea {
  resize: vertical;
  min-height: 64px;
}

.text-field select {
  appearance: none;
  cursor: pointer;
  padding-right: 40px;
}

.text-field:has(select)::after {
  content: 'expand_more';
  font-family: 'Material Symbols Rounded', sans-serif;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--on-surface-variant);
  margin-top: 4px;
}

.field-label {
  position: absolute;
  left: 14px;
  top: 15px;
  color: var(--on-surface-variant);
  font-size: 14px;
  pointer-events: none;
  transition: all 0.15s ease;
  background: transparent;
  padding: 0 4px;
}

.text-field input:focus,
.text-field textarea:focus,
.text-field select:focus {
  border-color: var(--primary);
  border-width: 2px;
  background: var(--surface-container-high);
}

.text-field input:focus + .field-label,
.text-field textarea:focus + .field-label,
.text-field select:focus + .field-label,
.text-field input:not(:placeholder-shown) + .field-label,
.text-field textarea:not(:placeholder-shown) + .field-label,
.text-field:has(select) .field-label,
.text-field input[type='time'] + .field-label,
.text-field input[type='number'] + .field-label {
  top: -8px;
  left: 12px;
  font-size: 11.5px;
  color: var(--primary);
  background: var(--surface-container-low);
  font-weight: 500;
}

.text-field input:focus + .field-label,
.text-field textarea:focus + .field-label {
  background: var(--surface-container-low);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

/* Search field */
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 220px;
  background: var(--surface-container-high);
  border: 1px solid var(--outline-variant);
  border-radius: 100px;
  padding: 8px 18px;
  transition: border-color 0.15s ease;
}

.search-field:focus-within {
  border-color: var(--primary);
}

.search-field .material-symbols-rounded {
  color: var(--on-surface-variant);
}

.search-field input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--on-surface);
  font-family: inherit;
  font-size: 14px;
  width: 100%;
}

/* Switch */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 16px;
  font-size: 14px;
}

.switch {
  appearance: none;
  width: 52px;
  height: 32px;
  border-radius: 100px;
  background: var(--surface-variant);
  border: 2px solid var(--outline);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.switch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--outline);
  transform: translateY(-50%);
  transition: all 0.2s ease;
}

.switch:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.switch:checked::after {
  left: 26px;
  width: 22px;
  height: 22px;
  background: var(--on-primary);
}

/* File input */
.file-input {
  width: 100%;
  padding: 14px;
  border: 1.5px dashed var(--outline);
  border-radius: 12px;
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
  margin-bottom: 12px;
  cursor: pointer;
  font-family: inherit;
}

.file-input::file-selector-button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  margin-right: 12px;
  padding: 8px 16px;
  border-radius: 100px;
  border: none;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  cursor: pointer;
}

/* ============================================================
   Messages
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px 16px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.message-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: 16px;
  padding: 14px 18px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.message-item:hover {
  box-shadow: var(--shadow);
  transform: translateX(2px);
}

.message-index {
  color: var(--on-surface-variant);
  font-size: 12px;
  min-width: 34px;
  text-align: right;
}

.message-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.message-meta {
  font-size: 11.5px;
  color: var(--on-surface-variant);
}

.message-actions {
  display: flex;
  gap: 4px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.message-item:hover .message-actions {
  opacity: 1;
}

.empty-state {
  text-align: center;
  color: var(--on-surface-variant);
  padding: 40px 20px;
  border-radius: 16px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* ============================================================
   Tasks
   ============================================================ */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px;
}

.task-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: 20px;
  padding: 20px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.task-card:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-3px);
}

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

.task-title {
  font-size: 16px;
  font-weight: 500;
  word-break: break-word;
}

.task-channel {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--on-surface-variant);
  font-size: 12.5px;
  margin-top: 3px;
}

.task-channel .material-symbols-rounded {
  font-size: 16px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status-chip .material-symbols-rounded {
  font-size: 15px;
}

.status-chip.running {
  background: var(--success-container);
  color: var(--on-success-container);
}

.status-chip.paused {
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
}

.status-chip.idle {
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
}

.status-chip.stopped {
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
}

.task-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.task-detail {
  background: var(--surface-container);
  border-radius: 12px;
  padding: 10px 12px;
}

.task-detail-label {
  font-size: 11px;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.task-detail-value {
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
}

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

.task-actions button {
  padding: 8px 16px;
  font-size: 13px;
}

/* ============================================================
   Dialogs
   ============================================================ */
.md-dialog {
  border: none;
  border-radius: 28px;
  padding: 24px;
  background: var(--surface-container-high);
  color: var(--on-surface);
  width: min(480px, calc(100vw - 32px));
  box-shadow: var(--shadow-3);
}

.md-dialog.wide {
  width: min(620px, calc(100vw - 32px));
}

.md-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.md-dialog h3 {
  font-size: 22px;
  margin-bottom: 14px;
}

.md-dialog p {
  margin-top: 0;
}

.md-dialog .text-field {
  margin-bottom: 16px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ============================================================
   Snackbar
   ============================================================ */
.snackbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 140%);
  background: var(--inverse-surface);
  color: var(--inverse-on-surface);
  padding: 14px 22px;
  border-radius: 14px;
  box-shadow: var(--shadow-3);
  font-size: 13.5px;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
  max-width: min(560px, calc(100vw - 32px));
}

.snackbar.show {
  transform: translate(-50%, 0);
}

.snackbar.error {
  background: var(--error);
  color: var(--on-error-container);
}

/* ============================================================
   Login screen
   ============================================================ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--background);
}

body:not(.authed) .login-screen {
  display: flex;
}

body.authed .login-screen {
  display: none;
}

body:not(.authed) .top-app-bar,
body:not(.authed) .content {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: 28px;
  padding: 32px;
  box-shadow: var(--shadow-3);
  text-align: center;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 14px;
  box-shadow: var(--shadow-2);
}

.login-card h2 {
  font-size: 24px;
  margin-bottom: 6px;
}

.login-card > p {
  margin: 0 0 20px;
  font-size: 13px;
}

.login-card .text-field {
  text-align: left;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
}

.login-error {
  color: var(--error);
  font-size: 12.5px;
  min-height: 17px;
  margin: 0 0 10px;
  text-align: left;
}

.login-switch {
  margin: 12px 0 0;
  text-align: center;
}

.login-switch .text-button {
  font-size: 13px;
}

/* User chip */
.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  border-radius: 100px;
  background: var(--surface-container-high);
  border: 1px solid var(--outline-variant);
  color: var(--on-surface-variant);
  font-size: 12.5px;
  font-weight: 500;
}

.user-chip > .material-symbols-rounded {
  font-size: 22px;
  color: var(--primary);
}

.user-logout.icon-button {
  width: 32px;
  height: 32px;
}

.user-logout .material-symbols-rounded {
  font-size: 18px;
  color: var(--on-surface-variant);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .content {
    padding: 16px;
  }
  .app-bar-inner {
    padding: 10px 16px;
  }
  .brand-text p {
    display: none;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .nav-tab {
    padding: 12px 12px;
    font-size: 13px;
  }
  .nav-tab .material-symbols-rounded {
    font-size: 18px;
  }
  .connection-chip span:last-child {
    display: none;
  }
  .user-chip #userName {
    display: none;
  }
  .message-index {
    display: none;
  }
}
