/* IPAM - Net-Gate CSS */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --sidebar-bg: #f8fafc;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { font-family: var(--font); background: var(--bg); color: var(--gray-800); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

.app-layout { display: flex; min-height: 100vh; }

.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); border-right: 1px solid var(--gray-200); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; border-bottom: 1px solid var(--gray-200); font-size: 18px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.3px; }

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: var(--gray-600); text-decoration: none; font-size: 13.5px; font-weight: 500; transition: all .15s ease; white-space: nowrap; }
.nav-item:hover { color: var(--accent); background: var(--accent-light); }
.nav-item.active { color: var(--accent); background: var(--accent-light); font-weight: 600; }
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

.nav-divider { padding: 12px 20px 4px; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--gray-400); }

.main-wrapper { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar { height: var(--topbar-h); background: var(--bg); border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 50; }

.topbar-title { font-size: 14px; font-weight: 600; color: var(--gray-700); letter-spacing: -0.2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-info { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-600); }
.content { flex: 1; padding: 28px; max-width: 1400px; width: 100%; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.5px; line-height: 1.2; }
.page-subtitle { display: block; font-size: 13px; color: var(--gray-500); margin-top: 3px; }

.card { background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); 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(--gray-100); background: var(--gray-50); }
.card-title { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }
.card-danger { border-color: #fca5a5; }
.mt-4 { margin-top: 20px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 20px; }
.max-w-2xl { max-width: 720px; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 11px 16px; font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover td { background: var(--gray-50); }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #f1f5f9; color: #475569; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; font-size: 13px; font-weight: 500; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; transition: all .15s ease; font-family: var(--font); line-height: 1; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--gray-600); border-color: var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #d97706; color: white; border-color: #d97706; }
.btn-warning:hover { background: #b45309; border-color: #b45309; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 8px; align-items: center; }

.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea, .form-select-sm { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13.5px; font-family: var(--font); color: var(--gray-800); background: var(--bg); transition: border-color .15s, box-shadow .15s; outline: none; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.form-select-sm { width: auto; padding: 5px 28px 5px 10px; font-size: 12.5px; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--gray-100); }

.flash { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 13.5px; font-weight: 500; }
.flash-success { background: var(--success-bg); color: #15803d; border: 1px solid #bbf7d0; }
.flash-error { background: var(--danger-bg); color: #b91c1c; border: 1px solid #fecaca; }
.flash-close { background: none; border: none; cursor: pointer; font-size: 18px; color: inherit; line-height: 1; opacity: 0.6; padding: 0 4px; }
.flash-close:hover { opacity: 1; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); transition: box-shadow .15s; }
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon-blue { background: #dbeafe; color: #2563eb; }
.stat-icon-green { background: #dcfce7; color: #16a34a; }
.stat-icon-red { background: #fee2e2; color: #dc2626; }
.stat-icon-gray { background: #f1f5f9; color: #475569; }
.stat-number { font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 3px; font-weight: 500; }

.stats-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.stat-mini { display: flex; flex-direction: column; gap: 2px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: 10px 16px; min-width: 120px; }
.stat-mini-label { font-size: 11px; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-mini-value { font-size: 20px; font-weight: 700; color: var(--gray-900); }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; align-items: start; }
.detail-list dt { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .4px; padding-top: 2px; }
.detail-list dd { font-size: 13.5px; color: var(--gray-800); }

.filter-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip { padding: 5px 14px; border-radius: 9999px; font-size: 12.5px; font-weight: 500; text-decoration: none; color: var(--gray-600); background: var(--gray-100); border: 1px solid var(--gray-200); transition: all .15s; white-space: nowrap; }
.filter-chip:hover { background: var(--accent-light); color: var(--accent); border-color: #bfdbfe; }
.filter-chip.active { background: var(--accent); color: white; border-color: var(--accent); }
.filter-divider { width: 1px; height: 24px; background: var(--gray-200); margin: 0 4px; }
.filter-form { display: flex; align-items: center; }

.activity-list { max-height: 380px; overflow-y: auto; }
.activity-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--gray-100); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 28px; height: 28px; background: var(--gray-100); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--gray-500); margin-top: 2px; }
.activity-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.activity-desc { font-size: 13px; color: var(--gray-700); }
.activity-meta { font-size: 11.5px; color: var(--gray-400); }

.action-buttons { display: flex; gap: 4px; }
.empty-state { padding: 40px; text-align: center; color: var(--gray-400); font-size: 13px; }

.auth-body { background: var(--gray-50); display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-container { width: 100%; max-width: 400px; }
.auth-card { background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 40px; box-shadow: var(--shadow); }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h1 { font-size: 28px; font-weight: 800; color: var(--gray-900); letter-spacing: -1px; margin-top: 12px; }
.auth-logo p { color: var(--gray-500); font-size: 13px; margin-top: 4px; }

.calendar { padding: 0; }
.calendar-header { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.calendar-day-name { padding: 10px; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--gray-400); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-cell { min-height: 100px; border-right: 1px solid var(--gray-100); border-bottom: 1px solid var(--gray-100); padding: 6px; vertical-align: top; }
.calendar-cell.empty { background: var(--gray-50); }
.calendar-cell.today { background: #eff6ff; }
.calendar-cell.has-unpaid { background: #fff7f7; }
.calendar-cell.all-paid { background: #f0fdf4; }
.cell-day { font-size: 12px; font-weight: 700; color: var(--gray-600); margin-bottom: 4px; }
.today .cell-day { background: var(--accent); color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.cal-payment { display: flex; align-items: center; gap: 3px; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; font-size: 10px; flex-wrap: wrap; }
.cal-payment-paid { background: #dcfce7; }
.cal-payment-unpaid { background: #fee2e2; }
.cal-payment-waived { background: #f1f5f9; }
.cal-cidr { font-weight: 600; font-family: monospace; font-size: 10px; }
.cal-amount { font-weight: 700; color: var(--gray-700); margin-left: auto; }
.cal-btn-pay { background: var(--success); color: white; border: none; border-radius: 2px; width: 14px; height: 14px; font-size: 9px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--gray-400); }
.fw-600 { font-weight: 600; }
.link { color: var(--accent); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
.link-code { color: var(--accent); text-decoration: none; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12.5px; }
.link-code:hover { text-decoration: underline; }
code { font-family: "SFMono-Regular", Consolas, "Courier New", monospace; font-size: 12px; background: var(--gray-100); padding: 1px 5px; border-radius: 3px; }

/* ── Lease dropdown ── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    min-width: 200px;
    z-index: 999;
    overflow: hidden;
    animation: ddFadeIn .12s ease;
}
.dropdown-menu.open { display: block; }
.dropdown-menu.open-up { top: auto; bottom: calc(100% + 4px); animation: ddFadeUp .12s ease; }
@keyframes ddFadeUp { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
@keyframes ddFadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text);
    transition: background .12s;
    border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: #f8fafc; }
.dropdown-item strong { display: block; font-size: 13px; }
.dropdown-item small { color: var(--text-muted); font-size: 11px; }
.dropdown-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }

/* ── Provision Steps ─────────────────────────────────── */
.provision-steps {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 24px;
    font-size: 13px;
}
.provision-steps .step {
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 500;
}
.provision-steps .step.active {
    background: var(--primary);
    color: #fff;
}
.provision-steps .step-arrow {
    color: var(--text-muted);
    font-size: 16px;
}

/* ── Provision Form ───────────────────────────────────── */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }
.form-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 14px;
}
.form-row-readonly {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.required { color: #dc2626; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
}
