/* ── Admin pages (colours from the palette in app.css) ── */
.admin-page {
    min-width: min-content;   /* wide tables scroll the card sideways (scrollbar stays in view) */
}

.admin-empty {
    text-align: center;
    color: var(--bob-muted);
    padding: 2rem 1rem !important;
}

.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.admin-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--bob-text);
    margin: 0 0 4px 0;
}

.admin-page-subtitle {
    color: var(--bob-muted);
    font-size: 0.875rem;
    margin: 0;
}

.admin-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bob-text);
    margin: 1.75rem 0 0.75rem;
}

.admin-filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.admin-filter-bar input,
.admin-filter-bar select {
    padding: 7px 10px;
    border: 1px solid var(--bob-border);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--bob-surface);
    color: var(--bob-text);
    outline: none;
}

.admin-filter-bar input:focus,
.admin-filter-bar select:focus { border-color: var(--bob-border-strong); }

.admin-filter-bar input { flex: 1; }

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bob-surface);
    border: 1px solid var(--bob-border);
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.875rem;
    color: var(--bob-text);
}

.admin-table thead tr {
    background: var(--bob-sidebar);
}

.admin-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--bob-text-2);
    white-space: nowrap;
    border-bottom: 1px solid var(--bob-border);
}

.admin-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--bob-border-soft);
    vertical-align: middle;
}

.admin-table tbody tr:hover { background: var(--bob-bg); }
.admin-table tbody tr:last-child td { border-bottom: none; }

.admin-table td.truncate {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Resizable columns (handles added by app.js) ─────── */
.admin-table th { position: relative; }

.admin-table .col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
}

.admin-table .col-resizer:hover,
.admin-table .col-resizer.active { background: var(--bob-border-strong); }

.admin-table.resized { table-layout: fixed; }
.admin-table.resized th { overflow: hidden; text-overflow: ellipsis; }
.admin-table.resized td.truncate { max-width: none; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-green  { background: var(--bob-success-soft); color: var(--bob-success); }
.badge-red    { background: var(--bob-danger-soft);  color: var(--bob-danger); }
.badge-yellow { background: var(--bob-warning-soft); color: var(--bob-warning); }
.badge-grey   { background: var(--bob-soft);         color: var(--bob-muted); }

/* ── Action buttons ──────────────────────────────────── */
.btn-action {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--bob-border);
    background: var(--bob-surface);
    font-size: 0.8rem;
    cursor: pointer;
    margin-right: 4px;
    color: var(--bob-text-2);
}

.btn-action:hover { background: var(--bob-bg); border-color: var(--bob-border-strong); }

.btn-action-danger {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #f3c4bf;
    background: var(--bob-surface);
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--bob-danger);
}

.btn-action-danger:hover { background: var(--bob-danger-soft); }

.btn-primary {
    background: var(--bob-accent);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary:hover { background: var(--bob-accent-hover); }

.btn-secondary {
    background: var(--bob-surface);
    color: var(--bob-text-2);
    border: 1px solid var(--bob-border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
}

.btn-secondary:hover { background: var(--bob-bg); border-color: var(--bob-border-strong); }

/* ── Nav admin links (sidebar) ───────────────────────── */
.nav-admin-link {
    display: block;
    padding: 0.35rem 0.5rem;
    color: var(--bob-text-2);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1px;
}

.nav-admin-link:hover { background: var(--bob-hover); color: var(--bob-text); }
.nav-admin-link.active { background: var(--bob-active); color: var(--bob-text); }

/* ── Drawer panel ────────────────────────────────────── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 30, 29, 0.25);
    z-index: 900;
}

.drawer-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 480px;
    max-width: 100%;
    background: var(--bob-surface);
    border-left: 1px solid var(--bob-border);
    box-shadow: -4px 0 32px rgba(31, 30, 29, 0.12);
    z-index: 901;
    display: flex;
    flex-direction: column;
    color: var(--bob-text);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--bob-border-soft);
    flex-shrink: 0;
}

.drawer-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bob-text);
    margin: 0;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--bob-faint);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}

.drawer-close:hover { background: var(--bob-soft); color: var(--bob-text); }

.drawer-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
    flex: 1;
}

/* ── Delete confirm (small inline modal) ─────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 30, 29, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bob-surface);
    border: 1px solid var(--bob-border);
    border-radius: 14px;
    width: 400px;
    max-width: 95%;
    box-shadow: 0 20px 60px rgba(31, 30, 29, 0.18);
    color: var(--bob-text);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--bob-border-soft);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bob-text);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--bob-faint);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}

.modal-close:hover { background: var(--bob-soft); color: var(--bob-text); }

.modal-body {
    padding: 20px 24px 24px;
}

/* ── Form fields inside modals ───────────────────────── */
.form-field {
    margin-bottom: 14px;
}

.form-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--bob-text-2);
    margin-bottom: 5px;
}

.form-field input[type=text],
.form-field input[type=password],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--bob-border-strong);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bob-surface);
    color: var(--bob-text);
    box-sizing: border-box;
    outline: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--bob-accent);
    box-shadow: 0 0 0 3px var(--bob-accent-soft);
}

.form-field textarea { resize: vertical; min-height: 80px; }

.form-field input[readonly],
.form-field input[disabled] { background: var(--bob-bg); color: var(--bob-muted); }

.form-field-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.form-field-check input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--bob-accent); }
.form-field-check label { font-size: 0.875rem; color: var(--bob-text-2); cursor: pointer; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--bob-border-soft);
}

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 14px;
}

.alert-error   { background: var(--bob-danger-soft);  color: var(--bob-danger);  border: 1px solid #f3c4bf; }
.alert-success { background: var(--bob-success-soft); color: var(--bob-success); border: 1px solid #c9dfbf; }

/* ── Breadcrumb ──────────────────────────────────────── */
.admin-breadcrumb {
    font-size: 0.85rem;
    color: var(--bob-muted);
    margin-bottom: 16px;
}

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

/* ── Tools page: parameter cards in the drawer ───────── */
.tool-param {
    border: 1px solid var(--bob-border);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    background: var(--bob-bg);
}

.tool-param input[type=text],
.tool-param select {
    border: 1px solid var(--bob-border);
    border-radius: 8px;
    padding: 0.4rem 0.55rem;
    font-size: 0.85rem;
    background: var(--bob-surface);
    color: var(--bob-text);
    min-width: 0;
}

.tool-param-head { display: flex; align-items: center; gap: 0.4rem; }
.tool-param-name { flex: 1; font-family: monospace; font-weight: 600; }
.tool-param-foot { display: flex; align-items: center; gap: 0.75rem; }
.tool-param-foot label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--bob-text-2); white-space: nowrap; }
.tool-param-foot input[type=text] { flex: 1; }

.tool-hint { font-size: 0.8rem; color: var(--bob-muted); margin: 0.25rem 0 0.75rem; }
.tool-hint-error { color: var(--bob-accent); }
