:root {
  font-family: "Manrope", sans-serif;
  color: #1f2933;
  background: #f4f5f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #1f2933;
  --muted: #7b858e;
  --line: #e5e8e3;
  --paper: #fff;
  --canvas: #f4f5f2;
  --blue: #244fb4;
  --red: #e33e2b;
  --green: #27876a;
  --orange: #d58831;
  --mono: "DM Mono", monospace;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #82a0ef; outline-offset: 2px; }
#app[hidden], #login-screen[hidden] { display: none !important; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #f4f5f2 0%, #edf3ff 100%); }
.auth-card { width: min(100%, 420px); background: rgba(255, 255, 255, 0.96); border: 1px solid #e7ebf0; border-radius: 18px; box-shadow: 0 20px 60px rgba(25, 42, 65, 0.12); padding: 32px 28px 26px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-kicker { margin: 0 0 4px; color: #7e8a94; font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.auth-card h1 { margin: 0; font-size: 32px; line-height: 1.1; }
.auth-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.auth-form { margin-top: 26px; display: grid; gap: 18px; }
.auth-field { display: grid; gap: 8px; color: #3d4952; font-size: 11px; font-weight: 700; }
.auth-field input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #dfe5ec; border-radius: 10px; background: #f8fafc; color: var(--ink); }
.login-error { min-height: 18px; margin: -6px 0 0; color: var(--red); font-size: 12px; font-weight: 700; }
.auth-submit { width: 100%; min-height: 44px; }
.auth-footer { margin: 18px 0 0; color: #6d7881; font-size: 13px; text-align: center; }
.auth-footer strong { color: #36414a; font-weight: 700; }
.topbar { height: 68px; background: #fff; border-bottom: 1px solid #e9ebe7; display: flex; align-items: center; padding: 0 clamp(20px, 4vw, 64px); gap: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--blue); color: white; font-size: 20px; font-weight: 800; border-radius: 9px 9px 9px 2px; }
.brand-mark span { color: #ffc34d; }
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: 0; }
.brand-name span { color: var(--blue); font-weight: 600; }
.main-nav { height: 100%; display: flex; align-items: stretch; gap: 28px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 9px; padding: 0 3px; border: 0; background: none; color: #77808a; font-size: 12px; font-weight: 700; }
.nav-link svg { width: 16px; height: 16px; }
.nav-link.active { color: var(--blue); }
.nav-link.active::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--blue); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.company-chip { display: flex; align-items: center; gap: 8px; color: #59636e; font-size: 11px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; background: #4da77b; border-radius: 50%; box-shadow: 0 0 0 3px #e5f3eb; }
.avatar-button { border: 0; width: 34px; height: 34px; border-radius: 50%; background: #fae6df; color: #bb4a35; font-size: 11px; font-weight: 800; }
.logout-button { border: 1px solid #e4e8ee; background: #fff; border-radius: 8px; color: #46515d; padding: 8px 12px; font-size: 10px; font-weight: 700; }
.admin-panel.hidden, .hidden { display: none !important; }
.admin-panel { margin-bottom: 18px; padding: 20px 18px; border: 1px solid #e6e8e4; border-radius: 7px; background: #fff; box-shadow: 0 2px 5px #27333a08; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.admin-header h2 { font-size: 20px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-card { border: 1px solid #edf0ec; border-radius: 8px; background: #f9fbfd; padding: 16px; }
.admin-card h3 { margin: 0 0 14px; font-size: 14px; }
.list-stack { display: grid; gap: 10px; }
.admin-list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid #e7ebf0; border-radius: 8px; background: #fff; }
.admin-list-item strong { display: block; font-size: 12px; }
.admin-list-item span { color: var(--muted); font-size: 9px; text-transform: capitalize; }
.admin-actions { display: flex; gap: 8px; }
.admin-actions .icon-button { width: 28px; height: 28px; }
.danger-button { border-color: #f8d8d3; background: #fff5f2; color: #ca4a36; }
.page-shell { max-width: 1560px; margin: 0 auto; padding: 36px clamp(20px, 4vw, 64px) 22px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.eyebrow, .section-kicker { color: #929a9f; font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: 0; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.eyebrow-line { width: 18px; height: 2px; background: var(--red); }
h1, h2, p { margin: 0; }
h1 { font-size: 27px; line-height: 1.25; font-weight: 800; letter-spacing: 0; }
.page-heading p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid transparent; border-radius: 5px; font-size: 11px; font-weight: 700; transition: transform .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button svg { width: 15px; height: 15px; }
.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover { background: #1a419f; }
.button-quiet { min-height: 32px; background: #fff; border-color: var(--line); color: #535e68; }
.button-danger { background: #fff4f1; color: #bd4c3b; border-color: #f5d8d1; }
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card { position: relative; overflow: hidden; min-height: 112px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.metric-card::after { content: ""; position: absolute; width: 75px; height: 75px; top: -36px; right: -27px; border-radius: 50%; background: currentColor; opacity: .06; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: #757f89; font-size: 10px; font-weight: 700; }
.metric-top svg { width: 17px; height: 17px; color: currentColor; }
.metric-card strong { display: block; margin-top: 7px; color: var(--ink); font-family: var(--mono); font-size: 25px; font-weight: 500; line-height: 1.05; }
.metric-card small { display: block; margin-top: 5px; color: #939aa0; font-size: 9px; }
.metric-total { color: var(--blue); border-top: 2px solid var(--blue); }
.metric-contractors { color: var(--orange); border-top: 2px solid #e0a451; }
.metric-customers { color: var(--green); border-top: 2px solid #4b9d7b; }
.metric-open { color: var(--red); border-top: 2px solid #e66854; }
.workspace-panel, .info-panel { border: 1px solid #e6e8e4; border-radius: 7px; background: #fff; box-shadow: 0 2px 5px #27333a08; }
.workspace-panel { padding: 0 18px 13px; }
.toolbar { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border-bottom: 1px solid #edf0ec; }
.week-controls, .toolbar-tools { display: flex; align-items: center; gap: 8px; }
.week-label { display: flex; flex-direction: column; gap: 2px; margin: 0 9px; }
.week-label strong { font-size: 12px; }
.week-label span { color: #8b949b; font-size: 9px; }
.icon-button { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid #e7e9e6; border-radius: 5px; background: #fff; color: #59646e; }
.icon-button:hover { background: #f4f6f8; }
.icon-button svg { width: 15px; height: 15px; }
.today-button { margin-left: 2px; }
.search-box, .filter-select { min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #e7e9e6; border-radius: 5px; color: #8a939b; }
.search-box svg, .filter-select svg { width: 14px; height: 14px; flex: none; }
.search-box input, .filter-select select { min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: #36414a; font-size: 10px; }
.search-box input { width: 150px; }
.search-box input::placeholder { color: #a0a7ac; }
.filter-select select { max-width: 144px; cursor: pointer; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; padding-top: 14px; }
.week-grid.wide-view { grid-template-columns: minmax(0, 1fr); }
.view-toggle { display: inline-flex; padding: 2px; border: 1px solid #e7e9e6; border-radius: 5px; background: #f4f6f4; }
.view-toggle[hidden] { display: none; }
.view-toggle button { min-height: 28px; padding: 0 12px; border: 0; border-radius: 3px; background: transparent; color: #6d7881; font-size: 10px; font-weight: 700; cursor: pointer; }
.view-toggle button.active { background: #fff; color: var(--blue); box-shadow: 0 1px 3px #1f29331a; }
.week-grid.month-view { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-weekday { padding: 4px 6px; color: #8e979e; font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.month-day { min-height: 112px; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid #eceeeb; border-radius: 4px; background: #fbfcfa; }
.month-day.is-outside { background: #f6f7f5; opacity: .6; }
.month-day.is-today { border-color: #9bb1ec; background: #f7f9ff; opacity: 1; }
.month-day-head { display: flex; align-items: center; gap: 4px; }
.month-day-number { flex: 1; color: #29343d; font-size: 12px; font-weight: 800; }
.month-day.is-today .month-day-number { color: var(--blue); }
.month-add { width: 18px; height: 18px; border: 1px dashed #dfe3df; border-radius: 3px; background: transparent; color: #969fa4; font-size: 11px; line-height: 1; opacity: 0; }
.month-day:hover .month-add, .month-add:focus-visible { opacity: 1; }
.month-add:hover { border-color: #9bb1ec; color: var(--blue); }
.month-count { display: none; min-width: 19px; height: 19px; padding: 0; place-items: center; border: 0; border-radius: 10px; background: #e9eefc; color: var(--blue); font-family: var(--mono); font-size: 9px; font-weight: 700; }
.month-events { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.month-chip { overflow: hidden; width: 100%; padding: 3px 5px; border: 0; border-left: 2px solid var(--event-color, var(--blue)); border-radius: 3px; background: #fff; color: var(--ink); font-size: 9px; text-align: left; text-overflow: ellipsis; white-space: nowrap; box-shadow: 0 1px 2px #1f29330d; }
.month-chip b { color: #515e69; font-family: var(--mono); font-weight: 500; }
.month-chip:hover { background: #f6f8fc; }
.month-more { padding: 1px 4px; border: 0; background: transparent; color: var(--blue); font-size: 9px; font-weight: 700; text-align: left; }
.day-column { min-height: 245px; min-width: 0; padding: 10px 9px 9px; border: 1px solid #eceeeb; border-radius: 5px; background: #fbfcfa; }
.day-column.is-today { border-color: #9bb1ec; background: #f7f9ff; }
.day-heading { display: flex; justify-content: space-between; align-items: start; min-height: 39px; margin-bottom: 8px; }
.day-name { display: block; color: #8e979e; font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.day-number { display: block; margin-top: 2px; color: #29343d; font-size: 17px; font-weight: 800; line-height: 1; }
.day-month { color: #9aa1a5; font-size: 8px; }
.day-count { min-width: 19px; height: 19px; display: grid; place-items: center; border-radius: 10px; background: #eff1ee; color: #78828a; font-family: var(--mono); font-size: 9px; }
.appointment-list { display: grid; gap: 6px; }
.appointment-card { width: 100%; display: block; padding: 8px 8px 7px; border: 0; border-left: 2px solid var(--event-color, var(--blue)); border-radius: 3px; background: #fff; color: var(--ink); text-align: left; box-shadow: 0 1px 3px #1f29330d; }
.appointment-card:hover { background: #f6f8fc; box-shadow: 0 2px 7px #1f293318; }
.event-time { color: #515e69; font-family: var(--mono); font-size: 9px; font-weight: 500; }
.event-customer { overflow: hidden; margin-top: 4px; font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.event-type { overflow: hidden; margin-top: 2px; color: #7e8991; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.event-contractor { overflow: hidden; margin-top: 6px; color: #68747c; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.empty-day { padding: 12px 3px; color: #a6adaf; font-size: 9px; line-height: 1.5; }
.day-add { width: 100%; height: 24px; margin-top: 6px; border: 1px dashed #dfe3df; border-radius: 3px; background: transparent; color: #969fa4; font-size: 9px; }
.day-add:hover { border-color: #9bb1ec; color: var(--blue); }
.legend { display: flex; align-items: center; gap: 18px; margin-top: 12px; color: #7d878e; font-size: 9px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-blue { background: var(--blue); }.dot-orange { background: var(--orange); }.dot-green { background: var(--green); }
.legend-note { margin-left: auto; color: #a0a7ab; }
.legend-note svg { width: 12px; height: 12px; }
.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 15px; }
.info-panel { min-height: 145px; padding: 16px 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; }
.panel-heading h2 { margin-top: 4px; font-size: 13px; font-weight: 800; }
.panel-heading > svg { width: 17px; height: 17px; color: #a4adb0; }
.summary-content { display: flex; gap: 0; margin-top: 18px; }
.summary-stat { flex: 1; padding-left: 16px; border-left: 1px solid #e8ebe7; }
.summary-stat:first-child { padding-left: 0; border-left: 0; }
.summary-stat strong { display: block; font-family: var(--mono); font-size: 17px; font-weight: 500; }
.summary-stat span { display: block; margin-top: 3px; color: #879198; font-size: 9px; }
.next-content { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.next-date { width: 44px; height: 48px; display: grid; align-content: center; justify-items: center; border-radius: 4px; background: #f1f4fb; color: var(--blue); }
.next-date strong { font-family: var(--mono); font-size: 17px; font-weight: 500; }
.next-date span { font-size: 8px; text-transform: uppercase; }
.next-details { min-width: 0; }
.next-details strong, .next-details span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-details strong { font-size: 10px; }
.next-details span { margin-top: 4px; color: #859097; font-size: 9px; }
.next-time { margin-left: auto; color: #55616a; font-family: var(--mono); font-size: 10px; }
.no-next { margin-top: 22px; color: #879198; font-size: 10px; }
footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding: 18px 0 8px; border-top: 1px solid var(--line); color: #6d7881; font-size: 13px; }
footer strong { color: #36414a; font-weight: 700; }
.appointment-dialog { width: min(540px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 0; overflow: auto; border: 1px solid #e8eae6; border-radius: 8px; background: white; color: var(--ink); box-shadow: 0 18px 70px #17232c30; }
.appointment-dialog::backdrop { background: #17232c70; backdrop-filter: blur(2px); }
.appointment-dialog form { padding: 23px; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.dialog-header h2 { margin-top: 5px; font-size: 19px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.field { display: grid; gap: 6px; color: #5d6870; font-size: 10px; font-weight: 700; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea { width: 100%; min-height: 38px; padding: 9px 10px; border: 1px solid #dfe3df; border-radius: 4px; background: #fff; color: #27323a; font-size: 11px; }
.field textarea { min-height: 70px; resize: vertical; }
.optional { color: #a0a7aa; font-weight: 400; }
.dialog-footer { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.dialog-footer .button-primary { margin-left: auto; }
.form-message { color: #bd4c3b; font-size: 10px; }
.hidden { display: none !important; }
.list-view { margin-top: 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.list-row { display: grid; grid-template-columns: 105px 1.2fr 1fr 1fr 120px; align-items: center; gap: 15px; min-height: 59px; padding: 10px 16px; border-bottom: 1px solid #edf0ec; font-size: 10px; }
.list-row button { color: inherit; }
.list-row:last-child { border-bottom: 0; }
.list-view > button.list-row { width: 100%; border: 0; border-bottom: 1px solid #edf0ec; background: #fff; color: inherit; text-align: left; }
.list-view > button.list-row:hover { background: #f8faf9; }
.list-header { min-height: 38px; background: #fafbf9; color: #8a9399; font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.list-date { color: #59656e; font-family: var(--mono); }
.list-customer { font-weight: 800; }
.list-sub { display: block; margin-top: 3px; color: #8b959b; font-size: 9px; font-weight: 400; }
.type-pill { justify-self: start; padding: 5px 7px; border-radius: 3px; background: #f0f3fa; color: var(--blue); font-size: 9px; }
.team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.team-card { padding: 17px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.team-person { display: flex; align-items: center; gap: 11px; }
.team-avatar { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; background: #e9efff; color: var(--blue); font-size: 11px; font-weight: 800; }
.team-card:nth-child(3n + 2) .team-avatar { background: #f9eadb; color: #a86728; }
.team-card:nth-child(3n) .team-avatar { background: #e3f1e9; color: #2a7e5c; }
.team-person strong { display: block; font-size: 11px; }
.team-person span { display: block; margin-top: 3px; color: #89939a; font-size: 9px; }
.team-stats { display: flex; justify-content: space-between; margin-top: 17px; padding-top: 12px; border-top: 1px solid #edf0ec; color: #8a9399; font-size: 9px; }
.team-stats strong { color: #37434b; font-family: var(--mono); font-weight: 500; }
.empty-results { padding: 38px 15px; color: #8b959b; text-align: center; font-size: 11px; }

@media (max-width: 1050px) {
  .topbar { gap: 32px; padding-inline: 24px; }
  .page-shell { padding-inline: 24px; }
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .day-column { min-height: 205px; }
}
@media (max-width: 700px) {
  .topbar { height: auto; min-height: 60px; flex-wrap: wrap; justify-content: space-between; gap: 0; padding: 0 16px; }
  .brand { min-width: auto; height: 58px; }
  .brand-mark { width: 31px; height: 31px; }
  .topbar-right { margin-left: 0; }
  .company-chip { display: none; }
  .main-nav { order: 2; width: 100%; height: 45px; justify-content: space-around; gap: 10px; }
  .nav-link { font-size: 10px; }
  .page-shell { padding: 25px 14px 18px; }
  .page-heading { align-items: center; gap: 12px; margin-bottom: 17px; }
  h1 { font-size: 23px; }
  .page-heading p { max-width: 240px; font-size: 10px; line-height: 1.5; }
  .page-heading .button { width: 40px; min-width: 40px; height: 40px; padding: 0; }
  .page-heading .button span { display: none; }
  .page-heading .button svg { width: 18px; height: 18px; }
  .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .metric-card { min-height: 94px; padding: 13px; }
  .metric-card strong { font-size: 22px; }
  .workspace-panel { padding: 0 10px 11px; }
  .toolbar { align-items: flex-start; flex-direction: column; padding: 12px 0; gap: 11px; }
  .week-controls, .toolbar-tools { width: 100%; }
  .week-controls { gap: 6px; }
  .week-label { margin-inline: 5px; }
  .toolbar-tools > * { flex: 1; }
  .search-box input { width: 100%; }
  .filter-select select { width: 100%; max-width: none; }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding-top: 10px; }
  .day-column { min-height: 166px; padding: 8px; }
  .month-day { min-height: 54px; padding: 4px; }
  .month-chip, .month-more, .month-add { display: none; }
  .month-count { display: inline-grid; }
  .month-day-head { flex-direction: column; align-items: flex-start; }
  .legend { flex-wrap: wrap; gap: 9px 13px; font-size: 8px; }
  .legend-note { width: 100%; margin-left: 0; }
  .bottom-row { grid-template-columns: 1fr; gap: 9px; margin-top: 10px; }
  .info-panel { min-height: 125px; padding: 14px; }
  .summary-content { margin-top: 15px; }
  .summary-stat { padding-left: 10px; }
  .summary-stat strong { font-size: 15px; }
  .summary-stat span { font-size: 8px; }
  footer { flex-direction: column; gap: 4px; font-size: 12px; }
  .team-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .team-card { padding: 12px; }
  .team-stats { gap: 8px; font-size: 8px; }
  .list-view { overflow-x: auto; }
  .list-row { min-width: 670px; }
}
@media (max-width: 380px) {
  .week-grid { grid-template-columns: 1fr; }
  .day-column { min-height: auto; }
  .team-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }