:root {
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --card: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: #2563eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- Boot Screen ---------- */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  color: var(--muted);
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login Screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(37, 99, 235, 0.12), transparent 42%),
    radial-gradient(circle at 82% 80%, rgba(14, 165, 233, 0.12), transparent 44%),
    linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 48%, #eff6ff 100%);
}
.login-card {
  width: 100%;
  max-width: 408px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 18px;
  padding: 34px 32px 30px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.1);
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 26px;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.28);
  margin-bottom: 14px;
}
.login-brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.login-brand p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 5px;
}
.login-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Forms & Inputs ---------- */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
textarea { min-height: 76px; resize: vertical; }

.pwd-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pwd-wrap input { padding-right: 40px; }
.pwd-toggle {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.pwd-toggle:hover { background: var(--bg-subtle); color: var(--text); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  margin: 14px 0 18px;
}
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Switch control */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.switch-meta strong { display: block; font-size: 13px; color: var(--text); }
.switch-meta span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.18s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.18s;
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* Alerts */
.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 14px;
}
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}
.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}
.alert-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:hover:not(:disabled) { background: var(--bg); border-color: #94a3b8; }
.btn:disabled { opacity: 0.58; cursor: not-allowed; }
.btn-block { width: 100%; padding: 10px 16px; font-size: 14px; font-weight: 600; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #15803d; border-color: #15803d; }
.btn-danger-ghost { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-danger-ghost:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-subtle); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-link {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
  font-family: inherit;
}
.btn-link:hover { color: var(--text); text-decoration: underline; }

/* ---------- Badges & Pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-alert {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.25);
}
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-outline {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #cbd5e1;
  font-weight: 500;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-green { background: #16a34a; }
.dot-red { background: #dc2626; }

/* ---------- App Shell Layout ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 232px;
  background: var(--sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: transform 0.22s ease;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 35;
}
.sidebar-brand {
  padding: 20px 18px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 11px;
}
.sidebar-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand h1 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-brand p {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
.nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-btn {
  width: 100%;
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-btn-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.nav-btn:hover { background: var(--sidebar-hover); color: #fff; }
.nav-btn.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sidebar-foot strong { color: #e2e8f0; font-weight: 600; }

/* ---------- Main & Topbar ---------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 10px 22px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar-left h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.mobile-menu-btn {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  white-space: nowrap;
}
.pill-blue { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.pill-green { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.pill-red { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

.logs-btn {
  position: relative;
}
.alert-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
.alert-dot.error { display: block; background: var(--danger); }
.alert-dot.warn { display: block; background: var(--warning); }

/* ---------- Content & Cards ---------- */
.content {
  padding: 20px 24px 40px;
  max-width: 1360px;
  width: 100%;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.toolbar-check:hover { background: var(--bg-subtle); }
.toolbar-check input[type="checkbox"],
.row-check {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  vertical-align: middle;
}
.card-subhint {
  font-size: 12px;
  color: var(--muted);
  margin: -6px 0 12px;
}
.col-check {
  width: 38px;
  text-align: center;
}
.toolbar input[type="text"],
.toolbar input[type="date"],
.toolbar select,
.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar select {
  width: auto;
  padding: 6px 10px;
  font-size: 13px;
}
.toolbar input[type="text"],
.filter-bar input[type="text"] {
  min-width: 210px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.pagination-info {
  font-size: 12px;
  color: var(--muted);
}
.pagination-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.title-cell strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  line-height: 1.45;
}
.title-cell .sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.status-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 13px;
}

/* Settings Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-bottom: 16px;
}
.runtime-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.runtime-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.runtime-item .k { font-size: 11px; color: var(--muted); }
.runtime-item .v { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 3px; }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 18px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 14px;
  width: min(880px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.9);
}
.modal-box.modal-sm { width: min(490px, 96vw); }
.modal-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

/* Onboarding Fullscreen Focus */
.onboarding-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.1), transparent 45%),
    linear-gradient(145deg, #f8fafc 0%, #eff6ff 100%);
}
.onboarding-card {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 30px;
  box-shadow: var(--shadow-md);
}
.onboarding-head { margin-bottom: 20px; }
.onboarding-head h2 { font-size: 20px; font-weight: 700; margin-top: 8px; }
.onboarding-head p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Article Preview Modal Content */
.preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.sub-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.sub-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.preview-iframe {
  width: 100%;
  height: 58vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}
.md-source {
  width: 100%;
  height: 58vh;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.cover-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  display: block;
}
.meta-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.meta-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: #f8fafc;
  font-size: 13px;
}
.meta-box h4 { font-size: 13px; font-weight: 700; margin-bottom: 8px; }

/* ---------- Slide-over Task Log Drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  z-index: 950;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(640px, 95vw);
  background: #fff;
  z-index: 960;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.drawer-filters {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.drawer-filters input[type="text"],
.drawer-filters input[type="date"],
.drawer-filters select {
  width: auto;
  padding: 6px 10px;
  font-size: 13px;
}
.drawer-filters input[type="text"] {
  min-width: 170px;
  flex: 1 1 170px;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 20px;
}
.drawer-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}
.drawer-foot .pagination {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.log-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 9px;
  background: #fff;
}
.log-item.log-error { border-left: 3px solid var(--danger); background: #fffbfb; }
.log-item.log-warn { border-left: 3px solid var(--warning); background: #fffdf7; }
.log-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.log-item-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.log-item-msg {
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-word;
  line-height: 1.55;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #0f172a;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25);
  display: none;
  z-index: 1200;
  max-width: 440px;
  border-left: 4px solid var(--primary);
}
.toast.toast-success { border-left-color: #22c55e; }
.toast.toast-error { background: #7f1d1d; border-left-color: #fca5a5; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .mobile-menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .topbar { padding: 10px 14px; }
  .content { padding: 14px 14px 32px; }
  .card { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar input[type="text"],
  .filter-bar input[type="text"] { min-width: 150px; flex: 1; }
  .hide-mobile { display: none; }
}
