/*
 * Ops Dashboard layout on top of Tabler. Dense, spreadsheet-like tables.
 * Colours come from Tabler variables, which switch with data-bs-theme
 * (set from the browser's light/dark preference in app.js).
 */

:root, [data-bs-theme] {
    /* Groundtruth green, from the logo (#43AE4A). */
    --tblr-primary: #3a9a41;
    --tblr-primary-rgb: 58, 154, 65;
    --tblr-link-color: #2f8536;
    --tblr-link-color-rgb: 47, 133, 54;
    --tblr-link-hover-color: #24692a;
}
[data-bs-theme="dark"] {
    --tblr-primary: #4cb853;
    --tblr-primary-rgb: 76, 184, 83;
    --tblr-link-color: #7dd083;
    --tblr-link-color-rgb: 125, 208, 131;
    --tblr-link-hover-color: #a6e0aa;
}

body { background: var(--tblr-bg-surface-secondary); font-size: .875rem; }

.topbar {
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
    padding: .5rem 1.25rem; background: var(--tblr-bg-surface);
    border-bottom: 1px solid var(--tblr-border-color);
}
.topbar .brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; color: inherit; text-decoration: none; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; align-items: center; }
.topbar nav a { padding: .3rem .6rem; border-radius: 4px; color: var(--tblr-secondary); text-decoration: none; }
.topbar nav a:hover { background: var(--tblr-bg-surface-secondary); color: inherit; }
.topbar nav a[aria-current="page"] { background: rgba(var(--tblr-primary-rgb), .12); color: var(--tblr-primary); font-weight: 600; }
.topbar nav a.pending-link { background: rgba(245, 159, 0, .15); color: var(--tblr-yellow); font-weight: 600; }
.topbar-search { margin-left: auto; width: 16rem; max-width: 100%; }
.topbar-user { display: flex; align-items: center; gap: .5rem; color: var(--tblr-secondary); }

.page { padding: 1.25rem; max-width: 1600px; margin: 0 auto; }
.page > .card, .page > section, .page > details { margin-bottom: 1rem; }
.page-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-heading h1 { margin: 0; font-size: 1.4rem; }
.page-heading .actions { display: flex; gap: .5rem; align-items: flex-start; }

.filter-tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filter-tabs .btn.active { background: rgba(var(--tblr-primary-rgb), .12); color: var(--tblr-primary); border-color: currentColor; }

table.inventory td, table.inventory th { vertical-align: top; }
table.inventory th { white-space: nowrap; }
.nowrap { white-space: nowrap; }
tr.removed td { opacity: .55; }
.w-1 { width: 1%; }

/* Sortable headers: app.js wraps each header's text in a button. */
.sort-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.sort-button::after { content: " ↕"; opacity: .3; }
th[aria-sort="ascending"] .sort-button::after { content: " ↑"; opacity: 1; }
th[aria-sort="descending"] .sort-button::after { content: " ↓"; opacity: 1; }

/* Server status dot. */
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: var(--tblr-secondary); vertical-align: middle; }
.dot-green { background: var(--tblr-green); }
.dot-yellow { background: var(--tblr-yellow); }
.dot-red { background: var(--tblr-red); }
.dot-gray { background: var(--tblr-gray-400); }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(28rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.detail-grid > .card { margin: 0; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.facts > div { display: contents; }
dl.facts dt { color: var(--tblr-secondary); font-weight: 500; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

.edit-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .6rem .9rem; }
.edit-form label { display: flex; flex-direction: column; gap: .2rem; margin: 0; }
.edit-form label > span { font-size: .75rem; color: var(--tblr-secondary); }
.edit-form .wide { grid-column: 1 / -1; }
.edit-form.narrow { max-width: 36rem; }
.field-hint { font-size: .75rem; color: var(--tblr-secondary); }

.card-approval { border-color: var(--tblr-yellow); background: rgba(245, 159, 0, .08); }
.approval-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.approval-form label { display: flex; flex-direction: column; gap: .2rem; margin: 0; }
.bulk-approve { display: flex; gap: .75rem; align-items: center; margin-bottom: .75rem; }
.inline-actions { display: flex; gap: .25rem; margin-top: .3rem; }

.note-form { display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .75rem; }
.note { padding: .6rem 0; border-top: 1px solid var(--tblr-border-color); }
.note-meta { font-size: .75rem; color: var(--tblr-secondary); margin-bottom: .2rem; }
.note-body { overflow-wrap: anywhere; }
form.inline { display: inline; }
.link-button { background: none; border: 0; padding: 0; color: var(--tblr-secondary); text-decoration: underline; font-size: inherit; cursor: pointer; }

.summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.summary { padding: 1rem 1.25rem; color: inherit; text-decoration: none; display: flex; flex-direction: column; }
.summary:hover { border-color: var(--tblr-primary); }
.summary-number { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }

.add-inline { position: relative; }
.add-inline > summary { list-style: none; }
.add-inline > summary::-webkit-details-marker { display: none; }
.add-inline[open] > .card { position: absolute; right: 0; z-index: 10; width: 22rem; margin-top: .25rem; }

.danger-zone > summary { cursor: pointer; color: var(--tblr-secondary); }
.search-form { display: flex; gap: .5rem; }
ul.plain { list-style: none; padding: 0; margin: 0; }
/* Tabler gives <pre> light text for a dark background; use the page's own colours. */
pre { background: var(--tblr-bg-surface); color: var(--tblr-body-color); border: 1px solid var(--tblr-border-color); padding: .75rem; border-radius: 4px; }
pre code { color: inherit; background: none; padding: 0; }

.signin { display: grid; place-items: center; min-height: 100vh; }
.signin .card { max-width: 26rem; text-align: center; }
.signin h1 { margin: .75rem 0 1.25rem; }
