/* TandemCS theme. Light/dark follows the device (CEO: always). Violet accent, soft status colours.
   Change a colour here and it changes everywhere. Author: Chadrick */

:root, [data-bs-theme=light] {
    --tcs-bg: #faf9fd;
    --tcs-surface: #ffffff;
    --tcs-text: #24212b;
    --tcs-muted: #6c6779;
    --tcs-border: #e4e0ee;
    --tcs-accent: #8b6fd6;        /* light violet */
    --tcs-accent-strong: #6d50c0;
    --tcs-accent-soft: #efeafb;
    --tcs-accent-hover: #e4dbf8;
    --tcs-accent-border: #d6cbf3;
    --tcs-sidebar: #f6f3fd;
    --tcs-ok-bg: #e3f4e6;   --tcs-ok-text: #2f6b3a;
    --tcs-warn-bg: #fdf3d7; --tcs-warn-text: #7a5a10;
    --tcs-bad-bg: #fbe4e4;  --tcs-bad-text: #8a2f2f;
    --tcs-info-bg: #e5eefb; --tcs-info-text: #2f4f7f;
    --bs-body-bg: var(--tcs-bg);
    --bs-body-color: var(--tcs-text);
    --bs-link-color-rgb: 109, 80, 192;
    --bs-border-color: var(--tcs-border);
}

[data-bs-theme=dark] {
    --tcs-bg: #17151d;
    --tcs-surface: #201d28;
    --tcs-text: #e8e5ef;
    --tcs-muted: #a09ab0;
    --tcs-border: #343042;
    --tcs-accent: #a58ee6;
    --tcs-accent-strong: #bba9ef;
    --tcs-accent-soft: #2c2640;
    --tcs-accent-hover: #362e50;
    --tcs-accent-border: #463c66;
    --tcs-sidebar: #1d1a26;
    --tcs-ok-bg: #1f3424;   --tcs-ok-text: #a8d8b0;
    --tcs-warn-bg: #3a3119; --tcs-warn-text: #ecd28f;
    --tcs-bad-bg: #3d2224;  --tcs-bad-text: #efb0b0;
    --tcs-info-bg: #1e2a3d; --tcs-info-text: #a9c3ea;
    --bs-body-bg: var(--tcs-bg);
    --bs-body-color: var(--tcs-text);
    --bs-link-color-rgb: 187, 169, 239;
    --bs-border-color: var(--tcs-border);
}

html, body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--tcs-bg);
    color: var(--tcs-text);
}

a, .btn-link { color: var(--tcs-accent-strong); }

/* Soft violet, like the record tags (CEO: the darker purple was too dark). */
.btn-primary, .btn-primary:disabled {
    color: var(--tcs-accent-strong);
    background-color: var(--tcs-accent-soft);
    border-color: var(--tcs-accent-border);
    font-weight: 600;
}
.btn-primary:hover, .btn-primary:active, .btn-primary:focus {
    color: var(--tcs-accent-strong) !important;
    background-color: var(--tcs-accent-hover) !important;
    border-color: var(--tcs-accent) !important;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background-color: var(--tcs-accent-soft); color: var(--tcs-accent-strong); font-weight: 600; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem var(--tcs-surface), 0 0 0 0.25rem var(--tcs-accent);
}

.content { padding-top: 1.1rem; }
h1:focus { outline: none; }
h1 { font-size: 1.6rem; font-weight: 600; margin: 0; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1rem 0 .4rem; }

.muted { color: var(--tcs-muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.page-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filter-row { max-width: 32rem; margin-bottom: .75rem; }

.tag {
    display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: .6rem;
    background: var(--tcs-accent-soft); color: var(--tcs-accent-strong); margin-left: .35rem; white-space: nowrap;
}
.status {
    display: inline-block; font-size: .8rem; padding: .1rem .5rem; border-radius: .35rem;
    background: var(--tcs-info-bg); color: var(--tcs-info-text); white-space: nowrap;
}
.status.ok { background: var(--tcs-ok-bg); color: var(--tcs-ok-text); }

.table-wrap { overflow-x: auto; background: var(--tcs-surface); border: 1px solid var(--tcs-border); border-radius: .5rem; }
.tcs-table { margin: 0; --bs-table-bg: transparent; --bs-table-color: var(--tcs-text); }
.tcs-table th { font-size: .8rem; color: var(--tcs-muted); font-weight: 600; border-bottom-color: var(--tcs-border); }
.tcs-table td { border-bottom-color: var(--tcs-border); vertical-align: top; }
.tcs-table tr.overdue td:first-child { color: var(--tcs-bad-text); }
.tcs-table tr.clickable { cursor: pointer; }
.tcs-table tr.clickable:hover td { background: var(--tcs-accent-soft); }
.tcs-table tr.not-yet td { color: var(--tcs-muted); }
.tcs-table td.summary, .task-row .summary { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.record-head {
    background: var(--tcs-surface); border: 1px solid var(--tcs-border); border-left: 4px solid var(--tcs-accent);
    border-radius: .5rem; padding: 1rem 1.25rem; position: sticky; top: 0; z-index: 5;
}
.record-title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.record-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .6rem 1.25rem; margin-bottom: .5rem; }
.record-grid label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tcs-muted); margin: 0; }

.task-card { background: var(--tcs-surface); border: 1px solid var(--tcs-border); border-radius: .5rem; margin-bottom: .5rem; overflow: hidden; }
.task-card.open { border-color: var(--tcs-accent); }
.task-card.closed { opacity: .7; }
.task-row {
    all: unset; box-sizing: border-box; cursor: pointer; width: 100%; padding: .6rem 1rem;
    display: flex; gap: .9rem; align-items: center; flex-wrap: wrap;
}
.task-row:hover { background: var(--tcs-accent-soft); }
.task-body { padding: .25rem 1rem 1rem; border-top: 1px solid var(--tcs-border); animation: tcs-open .15s ease-out; }
.task-summary { white-space: pre-wrap; }
@keyframes tcs-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.notes { list-style: none; padding: 0; margin: 0; }
.notes li { padding: .55rem 0; border-bottom: 1px solid var(--tcs-border); }
.notes li:last-child { border-bottom: 0; }
.note-meta { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--tcs-muted); margin-bottom: .2rem; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.notice { background: var(--tcs-warn-bg); color: var(--tcs-warn-text); border-radius: .5rem; padding: 1rem 1.25rem; max-width: 40rem; }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--tcs-ok-text); }
.invalid { outline: 1px solid var(--tcs-bad-text); }
.validation-message { color: var(--tcs-bad-text); }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Something went wrong on this part of the page." }

.darker-border-checkbox.form-check-input { border-color: #929292; }
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder { color: var(--bs-secondary-color); text-align: end; }
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder { text-align: start; }

@media (max-width: 640px) {
    .tcs-table th:nth-child(4), .tcs-table td:nth-child(4), .tcs-table th:nth-child(6), .tcs-table td:nth-child(6) { display: none; }
    .record-head { position: static; }
}
