:root {
  --navy: #071b33;
  --orange: #f7931e;
  --background: #f4f6f8;
  --panel: #ffffff;
  --line: #d9e0e7;
  --text: #17212b;
  --muted: #697586;
  --active: #137333;
  --inactive: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Aptos, Calibri, Arial, sans-serif;
  font-size: 15px;
}

a {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}

.app-header {
  position: relative;
  min-height: 74px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 34px;
  border-bottom: 5px solid var(--orange);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-link {
  display: block;
}

.brand img {
  display: block;
  width: 148px;
  height: auto;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 19px;
}

.brand span {
  margin-top: 3px;
  color: #c8d2df;
}

.user-initials-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.header-user-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

button.user-initials-badge {
  min-height: 34px;
  padding: 0;
  cursor: pointer;
}

button.user-initials-badge:hover {
  background: var(--orange);
  border-color: var(--orange);
}

.topnav {
  display: flex;
  gap: 8px;
}

.topnav a {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  padding: 9px 12px;
}

.topnav a.active {
  background: var(--orange);
  border-color: var(--orange);
}

.revenue-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.revenue-page .app-header {
  flex: 0 0 auto;
}

.revenue-page .page {
  width: 100%;
  flex: 1;
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  padding-top: 30px;
  padding-left: max(16px, calc((100vw - 1600px) / 2));
  padding-right: max(16px, calc((100vw - 1600px) / 2));
  padding-bottom: 60px;
  scrollbar-color: #c5ccd6 transparent;
  scrollbar-width: thin;
}

.revenue-page .page::-webkit-scrollbar {
  width: 8px;
}

.revenue-page .page::-webkit-scrollbar-track {
  background: transparent;
}

.revenue-page .page::-webkit-scrollbar-thumb {
  background: #c5ccd6;
  border-radius: 999px;
}

.page {
  width: min(1600px, calc(100% - 32px));
  margin: 30px auto 60px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.customer-heading-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.customer-heading-meta p {
  margin-top: 7px;
}

.edit-heading-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.delete-text-button {
  margin-top: 7px;
  border: 1px solid #e1aaa4;
  border-radius: 5px;
  padding: 3px 8px;
  color: var(--inactive);
  font-size: 12px;
  line-height: 1.3;
}

.delete-text-button:hover {
  border-color: var(--inactive);
  background: #fff0ed;
  color: var(--inactive);
}

.overview-heading h1,
.customer-detail-heading h1 {
  color: var(--orange);
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin: 0 0 18px;
  color: var(--navy);
  font-size: 20px;
  line-height: 1.2;
}

p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16, 41, 66, 0.07);
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--orange);
  color: #fff;
  padding: 10px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: #dc7f0c;
  color: #fff;
}

.button.secondary {
  background: #eef3f8;
  color: var(--navy);
  border: 1px solid #ccd6e0;
}

.button.secondary:hover {
  background: #e1e9f1;
}

.danger-button {
  background: var(--inactive);
  color: #fff;
}

.danger-button:hover {
  background: #8f1d14;
  color: #fff;
}

.customer-overview {
  padding: 8px 22px;
}

body.overview-page {
  overflow: hidden;
}

.overview-page .page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 112px);
  margin: 18px auto 0;
}

.overview-page .customer-overview {
  display: flex;
  flex: 1;
  min-height: 0;
}

.overview-scroll {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.overview-table {
  width: 100%;
  min-width: 1280px;
  table-layout: fixed;
}

.overview-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

.overview-table thead th {
  background: var(--navy);
  color: #ffffff;
}

.overview-table thead .sort-link {
  color: #ffffff;
}

.overview-table thead .sort-link:hover {
  color: #ffffff;
}

.overview-table thead .sort-arrow {
  color: #ffffff;
}

.overview-table th:nth-child(1),
.overview-table td:nth-child(1) {
  width: 5%;
}

.overview-table th:nth-child(2),
.overview-table td:nth-child(2) {
  width: 9%;
}

.overview-table th:nth-child(3),
.overview-table td:nth-child(3) {
  width: 31%;
  text-align: left;
}

.overview-table td:nth-child(3) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-table th:nth-child(4),
.overview-table td:nth-child(4) {
  width: 14%;
  text-align: left;
}

.overview-table th:nth-child(5),
.overview-table td:nth-child(5) {
  width: 17%;
  text-align: left;
}

.overview-table th:nth-child(3) .sort-link,
.overview-table th:nth-child(4) .sort-link,
.overview-table th:nth-child(5) .sort-link {
  justify-content: flex-start;
  text-align: left;
}

.overview-table th:nth-child(3) .sort-arrow,
.overview-table th:nth-child(4) .sort-arrow,
.overview-table th:nth-child(5) .sort-arrow {
  margin-left: 6px;
}

.overview-table th:nth-child(6),
.overview-table td:nth-child(6) {
  width: 7%;
}

.overview-table th:nth-child(7),
.overview-table td:nth-child(7) {
  width: 9%;
}

.overview-table th:nth-child(8),
.overview-table td:nth-child(8) {
  width: 8%;
}

.appointments-heading h1 {
  color: var(--orange);
}

.appointments-panel {
  padding: 8px 22px;
}

.appointments-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.appointments-table {
  table-layout: fixed;
}

.appointments-table thead,
.appointments-table tbody,
.appointments-table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.appointments-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
}

.appointments-table tbody {
  display: block;
  max-height: 650px;
  overflow-y: auto;
}

.appointments-table th,
.appointments-table td {
  vertical-align: middle;
  text-align: center;
}

.appointments-table th:nth-child(1),
.appointments-table td:nth-child(1) {
  width: 4%;
  padding-left: 4px;
  padding-right: 4px;
}

.appointments-table th:nth-child(2),
.appointments-table td:nth-child(2) {
  width: 10%;
  padding-left: 4px;
  padding-right: 6px;
}

.appointments-table th:nth-child(3),
.appointments-table td:nth-child(3) {
  width: 34%;
  text-align: left;
}

.appointments-table th:nth-child(4),
.appointments-table td:nth-child(4) {
  width: 15%;
}

.appointments-table th:nth-child(5),
.appointments-table td:nth-child(5) {
  width: 7%;
}

.appointments-table th:nth-child(6),
.appointments-table td:nth-child(6) {
  width: 11%;
}

.appointments-table th:nth-child(7),
.appointments-table td:nth-child(7) {
  width: 14%;
}

.appointments-table th:nth-child(8),
.appointments-table td:nth-child(8) {
  width: 5%;
  padding-left: 4px;
  padding-right: 4px;
}

.appointments-table th:nth-child(n+4) {
  position: relative;
  left: -8px;
}

.appointment-rank {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.appointment-date {
  color: var(--navy);
  font-weight: 800;
  white-space: nowrap;
}

.urgency {
  display: inline-flex;
  justify-content: center;
  min-width: 112px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.urgency.overdue {
  background: #fff0ed;
  color: var(--inactive);
}

.urgency.today,
.urgency.soon {
  background: #fff4df;
  color: #a85b00;
}

.urgency.planned {
  background: #eaf1f8;
  color: var(--navy);
}

.urgency.longterm {
  background: #e6f5ea;
  color: #1d6f39;
}

.urgency.longterm-dark {
  background: #1f6f3a;
  color: #ffffff;
}

.complete-appointment-form {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.appointments-table .complete-check-input {
  appearance: none;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  border: 1px solid #a9cdb3;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.appointments-table .complete-check-input:hover {
  background: #f1faf3;
  border-color: #4d9c62;
}

.appointments-table .complete-check-input:checked {
  background: #e9f8ed;
  border-color: #17833a;
}

.appointments-table .complete-check-input:checked::after {
  content: "✓";
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #17833a;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.complete-confirm-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(12, 22, 35, 0.42);
}

.complete-appointment-form.confirm-open .complete-confirm-overlay {
  display: grid;
}

.complete-confirm-box {
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 40px));
  padding: 18px;
  border: 1px solid #d5dde5;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(20, 34, 52, 0.28);
  color: var(--text);
  font-size: 15px;
  text-align: left;
}

.complete-confirm-box button {
  min-height: 38px;
  border-radius: 5px;
  padding: 8px 12px;
  font-size: 13px;
}

.complete-confirm-box button.secondary {
  background: #eef2f5;
  color: var(--navy);
}

.customer-form-panel {
  max-width: 820px;
  padding: 24px;
}

.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-heading .button {
  flex: 0 0 auto;
}

.admin-users-table th,
.admin-users-table td {
  text-align: center;
  vertical-align: middle;
}

.admin-users-table thead th {
  background: var(--navy);
  color: #fff;
}

.admin-users-table .table-button {
  margin: 0 auto;
}

.password-reveal {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 10px;
  background: #fff;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.password-reveal:hover {
  border-color: var(--navy);
}

.muted-cell {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 31, 46, 0.42);
}

.admin-access-modal {
  width: min(680px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px 24px;
}

.admin-access-modal form {
  display: grid;
  gap: 18px;
}

.admin-form-section {
  display: grid;
  gap: 0;
}

.admin-form-section h3 {
  margin: 0 0 14px;
  color: var(--navy);
  font-size: 16px;
}

.admin-form-section label {
  width: 100%;
}

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

.admin-permission-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.admin-permission-row input {
  width: 18px;
  height: 18px;
  min-height: 0;
  flex: 0 0 auto;
}

.login-info-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 31, 46, 0.42);
}

.login-info-modal {
  width: min(560px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px 24px;
}

.login-info-lines {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.login-info-lines > div,
.login-permission-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
}

.login-info-lines strong,
.login-permission-row span:first-child {
  color: var(--navy);
}

.login-info-lines span {
  font-weight: 800;
}

.login-permission-heading {
  margin: 10px 0 8px;
  color: var(--navy);
  font-size: 16px;
  text-align: center;
}

.login-permission-list {
  display: grid;
  gap: 0;
  width: min(420px, 100%);
  margin: 0 auto;
}

.login-permission-row {
  grid-template-columns: minmax(0, 1fr) 34px;
  justify-items: stretch;
  padding: 4px 0;
}

.login-permission-row span:first-child {
  justify-self: start;
}

.login-permission-row .login-permission-box {
  justify-self: center;
}

.login-permission-box {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.login-permission-box.allowed {
  background: #17833a;
}

.login-permission-box.denied {
  background: #b42318;
}

.message-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 31, 46, 0.42);
}

.message-modal {
  width: min(520px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px 24px;
}

.message-modal textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  font: inherit;
}

.message-modal textarea:focus {
  border-color: var(--orange);
  outline: 2px solid rgba(247, 147, 30, 0.18);
}

.message-status {
  min-height: 20px;
}

.message-time {
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 800;
}

.incoming-message-text {
  min-height: 90px;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
}

.message-reply-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.message-reply-button {
  margin-left: auto;
  background: var(--navy);
  color: #fff;
}

.message-reply-button:hover {
  background: #102942;
  color: #fff;
}

.order-entry-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  align-items: stretch;
  gap: 18px;
}

.order-entry-layout .customer-form-panel {
  max-width: none;
}

.invoice-preview-panel {
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.invoice-preview-empty {
  display: grid;
  flex: 1;
  min-height: 420px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
}

.invoice-pdf-preview {
  width: 100%;
  flex: 1;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.invoice-pdf-preview[hidden],
.invoice-preview-empty[hidden] {
  display: none;
}

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

.wide-field {
  grid-column: 1 / -1;
}

.full-width {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  color: var(--navy);
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus {
  border-color: var(--orange);
  outline: 2px solid rgba(247, 147, 30, 0.18);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.form-hint {
  margin: 2px 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
}

.checkbox-label input {
  width: auto;
  min-height: 0;
}

.invoice-file-field {
  align-content: start;
}

.invoice-file-current {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.invoice-file-current .checkbox-label {
  margin: 0 0 0 auto;
}

.invoice-file-current.muted {
  display: block;
}

.invoice-amount-field {
  padding: 10px;
  border: 1px solid rgba(247, 147, 30, 0.42);
  border-radius: 6px;
  background: #fff8ef;
}

.invoice-amount-field input {
  border-color: rgba(247, 147, 30, 0.55);
  font-weight: 800;
}

.invoice-analysis-status:empty {
  display: none;
}

.alert,
.success {
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 700;
}

.alert {
  background: #fff0ed;
  color: var(--inactive);
  border: 1px solid #f5c7c0;
}

.success {
  background: #ebf7ef;
  color: var(--active);
  border: 1px solid #b9e2c5;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--navy);
  font-size: 13px;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:hover {
  background: #f7f9fb;
}

.sort-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}

.sort-link:hover {
  color: var(--orange);
}

.sort-arrow {
  min-width: 12px;
  color: var(--orange);
  font-size: 15px;
}

.running-number {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

th:first-child,
th:nth-child(2),
th:nth-last-child(2),
th:last-child,
.running-number,
.customer-number,
.next-appointment-cell,
.revenue-cell {
  text-align: center;
}

th:first-child .sort-link,
th:nth-child(2) .sort-link,
th:nth-last-child(2) .sort-link,
th:last-child .sort-link {
  position: relative;
  justify-content: center;
  width: 100%;
  text-align: center;
}

th:first-child .sort-arrow,
th:nth-child(2) .sort-arrow,
th:nth-last-child(2) .sort-arrow,
th:last-child .sort-arrow {
  position: absolute;
  right: 0;
}

.customer-number a {
  display: inline-block;
  color: var(--navy);
  text-decoration: underline;
  text-decoration-color: rgba(7, 27, 51, 0.3);
  text-underline-offset: 3px;
}

.customer-number a:hover {
  color: var(--orange);
  text-decoration-color: var(--orange);
}

.customer-detail-top {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.35fr);
  gap: 18px;
  margin-bottom: 18px;
}

.detail-panel,
.orders-panel {
  padding: 20px;
}

.orders-panel .table-scroll {
  overflow-x: visible;
}

.master-data {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 13px 18px;
  margin: 0;
}

.master-data dt {
  color: var(--muted);
  font-weight: 700;
}

.master-data dd {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.revenue-chart {
  display: grid;
  gap: 14px;
}

.revenue-row {
  display: grid;
  grid-template-columns: 42px minmax(120px, 1fr) 105px;
  gap: 12px;
  align-items: center;
}

.revenue-year {
  color: var(--muted);
  font-weight: 700;
}

.revenue-track {
  height: 18px;
  overflow: hidden;
  border-radius: 4px;
  background: #e8edf2;
}

.revenue-bar {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--orange), #ffb252);
}

.revenue-row strong {
  color: var(--navy);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chart-empty {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px dashed #cbd5df;
  border-radius: 6px;
  color: var(--muted);
  background: #f8fafc;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.small-button {
  min-height: 34px;
  padding: 7px 13px;
}

.table-button {
  min-height: 30px;
  padding: 5px 11px;
  font-size: 13px;
}

.button.table-button {
  background: var(--active);
  color: #fff;
}

.button.table-button:hover {
  background: #0d5c29;
  color: #fff;
}

.completion-panel {
  max-width: 520px;
  margin: 80px auto 0;
  padding: 28px;
  text-align: center;
}

.completion-panel h1 {
  margin-bottom: 12px;
}

.completion-panel button {
  margin-top: 20px;
}

.orders-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.orders-table th,
.orders-table td {
  white-space: normal;
  text-align: center;
  padding: 12px 7px;
  overflow-wrap: anywhere;
}

.orders-table th:first-child,
.orders-table td:first-child {
  width: 9%;
}

.order-number-link {
  display: inline-block;
  color: var(--navy);
  text-decoration: underline;
  text-decoration-color: rgba(7, 27, 51, 0.3);
  text-underline-offset: 3px;
}

.order-number-link:hover {
  color: var(--orange);
  text-decoration-color: var(--orange);
}

.orders-table th:nth-child(2),
.orders-table td:nth-child(2),
.orders-table th:nth-child(3),
.orders-table td:nth-child(3) {
  width: 7%;
}

.orders-table th:nth-child(n+4):nth-child(-n+9),
.orders-table td:nth-child(n+4):nth-child(-n+9) {
  width: 10.5%;
}

.orders-table th:last-child,
.orders-table td:last-child {
  width: 14%;
}

.number-cell,
.invoice-cell {
  text-align: center;
}

.invoice-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  vertical-align: middle;
  text-align: right;
  white-space: nowrap;
}

.invoice-cell span {
  display: inline-block;
  min-width: 94px;
  margin-right: 0;
  text-align: right;
  white-space: nowrap;
}

.invoice-cell .table-button {
  display: inline-flex;
  justify-content: center;
  margin-left: 8px;
  vertical-align: middle;
}

.order-actions {
  text-align: center;
  white-space: nowrap;
}

.table-delete-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-left: 8px;
  font-size: 13px;
}

.pdf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 28px;
  margin-left: 8px;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
}

.pdf-badge-active {
  background: var(--active);
  color: #fff;
}

.pdf-badge-active:hover {
  background: #0d5a27;
  color: #fff;
}

.pdf-badge-missing {
  background: #d5dbe3;
  color: #6b7280;
}

.pdf-badge-missing:hover {
  background: #c5ccd6;
  color: var(--navy);
}

.order-values-row td {
  border-bottom: 0;
  padding-bottom: 7px;
}

.appointment-row td {
  padding-top: 7px;
  border-top: 1px dashed #cbd5df;
  color: var(--navy);
  background: #f7f9fb;
  font-size: 12px;
  font-weight: 700;
}

.appointment-row td:not(:empty)::before {
  content: "Termin: ";
  color: var(--muted);
  font-weight: 600;
}

.revenue-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.next-appointment-cell {
  white-space: nowrap;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.order-link {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-color: rgba(7, 27, 51, 0.3);
  text-underline-offset: 3px;
}

.order-link:hover {
  color: var(--orange);
  text-decoration-color: var(--orange);
}

.current-file {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
}

.delete-confirmation {
  max-width: 620px;
  margin: 70px auto 0;
  padding: 30px;
}

.error-window {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 20px;
  max-width: 680px;
  margin: 70px auto 0;
  padding: 30px;
  border-color: #f0b8b2;
}

.error-symbol {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--inactive);
  color: #fff;
  font-size: 30px;
  font-weight: 800;
}

.error-window h1 {
  color: var(--inactive);
}

.button.navy-button,
.button.close-window-button {
  background: var(--navy);
  color: #fff;
}

.button.navy-button:hover,
.button.close-window-button:hover {
  background: #102942;
  color: #fff;
}

.delete-confirmation h1 {
  margin-bottom: 18px;
}

.delete-warning {
  margin-top: 18px;
  color: var(--inactive);
  font-weight: 700;
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 800;
}

.status.active {
  background: #e8f3ec;
  color: var(--active);
}

.status.inactive {
  background: #fff0ed;
  color: var(--inactive);
}

.empty {
  padding: 30px 10px;
  color: var(--muted);
  text-align: center;
}

.header-search {
  position: absolute;
  left: 50%;
  display: grid;
  grid-template-columns: minmax(260px, 430px) auto;
  width: min(520px, 38vw);
  transform: translateX(-50%);
}

.header-search input {
  min-height: 38px;
  border-radius: 6px 0 0 6px;
}

.header-search button {
  min-height: 38px;
  border-radius: 0 6px 6px 0;
  padding: 8px 14px;
}

.search-result {
  margin-bottom: 16px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 11px 14px;
  background: #eef3f8;
  color: var(--navy);
}

.revenue-heading h1 {
  color: var(--orange);
}

.revenue-filters {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
  padding: 20px;
}

.revenue-filters > label {
  margin: 0;
}

.revenue-filters fieldset {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px 10px;
}

.revenue-filters legend {
  color: var(--navy);
  font-weight: 700;
}

.year-options,
.revenue-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.year-check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.year-check input {
  width: auto;
  min-height: 0;
}

.revenue-panel {
  padding: 24px;
}

.revenue-total {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--navy);
}

.revenue-total span {
  color: var(--muted);
  font-weight: 700;
}

.revenue-total strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.revenue-legend {
  justify-content: center;
  margin-bottom: 24px;
  color: var(--navy);
  font-weight: 700;
}

.revenue-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.revenue-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.annual-line-chart {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.annual-line-chart svg {
  display: block;
  width: 100%;
  min-height: 220px;
}

.annual-line-chart .axis {
  stroke: #cbd5df;
  stroke-width: 1.5;
}

.annual-line-chart .y-axis-mark line {
  stroke: #e5ebf1;
  stroke-width: 1;
}

.annual-line-chart .y-axis-mark text {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.annual-line-series polyline {
  fill: none;
  stroke: var(--series-color);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.annual-line-series circle {
  fill: var(--series-color);
  stroke: none;
  opacity: 0.68;
}

.annual-line-chart text {
  fill: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.annual-line-chart .month-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.annual-line-chart .year-end-label {
  paint-order: stroke;
  stroke: #fbfcfd;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.monthly-chart-frame {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 390px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.monthly-chart-scale {
  position: relative;
  min-height: 330px;
  padding-top: 14px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

.monthly-chart-scale span {
  position: absolute;
  right: 10px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

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

.month-column {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0;
  min-width: 0;
  padding: 0;
  background: var(--navy);
}

.month-column:nth-child(odd) .month-bars {
  background: #fff;
}

.month-column:nth-child(even) .month-bars {
  background: #e8edf3;
}

.month-column > strong {
  padding: 9px 4px;
  color: #fff;
  text-align: center;
  font-size: 12px;
}

.month-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  min-height: 330px;
  padding: 14px 13px 0;
}

.monthly-bar-wrap {
  display: flex;
  flex: 1;
  align-items: end;
  height: 100%;
  min-width: 7px;
}

.monthly-bar {
  display: block;
  width: 100%;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
}

.revenue-ranking-panel {
  margin-top: 18px;
  padding: 24px;
}

.ranking-scroll {
  overflow-x: auto;
}

.revenue-ranking-table {
  min-width: 760px;
}

.revenue-ranking-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--navy);
  color: #ffffff;
}

.revenue-ranking-table th,
.revenue-ranking-table td {
  white-space: nowrap;
}

.revenue-ranking-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.revenue-ranking-table tbody tr:nth-child(even) {
  background: #e8edf3;
}

.revenue-ranking-table th:nth-child(n+4),
.revenue-ranking-table td:nth-child(n+4) {
  width: 128px;
  text-align: right;
}

.revenue-ranking-table td:nth-child(3) {
  min-width: 240px;
  white-space: normal;
}

@media (max-width: 760px) {
  .order-entry-layout {
    grid-template-columns: 1fr;
  }

  .app-header,
  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .header-search {
    position: static;
    width: 100%;
    transform: none;
  }

  .revenue-filters {
    grid-template-columns: 1fr;
  }

  .monthly-chart {
    grid-template-columns: repeat(6, minmax(44px, 1fr));
  }

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

  .customer-detail-top {
    grid-template-columns: 1fr;
  }

  .page {
    width: min(100% - 24px, 1180px);
    margin-top: 18px;
  }

  .orders-table {
    font-size: 12px;
  }

  .orders-table th,
  .orders-table td {
    padding: 9px 4px;
  }
}
