:root {
    --bg-start: #f5f7ea;
    --bg-end: #dbe8f6;
    --ink: #1a232f;
    --muted: #516071;
    --card: #ffffff;
    --brand: #0a6f57;
    --brand-2: #1f4e8c;
    --warn: #9c3a20;
    --line: #d4dde7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    color: var(--ink);
    background: linear-gradient(140deg, var(--bg-start), var(--bg-end));
    min-height: 100vh;
}

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 20px 40px;
}

h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: .2px;
}

.subtitle {
    margin-top: 8px;
    color: var(--muted);
    font-size: .98rem;
}

.grid {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .05);
    padding: 16px;
}

h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

label {
    display: block;
    font-size: .9rem;
    margin: 8px 0 6px;
    color: var(--muted);
}

input,
select,
button {
    width: 100%;
    border: 1px solid #bcc9d8;
    border-radius: 10px;
    padding: 10px;
    font-size: .95rem;
    background: white;
}

button {
    border: 0;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    color: white;
    font-weight: 600;
    margin-top: 10px;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.06);
}

.small {
    font-size: .88rem;
    color: var(--muted);
}

.ok {
    color: var(--brand);
    font-weight: 600;
}

.error {
    color: var(--warn);
    font-weight: 600;
}

.links a {
    color: var(--brand-2);
    text-decoration: none;
    font-weight: 600;
    margin-right: 14px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 8px 0;
}

.toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: .9rem;
    color: var(--muted);
    user-select: none;
}

.toolbar input[type="checkbox"] {
    width: auto;
    margin: 0;
    transform: scale(1.1);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e6edf5;
    border-radius: 12px;
    background: #fbfdff;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    margin-top: 0;
}

th,
td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid #ecf0f4;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 600;
    background: #f3f7fc;
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody tr:nth-child(even) {
    background: #fcfeff;
}

.mono {
    font-family: Consolas, "Courier New", monospace;
}

.truncate {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: bottom;
}

.chip {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 999px;
    background: #edf3ff;
    color: #284a7f;
    font-size: .76rem;
    margin: 1px 4px 1px 0;
}

.wide {
    grid-column: 1 / -1;
}

.hidden {
    display: none !important;
}

.session-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.badge {
    background: #edf3ff;
    color: #2a4f86;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: .85rem;
}

#loginModal {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(8, 16, 26, .44);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card {
    width: min(420px, 92vw);
    border-radius: 16px;
    border: 1px solid var(--line);
    background: white;
    padding: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .18);
}

.modal-title {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.db-tools {
    display: flex;
    gap: 8px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.db-tools>div {
    min-width: 180px;
}

.db-meta {
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: 6px;
}

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

.btn-row button {
    width: auto;
    margin: 0;
    padding: 7px 10px;
    font-size: .85rem;
}