/* ============================================================
   Infra Manager — styles.css
   ============================================================ */

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

:root {
  --accent:    #6366f1;
  --accent-h:  #4f46e5;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --ok:        #22c55e;
  --bg:        #f8f8f7;
  --surface:   #ffffff;
  --border:    rgba(0,0,0,0.1);
  --border-md: rgba(0,0,0,0.18);
  --text:      #1a1a1a;
  --muted:     #6b7280;
  --radius:    8px;
  --radius-lg: 12px;
}

body { font-family: system-ui, -apple-system, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }

/* ---- Navbar ---- */
.navbar { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 52px; background: var(--surface); border-bottom: 0.5px solid var(--border); position: sticky; top: 0; z-index: 100; }
.navbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.navbar-nav { display: flex; list-style: none; gap: 4px; flex: 1; }
.navbar-nav a { display: block; padding: 5px 12px; border-radius: var(--radius); color: var(--muted); text-decoration: none; font-size: 13px; transition: background .15s, color .15s; }
.navbar-nav a:hover { background: var(--bg); color: var(--text); }
.navbar-nav a.active { background: #eef2ff; color: var(--accent); font-weight: 500; }
.btn-logout { font-size: 13px; color: var(--muted); text-decoration: none; padding: 5px 10px; border-radius: var(--radius); transition: background .15s; }
.btn-logout:hover { background: var(--bg); color: var(--danger); }

/* ---- Main ---- */
.main-content { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }
.page-title { font-size: 22px; font-weight: 600; margin-bottom: 20px; }
.section-title { font-size: 16px; font-weight: 600; margin: 28px 0 12px; display: flex; align-items: center; gap: 8px; }
.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 20px; }
.back-link:hover { color: var(--text); }

/* ---- Toolbar ---- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }

/* ---- Stats grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 32px; }
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
.stat-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1; margin-bottom: 8px; }
.stat-sub { font-size: 11px; color: var(--muted); }
.stat-link { font-size: 12px; color: var(--accent); text-decoration: none; }
.stat-link:hover { text-decoration: underline; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 0.5px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.data-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 0.5px solid var(--border); white-space: nowrap; background: var(--bg); }
.data-table td { padding: 10px 14px; border-bottom: 0.5px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafaf9; }
.fw-medium { font-weight: 500; }
.sub-text { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; }
.link-cell { white-space: nowrap; display: flex; gap: 4px; align-items: center; }

/* ---- Badges & chips ---- */
.badge { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 20px; }
.badge-server  { background: #e0e7ff; color: #3730a3; }
.badge-domain  { background: #d1fae5; color: #065f46; }
.badge-ai      { background: #fae8ff; color: #6b21a8; }
.badge-type    { background: var(--bg); color: var(--muted); }
.badge-count   { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 20px; }

.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 500; }
.chip-expired { background: #fee2e2; color: #991b1b; }
.chip-danger  { background: #fee2e2; color: #991b1b; }
.chip-warning { background: #fef3c7; color: #92400e; }
.chip-ok      { background: #d1fae5; color: #065f46; }
.chip-warn    { background: #fef3c7; color: #92400e; }
.chip-neutral { background: var(--bg); color: var(--muted); }

/* Row coloring */
.row-expired td { background: #fff5f5; }
.row-danger  td { background: #fff8f8; }
.row-warning td { background: #fffdf0; }

/* Expiry text colors */
.expired { color: var(--danger); }
.danger  { color: #dc2626; }
.warning { color: #d97706; }
.ok      { color: var(--ok); }

/* ---- Buttons ---- */
.btn { display: inline-block; padding: 7px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; border: 0.5px solid var(--border-md); background: var(--surface); color: var(--text); transition: background .15s; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent-h); }
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #dc2626; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { font-size: 12px; padding: 5px 12px; }
.btn-right { margin-left: auto; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius); text-decoration: none; color: var(--accent); background: #eef2ff; border: none; cursor: pointer; font-size: 14px; transition: background .15s; }
.btn-icon:hover { background: #e0e7ff; }
.btn-icon-muted { color: var(--muted); background: var(--bg); }
.btn-icon-muted:hover { background: var(--border); }

/* ---- Forms ---- */
.edit-form { max-width: 900px; }
.form-section { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 16px; }
.form-section-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section-badge { font-size: 11px; font-weight: 400; }
.section-badge-secure { color: var(--warning); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .form-grid, .form-grid-4 { grid-template-columns: 1fr; } }
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: 12px; font-weight: 500; color: var(--muted); }
.field-group input, .field-group select, .field-group textarea {
  padding: 7px 10px; border: 0.5px solid var(--border-md); border-radius: var(--radius);
  font-size: 13px; color: var(--text); background: var(--surface); font-family: inherit;
  transition: border-color .15s;
}
.field-group input:focus, .field-group select:focus, .field-group textarea:focus {
  outline: none; border-color: var(--accent);
}
.field-group textarea { resize: vertical; min-height: 80px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.form-hint { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding: 4px 0; }

/* Custom fields */
.custom-field-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin-bottom: 8px; }
.btn-remove-cf { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0.5px solid var(--border-md); border-radius: var(--radius); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 13px; flex-shrink: 0; }
.btn-remove-cf:hover { background: #fee2e2; color: var(--danger); border-color: var(--danger); }

/* ---- Login ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-box { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 36px 40px; width: 100%; max-width: 380px; }
.login-logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; margin-bottom: 28px; }

/* ---- Alerts ---- */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 0.5px solid #fca5a5; }

/* ---- Empty state ---- */
.empty-state { color: var(--muted); font-size: 14px; padding: 40px; text-align: center; background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); }
.empty-state a { color: var(--accent); }
