/* ════════════════════════════════════════════════════════════════
   Stoei Scout — admin pages only (sign-in, shop database, edit,
   settings, field intel queue). Loaded after css/app.css, which has
   the sidebar, top bar and lead badges shared with the map.

   Only reads --st-* settings (look values live in css/theme.css).
════════════════════════════════════════════════════════════════ */

/* ─── Layout: the admin page scrolls; the sidebar stays put ────── */
.admin-page {
    display: flex;
    min-height: 100vh;
}
.admin-page .nav-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    min-height: 100vh;
    z-index: 10;
}
.admin-page .main-content {
    margin-left: var(--st-sidebar-width);
    min-height: 100vh;
    overflow: visible;
    background: none;
}
.admin-page .top-bar {
    padding: 0 var(--st-space-6);
    position: sticky;
    top: 0;
    z-index: 5;
}
.top-bar p {
    font-size: var(--st-text-1);
    color: var(--st-color-text-faint);
    margin-top: 0.1rem;
}
.top-bar-actions {
    display: flex;
    gap: var(--st-space-2);
    align-items: center;
}

.page-body {
    padding: var(--st-space-6);
    flex: 1;
}
.page-body-narrow {
    max-width: 800px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--st-space-4);
    margin-bottom: var(--st-space-4);
}

/* ─── Fields ───────────────────────────────────────────────────── */
.admin-search,
.admin-select,
.form-input,
.form-textarea,
.input-row input,
.pwd-input,
.login-input {
    padding: var(--st-space-2) var(--st-space-3);
    border: var(--st-line-width) solid var(--st-color-line);
    border-radius: var(--st-radius-control);
    background: var(--st-color-surface);
    font-family: inherit;
    font-size: var(--st-text-1);
    color: var(--st-color-text);
    outline: none;
    transition: border-color var(--st-motion), box-shadow var(--st-motion);
}
.admin-search:focus,
.form-input:focus,
.form-textarea:focus,
.input-row input:focus,
.pwd-input:focus,
.login-input:focus {
    border-color: var(--st-color-accent-fill);
    box-shadow: var(--st-ring-field);
}
.admin-search::placeholder,
.input-row input::placeholder,
.form-input::placeholder {
    color: var(--st-color-text-faint);
}
.admin-search {
    width: 260px;
}
.admin-select {
    color: var(--st-color-text-soft);
    cursor: pointer;
}
.form-input,
.form-textarea {
    font-size: var(--st-text-2);
}
.form-textarea {
    resize: vertical;
}

/* Password with a show/hide eye (settings and sign-in) */
.pwd-wrapper {
    position: relative;
    flex: 1;
}
.pwd-input,
.login-input {
    width: 100%;
    padding-right: var(--st-space-8);
}
.pwd-toggle {
    position: absolute;
    right: var(--st-space-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--st-color-text-faint);
    font-size: var(--st-text-3);
    line-height: 1;
    padding: 0;
}
.pwd-toggle:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─── Buttons (the kit's .st-btn) ──────────────────────────────── */
/* Dark button beside the address field */
.btn-locate,
.btn-locate:hover {
    background: var(--st-color-sidebar);
    color: var(--st-color-on-sidebar-strong);
}

/* ─── Shop database table ──────────────────────────────────────── */
.table-wrapper {
    background: var(--st-color-surface);
    border-radius: var(--st-radius-card);
    border: var(--st-line-width) solid var(--st-color-line);
    overflow: auto;
    box-shadow: var(--st-shadow-1);
}

.admin-table td {
    vertical-align: middle;
    line-height: inherit;
}
.admin-table .table-message {
    padding: var(--st-space-4);
    color: var(--st-color-text-muted);
}
.admin-table .table-message.error {
    color: var(--st-color-bad);
}

.edit-link {
    color: var(--st-color-accent);
    font-weight: 500;
    font-size: var(--st-text-1);
}

.delete-btn:hover {
    border-color: var(--st-color-bad);
    color: var(--st-color-bad);
    background: var(--st-color-bad-tint);
}
.delete-btn {
    background: none;
    border: var(--st-line-width) solid var(--st-color-line);
    color: var(--st-color-text-faint);
    padding: var(--st-space-1) var(--st-space-3);
    border-radius: var(--st-radius-1);
    cursor: pointer;
    font-size: var(--st-text-1);
    font-family: inherit;
    transition: background var(--st-motion), border-color var(--st-motion), color var(--st-motion);
}

/* ─── Edit page ────────────────────────────────────────────────── */
.score-banner {
    background: var(--st-color-sidebar);
    color: var(--st-color-on-sidebar-strong);
    padding: var(--st-space-4) var(--st-space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--st-line-width) solid var(--st-color-sidebar-line);
}
.score-banner h2 {
    font-size: var(--st-text-5);
    font-weight: 600;
    color: var(--st-color-on-sidebar-strong);
}
.score-banner-right {
    display: flex;
    align-items: center;
    gap: var(--st-space-3);
    font-size: var(--st-text-1);
    color: var(--st-color-on-sidebar-muted);
}

.edit-body {
    flex: 1;
    padding: var(--st-space-6) var(--st-space-6) var(--st-space-11);
    overflow-y: auto;
}

.grid-layout,
.two-col,
.three-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--st-space-3);
}
.grid-layout {
    gap: var(--st-space-5);
}
.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}
@media (max-width: 900px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
}

/* Boxes: form sections (edit page) and categories (settings page) */
.form-section,
.category-card {
    background: var(--st-color-surface);
    border: var(--st-line-width) solid var(--st-color-line);
    border-radius: var(--st-radius-card);
    padding: var(--st-space-5);
    margin-bottom: var(--st-space-5);
}
.form-section.highlight,
.category-card.security {
    border-left: 3px solid var(--st-color-accent-fill);
}

.form-section h3 {
    font-size: var(--st-text-1);
    font-weight: 600;
    color: var(--st-color-text-faint);
    text-transform: uppercase;
    letter-spacing: var(--st-tracking-label);
    margin-bottom: var(--st-space-4);
    padding-bottom: var(--st-space-3);
    border-bottom: var(--st-line-width) solid var(--st-color-sunk);
}
.form-section.highlight h3 {
    color: var(--st-color-accent);
}
.section-hint {
    font-size: var(--st-text-1);
    font-weight: 400;
    color: var(--st-color-text-faint);
    text-transform: none;
    letter-spacing: 0;
}

.form-group {
    margin-bottom: var(--st-space-4);
    display: flex;
    flex-direction: column;
}
.form-group:last-child {
    margin-bottom: 0;
}
.form-group label {
    font-size: var(--st-text-1);
    font-weight: 500;
    color: var(--st-color-text-muted);
    margin-bottom: var(--st-space-1);
}

.input-row {
    display: flex;
    gap: var(--st-space-2);
}
.input-row input {
    flex: 1;
}
.input-row-narrow {
    max-width: 420px;
}
/* Fields stacked one under the other, button last (password change). */
.input-stack {
    display: flex;
    flex-direction: column;
    gap: var(--st-space-2);
}
.input-stack > .st-btn {
    align-self: flex-start;
}

.map-wrapper {
    height: 280px;
    width: 100%;
    border-radius: var(--st-radius-control);
    border: var(--st-line-width) solid var(--st-color-line);
    margin-bottom: var(--st-space-4);
    overflow: hidden;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: var(--st-space-2);
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--st-space-2);
    font-size: var(--st-text-1);
    background: var(--st-color-bg);
    padding: var(--st-space-2) var(--st-space-3);
    border-radius: var(--st-radius-1);
    cursor: pointer;
    border: var(--st-line-width) solid var(--st-color-line);
    color: var(--st-color-text-muted);
    transition: background var(--st-motion), border-color var(--st-motion), color var(--st-motion);
}

.action-bar {
    position: fixed;
    bottom: 0;
    left: var(--st-sidebar-width);
    right: 0;
    background: var(--st-color-surface);
    border-top: var(--st-line-width) solid var(--st-color-line);
    padding: var(--st-space-4) var(--st-space-6);
    display: flex;
    justify-content: flex-end;
    gap: var(--st-space-2);
    z-index: 5;
    box-shadow: var(--st-shadow-1);
}

/* ─── Settings page ────────────────────────────────────────────── */
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--st-space-4);
    padding-bottom: var(--st-space-3);
    border-bottom: var(--st-line-width) solid var(--st-color-sunk);
}
.category-header h3 {
    font-size: var(--st-text-1);
    font-weight: 600;
    color: var(--st-color-text-soft);
}
.category-count {
    font-size: var(--st-text-1);
    color: var(--st-color-text-faint);
    background: var(--st-color-sunk);
    padding: 0.15rem var(--st-space-2);
    border-radius: var(--st-radius-pill);
}

.tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--st-space-2);
    margin-bottom: var(--st-space-4);
    min-height: 28px;
}
.tag {
    background: var(--st-color-bg);
    border: var(--st-line-width) solid var(--st-color-line);
    padding: var(--st-space-1) var(--st-space-2) var(--st-space-1) var(--st-space-3);
    border-radius: var(--st-radius-1);
    font-size: var(--st-text-1);
    display: inline-flex;
    align-items: center;
    gap: var(--st-space-2);
    color: var(--st-color-text-muted);
}
.tag button {
    background: none;
    border: none;
    color: var(--st-color-line-strong);
    font-weight: 700;
    cursor: pointer;
    font-size: var(--st-text-2);
    line-height: 1;
    padding: 0;
    transition: color var(--st-motion);
}
.tag button:hover {
    color: var(--st-color-bad);
}

.empty-label {
    color: var(--st-color-line-strong);
    font-size: var(--st-text-1);
    font-style: italic;
}

/* ─── Sign-in page ─────────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-wrap {
    width: 100%;
    max-width: 380px;
    padding: var(--st-space-6);
}
.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: var(--st-space-7);
}
/* Same wordmark as the sidebar, in page colors */
.login-logo .st-logo {
    align-items: center;
    font-size: var(--st-text-13);
    color: var(--st-color-text);
}
.login-logo .st-logo__app {
    color: var(--st-color-eyebrow);
}
.login-card {
    background: var(--st-color-surface);
    border-radius: var(--st-radius-4);
    padding: var(--st-space-7);
    box-shadow: var(--st-shadow-raised);
}
.login-card h2 {
    font-size: var(--st-text-5);
    font-weight: 600;
    margin-bottom: var(--st-space-1);
}
.login-card p {
    font-size: var(--st-text-1);
    color: var(--st-color-text-faint);
    margin-bottom: var(--st-space-6);
}
.login-error {
    background: var(--st-color-bad-tint);
    color: var(--st-color-bad);
    font-size: var(--st-text-1);
    padding: var(--st-space-3) var(--st-space-4);
    border-radius: var(--st-radius-control);
    margin-bottom: var(--st-space-4);
}
.login-card .form-group {
    margin-bottom: var(--st-space-4);
}
.login-input {
    padding-top: var(--st-space-3);
    padding-bottom: var(--st-space-3);
    font-size: var(--st-text-3);
}
.login-input:disabled {
    background: var(--st-color-bg);
    cursor: not-allowed;
}
.login-btn {
    width: 100%;
    margin-top: var(--st-space-2);
}
.login-btn:disabled {
    background: var(--st-color-text-faint);
    cursor: not-allowed;
}

/* ─── Field intel queue ────────────────────────────────────────── */
.review-header {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--st-space-6) var(--st-space-10) var(--st-space-2) var(--st-space-6);   /* right: room for the light/dark switch */
    display: grid;
    gap: var(--st-space-2);
}
.review-header h1 {
    font-size: var(--st-text-13);
}
.review-header p {
    color: var(--st-color-text-muted);
}
.review-back {
    font-size: var(--st-text-3);
}
.review-message {
    text-align: center;
    color: var(--st-color-text-muted);
    margin-top: var(--st-space-7);
}
.review-message.error {
    color: var(--st-color-bad);
}

.review-container {
    padding: var(--st-space-6);
    max-width: 900px;
    margin: 0 auto;
}
.queue-card {
    background: var(--st-color-surface);
    padding: var(--st-space-6);
    border-radius: var(--st-radius-card);
    box-shadow: var(--st-shadow-1);
    margin-bottom: var(--st-space-4);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-left: 4px solid var(--st-color-warn-fill);
}
.queue-info {
    flex: 1;
}
.queue-info h3 {
    margin-bottom: var(--st-space-1);
    font-size: var(--st-text-7);
}
.queue-id {
    font-size: var(--st-text-2);
    font-weight: 400;
    color: var(--st-color-text-faint);
}
.queue-meta {
    font-size: var(--st-text-2);
    color: var(--st-color-text-muted);
    margin-bottom: var(--st-space-3);
}
.queue-suggestion {
    background: var(--st-color-bg);
    padding: var(--st-space-4);
    border: var(--st-line-width) solid var(--st-color-line);
    border-radius: var(--st-radius-1);
    font-family: var(--st-font-mono);
    font-size: var(--st-text-3);
    color: var(--st-color-text-soft);
}
.queue-actions {
    display: flex;
    gap: var(--st-space-2);
    flex-direction: column;
    min-width: 120px;
    margin-left: var(--st-space-4);
}
