:root { color-scheme: light; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--app-text); background: var(--app-page); line-height: 1.55; font-size: 15px; --app-blue: #0867ce; --app-border: light-dark(#dce5f0, #35465e); --app-nav: #102b4d; --header-height: 68px; --sidebar-width: 240px; --app-text: light-dark(#172b4d, #e2eaf5); --app-page: light-dark(#f1f5fa, #101a29); --app-surface: light-dark(#ffffff, #1b293d); --app-soft: light-dark(#f3f8ff, #22334c); --app-hover: light-dark(#eaf3ff, #2b405c); --app-muted: light-dark(#596b82, #b0c2d8); --app-link: light-dark(#0867ce, #80bdff); --app-input-border: light-dark(#cbd6e3, #61748e); --app-error: light-dark(#8d2020, #ffc0c0); }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] { color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; }
.record-row-clickable { cursor: pointer; }
.record-row-clickable:hover, .record-row-clickable:focus-within { background: var(--app-hover); }
.app-header { background: var(--app-nav); color: white; padding: 0 1.5rem; display: flex; align-items: center; gap: 1.25rem; min-height: var(--header-height); box-shadow: 0 3px 18px #102b4d14; }
.app-header a { color: white; }
.app-shell .app-header { position: fixed; inset: 0 0 auto; z-index: 30; height: var(--header-height); }
.app-header form { margin: 0; }
.header-workspace { color: #c5d7ed; border-left: 1px solid #ffffff30; padding-left: 1.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; min-width: 0; }
.header-user > span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest-shell .app-header { justify-content: space-between; }
.app-sidebar { display: flex; flex-direction: column; position: fixed; top: var(--header-height); bottom: 0; left: 0; width: var(--sidebar-width); padding: 1.25rem .9rem; overflow-y: auto; background: radial-gradient(ellipse at bottom right, #155a9b, transparent 80%), var(--app-nav); color: #dfebfa; z-index: 20; box-shadow: 4px 0 24px #102b4d1a; }
.app-sidebar nav { display: block; flex: 1; min-height: 0; overflow-y: auto; }
.nav-group { margin-bottom: 1.3rem; }
.app-sidebar .nav-heading { display: flex; align-items: center; gap: .6rem; margin: 0 0 .4rem; padding: .6rem .5rem; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #b5d8ff; list-style: none; border-radius: 8px; }
.nav-heading::-webkit-details-marker { display: none; }
.app-sidebar .nav-heading:hover { background: #ffffff14; }
.nav-chevron { width: 16px; height: 16px; flex-shrink: 0; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 2; transform: rotate(-90deg); }
.nav-group[open] > .nav-heading .nav-chevron { transform: none; }
.nav-group-links { padding-left: .4rem; }
.sidebar-toolbar { display: none; flex-shrink: 0; justify-content: flex-end; padding-top: .75rem; border-top: 1px solid #ffffff24; }
.sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: .5rem; margin: 0; background: #ffffff14; color: white; border: 1px solid #ffffff40; border-radius: 8px; }
.app-sidebar a { display: flex; align-items: center; gap: .75rem; color: #dfebfa; text-decoration: none; padding: .55rem .8rem; border-radius: 8px; margin: .15rem 0; border: 1px solid transparent; }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-sidebar a:hover, .app-sidebar a:focus-visible { background: #ffffff14; color: white; }
.app-sidebar a[aria-current="page"] { background: #ffffff1c; border-color: #ffffff26; color: white; font-weight: 650; }
.sidebar-footer { flex-shrink: 0; font-size: .75rem; color: #b5d8ff; padding: .8rem; border-top: 1px solid #ffffff24; }
.app-shell .app-workspace { margin-left: var(--sidebar-width); padding-top: var(--header-height); min-height: 100vh; }
.nav-toggle { display: none; margin: 0; padding: .4rem .6rem; background: #ffffff14; border: 1px solid #ffffff40; }
@media (min-width: 801px) {
    .nav-ready .sidebar-toolbar { display: flex; }
    .nav-collapsed { --sidebar-width: 76px; }
    .nav-collapsed .app-sidebar { padding: 1rem .5rem; }
    .nav-collapsed .app-sidebar a { justify-content: center; padding: .65rem; }
    .nav-collapsed .nav-label, .nav-collapsed .nav-chevron, .nav-collapsed .sidebar-footer { display: none; }
    .nav-collapsed .nav-heading { justify-content: center; padding: .65rem; }
    .nav-collapsed .nav-group-links { padding: 0; }
    .nav-collapsed .sidebar-toolbar { justify-content: center; }
    .nav-collapsed .sidebar-toggle .nav-icon { transform: rotate(180deg); }
    .nav-collapsed .nav-group + .nav-group { border-top: 1px solid #ffffff24; padding-top: .65rem; }
    .nav-collapsed .nav-group { margin-bottom: .65rem; }
    .app-sidebar .nav-flyout { position: fixed; inset: auto; margin: 0; width: 240px; max-width: calc(100vw - 100px); max-height: calc(100vh - 84px); overflow-y: auto; padding: .65rem; background: var(--app-nav); color: #dfebfa; border: 1px solid #ffffff30; border-radius: 12px; box-shadow: 0 12px 30px #102b4d40; }
    .nav-flyout::before { content: attr(data-title); display: block; padding: .5rem .65rem; color: #b5d8ff; font-weight: 650; font-size: .85rem; }
    .nav-collapsed .nav-flyout .nav-label { display: inline; }
    .nav-collapsed .nav-flyout a { justify-content: flex-start; }
}
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 100; padding: .7rem 1rem; background: var(--app-surface); color: var(--app-text); border-radius: 8px; }
.skip-link:focus { top: .5rem; }
.brand { font-size: 1.4rem; font-weight: 750; text-decoration: none; }
.brand img { display: block; width: 150px; height: auto; }
nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
nav form { margin: 0; }
main { margin: 1.75rem auto; padding: 0 1.5rem; }
.narrow { max-width: 520px; }
.wide { max-width: 1600px; }
.card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 16px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 10px 30px -12px #203b6329; min-width: 0; overflow-wrap: anywhere; }
.app-shell main.narrow { max-width: 780px; }
.card > p, .settings-form > p { color: var(--app-muted); }
.card > p a, .settings-form > p a { text-underline-offset: .18em; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-heading h1 { margin-bottom: .4rem; }
.page-heading .eyebrow { margin: 0 0 .4rem; }
.page-heading p { margin: .25rem 0; }
.settings-form > h2 { margin: 2rem 0 .5rem; padding-top: 1.5rem; border-top: 1px solid var(--app-border); }
.settings-form > h2:first-of-type { margin-top: 1.25rem; }
.form-field { min-width: 0; }
.grid > div > label, .grid > div > .form-field > label { margin-top: 0; }
.settings-form > .grid { margin-top: 1rem; align-items: start; }
.form-actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--app-border); }
.form-actions button { margin: 0; }
.form-actions small { color: var(--app-muted); }
.status-badge { display: inline-flex; align-items: center; flex-shrink: 0; gap: .4rem; max-width: none; padding: .22rem .6rem; border: 1px solid currentColor; border-radius: 6px; font-size: .78rem; font-weight: 650; line-height: 1.45; vertical-align: middle; white-space: nowrap; overflow-wrap: normal; }
.status-badge::before { content: ""; width: .42rem; height: .42rem; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.status-badge.status-custom { color: var(--badge-color); background: var(--badge-background); border-color: var(--badge-color); }
.status-neutral { color: var(--app-muted); background: var(--app-soft); }
.status-info { color: light-dark(#175ca3, #acd5ff); background: light-dark(#edf5ff, #223c57); }
.status-success { color: light-dark(#17643e, #9be0b7); background: light-dark(#edf9f1, #173d31); }
.status-warning { color: light-dark(#805000, #ffda8a); background: light-dark(#fff8e4, #42351c); }
.status-danger { color: light-dark(#a02630, #ffb1b7); background: light-dark(#fff0f1, #472830); }
.sla-summary { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }
.sla-details dd { margin-bottom: .8rem; font-variant-numeric: tabular-nums; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.metric-card { display: block; padding: 1.2rem; border: 1px solid var(--app-border); border-top: 3px solid var(--app-link); border-radius: 12px; background: var(--app-surface); text-decoration: none; color: var(--app-text); min-width: 0; }
.metric-card:hover { border-color: var(--app-link); background: var(--app-soft); }
.metric-card > span, .metric-card > strong { display: block; }
.metric-card > span { color: var(--app-muted); font-size: .85rem; }
.metric-card > strong { font-size: 2rem; line-height: 1.35; font-weight: 700; font-variant-numeric: tabular-nums; margin: .3rem 0; }
.metric-card.metric-warning { border-top-color: light-dark(#a16600, #ffda8a); }
.metric-card.metric-danger { border-top-color: light-dark(#b52f3b, #ffb1b7); }
.app-sidebar .nav-group:has(a[aria-current="page"]) > .nav-heading { background: #ffffff1c; color: #fff; box-shadow: inset 3px 0 #8ecbff; }
.app-sidebar a[aria-current="page"] { box-shadow: inset 3px 0 #8ecbff; }
h1 { margin: 0 0 1rem; font-size: 1.7rem; line-height: 1.25; }
h2 { margin-top: 0; font-size: 1.2rem; }
h1, h2, h3 { font-weight: 650; letter-spacing: -.025em; }
a { color: var(--app-link); }
label { display: block; font-weight: 600; margin: 1rem 0 .35rem; }
input, select, button { font: inherit; }
input, select { width: 100%; min-width: 0; padding: .6rem .75rem; border: 1px solid var(--app-input-border); border-radius: 9px; background: var(--app-surface); color: var(--app-text); }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; padding: 0; margin: 0; flex: 0 0 auto; accent-color: var(--app-blue); }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { display: flex; align-items: center; gap: .6rem; font-weight: 500; }
input[type="color"] { max-width: 100px; height: 44px; padding: .3rem; }
input[readonly], textarea[readonly] { background: var(--app-soft); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--app-error); }
button { cursor: pointer; border: 0; border-radius: 9px; padding: .65rem 1rem; background: var(--app-blue); color: white; font-weight: 600; margin-top: 1.25rem; }
button:hover { background: #0453ac; }
.secondary { background: var(--app-soft); color: var(--app-link); }
.secondary:hover { background: var(--app-hover); }
.link { margin: 0; padding: 0; background: transparent; color: white; text-decoration: underline; }
.notice, .errors { padding: 1rem; border-radius: 8px; margin-bottom: 1rem; }
.notice { background: light-dark(#e1edfd, #223c5b); color: light-dark(#173b68, #d1e6ff); }
.errors { background: light-dark(#fee7e7, #512d36); color: var(--app-error); }
.errors ul { margin: 0; padding-left: 1.25rem; }
.development-notice { padding: .65rem .9rem; font-size: .82rem; background: var(--app-soft); border: 1px dashed var(--app-input-border); color: var(--app-muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1.5rem; }
.integration-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1.5rem; }
.integration-tile { display: flex; flex-direction: column; margin-bottom: 0; }
.integration-tile > .button { margin-top: auto; align-self: flex-start; }
.integration-tile-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.integration-tile-heading h2 { margin: 0; }
.integration-tile-note { font-size: .9rem; }
.members { list-style: none; padding: 0; }
.members li { padding: .75rem 0; border-bottom: 1px solid var(--app-border); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--app-muted); }
:focus-visible { outline: 3px solid var(--app-link); outline-offset: 3px; }
.app-header :focus-visible, .app-sidebar :focus-visible { outline-color: #b5d8ff; }
input:focus, select:focus, textarea:focus { border-color: var(--app-blue); box-shadow: 0 0 0 3px #0867ce24; }
textarea { width: 100%; padding: .7rem; border: 1px solid var(--app-input-border); border-radius: 9px; font: inherit; resize: vertical; background: var(--app-surface); color: var(--app-text); }
.section-heading, .actions, .inline-fields { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.section-heading { justify-content: space-between; margin-bottom: 1rem; }
.section-heading h1 { margin: 0; }
.button { display: inline-block; background: var(--app-blue); color: white; border-radius: 9px; padding: .65rem 1rem; text-decoration: none; font-weight: 600; }
.button:hover { background: #0453ac; }
.actions { margin-top: 1.25rem; }
.actions button, .inline-fields button { margin: 0; }
.timer-control { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.timer-control .ticket-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.inline-fields input { flex: 1 1 180px; width: auto; min-width: 0; }
.search-form { margin-bottom: 1.5rem; }
.saved-view-shortcuts { margin: 1rem 0; gap: .6rem; }
.saved-view-shortcuts > span { color: var(--app-muted); font-size: .9rem; }
.saved-view-settings { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--app-border); }
.saved-view-list { list-style: none; padding: 0; margin-bottom: 0; }
.saved-view-list li { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding-top: 1rem; }
.saved-view-list li > form:first-child { flex: 1 1 240px; min-width: 0; }
.saved-view-list button { margin-top: 0; }
.checklist-items { list-style: none; padding: 0; }
.checklist-items > li { padding: 1rem 0; border-bottom: 1px solid var(--app-border); }
.checklist-item-heading { display: flex; align-items: center; gap: .75rem; }
.checklist-item-heading button { margin: 0; }
.checklist-item-heading > span { min-width: 0; overflow-wrap: anywhere; }
.checklist-completed { text-decoration: line-through; color: var(--app-muted); }
.checklist-completion { font-size: .85rem; color: var(--app-muted); }
.ticket-toolbar { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: start; gap: 1rem; }
.ticket-toolbar label { margin-top: 0; }
.ticket-toolbar button { margin-top: 1.9rem; }
.ticket-toolbar small { display: block; color: var(--app-muted); margin-top: .3rem; }
.ticket-filters { border: 1px solid var(--app-border); border-radius: 9px; margin-top: 1rem; padding: .75rem 1rem; }
.ticket-filters > summary { font-weight: 650; }
.filter-count { background: var(--app-soft); border-radius: 1rem; padding: .1rem .5rem; font-size: .85rem; }
.filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 1rem 0; }
.filter-chip { display: inline-flex; align-items: center; gap: .6rem; padding: .3rem .7rem; border: 1px solid var(--app-border); border-radius: 2rem; background: var(--app-soft); text-decoration: none; max-width: 100%; overflow-wrap: anywhere; }
.filter-chip:hover { background: var(--app-hover); }
@media (max-width: 600px) {
    .ticket-toolbar { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
    .ticket-toolbar button { margin: 0; justify-self: start; }
}
.table-scroll { overflow-x: auto; border: 1px solid var(--app-border); border-radius: 10px; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .65rem .75rem; border-bottom: 1px solid var(--app-border); vertical-align: top; overflow-wrap: anywhere; }
th { background: var(--app-soft); font-size: .85rem; font-weight: 650; color: var(--app-muted); }
thead th { text-align: left; letter-spacing: .015em; }
tbody tr:last-child > td { border-bottom: 0; }
td:has(> a[href*="/tickets/"]) > a:first-child { font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: .18em; }
tbody tr:hover { background: var(--app-hover); }
:root[data-density="compact"] th, :root[data-density="compact"] td { padding-top: .3rem; padding-bottom: .3rem; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 400; }
.check input { width: auto; }
fieldset { border: 1px solid var(--app-border); border-radius: 7px; margin-top: 1.5rem; padding: 1rem; max-height: 350px; overflow-y: auto; }
legend { font-weight: 650; }
fieldset > label { margin: .45rem 0; }
.danger { background: #a52b2b; }
.danger:hover { background: #802020; }
.field-error { color: var(--app-error); font-size: .9rem; }
.preserve-lines { white-space: pre-wrap; }
dt { font-weight: 650; margin-top: .75rem; }
dd { margin-left: 0; }
.swatch { width: 1rem; height: 1rem; display: inline-block; border: 1px solid #68798c; border-radius: 3px; margin-right: .5rem; vertical-align: middle; }
.pagination { margin-top: 1.5rem; display: flex; gap: 1rem; justify-content: space-between; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ticket-entry { padding: 1rem 0; border-top: 1px solid var(--app-border); margin-top: 1rem; }
.ticket-entry time { font-size: .85rem; color: var(--app-muted); }
summary { cursor: pointer; color: var(--app-link); }
@media (max-width: 800px) {
    .app-shell .app-header { padding: 0 1rem; gap: .75rem; }
    .header-workspace, .header-user > span { display: none; }
    .header-user { gap: .65rem; }
    .appearance-link { font-size: .85rem; }
    .app-shell .app-workspace { margin-left: 0; }
    .app-sidebar { position: static; width: auto; max-height: none; margin-top: var(--header-height); }
    .app-shell:not(.nav-ready) .app-workspace { padding-top: 0; }
    .nav-ready .nav-toggle { display: inline-block; }
    .nav-ready .app-sidebar { display: none; position: fixed; top: var(--header-height); bottom: 0; width: min(300px, 90vw); margin-top: 0; }
    .nav-ready.nav-open .app-sidebar { display: flex; }
    .brand img { width: 110px; }
    main { padding: 0 1rem; margin-top: 1rem; }
    .card { padding: 1.1rem; }
}
@media print {
    :root[data-theme] { color-scheme: light; background: white; color: black; font-size: 10pt; }
    :root[data-density] th, :root[data-density] td { padding-top: .65rem; padding-bottom: .65rem; }
    header, .app-sidebar, .skip-link, .no-print, main > .notice, main > .errors { display: none !important; }
    .app-shell .app-workspace { margin: 0; padding: 0; min-height: 0; }
    main.wide { max-width: none; margin: 0; padding: 0; }
    .invoice-document { border: 0; box-shadow: none; padding: 0; }
    .invoice-document .table-scroll { overflow: visible; }
    .invoice-document tr { break-inside: avoid; }
    .invoice-document thead { display: table-header-group; }
    .time-entries-print { border: 0; box-shadow: none; padding: 0; }
    .time-entries-print .table-scroll { overflow: visible; }
    .time-entries-print table { table-layout: fixed; font-size: 8pt; }
    .time-entries-print tr { break-inside: avoid; }
    .time-entries-print thead { display: table-header-group; }
    .status-badge { color: black; background: white; }
}
