:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #ef4444;
    --success: #10b981;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 { margin: 0; color: var(--primary); }
.login-card p { color: var(--text-muted); margin-bottom: 2rem; }

/* Dashboard */
.layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand { font-weight: bold; font-size: 1.25rem; color: var(--primary); }
.nav-links a { margin-left: 1rem; color: var(--text-muted); }
.nav-links a:hover { color: var(--primary); }

.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
}

.card {
    background: var(--bg-card);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}
.stat-val { font-size: 2rem; font-weight: bold; color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Forms */
.form-group { margin-bottom: 1rem; term-align: left; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-main); font-weight: 500; }
input[type="text"], input[type="password"], input[type="url"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
}
input:focus { outline: 2px solid var(--primary); border-color: transparent; }

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    background: var(--border);
    cursor: pointer;
    border: none;
    font-size: 1rem;
    font-weight: 500;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); color: white; padding: 0.5rem 1rem; font-size: 0.875rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f9fafb; font-weight: 600; color: var(--text-muted); }
.short-link { color: var(--primary); font-family: monospace; }
.long-link { color: var(--text-muted); max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.action-btn { background: none; border: none; cursor: pointer; color: var(--danger); }

.alert { padding: 1rem; border-radius: 0.375rem; margin-bottom: 1rem; }
.alert.error { background: #fee2e2; color: #b91c1c; }
.alert.success { background: #d1fae5; color: #065f46; }

/* Modal */
.modal-overlay {
    display: none; /* hidden by default */
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal-content { background: white; padding: 2rem; border-radius: 0.5rem; width: 100%; max-width: 500px; }
