/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0f1117;
    color: #e1e4ea;
    line-height: 1.6;
    min-height: 100vh;
}
a { color: #58a6ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ── */
nav {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.logo { font-size: 1.2rem; font-weight: 700; color: #e1e4ea !important; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.45rem 0.9rem; border-radius: 6px; font-size: 0.875rem;
    font-weight: 500; cursor: pointer; border: 1px solid #30363d;
    background: #21262d; color: #e1e4ea; text-decoration: none !important;
    transition: background 0.15s;
}
.btn:hover { background: #30363d; }
.btn-primary { background: #238636; border-color: #2ea043; color: #fff; }
.btn-primary:hover { background: #2ea043; }
.btn-danger { color: #f85149; border-color: #f8514933; }
.btn-danger:hover { background: #f851491a; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: #21262d; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

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

/* ── Flash messages ── */
.flash {
    padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem;
    font-size: 0.9rem; border: 1px solid transparent;
}
.flash-success { background: #1a3a2a; border-color: #2ea043; color: #7ee787; }
.flash-error   { background: #3a1a1a; border-color: #f85149; color: #fbb5b2; }
.flash-info    { background: #1a2a3a; border-color: #58a6ff; color: #a5d6ff; }

/* ── Toolbar ── */
.toolbar { margin-bottom: 1rem; }
.search-form { display: flex; gap: 0.5rem; align-items: center; }
.search-form input[type="text"] {
    flex: 1; padding: 0.5rem 0.75rem; border-radius: 6px; border: 1px solid #30363d;
    background: #161b22; color: #e1e4ea; font-size: 0.9rem;
}
.search-form input[type="text"]::placeholder { color: #6e7681; }
.search-form input[type="text"]:focus { outline: none; border-color: #58a6ff; }

/* ── Tag list ── */
.tag-list {
    display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem;
}
.tag {
    display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px;
    font-size: 0.8rem; background: #21262d; color: #8b949e !important;
    border: 1px solid #30363d; text-decoration: none !important;
    transition: all 0.15s;
}
.tag:hover { background: #30363d; color: #e1e4ea !important; }
.tag.active { background: #1f3a2a; border-color: #2ea043; color: #7ee787 !important; }
.tag-sm { font-size: 0.7rem; padding: 0.1rem 0.45rem; }

/* ── Bookmark Grid ── */
.bookmark-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
}
@media (min-width: 640px) {
    .bookmark-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
    .bookmark-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Card ── */
.card {
    background: #161b22; border: 1px solid #30363d; border-radius: 10px;
    padding: 0; display: flex; flex-direction: column;
    transition: border-color 0.15s, transform 0.15s;
    overflow: hidden;
}
.card:hover { border-color: #58a6ff44; transform: translateY(-1px); }

.card-thumb {
    height: 100px;
    background: #1c2128;
    display: flex; align-items: center; justify-content: center;
    border-bottom: 1px solid #30363d;
    overflow: hidden;
}
.card-thumb img {
    width: 64px; height: 64px;
    border-radius: 12px;
    background: #21262d;
}

.card-body {
    flex: 1; min-width: 0;
    padding: 0.75rem;
    display: flex; flex-direction: column;
}
.card-header { margin-bottom: 0.25rem; }
.card-title {
    font-size: 0.95rem; font-weight: 600; color: #e1e4ea !important;
    display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-domain { display: block; font-size: 0.75rem; color: #6e7681; }
.card-desc {
    font-size: 0.8rem; color: #8b949e; margin: 0.3rem 0 0.5rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-footer {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.3rem;
    margin-top: auto;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.card-actions { display: flex; gap: 0.2rem; }
.card-time { font-size: 0.65rem; color: #6e7681; margin-top: 0.3rem; }

/* ── Empty ── */
.empty-state {
    text-align: center; padding: 4rem 1rem; color: #6e7681;
}
.empty-state p { margin-bottom: 1rem; font-size: 1.1rem; }

/* ── Form ── */
.form-container { max-width: 600px; }
.form-container h1 { font-size: 1.4rem; margin-bottom: 1.25rem; }
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.35rem; color: #8b949e;
}
.form-group label small { font-weight: 400; color: #6e7681; }
.form-group input[type="url"],
.form-group input[type="text"],
.form-group textarea {
    width: 100%; padding: 0.55rem 0.75rem; border-radius: 6px; border: 1px solid #30363d;
    background: #161b22; color: #e1e4ea; font-size: 0.9rem; font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: #58a6ff; }
.form-group textarea { resize: vertical; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1.25rem; }
.hint { font-size: 0.8rem; color: #6e7681; margin-top: 0.75rem; }
