/* OpenClaw Admin — Minimal custom CSS */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #dde1e6;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Layout */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-size: 18px;
  font-weight: 600;
  margin-right: 32px;
  white-space: nowrap;
}

.app-header nav { display: flex; gap: 4px; flex: 1; }

.app-header nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.app-header nav a:hover { background: var(--bg); color: var(--text); }
.app-header nav a.active { background: var(--primary); color: white; }

.app-header .header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-content {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 24px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn:hover { background: var(--bg); }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-inline {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.form-inline .form-group { margin-bottom: 0; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted { background: #f3f4f6; color: #6b7280; }

/* Resource threshold colors */
.res-green { color: #166534; }
.res-yellow { color: #92400e; }
.res-red { color: #991b1b; }
.res-badge-danger { background: #fef2f2; color: #991b1b; }

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toast-in 0.3s ease;
  max-width: 400px;
}

.toast-success { background: #166534; color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--primary); color: white; }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Steps progress */
.steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 0;
}

.step-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.step-success .step-icon { background: #dcfce7; color: #166534; }
.step-error .step-icon { background: #fef2f2; color: var(--danger); }
.step-pending .step-icon { background: #f3f4f6; color: #6b7280; }

/* Login */
.login-container {
  max-width: 360px;
  margin: 120px auto;
}

.login-container h2 { text-align: center; margin-bottom: 24px; }

/* Detail sections */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-item label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-item .value {
  font-size: 15px;
  font-weight: 500;
  margin-top: 2px;
}

/* Markdown content */
.md-content {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-height: 500px;
  overflow-y: auto;
}

/* Tags (for allowFrom lists) */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  font-family: 'SF Mono', Monaco, monospace;
}

.tag .remove-tag {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  margin-left: 2px;
}

.tag .remove-tag:hover { color: var(--danger); }

/* Confirm dialog */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.dialog {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.dialog h3 { margin-bottom: 12px; }
.dialog p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.empty-state p { margin-top: 8px; font-size: 14px; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Utility */
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
/* Editable values (inline edit) */
.editable-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.btn-icon:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.inline-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.inline-edit-input {
  padding: 4px 8px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  flex: 1;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.inline-edit-input:focus {
  outline: none;
}

/* Day picker toggles */
.day-picker {
  display: flex;
  gap: 4px;
}

.day-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  color: var(--text-muted);
  background: var(--surface);
}

.day-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.day-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Month picker grid (3x4) */
.month-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

/* Cron form textarea */
.form-group textarea {
  transition: border-color 0.15s;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Health dashboard */
.health-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.summary-card .summary-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.summary-card .summary-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}

.summary-active .summary-value { color: var(--success); }
.summary-dormant .summary-value { color: var(--warning); }
.summary-inactive .summary-value { color: var(--text-muted); }

/* Progress bars */
.kartlegging-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-label {
  width: 100px;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-good { background: var(--success); }
.progress-mid { background: var(--warning); }
.progress-low { background: var(--danger); }

.progress-count {
  width: 48px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  flex-shrink: 0;
}

/* Alerts */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}

.alert-red { background: #fef2f2; color: #991b1b; }
.alert-yellow { background: #fffbeb; color: #92400e; }

.alert-icon { flex-shrink: 0; }

/* Engagement bar */
.engage-bar {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--primary);
}

/* Active user detail cards */
.active-detail {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.active-detail:last-child { border-bottom: none; }

.active-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.active-detail-body {
  padding-left: 4px;
}

.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.chip-farge { background: #dbeafe; color: #1e40af; }
.chip-team { background: #fce7f3; color: #9d174d; }
.chip-model { background: #d1fae5; color: #065f46; }

.step-dot { font-size: 11px; letter-spacing: 1px; }
.step-done { color: var(--success); }
.step-intro { color: var(--warning); }
.step-pending { color: var(--border); }

.agenda-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  padding-left: 4px;
}

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.mono { font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; }
.hidden { display: none !important; }

/* Segment control (3-way button group) */
.segment-control { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; width: fit-content; }
.segment-control button { flex: 1; padding: 7px 16px; background: none; border: none; border-right: 1px solid var(--border); cursor: pointer; font-size: 13px; color: var(--text-muted); transition: all 0.15s; white-space: nowrap; }
.segment-control button:last-child { border-right: none; }
.segment-control button:hover { background: var(--surface-hover, #f9fafb); color: var(--text); }
.segment-control button.active { background: var(--primary); color: #fff; font-weight: 500; }

/* Step status badge variants */
.badge-kartlagt { background: #dbeafe; color: #1e40af; }
.badge-forstatt { background: #d1fae5; color: #065f46; }
.badge-integrert { background: #bbf7d0; color: #14532d; }
.badge-under-arbeid { background: #fef3c7; color: #92400e; }
.badge-introdusert { background: #ffedd5; color: #9a3412; }
.badge-ukjent { background: #f3f4f6; color: #6b7280; }
