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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    line-height: 1.6;
}

/* Nav */
nav {
    background: #1e293b;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    border-bottom: 1px solid #334155;
}
nav .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #38bdf8;
    text-decoration: none;
}
nav .nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}
nav .nav-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
}
nav .nav-links a:hover { color: #e2e8f0; }
form.inline { display: inline; }
button.link {
    background: none; border: none; color: #94a3b8;
    cursor: pointer; font: inherit; font-size: 0.9rem;
}
button.link:hover { color: #e2e8f0; }

/* Main */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

h1 { font-size: 1.5rem; margin-bottom: 1.5rem; color: #f1f5f9; }

/* Messages */
.msg {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.msg.error { background: #7f1d1d; color: #fca5a5; border: 1px solid #991b1b; }
.msg.success { background: #14532d; color: #86efac; border: 1px solid #166534; }

/* Table */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
th, td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid #1e293b;
}
th { color: #64748b; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
td { color: #e2e8f0; }
td.url { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td code { background: #1e293b; padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.85rem; }
td.empty { text-align: center; color: #64748b; padding: 3rem 0; }
td.empty a { color: #38bdf8; }

/* Actions */
td.actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: nowrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    background: #2563eb;
    color: #fff;
    transition: background 0.15s;
}
.btn:hover { background: #1d4ed8; }
.btn.sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn.secondary { background: #334155; color: #e2e8f0; }
.btn.secondary:hover { background: #475569; }
.btn.warn { background: #92400e; color: #fde68a; }
.btn.warn:hover { background: #b45309; }
.btn.ok { background: #166534; color: #86efac; }
.btn.ok:hover { background: #15803d; }
.btn.danger { background: #991b1b; color: #fca5a5; }
.btn.danger:hover { background: #b91c1c; }

/* Login */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(56,189,248,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(99,102,241,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(168,85,247,0.05) 0%, transparent 50%);
}
.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2rem 2rem;
    background: linear-gradient(135deg, #1e293b 0%, #1a2332 100%);
    border: 1px solid #334155;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    animation: loginIn 0.4s ease-out;
}
@keyframes loginIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px; height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    color: #fff;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(37,99,235,0.25);
}
.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-subtitle { color: #64748b; font-size: 0.9rem; }
.login-form { margin-top: 0; }
.login-form .field label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.login-form .field label svg { opacity: 0.5; }
.login-form .field input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-form .field input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.login-form .field input::placeholder { color: #475569; }

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.5rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(37,99,235,0.3);
}
.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.4);
}
.btn-login:active {
    transform: translateY(0);
}
.btn-login svg { transition: transform 0.2s; }
.btn-login:hover svg { transform: translateX(3px); }

/* Forms */
.field { margin-bottom: 1rem; }
.field label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    color: #94a3b8;
}
.field input, .field select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #334155;
    border-radius: 6px;
    background: #1e293b;
    color: #e2e8f0;
    font: inherit;
    font-size: 0.9rem;
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56,189,248,0.2);
}
.field small { display: block; margin-top: 0.25rem; color: #64748b; font-size: 0.8rem; }
.field.checkbox label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.field.checkbox input { width: auto; }

fieldset {
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
legend {
    padding: 0 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
