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

/* CSS Variables — Light mode */
:root, [data-theme="light"] {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface2: #f8f9fa;
    --text: #333333;
    --text2: #666666;
    --border: #dee2e6;
    --border2: #f0f0f0;
    --nav-bg: #2c3e50;
    --nav-text: #ffffff;
    --nav-link: #cccccc;
    --shadow: rgba(0,0,0,.08);
}

/* Dark mode */
[data-theme="dark"] {
    --bg: #0d1117;
    --surface: #161b22;
    --surface2: #21262d;
    --text: #e6edf3;
    --text2: #8b949e;
    --border: #30363d;
    --border2: #21262d;
    --nav-bg: #161b22;
    --nav-text: #e6edf3;
    --nav-link: #8b949e;
    --shadow: rgba(0,0,0,.4);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); transition: background .2s, color .2s; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { width: 100%; max-width: 400px; padding: 1rem; }
.login-card { background: var(--surface); border-radius: 8px; padding: 2rem; box-shadow: 0 2px 8px var(--shadow); }
.login-card h1 { font-size: 1.1rem; color: var(--text2); margin-bottom: .25rem; }
.login-card h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .35rem; font-size: .9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 4px; font-size: 1rem;
    background: var(--surface); color: var(--text);
}
.form-group input:focus { outline: none; border-color: #4a90e2; box-shadow: 0 0 0 2px rgba(74,144,226,.2); }

/* Buttons */
.btn { display: inline-block; padding: .5rem 1rem; border: none; border-radius: 4px; cursor: pointer; font-size: .9rem; font-weight: 500; text-decoration: none; }
.btn-primary { background: #4a90e2; color: #fff; }
.btn-primary:hover { background: #357abd; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #545b62; }
.btn-full { width: 100%; text-align: center; padding: .65rem; }

/* Theme toggle */
.theme-toggle { background: none; border: 1px solid var(--nav-link); color: var(--nav-link); border-radius: 4px; padding: .25rem .5rem; cursor: pointer; font-size: 1rem; }
.theme-toggle:hover { border-color: var(--nav-text); color: var(--nav-text); }

/* Status indicators */
.status-up { color: #27ae60; font-weight: 600; }
.status-down { color: #e74c3c; font-weight: 600; }
.expiry-warning { background: #fff3cd !important; color: #856404 !important; }
.expiry-critical { background: #f8d7da !important; color: #842029 !important; }

/* Alerts / banners */
.error-banner { background: #f8d7da; color: #842029; border: 1px solid #f5c2c7; border-radius: 4px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .9rem; }
.warning-banner { background: #fff3cd; color: #664d03; border: 1px solid #ffecb5; border-radius: 4px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .9rem; }
.success-banner { background: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; border-radius: 4px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .9rem; }

/* Toast */
.toast { position: fixed; top: 1rem; right: 1rem; padding: .75rem 1.25rem; border-radius: 4px; z-index: 9999; font-size: .9rem; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.nav { background: var(--nav-bg); color: var(--nav-text); padding: .75rem 0; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--nav-text); text-decoration: none; }
.nav-links { display: flex; gap: 1rem; list-style: none; align-items: center; }
.nav-links a { color: var(--nav-link); text-decoration: none; font-size: .9rem; }
.nav-links a:hover { color: var(--nav-text); }
.main-content { padding: 2rem 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 6px; overflow: hidden; box-shadow: 0 1px 4px var(--shadow); }
th { background: var(--surface2); padding: .75rem 1rem; text-align: left; font-size: .85rem; color: var(--text2); border-bottom: 2px solid var(--border); }
td { padding: .7rem 1rem; border-bottom: 1px solid var(--border2); font-size: .9rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* Cards / stat panels */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border-radius: 8px; padding: 1.25rem; box-shadow: 0 1px 4px var(--shadow); text-align: center; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; }
.stat-card .stat-label { font-size: .85rem; color: var(--text2); margin-top: .25rem; }
.stat-card.green .stat-value { color: #27ae60; }
.stat-card.red .stat-value { color: #e74c3c; }
.stat-card.blue .stat-value { color: #3498db; }
.stat-card.orange .stat-value { color: #f39c12; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.4rem; }

/* Pagination */
.pagination { display: flex; gap: .5rem; justify-content: center; margin-top: 1.5rem; }
.pagination a, .pagination span { padding: .4rem .75rem; border: 1px solid var(--border); border-radius: 4px; text-decoration: none; font-size: .9rem; color: var(--text); background: var(--surface); }
.pagination a:hover { background: var(--surface2); }
.pagination .active { background: #4a90e2; color: #fff; border-color: #4a90e2; }
