:root {
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.55);
  --shadow-soft: 0 18px 50px rgba(24, 39, 75, 0.08), 0 8px 24px rgba(24, 39, 75, 0.08);
  --text-main: #1f2937;
  --log-bg: #f8fafc;
  --log-border: #dbe5f2;
  --log-text: #0f172a;
  --log-error: #dc2626;
  --log-warning: #b45309;
  --log-debug: #2563eb;
  --log-success: #059669;
  --log-info: #334155;
}

html,
body {
  min-height: 100%;
  font-family: "SF Pro Text", "SF Pro Display", "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
}

body.macos-shell {
  background: radial-gradient(circle at 20% 20%, #e9f2ff 0%, #f4f7ff 35%, #eff3fb 100%);
}

.mac-window,
.card,
.alert,
.table,
.collapse,
.stats,
.stat {
  border-radius: 16px;
}

.mac-window {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
}

.mac-toolbar {
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mac-traffic-lights {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mac-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.mac-dot-red {
  background: #ff5f57;
}

.mac-dot-yellow {
  background: #febc2e;
}

.mac-dot-green {
  background: #28c840;
}

.content-wrap {
  animation: fade-slide-in 220ms ease-out;
}

.glass-sidebar {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.78), rgba(243, 246, 252, 0.72));
  backdrop-filter: blur(16px);
}

.menu li > a {
  border-radius: 12px;
  transition: all 180ms ease;
}

.menu li > a.active,
.menu li > a:hover {
  background: rgba(59, 130, 246, 0.12);
  color: rgb(29, 78, 216);
  transform: translateX(2px);
}

.btn,
.input,
.select,
.file-input,
.checkbox,
.collapse,
.card,
a,
tr,
td {
  transition: all 180ms ease;
}

.btn {
  border-radius: 12px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, #4285ff, #3478f6);
  border-color: #3478f6;
}

.btn-primary:hover {
  filter: brightness(1.03);
}

.input:focus,
.select:focus,
.file-input:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.input,
.select,
.file-input {
  border-radius: 10px;
}

.card {
  box-shadow: var(--shadow-soft);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
}

.table tr:hover td {
  background: rgba(59, 130, 246, 0.04);
}

.log-surface {
  background: var(--log-bg);
  border: 1px solid var(--log-border);
  color: var(--log-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

#log-window {
  font-variant-ligatures: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.log-line {
  color: var(--log-text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-level-error {
  color: var(--log-error);
}

.log-level-warning {
  color: var(--log-warning);
}

.log-level-debug {
  color: var(--log-debug);
}

.log-level-success {
  color: var(--log-success);
}

.log-level-info {
  color: var(--log-info);
}

.mobile-sticky-actions {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  padding-top: 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.13);
}

.mobile-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.mobile-tabbar a {
  padding: 10px 4px 12px;
  text-align: center;
  font-size: 11px;
  color: #64748b;
}

.mobile-tabbar a.active {
  color: #2563eb;
  font-weight: 600;
}

.surface-title {
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #0f172a;
}

.surface-subtitle {
  color: #64748b;
  font-size: 13px;
}

.htmx-swapping {
  opacity: 0.65;
}

.loading .btn,
.loading .input,
.loading .select {
  pointer-events: none;
}

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

@media (max-width: 768px) {
  .drawer-content {
    padding-bottom: 1rem;
  }

  .card,
  .mac-window {
    border-radius: 14px;
  }

  .table th,
  .table td {
    white-space: nowrap;
    font-size: 12px;
  }

  .drawer-content {
    padding-bottom: 72px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --log-bg: #0b1220;
    --log-border: #1f2a44;
    --log-text: #e2e8f0;
    --log-error: #f87171;
    --log-warning: #fbbf24;
    --log-debug: #60a5fa;
    --log-success: #34d399;
    --log-info: #cbd5e1;
  }

  .log-surface {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }
}
