/* ============================================================
   W-Services Admin UI — app.css
   ============================================================ */

/* ── Google Font import ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
  --primary:        #6366f1;
  --primary-hover:  #4f46e5;
  --primary-light:  #eef2ff;
  --primary-ring:   rgba(99,102,241,.25);

  --danger:         #ef4444;
  --danger-hover:   #dc2626;
  --danger-light:   #fef2f2;

  --success:        #22c55e;
  --success-light:  #f0fdf4;

  --warning:        #f59e0b;
  --warning-light:  #fffbeb;

  --info:           #3b82f6;
  --info-light:     #eff6ff;

  /* Sidebar */
  --sidebar-bg:     #0f172a;
  --sidebar-hover:  #1e293b;
  --sidebar-active: #1e293b;
  --sidebar-border: #1e293b;
  --sidebar-text:   #94a3b8;
  --sidebar-active-text: #f1f5f9;
  --sidebar-width:  240px;

  /* Content */
  --bg:             #f8fafc;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --border-light:   #f1f5f9;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;

  /* Shadows */
  --shadow-sm:      0 1px 2px rgba(0,0,0,.05);
  --shadow:         0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:      0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-xl:      0 20px 25px -5px rgba(0,0,0,.10), 0 8px 10px -6px rgba(0,0,0,.05);

  --radius-sm:      6px;
  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;

  --transition:     150ms cubic-bezier(.4,0,.2,1);
  --header-h:       64px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* ============================================================
   LAYOUT
   ============================================================ */

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: -.5px;
}
.sidebar-logo-text {
  color: #f1f5f9;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.3px;
}
.sidebar-logo-sub {
  color: var(--sidebar-text);
  font-size: 10px;
  font-weight: 400;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.nav-section-label {
  color: var(--sidebar-text);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 12px 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  user-select: none;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.sidebar-avatar {
  width: 30px; height: 30px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-username {
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-role {
  color: var(--sidebar-text);
  font-size: 11px;
}

/* ── Main wrapper ── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top header ── */
.top-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}
.page-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-date { color: var(--text-secondary); font-size: 13px; }
.header-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

/* ── Page content ── */
.page-content {
  flex: 1;
  padding: 24px 28px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.indigo  { background: var(--primary-light); color: var(--primary); }
.stat-icon.green   { background: var(--success-light); color: var(--success); }
.stat-icon.blue    { background: var(--info-light); color: var(--info); }
.stat-icon.purple  { background: #f5f3ff; color: #7c3aed; }
.stat-icon.yellow  { background: var(--warning-light); color: var(--warning); }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-delta {
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-delta.neutral { color: var(--text-muted); }

/* ── Dashboard grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
tbody td {
  padding: 11px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}
.td-mono {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
}
.table-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.table-empty svg { opacity: .35; margin: 0 auto 12px; display: block; }

/* ── Toolbar (above table) ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar-left  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-green  { background: var(--success-light); color: #15803d; }
.badge-red    { background: var(--danger-light);  color: #b91c1c; }
.badge-blue   { background: var(--info-light);    color: #1d4ed8; }
.badge-yellow { background: var(--warning-light); color: #92400e; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #f5f3ff; color: #6d28d9; }
.badge-indigo { background: var(--primary-light); color: var(--primary-hover); }

/* HTTP status badges */
.badge-2xx { background: var(--success-light); color: #15803d; }
.badge-3xx { background: var(--info-light); color: #1d4ed8; }
.badge-4xx { background: var(--warning-light); color: #92400e; }
.badge-5xx { background: var(--danger-light); color: #b91c1c; }

/* No dot variant */
.badge-nodot::before { display: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
}
.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}
.btn svg { flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(99,102,241,.3);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 2px 6px rgba(99,102,241,.4);
}
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg); border-color: #cbd5e1; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 1px 3px rgba(239,68,68,.3);
}
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #16a34a; }

.btn-sm { padding: 5px 11px; font-size: 12px; gap: 5px; }
.btn-lg { padding: 11px 22px; font-size: 14.5px; }
.btn-icon {
  padding: 7px;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
}
.btn-icon.btn-sm { width: 26px; height: 26px; padding: 5px; }
.btn-full { width: 100%; }

/* Loading state */
.btn.loading { pointer-events: none; }
.btn.loading .btn-text { opacity: 0; }
.btn.loading::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.btn-primary.loading::after { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
.btn-secondary.loading::after { border-color: rgba(0,0,0,.12); border-top-color: var(--text-primary); }
.btn { position: relative; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 11.5px; color: var(--danger); margin-top: 5px; display: none; }
.form-group.has-error .form-error { display: block; }
.form-group.has-error .form-input { border-color: var(--danger); }

.form-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:hover { border-color: #cbd5e1; }
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-input:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

textarea.form-input { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* Search input */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrapper svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  padding-left: 34px;
  min-width: 220px;
}

/* Checkbox */
.checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}
.checkbox-item input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Toggle switch ── */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle input:focus + .toggle-slider { box-shadow: 0 0 0 3px var(--primary-ring); }
.toggle-label { font-size: 13px; font-weight: 500; color: var(--text-primary); cursor: pointer; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(.98);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 680px; }
.modal-sm { max-width: 400px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text-primary); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Confirm modal */
.confirm-modal .confirm-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--danger-light);
  color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.confirm-modal .confirm-message {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}
.confirm-modal .modal-title { text-align: center; }
.confirm-modal .modal-header { justify-content: center; border: none; padding-bottom: 0; }
.confirm-modal .modal-footer { justify-content: center; }

/* ── Token display ── */
.token-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.token-value {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.6;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 13px 16px;
  min-width: 280px;
  max-width: 380px;
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.hide { transform: translateX(120%); opacity: 0; transition-timing-function: ease-in; transition-duration: .2s; }
.toast-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast-success .toast-icon { background: var(--success-light); color: var(--success); }
.toast-error   .toast-icon { background: var(--danger-light);  color: var(--danger); }
.toast-info    .toast-icon { background: var(--info-light);    color: var(--info); }
.toast-warning .toast-icon { background: var(--warning-light); color: var(--warning); }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.toast-msg   { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.toast-close {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  padding: 0; display: flex;
  transition: color var(--transition);
}
.toast-close:hover { color: var(--text-primary); }

/* Left accent line */
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--info); }
.toast-warning { border-left: 3px solid var(--warning); }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; }
.spinner-lg { width: 28px; height: 28px; border-width: 3px; }

.page-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 20px;
  gap: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   SERVICE CARDS GRID
   ============================================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.service-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.service-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.service-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.service-id   { font-size: 11px; color: var(--text-muted); font-family: monospace; margin-top: 2px; }
.service-url  {
  font-size: 12px;
  color: var(--primary);
  font-family: monospace;
  word-break: break-all;
  background: var(--primary-light);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  display: block;
}
.service-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 14px; min-height: 40px; }
.service-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
  gap: 8px;
}
.service-actions { display: flex; gap: 6px; }

/* ============================================================
   LOGS PAGE
   ============================================================ */
.filters-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}
.filter-actions { display: flex; gap: 8px; grid-column: span 1; }

/* Pagination */
.pagination-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-top: 1px solid var(--border-light);
  gap: 12px;
}
.page-info { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(99,102,241,.12) 0%, transparent 70%);
  top: -200px; right: -200px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(139,92,246,.08) 0%, transparent 70%);
  bottom: -150px; left: -100px;
  pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,.98);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.05);
  width: 100%;
  max-width: 400px;
  padding: 40px;
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 52px; height: 52px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 4px 14px rgba(99,102,241,.4);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
}
.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.5px;
  margin-bottom: 4px;
}
.login-sub {
  font-size: 13.5px;
  color: var(--text-muted);
}
.login-error {
  background: var(--danger-light);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }
.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2         { gap: 8px; }
.gap-3         { gap: 12px; }
.gap-4         { gap: 16px; }
.mt-1          { margin-top: 4px; }
.mt-2          { margin-top: 8px; }
.mt-3          { margin-top: 12px; }
.mb-4          { margin-bottom: 16px; }
.mb-6          { margin-bottom: 24px; }
.text-sm       { font-size: 12px; }
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.font-mono     { font-family: 'SF Mono', 'Fira Code', monospace; }
.font-semibold { font-weight: 600; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full        { width: 100%; }
.hidden        { display: none !important; }
.relative      { position: relative; }
.divider       { border: none; border-top: 1px solid var(--border-light); margin: 16px 0; }

/* Section label */
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Info row */
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-row-label { color: var(--text-secondary); }
.info-row-value { font-weight: 500; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  :root { --sidebar-width: 200px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; --header-h: 56px; }
  .sidebar { transform: translateX(-240px); width: 240px; transition: transform .25s ease; }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .main-wrapper { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .services-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .top-header { padding: 0 16px; }
  .mobile-menu-btn { display: flex !important; }
  .filters-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left, .toolbar-right { flex-wrap: wrap; }
}

.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  background: none; border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  align-items: center; justify-content: center;
  cursor: pointer;
}
.mobile-menu-btn:hover { background: var(--bg); }

/* Mobile overlay */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.sidebar-backdrop.show { display: block; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
