:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #183044;
  background: #f3f6f8;
  font-synthesis: none;
  --navy: #142f42;
  --teal: #087b78;
  --teal-dark: #05645f;
  --text: #183044;
  --muted: #596c79;
  --line: #dce5e9;
  --surface: #fff;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, [role="button"], select { cursor: pointer; }
button { touch-action: manipulation; }
a { color: var(--teal-dark); text-underline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid #50b6b2; outline-offset: 3px; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .58; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { color: var(--navy); line-height: 1.25; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.app-shell { min-height: 100vh; }
.sidebar { background: var(--navy); color: #fff; padding: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.35rem; font-weight: 750; letter-spacing: -.5px; margin: 0 0 14px; min-height: 44px; }
.brand small { display: block; font-size: .69rem; text-transform: uppercase; letter-spacing: 1.5px; color: #a7c8d2; font-weight: 600; }
.sidebar nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
.nav-item { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-height: 44px; padding: 10px 14px; color: #dce7ed; text-decoration: none; font-weight: 600; border-radius: 7px; white-space: nowrap; }
.nav-item:hover { background: #234354; color: #fff; }
.nav-item.active { background: #0d7777; color: #fff; }
.app-main { min-width: 0; }
.topbar { min-height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; flex-wrap: wrap; }
.content { padding: 24px 16px 40px; max-width: 1760px; margin: 0 auto; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 24px; }
.page-title { margin: 0 0 6px; font-size: clamp(1.6rem, 3vw, 2rem); font-weight: 750; letter-spacing: -.7px; }
.eyebrow { color: var(--teal-dark); font-size: .72rem; font-weight: 750; letter-spacing: 1.3px; text-transform: uppercase; margin-bottom: 6px; }
.muted { color: var(--muted); }
.subtle { color: var(--muted); font-size: .84rem; }
.toolbar, .toolbar-group, .inline, .row-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar { justify-content: space-between; margin-bottom: 18px; }
.toolbar-group { min-width: 0; }
.toolbar-group > .input, .toolbar-group > .select { width: auto; max-width: 100%; }
.button, button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); font-weight: 650; text-decoration: none; line-height: 1.3; transition: background-color .15s, border-color .15s; }
.button:hover, button:hover { background: #edf3f5; border-color: #aebfc7; }
.button.primary, button.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.button.primary:hover, button.primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.button.secondary, button.secondary { background: #fff; color: var(--navy); }
.button.danger, button.danger { background: #fff3f1; border-color: #edb5ab; color: #a33225; }
.button.danger:hover, button.danger:hover { background: #ffe4df; }
.button.small, button.small { padding: 8px 12px; font-size: .83rem; min-height: 44px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; min-width: 0; overflow: hidden; }
.card + .card { margin-top: 18px; }
.card-header { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 20px; }
.grid-two, .grid-three, .stat-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.grid-two > .card, .grid-three > .card { margin-top: 0; }
.stat-grid { margin-bottom: 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 18px; }
.stat-label { font-size: .79rem; font-weight: 650; color: var(--muted); }
.stat-value { display: block; font-size: clamp(1.65rem, 3vw, 2.1rem); line-height: 1.25; letter-spacing: -.8px; font-weight: 750; color: var(--navy); margin: 9px 0 5px; font-variant-numeric: tabular-nums; }
.stat-note { color: var(--muted); font-size: .75rem; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 650; font-size: .86rem; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.full-width { grid-column: 1 / -1; }
.input, .select, .textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { width: 100%; min-height: 44px; border: 1px solid #bacbd3; background: #fff; color: var(--text); border-radius: 7px; padding: 10px 12px; font-size: 1rem; }
input::placeholder, textarea::placeholder { color: #70828c; opacity: 1; }
.textarea, textarea { min-height: 108px; resize: vertical; }
input[type="file"] { max-width: 100%; min-height: 44px; }
input[type="file"]::file-selector-button { min-height: 44px; border: 1px solid #bacbd3; background: #edf3f5; color: var(--navy); padding: 8px 12px; border-radius: 6px; margin-right: 10px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--teal); width: 20px; height: 20px; margin: 0; flex-shrink: 0; }
.checkbox-line { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.field-validation-error, .validation-message { color: #a33225; font-size: .82rem; }
.invalid, input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #bc4030; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 5px; background: #edf2f5; color: #4c6473; font-size: .72rem; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.badge.status-draft { color: #665622; background: #f7f1da; }
.badge.status-confirmed { color: #175b89; background: #e8f1fa; }
.badge.status-completed, .badge.success { color: #17644e; background: #e2f3ec; }
.badge.status-canceled { color: #a03b30; background: #fbe9e5; }
.badge.warning { color: #875000; background: #fff1d9; }
.alert { padding: 14px 16px; border: 1px solid #bbdce5; border-radius: 8px; background: #eef8fb; color: #23576b; margin-bottom: 18px; overflow-wrap: anywhere; }
.alert.error { background: #fff1ee; border-color: #ecc1b9; color: #92362a; }
.alert.warning { background: #fff8e8; border-color: #ead5a3; color: #785216; }
.alert.success { background: #eaf7f1; border-color: #b7dccc; color: #245f4b; }
.loading, .empty-state { padding: 42px 22px; text-align: center; color: var(--muted); }
.empty-state h2, .empty-state h3 { color: var(--navy); margin-bottom: 8px; }
.empty-state .button { margin-top: 14px; }
.table-wrap { width: 100%; overflow: auto; -webkit-overflow-scrolling: touch; }
.data-table { border-collapse: collapse; width: 100%; font-size: .87rem; text-align: left; }
.data-table th { padding: 12px 16px; color: #5b6f7a; background: #f6f9fa; border-bottom: 1px solid var(--line); font-size: .72rem; font-weight: 750; letter-spacing: .45px; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid #e7edef; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f8fbfb; }
.data-table td > strong { color: var(--navy); }
.data-table td .muted, .data-table td .subtle { display: block; }
.row-actions { flex-wrap: nowrap; gap: 6px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.agenda-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: stretch; }
.agenda-day { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-width: 0; overflow: hidden; padding-bottom: 8px; }
.agenda-day-header { padding: 13px 12px; border-bottom: 1px solid var(--line); background: #f8fafb; font-size: .85rem; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 5px; }
.agenda-day-header .subtle { font-size: .73rem; }
.agenda-job { display: block; width: calc(100% - 16px); padding: 12px; margin: 8px; border: 1px solid #c8dedd; border-left: 3px solid var(--teal); border-radius: 6px; background: #f0f8f7; color: var(--text); text-align: left; text-decoration: none; font-weight: 400; overflow-wrap: anywhere; }
.agenda-job:hover { background: #e6f3f1; border-color: #80b4af; }
.job-time { color: var(--teal-dark); font-size: .75rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.job-title { display: block; margin: 5px 0; font-size: .85rem; font-weight: 700; color: var(--navy); }
.job-detail { font-size: .75rem; color: var(--muted); margin-top: 3px; }
.agenda-job .badge { margin-top: 9px; font-size: .67rem; padding: 3px 6px; white-space: normal; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgb(10 29 42 / 55%); padding: 12px; }
.modal-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; width: 100%; max-width: 960px; max-height: calc(100dvh - 24px); display: flex; flex-direction: column; box-shadow: 0 18px 64px rgb(9 25 38 / 22%); }
.modal-header { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2, .modal-header h3 { margin: 0; }
.modal-body { padding: 20px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.modal-footer { display: flex; justify-content: flex-end; flex: 0 0 auto; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); background: #fafcfc; border-radius: 0 0 12px 12px; }
.autocomplete { position: relative; min-width: 0; }
.suggestions { position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 20; background: #fff; border: 1px solid #bacbd3; border-radius: 7px; box-shadow: 0 8px 24px rgb(20 47 66 / 12%); max-height: 260px; overflow-y: auto; padding: 4px; list-style: none; margin: 0; }
.suggestion { width: 100%; display: block; min-height: 44px; padding: 10px; text-align: left; border: 0; border-radius: 4px; background: #fff; font-weight: 400; cursor: pointer; }
.suggestion:hover, .suggestion[aria-selected="true"] { background: #eaf5f3; }
.suggestion strong, .suggestion small { display: block; }
.suggestion small { color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 20px; padding: 0 2px; }
.tab { flex: 0 0 auto; min-height: 48px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--muted); padding: 12px 18px; background: transparent; text-decoration: none; font-weight: 650; white-space: nowrap; }
.tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); background: transparent; }
.tab:hover { background: #edf5f4; }
.detail-list { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr); gap: 12px 16px; margin: 0; }
.detail-list dt { color: var(--muted); font-size: .85rem; }
.detail-list dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.history-card { padding: 16px; border: 1px solid var(--line); border-left: 3px solid #8bafa8; border-radius: 7px; background: #fff; }
.history-card + .history-card { margin-top: 12px; }
.source-description { padding: 16px; background: #f6f8fa; border: 1px solid var(--line); border-radius: 7px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.employee-card { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; min-width: 0; }
.employee-card > :last-child { min-width: 0; overflow-wrap: anywhere; }
.employee-avatar { flex: 0 0 44px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #e3f1ee; color: #17675f; font-size: .9rem; font-weight: 750; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack > .card { margin-top: 0; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 2000; background: #fff1ee; color: #92362a; border-top: 1px solid #ecc1b9; padding: 16px 52px 16px 20px; }
#blazor-error-ui .dismiss { position: absolute; top: 8px; right: 12px; min-width: 44px; min-height: 44px; cursor: pointer; }
@media (min-width: 640px) {
  .content { padding: 28px 24px 48px; }
  .form-grid, .grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agenda-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-backdrop { padding: 24px; }
  .modal-panel { max-height: calc(100dvh - 48px); }
  .modal-body { padding: 24px; }
}
@media (min-width: 960px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 224px; z-index: 100; padding: 25px 16px; overflow-y: auto; }
  .brand { padding: 0 12px; margin-bottom: 34px; }
  .sidebar nav { flex-direction: column; overflow-x: visible; gap: 6px; }
  .nav-item { width: 100%; padding: 12px 14px; }
  .app-main { margin-left: 224px; }
  .topbar { padding: 14px 30px; }
  .content { padding: 30px 30px 48px; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .agenda-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .agenda-day { min-height: 300px; }
  .agenda-day-header { flex-direction: column; align-items: flex-start; }
  .agenda-job { padding: 9px; }
}
@media (max-width: 639px) {
  .page-header > .button { width: 100%; }
  .toolbar > .toolbar-group { width: 100%; }
  .toolbar-group > .input, .toolbar-group > .select { flex: 1; min-width: 130px; }
  .card-header, .card-body { padding: 16px; }
  .stat-card { padding: 14px; }
  .data-table { min-width: 640px; }
  .modal-header, .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .modal-footer .button { flex: 1; }
  .detail-list { grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  body { background: #fff; color: #000; font-size: 10pt; }
  .sidebar, .topbar, .toolbar, .row-actions, .pagination, .modal-backdrop { display: none !important; }
  .app-main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  .card, .stat-card, .agenda-day { break-inside: avoid; box-shadow: none; }
  .table-wrap { overflow: visible; }
  .data-table { min-width: 0; }
  .agenda-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

/* Compact operational overview and a single daily/weekly agenda. */
.agenda-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; gap: 12px; }
.agenda-summary .stat-card { padding: 12px 14px; min-height: 100px; }
.agenda-summary .stat-value { font-size: 1.65rem; margin: 4px 0; }
.agenda-summary .money-value { font-size: 1.25rem; letter-spacing: -.3px; }
.unified-agenda .toolbar { margin-bottom: 12px; }
.unified-agenda .agenda-day-header { flex-direction: row; align-items: center; padding: 10px 12px; }
.unified-agenda .agenda-day-header h2 { margin: 0; font-size: 1rem; }
.agenda-grid.single-day { grid-template-columns: minmax(0, 1fr); }
.unified-agenda .agenda-day { min-height: 0; }
.unified-agenda .agenda-job { margin: 6px; width: calc(100% - 12px); padding: 11px; }
.imported-job { background: #fffaf0; border-color: #e8d9b6; border-left-color: #b7832d; }
.imported-job:hover { background: #fff7e7; border-color: #d5b16e; }
.imported-job .row-actions { gap: 5px; margin-top: 8px; }
.imported-job .row-actions .small { font-size: .76rem; padding: 7px 9px; }
.source-caption { margin-top: 7px; font-size: .7rem; color: var(--muted); }
@media (min-width: 900px) { .single-day .agenda-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
@media (max-width: 620px) { .agenda-summary { gap: 7px; } .agenda-summary .stat-card { padding: 10px; } .agenda-summary .stat-label, .agenda-summary .stat-note { font-size: .7rem; } .agenda-summary .money-value { font-size: 1rem; } }
/* Keep agenda filters on one row when the available width permits it. */
@media (min-width: 760px) {
  .toolbar > .select { width: auto; min-width: 160px; flex: 1 1 180px; }
  .toolbar > .field:has(input[type="date"]) { flex: 0 1 180px; }
  .unified-agenda > .toolbar > .select { flex: 1 1 240px; }
}
.client-name-link { display: block; border: 0; background: transparent; padding: 0; min-height: 44px; max-width: 100%; color: var(--navy); font: inherit; font-weight: 750; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.client-name-link:hover { text-decoration: underline; }
@media (max-width: 620px) {
  .sidebar nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; gap: 4px; }
  .sidebar .nav-item { justify-content: center; padding: 9px 3px; min-width: 0; font-size: .74rem; }
  .clients-table .data-table { min-width: 0; table-layout: fixed; }
  .clients-table .data-table th:nth-child(n+3), .clients-table .data-table td:nth-child(n+3) { display: none; }
  .clients-table .data-table td, .clients-table .data-table th { width: 50%; padding: 11px 8px; overflow-wrap: anywhere; }
}
