:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --bg: #f0f2f5;
  --bg2: #ffffff;
  --text: #1e293b;
  --text2: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --radius: 10px;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }

.auth-page { display:flex; align-items:center; justify-content:center; min-height:100vh; padding:20px; }
.auth-card { background: var(--bg2); border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(0,0,0,.1); }
.auth-card .logo { text-align:center; margin-bottom:24px; }
.auth-card .logo h1 { font-size:24px; margin:8px 0 4px; }
.auth-card .logo p { color:var(--text2); font-size:13px; }
.auth-card .logo-icon { width:56px; height:56px; background:var(--primary); color:#fff; border-radius:14px; display:inline-flex; align-items:center; justify-content:center; font-size:24px; }

.layout { display:flex; min-height:100vh; }
.sidebar { width:260px; background: var(--bg2); border-right:1px solid var(--border); display:flex; flex-direction:column; position:fixed; top:0; bottom:0; overflow-y:auto; z-index:100; }
.sidebar-header { padding:20px; border-bottom:1px solid var(--border); }
.sidebar-header h1 { font-size:16px; }
.sidebar-header p { font-size:12px; color:var(--text2); margin-top:2px; }
.nav-menu { list-style:none; padding:8px; flex:1; }
.nav-section { font-size:11px; color:var(--text2); text-transform:uppercase; letter-spacing:.5px; padding:12px 12px 6px; font-weight:600; }
.nav-item { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px; cursor:pointer; color:var(--text2); transition:all .15s; font-size:13px; }
.nav-item:hover { background:var(--bg); color:var(--text); }
.nav-item.active { background:var(--primary); color:#fff; }
.nav-item i { width:18px; text-align:center; }
.sidebar-footer { padding:12px; border-top:1px solid var(--border); }

.content { flex:1; margin-left:260px; padding:24px; max-width:1200px; }
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; flex-wrap:wrap; gap:12px; }
.page-header h2 { font-size:22px; font-weight:700; }

.card { background:var(--bg2); border-radius:var(--radius); border:1px solid var(--border); box-shadow:var(--shadow); overflow:hidden; }
.card-header { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.card-body { padding:20px; }

.stats-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px,1fr)); gap:16px; margin-bottom:20px; }
.stat-card { background:var(--bg2); border-radius:var(--radius); border:1px solid var(--border); padding:20px; display:flex; align-items:center; gap:14px; }
.stat-icon { width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:18px; }
.stat-icon.blue { background:#dbeafe; color:#2563eb; }
.stat-icon.green { background:#d1fae5; color:#059669; }
.stat-icon.red { background:#fee2e2; color:#dc2626; }
.stat-icon.orange { background:#fef3c7; color:#d97706; }
.stat-icon.purple { background:#ede9fe; color:#7c3aed; }
.stat-value { font-size:20px; font-weight:700; }
.stat-label { font-size:12px; color:var(--text2); margin-top:2px; }

.form-group { margin-bottom:14px; }
.form-group label { display:block; font-size:12px; font-weight:600; color:var(--text2); margin-bottom:4px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-row.three { grid-template-columns:1fr 1fr 1fr; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="tel"], input[type="url"], input[type="time"], input[type="color"],
textarea, select {
  width:100%; padding:9px 12px; border:1px solid var(--border); border-radius:8px; font-size:13px; font-family:inherit;
  background:var(--bg2); transition:border .15s;
}
input:focus, textarea:focus, select:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(26,115,232,.1); }
textarea { resize:vertical; }

.btn { display:inline-flex; align-items:center; gap:6px; padding:9px 16px; border:none; border-radius:8px; font-size:13px; font-weight:600; cursor:pointer; transition:all .15s; font-family:inherit; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-secondary { background:var(--bg); color:var(--text); border:1px solid var(--border); }
.btn-secondary:hover { background:var(--border); }
.btn-danger { background:var(--danger); color:#fff; }
.btn-danger:hover { background:#dc2626; }
.btn-success { background:var(--success); color:#fff; }
.btn-success:hover { background:#059669; }
.btn-sm { padding:6px 10px; font-size:12px; }
.btn-icon { background:none; border:none; cursor:pointer; padding:6px; border-radius:6px; color:var(--text2); }
.btn-icon:hover { background:var(--bg); color:var(--text); }
.btn-icon.danger:hover { background:#fee2e2; color:var(--danger); }

.data-table { width:100%; border-collapse:collapse; }
.data-table th { text-align:left; padding:12px 16px; font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--text2); background:var(--bg); border-bottom:1px solid var(--border); font-weight:600; }
.data-table td { padding:12px 16px; border-bottom:1px solid var(--border); font-size:13px; }
.data-table tr:hover { background:rgba(26,115,232,.02); }
.data-table tr:last-child td { border-bottom:none; }

.badge { display:inline-block; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:600; }
.badge-draft { background:#f1f5f9; color:#64748b; }
.badge-sent { background:#dbeafe; color:#2563eb; }
.badge-accepted { background:#d1fae5; color:#059669; }
.badge-rejected { background:#fee2e2; color:#dc2626; }
.badge-expired { background:#fef3c7; color:#d97706; }

.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.4); display:none; align-items:center; justify-content:center; z-index:1000; padding:20px; }
.modal-overlay.open { display:flex; }
.modal { background:var(--bg2); border-radius:16px; width:100%; max-width:640px; max-height:85vh; overflow-y:auto; box-shadow:0 20px 60px rgba(0,0,0,.2); }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:20px 24px; border-bottom:1px solid var(--border); position:sticky; top:0; background:var(--bg2); z-index:1; }
.modal-body { padding:24px; }

.empty-state { text-align:center; padding:60px 20px; color:var(--text2); }
.empty-state i { font-size:40px; margin-bottom:12px; display:block; }

.template-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px,1fr)); gap:16px; }
.template-card { border:2px solid var(--border); border-radius:var(--radius); padding:20px; cursor:pointer; transition:all .2s; text-align:center; }
.template-card:hover { border-color:var(--primary); transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,.08); }
.template-card.selected { border-color:var(--primary); background:rgba(26,115,232,.03); }
.template-card .icon { font-size:36px; margin-bottom:8px; }
.template-card h3 { font-size:15px; margin-bottom:4px; }
.template-card p { font-size:12px; color:var(--text2); }

.toolbar { display:flex; gap:8px; margin-bottom:16px; flex-wrap:wrap; align-items:center; }
.search-input { position:relative; flex:1; min-width:200px; }
.search-input i { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--text2); }
.search-input input { padding-left:36px; }

.toast-container { position:fixed; top:20px; right:20px; z-index:9999; display:flex; flex-direction:column; gap:8px; }
.toast { padding:12px 20px; border-radius:10px; color:#fff; font-size:13px; font-weight:500; box-shadow:0 4px 16px rgba(0,0,0,.15); display:flex; align-items:center; gap:8px; animation:slideIn .3s ease; }
.toast.success { background:#059669; }
.toast.error { background:#dc2626; }
.toast.info { background:#2563eb; }
@keyframes slideIn { from { transform:translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } }

.tenant-card { border:1px solid var(--border); border-radius:var(--radius); padding:16px; display:flex; align-items:center; gap:14px; transition:all .15s; cursor:pointer; }
.tenant-card:hover { border-color:var(--primary); box-shadow:0 2px 8px rgba(0,0,0,.06); }
.tenant-icon { width:48px; height:48px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:24px; flex-shrink:0; }
.tenant-info { flex:1; }
.tenant-info h3 { font-size:14px; font-weight:600; }
.tenant-info p { font-size:12px; color:var(--text2); }
.tenant-meta { text-align:right; font-size:12px; color:var(--text2); }

.actions { display:flex; gap:4px; }
.tabs { display:flex; gap:4px; background:var(--bg); border-radius:8px; padding:4px; }
.tab { padding:8px 14px; border-radius:6px; cursor:pointer; font-size:13px; font-weight:500; color:var(--text2); transition:all .15s; }
.tab.active { background:var(--bg2); color:var(--text); box-shadow:var(--shadow); }
.tab:hover:not(.active) { color:var(--text); }

.service-group { margin-bottom:20px; }
.service-group-header { display:flex; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:2px solid var(--border); margin-bottom:8px; }
.service-group-header h3 { font-size:14px; font-weight:600; }

@media (max-width:768px) {
  .sidebar { display:none; }
  .sidebar.open { display:flex; position:fixed; width:100%; }
  .content { margin-left:0; }
  .form-row, .form-row.three { grid-template-columns:1fr; }
  .stats-grid { grid-template-columns:1fr 1fr; }
  .mobile-toggle { display:block !important; }
}
.mobile-toggle { display:none; position:fixed; top:12px; left:12px; z-index:200; background:var(--bg2); border:1px solid var(--border); border-radius:8px; padding:8px 12px; cursor:pointer; }
