:root {
    --bg: #0f172a;
    --panel: #111827;
    --panel2: #1f2937;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #334155;
    --accent: #38bdf8;
    --danger: #fb7185;
    --success: #34d399;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, #1e3a8a 0, var(--bg) 34rem);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.92);
    position: sticky;
    top: 0;
    backdrop-filter: blur(12px);
}
.brand a { color: white; font-weight: 800; font-size: 1.05rem; }
nav { display: flex; gap: .8rem; flex-wrap: wrap; }
nav a { color: var(--text); font-size: .95rem; }

.container { width: min(1100px, calc(100% - 2rem)); margin: 2rem auto; }
.card {
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 16px 50px rgba(0,0,0,.25);
    margin-bottom: 1rem;
}
.card-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}
h1 { margin: 0; font-size: 1.45rem; }
h2 { margin: 1.3rem 0 .75rem; font-size: 1.1rem; }
p { color: var(--muted); line-height: 1.5; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.link-card {
    background: rgba(31, 41, 55, .8);
    border: 1px solid var(--line);
    border-radius: .9rem;
    padding: 1rem;
}
.link-title { font-weight: 750; font-size: 1.05rem; color: white; word-break: break-word; }
.link-url { color: var(--muted); font-size: .88rem; word-break: break-all; margin-top: .35rem; }
.meta { color: var(--muted); font-size: .85rem; margin-top: .55rem; }
.actions { display: flex; gap: .5rem; margin-top: .85rem; flex-wrap: wrap; }

form { display: grid; gap: .85rem; }
label { display: grid; gap: .35rem; font-weight: 650; color: var(--text); }
input, textarea, select {
    width: 100%;
    background: #0b1220;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: .65rem;
    padding: .75rem .85rem;
    font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
.help { color: var(--muted); font-size: .85rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .85rem; }
.checkbox-row { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.checkbox-row input { width: auto; }

.btn, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #04111f;
    border: 0;
    border-radius: .65rem;
    padding: .68rem .95rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}
.btn.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: white; }
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }

.flash { padding: .8rem 1rem; border-radius: .75rem; margin-bottom: 1rem; border: 1px solid var(--line); }
.flash.success { background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .45); }
.flash.error { background: rgba(251, 113, 133, .12); border-color: rgba(251, 113, 133, .45); }
.flash.info { background: rgba(56, 189, 248, .12); border-color: rgba(56, 189, 248, .45); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: white; }
td { color: var(--text); }
.badge { display: inline-flex; padding: .18rem .5rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .8rem; }
.footer { color: var(--muted); text-align: center; padding: 2rem; }
.empty { color: var(--muted); padding: 1rem 0; }

@media (max-width: 680px) {
    .topbar { align-items: flex-start; flex-direction: column; gap: .75rem; }
    nav { gap: .65rem; }
}
