:root {
  color-scheme: dark;
  --bg: #0c0c0c;
  --surface: #121212;
  --surface-2: #1b1b1b;
  --surface-3: #202020;
  --line: #313134;
  --line-soft: #252528;
  --text: #e8eaed;
  --muted: #a8abb0;
  --faint: #74777d;
  --orange: #ff7b13;
  --orange-soft: rgba(255, 123, 19, 0.18);
  --blue: #8ab4f8;
  --blue-dark: #1f5b8e;
  --danger: #f87171;
  --ready: #a8d879;
  --radius: 8px;
  --topbar: 56px;
  --month-strip: 0px;
  --week-col: 48px;
  --day-row-min: 112px;
  --calendar-grid-columns: var(--week-col) repeat(7, minmax(0, 1fr));
  font-family: "Google Sans", "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  overflow-x: hidden;
}

body.app-locked .app-shell {
  pointer-events: none;
  filter: saturate(.7) brightness(.55);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  min-height: 100dvh;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.app-login-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 123, 19, .14), transparent 34%),
    #0c0c0c;
}

.app-login-screen[hidden] {
  display: none;
}

.app-login-card {
  width: min(420px, 100%);
  border: 1px solid #333437;
  border-radius: 12px;
  background: #171717;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .55);
  padding: 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-brand strong {
  color: #f1f3f4;
  font-size: 22px;
  font-weight: 600;
}

.login-brand strong span {
  color: var(--orange);
}

.login-brand p,
.modal-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-error {
  margin: 0 0 12px;
  color: #fecaca;
  font-size: 13px;
}

.topbar {
  height: var(--topbar);
  border-bottom: 1px solid var(--line-soft);
  background: #121212;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-left {
  flex: 1 1 auto;
}

.topbar-right {
  flex: 0 0 auto;
}

.topbar-left h1 {
  margin: 0 0 0 6px;
  font-size: 20px;
  font-weight: 400;
  color: #f1f3f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: 14px;
  flex: 0 0 auto;
}

.brand-title {
  font-size: 15px;
  color: #f1f3f4;
}

.calendar-mark {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: #202020;
  border: 1px solid #3c4043;
  border-bottom: 2px solid var(--orange);
  color: white;
  font-size: 11px;
  font-weight: 700;
}

.icon-button,
.nav-button,
.tiny-button {
  border: 0;
  background: transparent;
  min-width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #bdc1c6;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.tiny-button {
  min-width: 26px;
  height: 26px;
  font-size: 17px;
}

.icon-button:hover,
.nav-button:hover,
.tiny-button:hover {
  background: #2a2b2f;
}

.icon-button:active,
.nav-button:active,
.tiny-button:active,
.today-button:active,
.primary-button:active,
.create-button:active,
.fab:active {
  transform: scale(.97);
}

.today-button {
  border: 1px solid #3c4043;
  background: transparent;
  border-radius: 18px;
  color: #e8eaed;
  padding: 7px 15px;
  cursor: pointer;
  transition: background 140ms ease;
}

.today-button:hover {
  background: #26272b;
}

.segmented {
  display: flex;
  align-items: center;
  border: 1px solid #3c4043;
  border-radius: 18px;
  overflow: hidden;
  background: #171717;
}

.segmented button {
  border: 0;
  background: transparent;
  color: #e8eaed;
  padding: 7px 13px;
  cursor: pointer;
  min-width: 62px;
}

.segmented button.active {
  background: #2c2d31;
  color: white;
}

.profile-button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 123, 19, .45);
  background: linear-gradient(145deg, #2a2018 0%, #202020 52%, #ff7b13 140%);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  display: inline-grid;
  place-content: center;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 4px 14px rgba(0,0,0,.35);
  overflow: hidden;
}

.profile-button span {
  display: block;
  transform: translateY(.5px);
}

.month-strip {
  display: none;
  height: 56px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line-soft);
  background: #292a2f;
}

.month-strip::-webkit-scrollbar {
  display: none;
}

.month-strip button {
  min-width: 76px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid #6d7078;
  background: transparent;
  color: #e8eaed;
  font-size: 18px;
  cursor: pointer;
}

.month-strip button.active {
  background: #1f5b8e;
  border-color: #1f5b8e;
}

.workspace {
  display: flex;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  flex: 1;
}

.sidebar {
  width: 256px;
  flex-shrink: 0;
  border-right: 1px solid var(--line-soft);
  background: #101010;
  padding: 12px 14px;
  overflow-y: auto;
}

.create-button {
  height: 48px;
  border: 0;
  border-radius: 24px;
  background: #303134;
  color: #f1f3f4;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0 19px;
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
  cursor: pointer;
  margin-bottom: 18px;
}

.create-button svg {
  color: var(--orange);
}

.sidebar-section,
.mini-calendar {
  margin-bottom: 20px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #e8eaed;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
}

.mini-weekdays,
.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mini-weekdays span {
  color: #9aa0a6;
  text-align: center;
  font-size: 10px;
  padding: 2px 0 6px;
}

.mini-grid button {
  border: 0;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  margin: auto;
  background: transparent;
  color: #bdc1c6;
  cursor: pointer;
  font-size: 11px;
}

.mini-grid button.outside {
  color: #5f6368;
}

.mini-grid button.today {
  background: var(--orange);
  color: white;
  box-shadow: 0 0 0 1px rgba(255,123,19,.35), 0 0 16px rgba(255,123,19,.25);
}

.mini-grid button.selected {
  outline: 1px solid var(--orange);
  color: white;
}

.calendar-list {
  display: grid;
  gap: 7px;
}

.calendar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  padding: 6px 4px;
  color: #dadce0;
  font-size: 13px;
}

.calendar-item:hover {
  background: #202124;
}

.calendar-item input[type="checkbox"] {
  accent-color: var(--cal-color);
  width: 16px;
  height: 16px;
}

.calendar-item .swatch {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
}

.side-link {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: #dadce0;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
  margin: 2px 0;
}

.side-link:hover,
.side-link.active {
  background: #26354f;
}

.content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  background: var(--surface);
  display: flex;
}

.calendar-view {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.weekday-row {
  display: grid;
  grid-template-columns: var(--calendar-grid-columns);
  height: 36px;
  border-bottom: 1px solid var(--line-soft);
  background: #121212;
}

.weekday-row span {
  display: grid;
  place-items: center;
  color: #9aa0a6;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--calendar-grid-columns);
  grid-auto-rows: minmax(var(--day-row-min), 1fr);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--line-soft);
  gap: 1px;
}

.week-number {
  background: #121212;
  color: #9aa0a6;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14px;
  min-width: 0;
}

.day-cell {
  min-width: 0;
  max-width: 100%;
  background: #121212;
  padding: 7px 6px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.day-cell:hover {
  background: #171717;
}

.day-cell.outside {
  background: #101010;
}

.date-number {
  color: #bdc1c6;
  font-size: 12px;
  min-height: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  margin: 0 auto 3px;
}

.day-cell.outside .date-number {
  color: #6f7378;
}

.date-number.today {
  background: var(--orange);
  color: white;
  border-radius: 50%;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(255,123,19,.35), 0 0 16px rgba(255,123,19,.25);
}

.event-stack {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.event-pill {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 18px;
  border-radius: 3px;
  padding: 2px 5px;
  color: #111;
  background: var(--event-color);
  font-size: 11px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  pointer-events: auto;
}

.event-pill .label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-pill.muted {
  opacity: .68;
}

.event-pill .time {
  flex: 0 0 auto;
  font-weight: 700;
}

.more-events {
  color: #bdc1c6;
  font-size: 11px;
  padding-left: 5px;
}

.week-day-column,
.day-column {
  background: #121212;
  min-height: 0;
  padding: 8px;
  overflow: auto;
}

.week-day-column h3,
.day-column h3 {
  font-size: 13px;
  font-weight: 500;
  color: #e8eaed;
  margin: 0 0 10px;
}

.agenda-event {
  position: relative;
  z-index: 2;
  border-left: 4px solid var(--event-color);
  background: #1b1b1b;
  border-radius: 6px;
  padding: 9px;
  margin-bottom: 8px;
  cursor: pointer;
  pointer-events: auto;
}

.agenda-event strong {
  display: block;
  font-size: 13px;
}

.agenda-event span {
  color: #a8abb0;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.data-view {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  padding: 22px;
  background: #121212;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 16px;
}

.view-header h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 500;
}

.view-header p {
  margin: 0;
  color: #a8abb0;
  font-size: 13px;
}

.view-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.danger-button {
  border: 0;
  border-radius: 8px;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 600;
}

.primary-button {
  background: var(--orange);
  color: #1c1005;
}

.ghost-button {
  background: #2a2b2f;
  color: #e8eaed;
}

.danger-button {
  background: rgba(248, 113, 113, .12);
  color: var(--danger);
}

.filter-row {
  margin-bottom: 12px;
}

.filter-row input,
.field input,
.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #3c4043;
  background: #151515;
  color: #e8eaed;
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
  outline: none;
  resize: vertical;
}

.filter-row input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--orange);
}

.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  padding: 12px;
  font-size: 13px;
}

th {
  color: #9aa0a6;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.data-card,
.billing-card {
  border: 1px solid var(--line-soft);
  background: #171717;
  border-radius: 8px;
  padding: 14px;
}

.data-card h3,
.billing-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.data-card p,
.billing-card p {
  margin: 3px 0;
  color: #a8abb0;
  font-size: 12px;
}

.empty-state {
  color: var(--muted);
  border-style: dashed;
}

.empty-state h3 {
  color: var(--text);
}

.empty-state.compact {
  border: 1px dashed var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 12px;
  padding: 0 9px;
  font-size: 11px;
  border: 1px solid;
}

.status.planned {
  color: #f7b267;
  border-color: rgba(247, 178, 103, .35);
  background: rgba(247, 178, 103, .1);
}

.status.ready {
  color: var(--ready);
  border-color: rgba(168, 216, 121, .35);
  background: rgba(168, 216, 121, .1);
}

.status.invoiced {
  color: #c7c9cc;
  border-color: rgba(199, 201, 204, .3);
  background: rgba(199, 201, 204, .08);
}

.billing-list {
  display: grid;
  gap: 12px;
}

.billing-lines {
  margin-top: 12px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  display: grid;
  gap: 5px;
}

.billing-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #dadce0;
}

.billing-total {
  color: var(--orange);
  font-weight: 800;
}

.fab {
  position: fixed;
  right: max(24px, calc(env(safe-area-inset-right) + 16px));
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  width: 58px;
  height: 58px;
  border-radius: 18px;
  border: 0;
  background: #aecbfa;
  color: #174ea6;
  display: none;
  place-items: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
  cursor: pointer;
}

.fab svg {
  width: 28px;
  height: 28px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 30;
}

.drawer {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: min(360px, 92vw);
  max-width: 100vw;
  background: #111113;
  border-right: 1px solid var(--line-soft);
  transform: translateX(-102%);
  transition: transform 180ms ease;
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: 100dvh;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

.drawer.open {
  transform: translateX(0);
}

.drawer-brand,
.drawer-account {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.google-style-title {
  font-size: 22px;
  color: #e8eaed;
}

.google-style-title span {
  color: var(--orange);
}

.google-style-title strong {
  color: #e8eaed;
  font-weight: 500;
  margin-left: 3px;
}

.drawer-links {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.drawer-links button {
  width: 100%;
  border: 0;
  border-radius: 0 28px 28px 0;
  background: transparent;
  color: #e8eaed;
  min-height: 52px;
  text-align: left;
  padding-left: 54px;
  font-size: 18px;
  cursor: pointer;
}

.drawer-links button:hover,
.drawer-links button.active {
  background: #1f5b8e;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  max-width: min(920px, calc(100vw - 24px));
  width: 100%;
  max-height: calc(100dvh - 24px);
}

.modal::backdrop {
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: 100%;
  max-width: 100%;
  background: #1b1b1b;
  border: 1px solid #3c4043;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  max-height: calc(100dvh - 34px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

.modal-card.narrow {
  max-width: 440px;
  margin: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  color: #bdc1c6;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.span-2 {
  grid-column: span 2;
}

.checkbox-panel {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  margin: 6px 0 14px;
  padding: 12px;
}

.checkbox-panel legend {
  padding: 0 6px;
  color: #bdc1c6;
  font-size: 12px;
  font-weight: 700;
}

.checkbox-panel > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #e8eaed;
  font-size: 13px;
}

.check-row input {
  accent-color: var(--orange);
}

.material-inputs {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
}

.meter-rate-list,
.meter-entry-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.meter-rate-row,
.meter-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .8fr) auto auto;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.meter-entry-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .7fr) minmax(86px, auto) auto;
}

.meter-rate-row .field,
.meter-entry-row .field {
  margin-bottom: 0;
}

.meter-entry-row p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.calculated-time {
  align-self: end;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 123, 19, .22);
  border-radius: 8px;
  color: #ffd1aa;
  background: rgba(255, 123, 19, .08);
  font-size: 13px;
  font-weight: 700;
}

.event-quick-mode .event-edit-only {
  display: none;
}

.event-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #151515;
}

.event-summary div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.event-summary strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
}

.event-summary span,
.event-summary a {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.event-summary a {
  color: #ffd1aa;
  text-decoration: none;
}

.material-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 10px;
  align-items: end;
}

.add-material-row,
.event-case-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.add-material-row select {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  border: 1px solid #3c4043;
  background: #151515;
  color: #e8eaed;
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
}

.event-case-actions {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.live-total,
.invoice-preview {
  background: rgba(255, 123, 19, .08);
  border: 1px solid rgba(255, 123, 19, .22);
  color: #ffd1aa;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  margin: 10px 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.modal-actions .danger-button {
  margin-right: auto;
}

.modal-actions.single {
  grid-template-columns: 1fr;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #121212;
}

::-webkit-scrollbar-thumb {
  background: #3c4043;
  border-radius: 10px;
  border: 2px solid #121212;
}

@media (max-width: 1024px) {
  :root {
    --month-strip: 56px;
    --week-col: 42px;
    --day-row-min: 106px;
  }

  .brand-lockup .brand-title,
  .today-button,
  .nav-button,
  .search-desktop {
    display: none;
  }

  .topbar {
    height: 64px;
    background: #303134;
    border-bottom-color: #45474c;
    gap: 8px;
  }

  .topbar-left h1 {
    font-size: clamp(18px, 2.2vw, 22px);
    text-transform: lowercase;
  }

  .segmented {
    display: none;
  }

  .month-strip {
    display: flex;
  }

  .sidebar {
    display: none;
  }

  .weekday-row {
    height: 34px;
    background: #202124;
  }

  .calendar-grid {
    grid-auto-rows: minmax(var(--day-row-min), 1fr);
  }

  .week-number {
    background: #3f4449;
    font-size: 16px;
  }

  .day-cell,
  .day-cell.outside {
    background: #202124;
  }

  .date-number {
    font-size: 16px;
    width: 28px;
    height: 28px;
  }

  .event-pill {
    font-size: 11.5px;
    min-height: 18px;
    padding: 2px 4px;
  }

  .fab {
    display: grid;
  }

  .data-view {
    padding: 16px;
  }
}

@media (max-width: 768px) {
  :root {
    --week-col: 38px;
    --day-row-min: 102px;
  }

  .event-pill .time {
    display: none;
  }
}

@media (max-width: 600px) {
  :root {
    --week-col: 36px;
    --day-row-min: 98px;
  }

  .topbar {
    padding: 0 8px;
    height: 62px;
  }

  .topbar-left {
    gap: 6px;
  }

  .topbar-left h1 {
    font-size: clamp(17px, 5vw, 21px);
    margin-left: 2px;
    max-width: 34vw;
  }

  .topbar-right {
    gap: 4px;
  }

  .brand-lockup {
    margin-right: 2px;
  }

  .icon-button {
    min-width: 34px;
    height: 34px;
  }

  .calendar-mark {
    width: 25px;
    height: 25px;
    min-width: 25px;
  }

  .profile-button {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .month-strip {
    height: 52px;
    gap: 8px;
    padding: 7px 10px;
  }

  .month-strip button {
    min-width: 70px;
    height: 36px;
    font-size: 15px;
  }

  .calendar-grid {
    grid-auto-rows: minmax(var(--day-row-min), 1fr);
  }

  .weekday-row {
    height: 32px;
  }

  .weekday-row span {
    font-size: 10px;
  }

  .week-number {
    font-size: 14px;
    padding-top: 12px;
  }

  .day-cell {
    padding: 5px 3px;
  }

  .date-number {
    width: 25px;
    height: 25px;
    min-height: 25px;
    font-size: 13px;
    margin-bottom: 2px;
  }

  .event-stack {
    gap: 2px;
  }

  .event-pill {
    min-height: 17px;
    padding: 1px 3px;
    font-size: 10.5px;
    border-radius: 3px;
  }

  .event-pill .label {
    display: block;
  }

  .more-events {
    font-size: 10px;
    padding-left: 3px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field input,
  .field select,
  .field textarea,
  .add-material-row select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .span-2 {
    grid-column: span 1;
  }

  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions span {
    display: none;
  }

  .modal-actions .danger-button {
    margin-right: 0;
    order: 5;
  }

  .material-row {
    grid-template-columns: 1fr;
  }

  .add-material-row,
  .event-case-actions {
    grid-template-columns: 1fr;
  }

  .view-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal {
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .modal-card {
    padding: 14px;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-actions {
    gap: 8px;
  }

  .meter-rate-row,
  .meter-entry-row {
    grid-template-columns: 1fr;
  }

  .meter-entry-row p {
    margin-bottom: 0;
  }
}

@media (max-width: 430px) {
  :root {
    --week-col: 34px;
    --day-row-min: 94px;
  }

  .topbar-left h1 {
    max-width: 30vw;
  }

  .month-strip button {
    min-width: 64px;
    font-size: 14px;
  }

  .event-pill {
    font-size: 10px;
    padding-inline: 2px;
  }
}

@media (max-width: 360px) {
  :root {
    --week-col: 30px;
    --day-row-min: 88px;
  }

  .topbar {
    padding: 0 6px;
    gap: 4px;
  }

  .topbar-left,
  .topbar-right {
    gap: 3px;
  }

  .topbar-left h1 {
    max-width: 26vw;
    font-size: 17px;
  }

  .icon-button {
    min-width: 31px;
    height: 31px;
  }

  .profile-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 10.5px;
  }

  .calendar-mark {
    width: 23px;
    height: 23px;
    min-width: 23px;
    font-size: 10px;
  }

  .month-strip {
    gap: 6px;
    padding-inline: 8px;
  }

  .month-strip button {
    min-width: 58px;
    font-size: 13px;
  }

  .day-cell {
    padding-inline: 2px;
  }

  .date-number {
    width: 23px;
    height: 23px;
    min-height: 23px;
    font-size: 12px;
  }

  .event-pill {
    font-size: 9.5px;
    min-height: 16px;
  }
}
