:root {
    color-scheme: dark;
    --surface: #242424;
    --inset: #202020;
    --raised: #353535;
    --line: #565656;
    --text: #f2f2f2;
    --muted: #bababa;
    --gold: #ffbf10;
    --gold-bar: #ba890f;
    --selected: #3196ef;
    --selected-text: #081521;
    --hover: #36324d;
    --row-selected: #3f347a;
    font: 14px/1.35 "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="light"] {
    color-scheme: light;
    --surface: #f3f3f3;
    --inset: #fff;
    --raised: #e8e8e8;
    --line: #a5a5a5;
    --text: #202020;
    --muted: #525252;
    --gold: #785600;
    --gold-bar: #f4c44f;
    --selected: #b9dcfc;
    --hover: #ece8f7;
    --row-selected: #dcd1fb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

.timeman-workbench {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    background: var(--surface);
    color: var(--text);
}

button, select, input { font: inherit; color: inherit; }
button, select, input {
    border: 1px solid var(--line);
    background: var(--raised);
    padding: .28rem .65rem;
}
button, select { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.masthead, .header-actions, .grid-title, .dialog-actions {
    display: flex;
    align-items: center;
    gap: .8rem;
}
.masthead { justify-content: space-between; padding: .35rem 1.5rem .6rem; }
h1 { margin: 0; font-size: 2.85rem; font-weight: 350; }
h1 strong { color: var(--gold); font-weight: 850; }
h2 { margin: 0; color: var(--gold); font-size: 1rem; text-transform: uppercase; }
.header-actions select { margin-inline-start: .25rem; }

.workspace {
    min-height: 0;
    display: grid;
    grid-template-columns: 24px clamp(200px, var(--folder-width, 21vw), 440px) 9px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    padding: 0 3px 12px;
}
.workspace[data-mode="daily"] { grid-template-columns: 24px minmax(0, 1fr); }
.folder-rail { display: grid; place-items: center; border-block: 1px solid var(--line); }
.folder-view-toggle {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--gold) 20%, var(--raised));
}
.folder-view-toggle::before {
    content: "";
    width: 6px;
    height: 6px;
    border-left: 1px solid;
    border-bottom: 1px solid;
    transform: translateX(1px) rotate(45deg);
}
.folder-view-toggle[aria-expanded="false"]::before { transform: translateX(-1px) rotate(225deg); }
.folder-splitter {
    display: grid;
    place-items: center;
    background: var(--raised);
    border-block: 1px solid var(--line);
    cursor: col-resize;
    touch-action: none;
}
.folder-splitter::before {
    content: "";
    width: 3px;
    height: 29px;
    background: radial-gradient(circle, var(--gold) 1px, transparent 1.5px) center top / 3px 6px;
}
.folder-splitter:hover, .folder-splitter:focus-visible, .workspace.resizing-folders .folder-splitter {
    background: color-mix(in srgb, var(--gold) 20%, var(--raised));
}
.workspace.resizing-folders { cursor: col-resize; user-select: none; }
.pane {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    box-shadow: inset 0 0 0 1px var(--inset);
    padding: 3px;
}
.folders h2, .grid-title {
    padding: 3px 6px;
    border: 1px solid var(--line);
    background: var(--inset);
}
.grid-title { min-height: 35px; padding-inline: 1rem; }
#scope { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-list, .grid-scroll {
    min-height: 0;
    overflow: auto;
    flex: 1;
    background: var(--inset);
    border: 1px solid var(--line);
    margin-top: 4px;
}

.folder-list ul { margin: 0; padding: 0; list-style: none; }
.folder-line { display: flex; align-items: stretch; min-height: 25px; }
.folder-line:hover { background: var(--hover); }
.folder-line:has([aria-pressed="true"]) { background: var(--selected); color: var(--selected-text); }
.folder-line button { border: 0; background: transparent; }
.folder-toggle, .folder-spacer { width: 24px; flex: 0 0 24px; }
.folder-toggle { padding: 0; }
.folder-toggle::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 1px solid;
    border-bottom: 1px solid;
    transform: rotate(-45deg);
}
.folder-toggle[aria-expanded="true"]::before { transform: translateY(-2px) rotate(45deg); }
.folder-choice {
    display: flex;
    gap: .45rem;
    align-items: center;
    min-width: 0;
    flex: 1;
    text-align: left;
    padding: 2px 4px;
}
.folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-icon {
    position: relative;
    display: inline-block;
    flex: 0 0 14px;
    height: 9px;
    border-radius: 1px;
    background: #f4b83e;
    box-shadow: inset 0 -1px 0 #0004;
}
.folder-icon::before {
    content: "";
    position: absolute;
    top: -2px;
    left: 0;
    width: 6px;
    height: 3px;
    border-radius: 1px 1px 0 0;
    background: inherit;
}
.folder-list .project-list { margin-inline-start: 13px; border-inline-start: 1px solid var(--line); }
.project-list .folder-choice { padding-inline-start: 32px; position: relative; }
.project-list .folder-choice::before {
    content: "";
    position: absolute;
    width: 25px;
    inset-inline-start: 0;
    border-top: 1px solid var(--line);
}
.project-list .folder-icon { background: #5ac9bb; }

table {
    width: 100%;
    min-width: 1070px;
    table-layout: fixed;
    border-spacing: 0;
    font-size: .93rem;
}
.selection-column { width: 28px; }
.grid-scroll > table, #new-activity-columns { min-width: 0; }
.activity-column-spacer, .new-activity thead .activity-column-spacer { padding: 0; border-inline-end: 0; }
.status-column { width: 58px; }
.date-column { width: max(150px, 11%); }
.short-column { width: 5%; }
.rate-column { width: 10%; }
.amount-column { width: 8%; }
.client-column { width: 14%; }
.project-column { width: 17%; }
.type-column { width: 10%; }
th, td {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 3px 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); font-weight: 500; }
.activity-group-heading th, .activity-group-subtotal td {
    padding-block: 1px;
    font-size: .81rem;
}
.activity-group-toggle, .activity-group-subtotal td:first-child {
    padding-inline-start: calc(8px + var(--group-depth, 0) * 12px);
    text-align: start;
}
.activity-group-heading th { padding: 0; background: var(--raised); }
.activity-group-toggle {
    display: block;
    width: 100%;
    padding-block: 2px;
    padding-inline-end: 5px;
    border: 0;
    background: transparent;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-group-toggle:hover { background: var(--hover); }
.activity-group-toggle::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-inline-end: 7px;
    border-inline-end: 1px solid currentColor;
    border-block-end: 1px solid currentColor;
    transform: translateY(-1px) rotate(-45deg);
}
.activity-group-toggle[aria-expanded="true"]::before { transform: translateY(-2px) rotate(45deg); }
.activity-group-subtotal td {
    background: var(--gold-bar);
    color: #181818;
    border-right: 0;
    font-weight: 650;
}
.activity-row:hover, .activity-row:hover + .description-row, .activity-row:has(+ .description-row:hover), .description-row:hover { background: var(--hover); }
.activity-row.is-selected, .description-row.is-selected { background: var(--row-selected); }
.activity-row.is-selected + .description-row .description { color: var(--text); }
.activity-row, .description-row { cursor: pointer; }
.selection-cell { text-align: center; }
.selection-cell input { margin: 0; vertical-align: middle; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.description-row td { height: 22px; }
.number, .activity-status { text-align: center; font-variant-numeric: tabular-nums; }
.traffic-light {
    display: block;
    width: 14px;
    height: 34px;
    margin: auto;
    background: center / contain no-repeat;
}
.traffic-light[data-light="amber"] { background-image: url("../images/traffic-amber.png"); }
.traffic-light[data-light="red"] { background-image: url("../images/traffic-red.png"); }
.traffic-light[data-light="green"] { background-image: url("../images/traffic-green.png"); }
.traffic-light-large { width: 20px; height: 48px; }
.description { color: var(--muted); }
.grid-message { margin: 0; padding: 1rem; }
.grid-totals {
    min-height: 18px;
    padding: 1px 8px;
    background: var(--gold-bar);
    color: #181818;
    font-size: .81rem;
    line-height: 1.3;
}
.status-bar { background: var(--gold-bar); color: #181818; padding: 3px 8px; font-size: .9rem; }
.workspace-progress { width: min(410px, calc(100vw - 24px)); }
.workspace-progress h2 { text-transform: none; }
.workspace-progress p { margin-block: .65rem; }
.workspace-progress progress { display: block; width: 100%; accent-color: var(--gold); }
.workbook-import-dialog { width: min(1180px, calc(100vw - 28px)); max-width: none; padding: 0; }
.workbook-import-layout { display: flex; flex-direction: column; gap: 10px; max-height: min(76dvh, 660px); padding: 14px; }
.workbook-import-layout h2 { text-transform: none; }
.workbook-import-layout p { margin: 3px 0 0; }
.workbook-import-source, .workbook-import-footer, .workbook-import-pages {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.workbook-import-source input { min-width: 0; max-width: 100%; }
.workbook-import-layout progress { width: 100%; accent-color: var(--gold); }
.workbook-import-grid { min-height: 100px; flex: 1 1 360px; overflow: auto; border: 1px solid var(--line); }
.workbook-import-grid table { min-width: 880px; }
.workbook-import-grid th { position: sticky; top: 0; z-index: 1; }
.workbook-import-grid th, .workbook-import-grid td { padding: 5px 7px; text-align: start; }
.workbook-import-validation { min-width: 170px; max-width: 320px; }
.workbook-import-grid td:last-child { min-width: 170px; max-width: 320px; }
.workbook-import-grid td { overflow-wrap: anywhere; }
#workbook-import-error, .workbook-import-grid [data-invalid] .workbook-import-validation { color: #ff9999; }
:root[data-theme="light"] #workbook-import-error,
:root[data-theme="light"] .workbook-import-grid [data-invalid] .workbook-import-validation { color: #982727; }
.workbook-import-footer { justify-content: flex-end; }
.workbook-import-pages { margin-inline-end: auto; }
@media (prefers-reduced-motion: no-preference) {
    .history-activity-changed { animation: history-row-highlight 1.1s ease-out; }
    @keyframes history-row-highlight {
        from { background-color: color-mix(in srgb, var(--gold) 35%, var(--surface)); }
    }
}

:root {
    --detail-panel: #1d1d1d;
    --detail-card: #2a2a2c;
    --detail-text: #dcdcdc;
    --detail-accent: #fdbe4d;
}
:root[data-theme="light"] {
    --detail-panel: #ececef;
    --detail-card: #fff;
    --detail-text: #202022;
    --detail-accent: #7e5112;
}
.workspace {
    --details-width: min(282px, calc(100vw - 34px));
    position: relative;
    padding-inline-end: 25px;
}
.workspace[data-details-pinned] { padding-inline-end: calc(var(--details-width) + 3px); }
.details-footer {
    display: grid;
    grid-template-columns: clamp(38px, 7vw, 130px) repeat(5, minmax(0, 1fr));
    align-items: center;
    padding: 4px 3px 8px;
    min-height: 62px;
}
.detail-glyph {
    font-family: "Segoe MDL2 Assets", "Segoe Fluent Icons", "Segoe UI Symbol", sans-serif;
    font-size: 18px;
    line-height: 1;
}
.details-footer-folder { width: clamp(32px, 6vw, 51px); margin-inline-start: 6px; }
.details-footer-item {
    min-width: 0;
    padding: 4px;
}
.details-footer-item > strong { display: block; color: var(--gold); }
.details-footer-item > button {
    display: block;
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    padding: 0;
    text-align: start;
    border: 0;
    background: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: underline;
    font-size: .87rem;
}
.details-footer-item > button:disabled { opacity: 1; color: var(--muted); text-decoration: none; }
.footer-detail-cards, .row-details-panel {
    background: var(--detail-panel);
    border: 1px solid var(--line);
    color: var(--detail-text);
    font-size: .87rem;
}
.footer-detail-cards {
    position: fixed;
    z-index: 10;
    width: min(308px, calc(100vw - 16px));
    max-height: min(440px, 55dvh);
    overflow: auto;
    padding: 4px;
}
.row-details-dock { position: absolute; z-index: 5; inset: 0 3px 12px auto; }
#toggle-row-details {
    width: 22px;
    height: 100%;
    writing-mode: vertical-rl;
    color: var(--detail-accent);
    background: var(--detail-panel);
    padding: 5px 2px;
}
.row-details-panel {
    position: absolute;
    inset: 0 21px 0 auto;
    width: var(--details-width);
    display: flex;
    flex-direction: column;
    border-inline-start: 3px solid var(--detail-accent);
    visibility: hidden;
    opacity: 0;
    clip-path: inset(0 0 0 100%);
    transition: clip-path 150ms ease, opacity 150ms ease, visibility 150ms;
}
.workspace[data-details-pinned] .row-details-panel { inset-inline-end: 0; }
.row-details-dock.is-open .row-details-panel { visibility: visible; opacity: 1; clip-path: inset(0); }
.row-details-splitter {
    position: absolute;
    inset: 0 auto 0 0;
    width: 9px;
    z-index: 1;
    display: grid;
    place-items: center;
    cursor: col-resize;
    touch-action: none;
}
.row-details-splitter::before {
    content: "";
    width: 3px;
    height: 28px;
    background: radial-gradient(circle, var(--detail-accent) 1px, transparent 1.5px) center / 3px 6px repeat-y;
}
.row-details-splitter:hover, .row-details-splitter:focus-visible,
.workspace[data-resizing-details] .row-details-splitter { background: var(--raised); }
.workspace[data-resizing-details] { cursor: col-resize; user-select: none; }
.row-details-panel > header, .detail-card > header { display: flex; align-items: center; gap: 5px; }
.row-details-panel > header { padding: 6px 9px 6px 12px; }
.row-details-panel h2 {
    flex: 1;
    color: inherit;
    text-transform: none;
    font-size: inherit;
    font-weight: 650;
}
.row-details-cards { overflow: auto; min-height: 0; padding: 6px 9px 9px; }
.detail-card {
    min-width: 0;
    display: grid;
    gap: 4px;
    padding: 9px 12px;
    background: var(--detail-card);
    overflow-wrap: anywhere;
}
.detail-card + .detail-card { margin-top: 9px; }
.detail-card h3 {
    flex: 1;
    margin: 0;
    color: var(--detail-accent);
    font-size: inherit;
    font-weight: 650;
}
.detail-card header > .detail-glyph { margin-inline-end: 3px; color: var(--detail-accent); }
.detail-icon-button, .detail-record-link { border: 0; background: none; padding: 0; }
.detail-icon-button {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    min-height: 22px;
    color: var(--detail-accent);
}
.detail-icon-button:hover:not(:disabled), .detail-icon-button[aria-pressed="true"] { background: var(--raised); }
.detail-icon-button .detail-glyph { font-size: 15px; }
.detail-record-link { justify-self: start; text-align: start; text-decoration: underline; }
.detail-card-name { font-weight: 650; }
.detail-card p { margin: 0; white-space: pre-line; }
.detail-card p strong { margin-inline-end: .5em; }
.detail-card a { color: inherit; }
@media (max-width: 680px) {
    .workspace, .workspace[data-details-pinned] { padding-inline-end: 29px; }
    .details-footer { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
    .row-details-panel { transition: none; }
}

dialog {
    max-width: min(420px, calc(100% - 2rem));
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    padding: 1.25rem;
}
dialog::backdrop { background: #0009; }
dialog form { display: grid; gap: .75rem; }
dialog p { margin: 0; }
dialog p:empty { display: none; }
.dialog-actions { justify-content: flex-end; }

@media (max-width: 680px) {
    .timeman-workbench { height: auto; min-height: 100%; grid-template-rows: auto 1fr auto auto; }
    .masthead { padding-inline: .6rem; flex-wrap: wrap; }
    h1 { font-size: 2rem; }
    .workspace { grid-template-columns: 24px minmax(0, 1fr); grid-template-rows: 210px minmax(540px, 74dvh); padding-inline-start: 6px; }
    .workspace[data-mode="daily"] { grid-template-rows: minmax(540px, 74dvh); }
    .folder-rail { grid-row: 1 / -1; }
    .folder-splitter { display: none; }
}


.timeframe-trigger {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    width: min(34rem, 60%);
    background: var(--inset);
    text-align: left;
    padding-inline: .45rem;
}
.timeframe-trigger::after {
    content: "";
    margin-inline-start: auto;
    border: 4px solid transparent;
    border-bottom: 0;
    border-top-color: currentColor;
}
#timeframe-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-icon {
    width: 15px;
    height: 14px;
    flex: 0 0 15px;
    border: 1px solid currentColor;
    border-radius: 2px;
    background: linear-gradient(currentColor, currentColor) 0 3px / 100% 1px no-repeat;
}

.anchored-dialog {
    position: fixed;
    inset: auto;
    margin: 0;
    max-width: none;
    max-height: calc(100dvh - 16px);
}
.anchored-dialog::backdrop { background: transparent; }
.timeframe-dialog {
    width: min(760px, calc(100vw - 16px));
    padding: 4px;
    border-color: var(--muted);
}
.timeframe-form { grid-template-columns: 152px minmax(0, 1fr); gap: .5rem; }
.timeframe-presets { margin: 0; min-width: 0; padding: 0; border: 1px solid var(--line); }
.timeframe-presets label { display: block; position: relative; cursor: pointer; }
.timeframe-presets input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.timeframe-presets span { display: block; padding: 3px 7px; }
.timeframe-presets input:checked + span { background: var(--row-selected); }
.timeframe-presets input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: -2px; }
.timeframe-presets label:hover { background: var(--hover); }

.timeframe-content { display: grid; gap: .45rem; align-content: start; padding: 3px 6px 3px 3px; }
.timeframe-calendars, .timeframe-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.timeframe-calendars h3 { margin: 0 0 .4rem; font-size: 1rem; font-weight: 500; }
#from-calendar, #to-calendar { background: var(--inset); border: 1px solid var(--line); }
.calendar-header { display: grid; grid-template-columns: 24px 24px minmax(0, 1fr) 24px 24px; align-items: center; border-bottom: 1px solid var(--line); }
.calendar-month { text-align: center; font-size: .9rem; padding: 3px; }
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: 27px;
    min-height: 189px;
    align-content: start;
    text-align: center;
    padding: 0 2px 2px;
}
.calendar-weekday { align-self: center; color: var(--muted); font-size: .9rem; }
.calendar-header button, .calendar-days button { border: 0; background: transparent; padding: 0; }
.calendar-header button:hover:enabled, .calendar-days button:hover:enabled { background: var(--hover); }
.calendar-days button.in-range { background: color-mix(in srgb, var(--selected) 26%, var(--inset)); }
.calendar-days button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--selected); }
.calendar-days button[aria-current="date"] { font-weight: bold; text-decoration: underline; }
.apply-time { display: flex; align-items: center; gap: .3rem; }
.apply-time input { margin: 0; }
.timeframe-times label { display: flex; align-items: center; gap: .45rem; }
.timeframe-times input { min-width: 0; flex: 1; }
.timeframe-times input:disabled { opacity: .55; }
.timeframe-dialog .dialog-actions { margin-top: .5rem; }
.timeframe-dialog .dialog-actions button { min-width: 7rem; }
#timeframe-error { color: var(--gold); }

@media (max-width: 620px) {
    .grid-title { flex-wrap: wrap; }
    #scope { flex-basis: 100%; }
    .timeframe-trigger { flex: 1; width: auto; }
    .timeframe-form { grid-template-columns: minmax(0, 1fr); }
    #timeframe-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .timeframe-calendars { gap: .35rem; }
    .calendar-header { grid-template-columns: 17px 17px minmax(0, 1fr) 17px 17px; }
    .timeframe-times label { flex-direction: column; align-items: stretch; }
}

.activity-date { padding: 0; }
.activity-date-display {
    display: block;
    width: 100%;
    padding: 3px 5px;
    border: 0;
    background: transparent;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-date-controls { display: flex; min-width: 0; }
.activity-date-controls input {
    cursor: pointer;
    min-width: 0;
    width: 100%;
    height: 24px;
    padding: 2px 4px;
    background: var(--inset);
    border-color: var(--selected);
    font: inherit;
}
.activity-date-dropdown { padding: 0 .35rem; border-left: 0; }
.activity-time-dialog { width: min(280px, calc(100vw - 16px)); padding: .7rem; border-radius: 6px; }
.activity-time-calendar { border: 1px solid var(--line); background: var(--inset); }
.activity-time-label { display: flex; align-items: center; gap: .6rem; }
.activity-time-label input { flex: 1; min-width: 0; }
.activity-time-dialog .dialog-actions button { min-width: 5.2rem; }
.time-edit-error { color: var(--gold); border: 1px solid var(--line); padding: 4px 8px; margin: 3px 0; }

.activity-lookup { padding: 0; }
.activity-lookup button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
    width: 100%;
    border: 0;
    padding: 3px 5px;
    background: transparent;
    text-align: left;
}
.activity-lookup button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-lookup button::after {
    content: "";
    border: 4px solid transparent;
    border-bottom: 0;
    border-top-color: currentColor;
    flex: none;
}
.activity-project-dialog {
    width: min(500px, calc(100vw - 16px));
    padding: 4px;
    border-color: var(--muted);
}
.activity-project-dialog form { gap: 4px; }
.activity-project-dialog h2 { padding: 3px 5px; }
.activity-project-options {
    min-height: 105px;
    max-height: 225px;
    overflow: auto;
    background: var(--inset);
    border: 1px solid var(--line);
}
.activity-project-table { min-width: 0; }
.activity-project-table col:nth-child(1) { width: 34%; }
.activity-project-table col:nth-child(2) { width: 44%; }
.activity-project-table col:nth-child(3) { width: 22%; }
.activity-project-table td:first-child { padding: 0; }
.activity-project-table td button {
    display: block;
    width: 100%;
    padding: 3px 5px;
    text-align: left;
    border: 0;
    background: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-project-table tbody tr:hover { background: var(--hover); cursor: pointer; }
.activity-project-table tbody tr.is-selected { background: var(--row-selected); }
#activity-project-search { width: 100%; background: var(--inset); }
#activity-project-error { color: var(--gold); padding: 3px 5px; }
.activity-project-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding-top: 3px; }
#select-activity-project { margin-inline-start: auto; }

.new-activity {
    margin-top: 3px;
    border: 1px solid var(--line);
    background: var(--inset);
}
.new-activity fieldset {
    min-width: 0;
    margin: 0;
    border: 0;
    padding: 0;
}
#new-activity-scroll { max-width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.new-activity thead th {
    position: static;
    padding: 1px 5px;
    font-size: .77rem;
    color: var(--muted);
    text-align: start;
}
.new-activity thead .entry-label-centered { text-align: center; }
.new-activity td.entry-date-cell, .entry-description { padding: 0; }
.entry-choice-dialog { width: min(300px, calc(100vw - 16px)); }
#entry-choice-search { width: 100%; background: var(--inset); }
#entry-choice-error { color: var(--gold); }
.entry-choice-actions { justify-content: space-between; }
.entry-choice-actions button { min-width: 82px; }
.entry-date-picker { display: grid; place-items: center; padding: 0 4px; border-left: 0; }
.entry-date-picker .calendar-icon { width: 13px; height: 12px; }
.entry-date-cell .activity-date-controls input { border-color: var(--line); }
.new-description-bar { display: flex; }
#new-description {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 6px;
    padding-inline-end: 7px;
    text-align: start;
}
#new-description > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#new-description::after {
    content: "";
    border-inline: 4px solid transparent;
    border-top: 4px solid currentColor;
}
#save-new-activity { flex: 0 0 26px; padding: 0; color: #56db88; font-weight: 700; }
:root[data-theme="light"] #save-new-activity { color: #136f37; }
#new-activity-message { margin: 4px 0 0; color: var(--gold); }
.description-dialog { max-width: none; width: min(780px, calc(100vw - 24px)); padding: .75rem; }
.description-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.description-editor {
    min-height: 140px;
    max-height: 45dvh;
    overflow: auto;
    padding: .5rem;
    border: 1px solid var(--line);
    background: var(--inset);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.grid-title { flex-wrap: wrap; gap: 4px 10px; }
.grid-title > .timeframe-trigger { flex: 1 1 130px; width: auto; max-width: 34rem; }
.grid-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    margin-inline-start: auto;
}
.grid-toolbar button { padding: 2px 6px; white-space: nowrap; color: var(--gold); }
.grid-search { display: flex; align-items: center; gap: 6px; min-width: 0; }
.grid-search input {
    width: clamp(85px, 11vw, 175px);
    min-width: 0;
    padding: 2px 5px;
    background: var(--inset);
}
.grid-search input::-webkit-search-cancel-button { display: none; }
.search-icon {
    position: relative;
    width: 11px;
    height: 11px;
    margin: 0 3px;
    border: 1px solid var(--gold);
    border-radius: 50%;
}
.search-icon::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 1px;
    background: var(--gold);
    transform: rotate(-45deg);
    left: -4px;
    bottom: -2px;
}
#open-new-activity span {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    margin-inline-end: 4px;
    border-radius: 2px;
    background: var(--gold-bar);
    color: #181818;
    font-weight: 700;
}
th[data-column] { padding: 0 2px; }
.column-heading { display: flex; align-items: center; min-width: 0; }
.column-heading button { border: 0; background: transparent; padding: 3px 1px; }
.column-sort { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-scroll thead th:has(.column-resize-handle) { padding-inline-end: 9px; }
.column-resize-handle {
    position: absolute;
    inset: 0 0 0 auto;
    width: 8px;
    cursor: col-resize;
    touch-action: none;
}
.column-resize-handle:hover, .column-resize-handle:focus-visible {
    background: color-mix(in srgb, var(--gold) 28%, transparent);
}
.grid-scroll.resizing-column { cursor: col-resize; user-select: none; }
.grid-group-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px 8px;
    padding: 2px 6px;
    margin-top: 4px;
    border: 1px solid var(--line);
    background: var(--inset);
    font-size: .85rem;
}
.grid-group-bar:not([hidden]) + .grid-scroll { margin-top: 0; border-top: 0; }
.grid-group-bar.is-drop-target { border-color: var(--gold); background: var(--hover); }
.grid-group-label { color: var(--gold); font-weight: 650; }
#grid-group-hint { color: var(--muted); }
.grid-group-columns { display: flex; flex-wrap: wrap; gap: 3px; min-width: 0; }
.grid-group-chip, #grid-add-group { padding: 1px 5px; }
#grid-add-group { margin-inline-start: auto; }
.column-sort[data-direction="up"]::after,
.column-sort[data-direction="down"]::after {
    content: "";
    display: inline-block;
    margin-inline-start: 4px;
    border: 3px solid transparent;
    border-top: 0;
    border-bottom-color: currentColor;
    vertical-align: middle;
}
.column-sort[data-direction="down"]::after { transform: rotate(180deg); }
.column-filter { display: grid; place-items: center; flex: 0 0 14px; }
.column-filter::before {
    content: "";
    width: 9px;
    height: 9px;
    background: currentColor;
    clip-path: polygon(0 0, 100% 0, 62% 45%, 62% 80%, 38% 100%, 38% 45%);
}
.column-filter.has-filter { color: var(--gold); }
.column-heading button:hover { background: var(--hover); }
.column-filter-dialog { width: min(260px, calc(100vw - 16px)); padding: .65rem; }
.column-filter-dialog form { gap: 4px; }
.column-filter-actions { display: flex; justify-content: space-between; gap: 4px; margin-top: 4px; }

.folder-search {
    display: flex;
    align-items: stretch;
    gap: 2px;
    margin-top: 3px;
}
.folder-search .grid-search { flex: 1; }
#folder-search { width: 100%; }
#folder-search::-webkit-search-cancel-button { display: none; }
.folder-search button { padding: 0 7px; color: var(--gold); }
#folder-search-empty { padding: .5rem; }
.folder-commands {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    border: 1px solid var(--line);
    padding: 2px;
}
.folder-commands button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 29px;
    padding: 0 2px;
    color: var(--detail-accent);
}
.folder-commands button:hover:enabled { background: var(--hover); }
.folder-commands .detail-glyph { font-size: 16px; }
.folder-command-caret {
    border: 4px solid transparent;
    border-top-color: var(--text);
    border-bottom: 0;
}
.client-context-menu.folder-add-menu { width: min(255px, calc(100vw - 16px)); }

.grid-scroll { overflow-anchor: none; }

.editable-description { padding: 0; }
.description-cell-controls { display: flex; align-items: stretch; min-width: 0; }
.description-cell-text, .description-cell-arrow {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 2px 5px;
}
.description-cell-text {
    flex: 1;
    min-width: 0;
    min-height: 22px;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.description-cell-arrow { flex: 0 0 22px; border-inline-start: 1px solid var(--line); }
.description-cell-arrow:hover { background: var(--raised); }
.description-cell-controls textarea {
    flex: 1;
    min-width: 0;
    min-height: 22px;
    resize: vertical;
    border: 1px solid var(--selected);
    padding: 1px 4px;
    background: var(--inset);
    color: var(--text);
    font: inherit;
}
#activity-description-error { color: var(--gold); }

.client-project-wizard {
    --wizard-height: 548px;
    width: min(820px, calc(100vw - 20px));
    height: min(var(--wizard-height), calc(100dvh - 20px));
    max-width: none;
    max-height: none;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
}
.client-project-wizard form {
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0;
}
.wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.6rem .4rem;
    border-bottom: 2px solid var(--gold);
    background: var(--inset);
}
.wizard-header h2 { color: var(--text); text-transform: none; font-size: 1.7rem; }
#wizard-step-count { color: var(--gold); }
.wizard-brand { font-size: 1.9rem; white-space: nowrap; }
.wizard-brand strong { color: var(--gold); }
.wizard-body { display: grid; grid-template-columns: 192px minmax(0, 1fr); min-height: 0; }
.wizard-sidebar {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 0;
    border-inline-end: 1px solid var(--line);
    background: var(--inset);
}
.wizard-steps {
    margin: 0;
    padding: 1.5rem 1.1rem 1rem 2.8rem;
    overflow: auto;
}
.wizard-artwork {
    display: block;
    width: 100%;
    height: min(122px, 22dvh);
    object-fit: contain;
}
.catalog-record-wizard .wizard-artwork { display: none; }
.catalog-record-wizard[data-wizard-kind="address"] [data-wizard-kind="address"],
.catalog-record-wizard[data-wizard-kind="contact"] [data-wizard-kind="contact"] { display: block; }
.wizard-steps button {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: .6rem .35rem;
}
.wizard-steps button:enabled:hover { background: var(--hover); }
.wizard-steps li[aria-current="step"] {
    color: var(--gold);
    background: color-mix(in srgb, var(--gold) 15%, var(--inset));
}
.wizard-pages { min-width: 0; min-height: 0; overflow: auto; padding: 1.6rem 2rem; }
.wizard-pages section, .wizard-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .8rem;
}
.wizard-wide { grid-column: 1 / -1; }
.wizard-pages label { display: grid; gap: .3rem; min-width: 0; }
.wizard-pages textarea {
    width: 100%;
    background: var(--inset);
    color: inherit;
    border: 1px solid var(--line);
    padding: .4rem;
    font: inherit;
    resize: vertical;
}
.wizard-pages input:not([type="checkbox"]), .wizard-pages select { min-width: 0; background: var(--inset); }
.wizard-pages .wizard-check { display: flex; align-items: center; }
.wizard-address { margin: 0 0 .6rem; padding: .7rem; min-width: 0; border: 1px solid var(--line); }
.wizard-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, max-content);
    gap: .4rem;
    padding: .45rem;
    border-top: 1px solid var(--line);
    background: var(--inset);
}
.wizard-footer-summary {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}
.wizard-actions button { min-width: 90px; }
#wizard-error { color: var(--gold); margin-top: .7rem; }
@media (max-width: 580px) {
    .wizard-brand { display: none; }
    .wizard-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr) auto;
    }
    .wizard-sidebar { display: contents; }
    .wizard-steps {
        display: flex;
        flex-wrap: wrap;
        list-style: none;
        max-height: min(108px, 24dvh);
        padding: .25rem .5rem;
        background: var(--inset);
    }
    .wizard-steps button { padding: .3rem .45rem; }
    .wizard-pages { padding: 1rem; }
    .wizard-artwork { grid-row: 3; width: 64px; height: min(50px, 12dvh); margin-inline-start: 8px; }
    .wizard-actions button { min-width: 0; padding-inline: .45rem; }
}

.client-context-menu {
    width: min(205px, calc(100vw - 16px));
    padding: 2px 0;
    overflow: visible;
    border-radius: 4px;
    box-shadow: 0 2px 5px #0004;
}
.client-context-submenu {
    position: absolute;
    z-index: 1;
    left: calc(100% - 1px);
    min-width: 215px;
    padding: 2px 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
    box-shadow: 0 2px 5px #0004;
}
.client-context-submenu.opens-left { right: calc(100% - 1px); left: auto; }
.client-context-menu button {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 4px 12px;
    font-size: .93rem;
}
.client-context-menu button:hover:not(:disabled),
.client-context-menu button[aria-expanded="true"] { background: var(--row-selected); }
.client-context-menu button[aria-haspopup="menu"] { padding-inline-end: 22px; position: relative; }
.client-context-menu button[aria-haspopup="menu"]::after {
    content: "";
    position: absolute;
    inset-inline-end: 9px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-right: 0;
    border-left-color: currentColor;
}
#context-remove-items { margin-top: 2px; border-top: 1px solid var(--line); }
@media (max-width: 440px) {
    .client-context-submenu, .client-context-submenu.opens-left {
        top: calc(100% - 1px) !important;
        left: -1px;
        right: -1px;
        min-width: 0;
    }
}

.catalog-record-wizard { width: min(620px, calc(100vw - 20px)); }
.catalog-record-wizard[data-wizard-kind="address"] { --wizard-height: 479px; }
.catalog-record-wizard[data-wizard-kind="contact"] { --wizard-height: 428px; }
#catalog-record-step, #catalog-record-error { color: var(--gold); }
#catalog-record-error { margin-top: .7rem; }

#workspace-options {
    width: min(660px, calc(100vw - 20px));
    max-width: none;
    max-height: calc(100dvh - 20px);
    padding: .9rem;
    border-radius: 5px;
}
#workspace-options-form { gap: .5rem; }
.options-content { border: 1px solid var(--line); }
.options-tabs { display: flex; flex-wrap: wrap; gap: 2px; background: var(--inset); }
.options-tabs button { border: 0; background: transparent; padding: .35rem .55rem; border-bottom: 2px solid transparent; }
.options-tabs button[aria-selected="true"] { border-color: var(--selected); }
.options-content section { min-height: min(445px, 62dvh); padding: 1rem; }
.options-content section > label, #options-rate-settings > label { display: grid; gap: .35rem; margin-bottom: .75rem; }
.options-content .option-check { display: flex; align-items: center; gap: .35rem; }
.options-content input:not([type="checkbox"]), .options-content select { min-width: 0; background: var(--inset); }
#options-rounding, #options-tax-name, #options-tax-percent, #options-base-rate { width: min(100%, 250px); }
.options-workflow-list { max-height: 290px; overflow: auto; margin: .5rem 0; }
.options-workflow-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(120px, 42%); align-items: center; gap: .25rem; margin-bottom: 4px; }
.options-workflow-row input { justify-self: start; }
.options-control-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
#options-rate-settings { min-width: 0; border: 0; margin: 0; padding: 0; }
#options-rate-rows { margin: 1rem 0; }
.options-rate-row { display: grid; grid-template-columns: minmax(80px, 2fr) minmax(95px, 1.4fr) minmax(52px, 1fr) auto; gap: 4px; margin-bottom: 5px; }
#options-error { color: var(--gold); }
@media (max-width: 460px) {
    .options-content section { padding: .55rem; }
    .options-rate-row { grid-template-columns: minmax(0, 1fr) minmax(80px, 1fr); }
    .options-workflow-row { grid-template-columns: auto minmax(0, 1fr); }
    .options-workflow-row select { grid-column: 2; }
}

.options-other-rules { margin: .7rem 0 .35rem; color: var(--muted); }
