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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    min-height: 100vh;
}

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

.login-container {
    width: 100%;
    max-width: 360px;
    padding: 20px;
}

.login-box {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 32px 24px;
}

.login-box form { display: flex; flex-direction: column; gap: 12px; }

/* Forms */
.form-group { width: 100%; }

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 10px 14px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    border-color: #555;
}

input::placeholder { color: #555; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    color: #fff;
}

.btn-primary {
    background: #2563eb;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-outline {
    background: transparent;
    border: 1px solid #333;
    color: #aaa;
}
.btn-outline:hover { border-color: #555; color: #fff; }

.btn-small { padding: 6px 14px; font-size: 13px; }
.btn-tiny { padding: 4px 10px; font-size: 12px; }

/* Navigation */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #141414;
    border-bottom: 1px solid #222;
}

.nav-links { display: flex; gap: 4px; }

.nav-link {
    padding: 6px 14px;
    color: #888;
    text-decoration: none;
    font-size: 13px;
    border-radius: 4px;
    transition: all 0.15s;
}
.nav-link:hover { color: #ccc; background: #1e1e1e; }
.nav-link.active { color: #fff; background: #222; }

.nav-user {
    font-size: 13px;
    color: #888;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Search */
.search-section {
    margin-bottom: 24px;
}

.search-form {
    background: #141414;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 16px;
}

.search-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-select {
    width: 160px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
}

/* Results */
.results-info {
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-card {
    background: #141414;
    border: 1px solid #222;
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid #1e1e1e;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.card-body {
    padding: 12px 16px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.field-wide {
    grid-column: span 2;
}

.field .label {
    font-size: 11px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field .value {
    font-size: 13px;
    color: #ddd;
    word-break: break-all;
}

.field .value.log-value {
    font-size: 11px;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: #1a1a1a;
    padding: 6px 8px;
    border-radius: 4px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.badge-brand { background: #1e293b; color: #60a5fa; }
.badge-active { background: #052e16; color: #4ade80; }
.badge-inactive { background: #2a1215; color: #f87171; }

/* Tables */
.table-wrap {
    overflow-x: auto;
    background: #141414;
    border: 1px solid #222;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid #222;
    color: #666;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid #1a1a1a;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #1a1a1a; }

.inactive-row td { opacity: 0.5; }

code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    background: #1a1a1a;
    padding: 2px 6px;
    border-radius: 3px;
    color: #a78bfa;
}

.muted { color: #555; }
.nowrap { white-space: nowrap; }

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

.alert-error {
    background: #2a1215;
    color: #f87171;
    border: 1px solid #3b1a1e;
}

/* Credentials Box */
.credentials-box {
    background: #0c1f0c;
    border: 1px solid #1a3a1a;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.credentials-box h3 {
    color: #4ade80;
    font-size: 15px;
    margin-bottom: 12px;
}

.cred-label {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 12px;
}

.cred-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.cred-key {
    font-size: 12px;
    color: #666;
    min-width: 120px;
}

.cred-warning {
    font-size: 12px;
    color: #f59e0b;
    margin-top: 12px;
}

/* Filter */
.filter-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.filter-input {
    max-width: 280px;
}

.create-user-form {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}

.page-info {
    font-size: 13px;
    color: #666;
}

/* Responsive */
@media (max-width: 640px) {
    .search-row {
        flex-direction: column;
    }
    .search-select {
        width: 100%;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .field-wide {
        grid-column: span 1;
    }
}
