:root {
  --primary:       #7c3aed;
  --primary-dark:  #6d28d9;
  --primary-light: #f5f3ff;
  --bg:            #f8fafc;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --sidebar-bg:    #1e1b4b;
  --sidebar-text:  #a5b4fc;
  --sidebar-active:#ffffff;
  --sidebar-w:     220px;
  --radius:        8px;
  --shadow:        0 1px 3px rgba(0,0,0,.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 6px;
  margin: 2px 8px;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: var(--sidebar-active); }
.nav-logout { color: #f87171; }
.nav-logout:hover { background: rgba(248,113,113,.15); color: #f87171; }
.sidebar-spacer { flex: 1; }
.sidebar-footer { padding: 12px 16px; font-size: 10px; color: rgba(255,255,255,.3); line-height: 1.4; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
}

.main-auth {
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

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

.page-title {
  font-size: 22px;
  font-weight: 600;
}

.page-actions { display: flex; gap: 8px; align-items: center; }

.breadcrumb-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  display: block;
  margin-bottom: 4px;
}
.breadcrumb-link:hover { color: var(--primary); }

.crumb-link { color: var(--primary); text-decoration: none; }
.crumb-link:hover { text-decoration: underline; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }
.mb { margin-bottom: 20px; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }
.table-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.table-link:hover { text-decoration: underline; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.mono { font-family: 'Cascadia Code', 'Fira Code', monospace; font-size: 13px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  background: var(--primary-light);
  color: var(--primary);
}
.badge-type   { border-radius: 4px; font-size: 11px; padding: 2px 6px; }
.badge-static { background: #f0fdf4; color: #166534; }
.badge-php    { background: #eff6ff; color: #1e40af; }
.badge-db     { background: #fef3c7; color: #92400e; font-family: monospace; }
.badge-ssl    { background: #dcfce7; color: #166534; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost    { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger-ghost { color: #ef4444; }
.btn-danger-ghost:hover { background: #fef2f2; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-muted); padding: 2px 6px; border-radius: 4px; }
.btn-close:hover { background: var(--bg); color: var(--text); }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.form-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.auth-wrap { width: 100%; max-width: 380px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.auth-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; margin-bottom: 28px; }

.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 560px; box-shadow: 0 20px 40px rgba(0,0,0,.15); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }

.meta-row { display: flex; gap: 32px; flex-wrap: wrap; }
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; }
.meta-value { font-size: 14px; display: flex; align-items: center; gap: 8px; }

.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* File editor */
.editor-area {
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  min-height: 600px;
  resize: vertical;
  border: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px 20px;
  tab-size: 2;
}
.editor-area:focus { outline: none; }

/* DB info */
.input-reveal { display: flex; gap: 8px; align-items: center; }
.input-reveal .form-control { flex: 1; }
