* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
}
.topbar {
    background: #1e3a5f;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar .brand { font-weight: 700; font-size: 1.05rem; }
.topbar nav { display: flex; gap: 14px; font-size: 0.9rem; }
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}
.card {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 16px;
    overflow-x: auto;
    overflow-y: visible;
}
h1, h2 { margin-top: 0; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
input[type=text], input[type=password], select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin-bottom: 14px;
}
button, .btn {
    display: inline-block;
    background: #1e3a5f;
    color: #fff;
    border: none;
    padding: 12px 18px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
button:hover, .btn:hover { background: #16324a; }
.btn-danger { background: #b91c1c; }
.btn-danger:hover { background: #991818; }
.btn-secondary { background: #64748b; }
table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    table-layout: auto;
}
th, td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid #e5e7eb;
    overflow-wrap: anywhere;
    word-break: break-word;
}
/* Action cells: keep controls inside the card without forcing the whole table wider */
td:last-child {
    vertical-align: middle;
}
th { color: #475569; font-size: 0.8rem; text-transform: uppercase; }
.result-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}
.result-name { font-weight: 700; font-size: 1rem; }
.result-meta { color: #475569; font-size: 0.87rem; margin-top: 4px; }
.badge {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-online { color: #16a34a; font-weight: 700; }
.tag-list { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #dcfce7;
    color: #166534;
    border-radius: 999px;
    padding: 4px 6px 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.tag-remove {
    background: transparent;
    color: #166534;
    border: none;
    font-size: 1rem;
    line-height: 1;
    padding: 0 6px;
    cursor: pointer;
}
.tag-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.tag-form select { flex: 1; min-width: 160px; margin-bottom: 0; padding: 8px; }
.tag-form button { padding: 8px 14px; font-size: 0.9rem; }
.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.btn-outline {
    background: #fff;
    color: #1e3a5f;
    border: 1px solid #1e3a5f;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}
.btn-outline:hover { background: #eef2f7; }

@media (max-width: 768px) {
    .card {
        overflow-x: auto;
        overflow-y: visible;
    }
    table {
        font-size: 0.82rem;
    }
    th, td {
        padding: 7px 4px;
    }
}

@media print {
    .topbar, .action-bar, .tag-form, .tag-remove, .pagination, form { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}
.status-offline { color: #94a3b8; }
.flash-error { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash-ok { background: #dcfce7; color: #166534; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.muted { color: #64748b; font-size: 0.85rem; }
.pagination { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pagination a, .pagination span {
    padding: 8px 12px;
    border-radius: 6px;
    background: #eef2f7;
    text-decoration: none;
    color: #1e3a5f;
    font-size: 0.9rem;
}
.pagination .current { background: #1e3a5f; color: #fff; }

