:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --line: #dbe2ea;
  --text: #102033;
  --muted: #5b6b7c;
  --brand: #2563eb;
  --danger: #dc2626;
  --dark: #0f172a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--brand);
  color: white;
  cursor: pointer;
}
button:disabled { opacity: .6; cursor: default; }
button.ghost {
  width: 100%;
  background: rgba(255,255,255,.08);
  color: #dbeafe;
  text-align: left;
}
button.danger { color: #fecaca; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(59,130,246,.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(16,185,129,.14), transparent 26%),
    #0b1020;
}
.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 24px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.login-card h1 { margin: 0 0 6px; }
.login-card p { margin: 0 0 20px; color: var(--muted); }
label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  font-weight: 600;
}
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
}
.login-card button { width: 100%; margin-top: 8px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}
.sidebar {
  background: var(--dark);
  color: #dbeafe;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.brand {
  padding: 8px 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-title {
  font-weight: 800;
  font-size: 22px;
}
.brand-subtitle {
  color: #93c5fd;
  font-size: 13px;
  margin-top: 4px;
}
.nav {
  display: grid;
  gap: 4px;
}
.nav button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
}
.nav button.active,
.nav button:hover {
  background: rgba(255,255,255,.1);
}
.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: #bfdbfe;
}
.main {
  min-width: 0;
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: start;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.page-head h1 {
  margin: 0;
  font-size: 28px;
}
.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
}
.cards {
  display: grid;
  grid-template-columns: repeat( auto-fit, minmax(180px, 1fr) );
  gap: 12px;
}
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15,23,42,.05);
}
.card {
  padding: 16px;
}
.card-title {
  color: var(--muted);
  font-size: 13px;
}
.card-value {
  font-size: 25px;
  font-weight: 800;
  margin-top: 8px;
}
.panel {
  padding: 16px;
  overflow: auto;
}
.panel h2 {
  margin: 0 0 12px;
}
.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e0ecff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}
.alert {
  padding: 12px 14px;
  border-radius: 14px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.loading {
  padding: 10px 12px;
  border-radius: 14px;
  background: #eff6ff;
  color: #1d4ed8;
}
.empty {
  min-height: 50vh;
  display: grid;
  place-items: center;
  text-align: center;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }
  .nav {
    grid-template-columns: repeat(3, 1fr);
  }
  .sidebar-footer {
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
  }
  .grid-two {
    grid-template-columns: 1fr;
  }
  .main {
    padding: 14px;
  }
}

/* Modal forms */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(86vh, 900px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, .35);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 21px;
}

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

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.modal-form {
  padding: 20px;
}

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

.form-field {
  margin: 0;
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: var(--text);
}

.form-field span,
.check-field span {
  font-size: 13px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.form-field textarea {
  resize: vertical;
}

.form-field-full {
  grid-column: 1 / -1;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.check-field input {
  width: 18px;
  height: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
}

button.secondary {
  background: #eef2f7;
  color: var(--text);
}

@media (max-width: 720px) {
  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
  }

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

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}

/* Offer document modal */
.form-field select,
.line-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.form-field select:focus,
.line-row input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.line-editor {
  grid-column: 1 / -1;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.line-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.line-editor-head h3 {
  margin: 0;
  font-size: 17px;
}

.line-editor-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.line-list {
  display: grid;
  gap: 10px;
}

.line-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(90px, .55fr) minmax(120px, .7fr) minmax(110px, .7fr) 38px;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.line-row label {
  margin: 0;
  display: grid;
  gap: 6px;
}

.line-row label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.line-sum {
  min-height: 43px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-weight: 800;
  white-space: nowrap;
}

.line-total,
.document-total {
  margin-top: 10px;
  text-align: right;
  color: var(--muted);
  font-weight: 700;
}

.document-total {
  color: var(--text);
  font-size: 18px;
}

.empty-line {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255,255,255,.65);
}

button.small {
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 12px;
}

button.danger-light {
  background: #fee2e2;
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

@media (max-width: 900px) {
  .line-row {
    grid-template-columns: 1fr 1fr;
  }
  .line-sum {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .line-editor-head {
    display: grid;
  }
  .line-row {
    grid-template-columns: 1fr;
  }
  .line-row button {
    width: 100%;
  }
}


/* Task + report modal additions */
.modal-card-wide {
  width: min(1040px, 100%);
}

.line-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.line-row select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.material-line-row {
  grid-template-columns: minmax(170px, 1.25fr) minmax(150px, 1fr) minmax(80px, .55fr) minmax(95px, .65fr) minmax(95px, .65fr) minmax(120px, .8fr) minmax(100px, .7fr) 38px;
}

.service-line-row {
  grid-template-columns: minmax(260px, 1.6fr) minmax(90px, .55fr) minmax(120px, .7fr) minmax(110px, .7fr) 38px;
}

.document-lines-editor {
  margin-top: 16px;
}

@media (max-width: 1100px) {
  .material-line-row,
  .service-line-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .material-line-row,
  .service-line-row {
    grid-template-columns: 1fr;
  }
}


/* Dashboard v2 fixes */
/* Dashboard v2 */
.dashboard-head .actions,
.page-head .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.dashboard-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15,23,42,.05);
}

.dashboard-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-panel-head h2 {
  margin: 0;
  font-size: 20px;
}

.dashboard-panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.work-list {
  display: grid;
  gap: 10px;
}

.work-card {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.work-card:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, .45);
  box-shadow: 0 10px 22px rgba(15,23,42,.08);
}

.work-card-top,
.work-foot,
.debt-object-head,
.debt-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.work-title {
  min-width: 0;
  font-weight: 800;
  color: var(--text);
}

.work-meta,
.work-note,
.work-foot {
  color: var(--muted);
  font-size: 13px;
}

.work-foot strong,
.work-card-top strong {
  color: var(--text);
  white-space: nowrap;
}

.empty-mini,
.detail-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #f8fafc;
}

.status-planned { background: #e0ecff; color: #1d4ed8; }
.status-completed, .paid-pill { background: #dcfce7; color: #166534; }
.status-cancelled, .unpaid-pill { background: #fee2e2; color: #991b1b; }

.detail-body {
  padding: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.detail-main h3 {
  margin: 0 0 6px;
  font-size: 23px;
}

.detail-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.detail-main p {
  margin: 0 0 14px;
  line-height: 1.45;
}

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

.detail-fields > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.detail-fields span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-side {
  display: grid;
  gap: 10px;
}

.detail-lines,
.debt-object {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.detail-lines h4 {
  margin: 0 0 10px;
}

.detail-line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.detail-line-row:last-child {
  border-bottom: 0;
}

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

.debt-object-head {
  margin-bottom: 10px;
}

.debt-report {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
}

.debt-report + .debt-report {
  margin-top: 8px;
}

.debt-lines {
  color: var(--muted);
  font-size: 13px;
  display: grid;
  gap: 3px;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .dashboard-head,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }
  .dashboard-head .actions,
  .page-head .actions {
    justify-content: stretch;
  }
  .dashboard-head .actions button,
  .page-head .actions button {
    flex: 1;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-fields {
    grid-template-columns: 1fr;
  }
  .detail-line-row {
    grid-template-columns: 1fr;
  }
}

/* Awaiting payment search */
.search-button {
  flex: 0 0 auto;
  font-size: 22px;
  font-weight: 800;
}

.awaiting-search-form {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

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

.filter-grid .form-field select,
.filter-grid .form-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
}

.filter-check {
  grid-column: 1 / -1;
  margin: 0;
}

.filter-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.awaiting-search-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.summary-tile {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.summary-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-tile strong {
  font-size: 20px;
}

.awaiting-search-results {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.awaiting-search-results h3 {
  margin: 0;
  font-size: 17px;
}

.awaiting-client-group,
.awaiting-date-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.awaiting-group-head,
.awaiting-object-row,
.awaiting-date-head,
.compact-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.awaiting-object-row,
.compact-line {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.awaiting-object-row span,
.compact-line span,
.awaiting-date-head span {
  color: var(--muted);
  font-size: 13px;
}

.compact-lines h3 {
  margin-top: 10px;
}

.awaiting-detail-report {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}

.awaiting-detail-report:hover {
  border-color: rgba(37, 99, 235, .45);
}

.awaiting-debug-line {
  padding: 6px 8px;
  border-radius: 10px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .filter-grid,
  .awaiting-search-summary,
  .awaiting-group-head,
  .awaiting-object-row,
  .awaiting-date-head,
  .compact-line {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    flex-direction: column;
  }
}

/* Awaiting payment search v2 */
.filter-grid .form-field-full {
  grid-column: 1 / -1;
}

.awaiting-search-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.awaiting-warning {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #fde68a;
  border-radius: 16px;
  background: #fffbeb;
  color: #92400e;
  margin: 14px 0;
}

.awaiting-warning p {
  margin: 0;
  color: #92400e;
  font-size: 13px;
}

.duplicate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.7);
}

.awaiting-report-totals,
.awaiting-report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.awaiting-report-totals span {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.awaiting-report-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

@media (max-width: 980px) {
  .awaiting-search-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .awaiting-search-summary,
  .duplicate-row {
    grid-template-columns: 1fr;
  }
  .awaiting-report-actions button {
    flex: 1;
  }
}

/* Server-backed feature parity */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.entity-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.entity-card-active {
  border-color: rgba(22, 163, 74, .45);
  box-shadow: 0 8px 24px rgba(22, 163, 74, .08);
}

.entity-card h2,
.entity-card p {
  margin: 0;
}

.entity-card-head,
.panel-title,
.sub-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.entity-card-head p,
.entity-card .muted {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.panel-title {
  align-items: center;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0;
}

.metric-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fafc;
}

.metric-strip span {
  color: var(--muted);
  font-size: 13px;
}

.sub-list {
  display: grid;
  gap: 8px;
}

.sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.sub-row:last-child {
  border-bottom: 0;
}

.sub-row > span:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.sub-row small,
td small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.ranking-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.ranking-row:last-child {
  border-bottom: 0;
}

.ranking-row small {
  color: var(--muted);
}

.pill-success {
  background: #dcfce7;
  color: #166534;
}

.pill-danger {
  background: #fee2e2;
  color: #991b1b;
}

button.success {
  background: #15803d;
  color: #fff;
}

button.icon-action {
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 10px;
}

button.icon-action svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  pointer-events: none;
}

button.icon-action-edit {
  color: #245748;
}

button.icon-action-delete {
  color: #b42318;
}

button.icon-action-delete:hover {
  background: #fee4e2;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.filter-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filter-panel input,
.filter-panel select {
  width: 100%;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.calendar-toolbar h2 {
  min-width: 220px;
  margin: 0;
  text-align: center;
  text-transform: capitalize;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
}

.calendar-weekdays span {
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.calendar-grid {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.calendar-day {
  min-height: 130px;
  padding: 8px;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-empty {
  background: #f8fafc;
}

.calendar-today {
  background: #f0fdf4;
  box-shadow: inset 0 0 0 2px #22c55e;
}

.calendar-number {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 6px;
  border-radius: 50%;
}

.calendar-today .calendar-number {
  background: #15803d;
  color: #fff;
}

.calendar-items {
  display: grid;
  gap: 5px;
}

button.calendar-item {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 0;
  padding: 6px 7px;
  border-radius: 8px;
  background: #edf6f1;
  color: #173d2d;
  font-size: 11px;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
}

.calendar-item small {
  color: #526c60;
}

.travel-stop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.travel-stop:last-child {
  border-bottom: 0;
}

.travel-stop > span:first-child {
  display: grid;
  min-width: 180px;
}

.travel-stop small {
  color: var(--muted);
}

@media (max-width: 820px) {
  .sidebar {
    max-height: 52vh;
    overflow-y: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-head,
  .entity-card-head,
  .sub-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .actions {
    flex-wrap: wrap;
  }

  .filter-panel {
    grid-template-columns: 1fr;
  }

  .calendar-weekdays,
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(86px, 1fr));
    min-width: 680px;
  }

  .calendar-grid {
    overflow: visible;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  button,
  .actions,
  .loading,
  .alert {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .panel,
  .card,
  .entity-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
