:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'DM Sans', sans-serif; }
body { background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }

.auth-shell { display: flex; min-height: 100vh; width: 100%; }
.auth-brand { flex: 1; background: #0f172a; color: white; padding: 60px; display: flex; flex-direction: column; justify-content: space-between; }
.brand-logo { font-size: 24px; font-weight: 800; font-family: 'Manrope', sans-serif; letter-spacing: -0.5px; }
.brand-logo span { color: #3b82f6; }
.brand-copy h1 { font-size: 36px; margin: 20px 0 10px; font-family: 'Manrope', sans-serif; line-height: 1.2; }
.brand-copy p { color: #94a3b8; font-size: 16px; max-width: 400px; }
.brand-foot { color: #64748b; font-size: 13px; }

.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { background: var(--card); padding: 40px; border-radius: 16px; border: 1px solid var(--border); width: 100%; max-width: 420px; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
.auth-card h2 { font-size: 22px; margin-bottom: 8px; font-family: 'Manrope', sans-serif; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.field input, .field select { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; transition: border 0.2s; }
.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; border: none; transition: background 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-block { width: 100%; }
.btn-light { background: #f1f5f9; color: #334155; }
.btn-light:hover { background: #e2e8f0; }
.btn-small { padding: 6px 12px; font-size: 12px; }

.layout { display: flex; width: 100%; min-height: 100vh; }
.sidebar { width: 260px; background: white; border-right: 1px solid var(--border); padding: 24px; display: flex; flex-direction: column; }
.nav-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: 24px 0 12px; letter-spacing: 0.5px; }
.nav button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: transparent; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; color: #475569; cursor: pointer; text-align: left; }
.nav button.active, .nav button:hover { background: #eff6ff; color: var(--primary); font-weight: 600; }
.side-bottom { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); line-height: 1.5; }

.main { flex: 1; display: flex; flex-direction: column; overflow-x: auto; }
.topbar { height: 70px; background: white; border-bottom: 1px solid var(--border); padding: 0 32px; display: flex; align-items: center; justify-content: space-between; }
.top-title { font-weight: 600; font-size: 16px; }
.avatar { width: 36px; height: 36px; background: #eff6ff; color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }

.content { padding: 32px; max-width: 1200px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.page-head h1 { font-size: 22px; font-family: 'Manrope', sans-serif; margin-bottom: 4px; }
.page-head p { color: var(--muted); font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 24px; }
.stat { background: white; padding: 20px; border-radius: 12px; border: 1px solid var(--border); }
.stat-top { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 700; font-family: 'Manrope', sans-serif; }

.table-wrap { background: white; border-radius: 12px; border: 1px solid var(--border); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.table th { background: #f8fafc; padding: 12px 16px; font-weight: 600; color: #475569; border-bottom: 1px solid var(--border); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: #1e293b; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.empty { text-align: center; padding: 40px !important; color: var(--muted); }
.empty small { display: block; margin-top: 4px; font-size: 12px; }

.badge { display: inline-block; padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge.green { background: #dcfce7; color: var(--success); }
.badge.red { background: #fee2e2; color: var(--danger); }
.muted { color: var(--muted); font-size: 12px; }
.money { font-weight: 700; font-family: 'Manrope', sans-serif; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px); }
.modal { background: white; width: 500px; max-width: 94vw; max-height: 92vh; overflow-y: auto; border-radius: 16px; padding: 24px; box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h2 { font-size: 18px; font-family: 'Manrope', sans-serif; }
.close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field.full, .modal-actions.full { grid-column: span 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.detail-box { background: #f8fafc; padding: 12px; border-radius: 8px; border: 1px solid var(--border); }
.detail-box small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.detail-box strong { font-size: 15px; font-family: 'Manrope', sans-serif; }

.toast { position: fixed; bottom: 20px; right: 20px; background: #0f172a; color: white; padding: 12px 20px; border-radius: 8px; font-size: 14px; transform: translateY(100px); opacity: 0; transition: all 0.3s; z-index: 1000; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
/* --- previously missing classes (used by index.html / admin.html) --- */
.ico { display: inline-block; width: 20px; text-align: center; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: 12px; }
.sidebar a { text-decoration: none; }

/* --- moved from the inline <style> of index.html --- */
.df-banner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.df-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.df-card h3 { margin: 0 0 12px; font-size: 15px; }
textarea { font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; resize: vertical; }
.cred { background: #f8fafc; border: 1px dashed #94a3b8; border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-size: 14px; line-height: 1.9; word-break: break-all; }
.cred code { font-size: 15px; font-weight: 700; user-select: all; }
.warn { color: #b45309; font-size: 13px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- automatic email settings --- */
.df-inline { display: flex; gap: 8px; }
.df-inline input { flex: 1; min-width: 0; }
.df-inline select { width: auto; flex: 0 0 auto; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; }
.df-check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.df-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.df-help { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 6px; }

/* --- client selection --- */
.df-selbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-top: 16px; font-size: 13px; }
.df-selbar a { color: var(--primary); font-weight: 600; text-decoration: none; }
.df-cb { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* --- accessibility --- */
.btn:focus-visible, .nav button:focus-visible, .close:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* --- responsive (the old file had no media queries) --- */
@media (max-width: 900px) {
  .auth-shell { flex-direction: column; min-height: 100vh; }
  .auth-brand { padding: 28px 24px; gap: 16px; }
  .brand-copy h1 { font-size: 24px; }
  .auth-main { padding: 24px 16px; }
  .auth-card { padding: 24px; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; border-right: none; border-bottom: 1px solid var(--border); }
  .nav-label { display: none; }
  .nav { display: flex; gap: 4px; flex-wrap: wrap; }
  .nav button { width: auto; }
  .side-bottom { margin: 0 0 0 auto; padding: 0; border: none; text-align: right; }
  .topbar { height: auto; min-height: 56px; padding: 10px 16px; gap: 8px; flex-wrap: wrap; }
  .content { padding: 16px; }
  .page-head { flex-direction: column; gap: 12px; }
  .stats { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full, .modal-actions.full { grid-column: auto; }
  .modal { padding: 18px; }
  .modal-actions { flex-wrap: wrap; }
}
@media print { .sidebar, .topbar, .toast { display: none; } }
