:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #5f6c85;
  --accent: #1f6fe5;
  --accent-2: #1859b8;
  --line: #dbe2ef;
  --danger: #b30f2f;
  --ok: #146c2e;
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #dce9ff 0%, var(--bg) 40%, #ecf2ff 100%);
}

a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.hidden { display: none !important; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.3rem;
  box-shadow: 0 15px 45px rgba(20, 52, 110, 0.14);
}
.auth-card-wide {
  width: min(560px, 100%);
}

.stack { display: grid; gap: 0.6rem; margin-top: 1rem; }
input, select, textarea, button {
  font: inherit;
  padding: 0.68rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #bcc9e3;
}
input[type="checkbox"] {
  padding: 0;
  border: 0;
  width: 1rem;
  height: 1rem;
}

input[readonly],
.readonly-field {
  background: #eef1f6;
  color: #4f5e79;
  border-color: #d2d9e8;
  cursor: not-allowed;
}
button, .button-link {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 400;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.68rem 0.85rem;
  border-radius: 10px;
  line-height: 1;
}
button:hover, .button-link:hover { background: var(--accent-2); }
.error { color: var(--danger); min-height: 1.2rem; }
.success { color: var(--ok); min-height: 1.2rem; }
.auth-actions {
  margin: 0.75rem 0 0;
}
.auth-separator {
  color: #8a96ac;
  margin: 0 0.4rem;
}
.auth-link {
  color: #1f4fb3;
  font-weight: 600;
}
.auth-link:hover {
  text-decoration: underline;
}

.demo-hint {
  margin-top: 1rem;
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.layout {
  height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, #2b6dd5 0%, #1d4fa5 100%);
  color: #f5f8ff;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.sidebar-main {
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.logo-link {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  background: transparent;
  padding: 0.25rem;
  border-radius: 12px;
  margin-bottom: 1.2rem;
  border: 0;
}

.logo-image {
  width: 56px;
  height: auto;
  border-radius: 12px;
  display: block;
}

.menu { display: grid; gap: 0.25rem; }
.menu-item {
  padding: 0.62rem 0.68rem;
  border-radius: 10px;
  color: #eaf1ff;
}
.menu-item:hover, .menu-item.active { background: rgba(255, 255, 255, 0.2); color: #fff; }
.menu-item-disabled {
  color: #bfd2f7;
  opacity: 0.52;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-footer {
  display: grid;
  gap: 0.5rem;
}

.ghost-btn, .logout-btn {
  width: 100%;
  text-align: center;
  padding: 0.6rem;
  border-radius: 10px;
  border: 1px solid #9fc0f8;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.logout-btn { background: #1a4a9b; border-color: #89aceb; }

/* Modal-spezifisch: neutrale, kleinere Ghost-Buttons */
.modal-actions .ghost-btn {
  width: auto;
  min-width: 120px;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #c9d3e6;
  background: #fff;
  color: #304369;
  font-weight: 600;
}
.modal-actions .ghost-btn:hover {
  background: #f3f6fb;
  border-color: #b6c4dd;
}

.content {
  height: 100vh;
  overflow-y: auto;
  margin-left: var(--sidebar-width);
  padding: 1.2rem;
}
.content-header { margin-bottom: 1rem; }
.content-header-top {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.content-header h1 {
  margin: 0;
}
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  font-size: 1.1rem;
  background: #1a5fc8;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 14, 33, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.grid-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  margin: 0.8rem 0;
  max-width: 560px;
}

.grid-form label {
  font-size: 0.88rem;
  font-weight: 650;
  color: #2f3e5f;
  margin-top: 0.3rem;
}
.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.grid-form button[type="submit"] {
  margin-top: 0.5rem;
}
.order-save-bar {
  position: sticky;
  bottom: 0.6rem;
  display: flex;
  justify-content: flex-start;
  padding-top: 0.55rem;
  margin-top: 0.2rem;
  background: transparent;
}
.order-save-btn {
  width: auto;
  min-width: 220px;
  max-width: 260px;
  box-shadow: 0 10px 24px rgba(24, 89, 184, 0.24);
}
.order-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}
.order-detail-form {
  max-width: none;
  gap: 0.75rem;
}
.order-side-panels {
  position: static;
  width: 100%;
  max-height: none;
  overflow: visible;
  display: grid;
  gap: 0.7rem;
  align-self: start;
}
.time-log-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
  padding: 0.75rem;
  display: grid;
  gap: 0.55rem;
}
.time-log-panel h3 {
  margin: 0;
}
.time-log-form {
  gap: 0.45rem;
}
.time-log-form button {
  margin-top: 0.35rem;
}
.time-log-table {
  width: 100%;
  margin-top: 0.1rem;
}
.time-log-table th,
.time-log-table td {
  font-size: 0.84rem;
  padding: 0.4rem 0.45rem;
  vertical-align: top;
}
.time-log-table td:last-child {
  white-space: nowrap;
}
.form-section {
  display: grid;
  gap: 0.45rem;
}
.collapsible-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  padding: 0.2rem 0.65rem 0.65rem;
}
.collapsible-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0;
  user-select: none;
}
.collapsible-summary::-webkit-details-marker {
  display: none;
}
.collapsible-summary::before {
  content: "▾";
  font-size: 0.9rem;
  color: #3d214f;
  transform: translateY(-1px);
}
.collapsible-section:not([open]) .collapsible-summary::before {
  content: "▸";
}
.collapsible-content {
  display: grid;
  gap: 0.45rem;
}
.upload-assist-wrap {
  display: grid;
  gap: 0.45rem;
  justify-items: start;
  margin-bottom: 0.2rem;
}
.ai-preview {
  width: min(720px, 100%);
  border: 1px solid #cfdcf3;
  background: #f5f9ff;
  border-radius: 10px;
  padding: 0.6rem;
  display: grid;
  gap: 0.45rem;
}
.ai-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}
.ai-preview-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
  font-size: 0.86rem;
}
.ai-field-applied {
  border-color: #7ea5df !important;
  background: #edf4ff !important;
}
.ai-field-low-confidence {
  border-color: #d4b38a !important;
  background: #fff7eb !important;
}
.form-row-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 0.7rem;
  align-items: end;
}
.form-row-four {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr 1fr;
  gap: 0.7rem;
  align-items: end;
}
.form-row-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.7rem;
  align-items: end;
}
.field-group {
  display: grid;
  gap: 0.45rem;
}
.form-section-title {
  margin: 0 0 0.1rem;
  font-size: 0.96rem;
  color: #3d214f;
}
.form-divider {
  border-top: 1px solid #f1b5d7;
  margin: 0.2rem 0;
}
.form-subsection-title {
  margin: 0.7rem 0 0.15rem;
  font-size: 0.92rem;
  color: #5b2b46;
}
.appointments-wrap {
  display: grid;
  gap: 0.45rem;
}
.booking-link-panel {
  border: 1px solid #d9e3f6;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.6rem;
  display: grid;
  gap: 0.4rem;
}
.booking-link-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.attachments-wrap {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.15rem;
}
.attachments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.attachments-list li {
  font-size: 0.88rem;
}
.attachment-link {
  color: #2459ad;
  text-decoration: underline;
  text-underline-offset: 0.12rem;
}
.attachment-link:hover {
  color: #1b4383;
}
.appointments-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 0.7rem;
}
.appointment-card {
  border: 1px solid #f2bedc;
  border-radius: 10px;
  background: #fff8fc;
  padding: 0.6rem;
  display: grid;
  gap: 0.4rem;
}
.appointment-card h5 {
  margin: 0 0 0.2rem;
  font-size: 0.86rem;
  color: #6e3052;
}
.address-map-wrap {
  display: grid;
  grid-template-columns: minmax(230px, 360px) auto;
  gap: 0.7rem;
  align-items: center;
  margin: 0.2rem 0 0.4rem;
}
.address-map-card {
  border: 1px solid #f2bedc;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.address-map-frame {
  width: 100%;
  height: 180px;
  border: 0;
  display: block;
}
.map-route-link {
  align-self: center;
  justify-self: start;
  white-space: nowrap;
}
.order-detail-form input:not([type="checkbox"]),
.order-detail-form select,
.order-detail-form textarea {
  width: min(430px, 100%);
}
.form-row-three input,
.form-row-three select {
  width: 100%;
}

@media (max-width: 980px) {
  .order-detail-layout {
    grid-template-columns: 1fr;
  }
  .order-side-panels {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
  }
  .form-row-three,
  .form-row-four,
  .form-row-two,
  .appointments-grid,
  .address-map-wrap {
    grid-template-columns: 1fr;
  }
  .map-route-link {
    white-space: normal;
  }
  .order-save-bar {
    justify-content: flex-start;
  }
  .order-save-btn {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .ai-preview-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.orders-search-input {
  width: min(460px, 100%);
  margin: 0.35rem 0 0.85rem;
}

.orders-filters {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  flex-wrap: nowrap;
  overflow: hidden;
  margin-bottom: 0.85rem;
}

.orders-filter-field {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  flex: 1 1 clamp(150px, 22vw, 240px);
  max-width: 250px;
}

.orders-filter-field label {
  font-size: 0.8rem;
  font-weight: 650;
  color: #2f3e5f;
}

.orders-filters .orders-search-input {
  width: 100%;
  margin: 0;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.7rem;
}
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.58rem;
  font-size: 0.92rem;
}
.table-sort-btn {
  border: 0;
  background: transparent;
  color: #334664;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.table-sort-btn:hover {
  color: #1f4fa3;
  background: transparent;
}
.table-link {
  color: #bf0d63;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.12rem;
}
.table-link:hover {
  color: #92084a;
}

.danger-table-btn {
  background: #8d1831;
  border: 1px solid #a31e3a;
  color: #fff;
  padding: 0.42rem 0.65rem;
  border-radius: 8px;
  font-size: 0.82rem;
}

.danger-table-btn:hover {
  background: #7b142a;
}

.danger-table-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 920px) {
  :root { --sidebar-width: 260px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .content {
    margin-left: 0;
    padding: 1rem;
  }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .orders-filters {
    gap: 0.45rem;
  }
  .orders-filter-field {
    flex-basis: 0;
    max-width: none;
  }
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.section-title-row h2 {
  margin: 0;
}

.section-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.orders-overview-header .button-link {
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  padding: clamp(0.5rem, 1.3vw, 0.68rem) clamp(0.62rem, 1.9vw, 0.85rem);
  font-size: clamp(0.82rem, 1.45vw, 0.95rem);
}
.orders-overview-header {
  flex-wrap: nowrap;
  overflow: hidden;
}
.orders-overview-header h2 {
  flex: 1 1 auto;
  min-width: 0;
  margin-right: auto;
  white-space: nowrap;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
}
.danger-icon-btn {
  min-width: 44px;
  width: 44px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  background: #b4233f;
  border: 1px solid #972f44;
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
}
.danger-icon-btn:hover {
  background: #9a2038;
}
.danger-icon-btn-table {
  width: 36px;
  min-width: 36px;
  height: 34px;
  font-size: 0.95rem;
}
.table-action-right {
  text-align: right;
}

.inline-field {
  display: grid;
  gap: 0.25rem;
  min-width: clamp(122px, 16vw, 165px);
  max-width: clamp(145px, 18vw, 180px);
  flex: 0 0 auto;
}

.inline-field select {
  min-width: 0;
  width: 100%;
}

.inline-field label {
  font-size: 0.8rem;
  font-weight: 650;
  color: #2f3e5f;
}

.week-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  flex-wrap: nowrap;
  overflow: hidden;
}

.calendar-nav-btn {
  width: clamp(36px, 4.2vw, 44px);
  height: 36px;
  flex: 0 0 auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f5f7fb;
  font-size: 1.2rem;
  color: #1f2f4d;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.calendar-nav-btn:hover {
  background: #e6edff;
  box-shadow: 0 3px 10px rgba(31, 47, 77, 0.12);
}

.week-controls h2 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(0.96rem, 1.7vw, 1.05rem);
}

.calendar-subscribe {
  margin-top: 0.15rem;
  display: grid;
  gap: 0.55rem;
}

.calendar-user-filter {
  margin-top: 0.2rem;
  border: 1px solid #d6dfef;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.55rem 0.65rem;
  display: grid;
  gap: 0.45rem;
}

.calendar-user-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.calendar-user-filter-title {
  font-size: 0.82rem;
  font-weight: 650;
  color: #2f3e5f;
}

.calendar-user-filter-action {
  height: 30px;
  min-width: 64px;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #cad5ea;
  background: #fff;
  color: #29406b;
  font-size: 0.8rem;
  font-weight: 600;
}

.calendar-user-filter-action:hover {
  background: #edf3ff;
}

.calendar-user-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.calendar-user-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #d5e1ff;
  border-radius: 999px;
  padding: 0.28rem 0.52rem;
  background: #fff;
  font-size: 0.8rem;
  color: #2f4368;
}

.calendar-user-filter-item input[type="checkbox"] {
  width: 0.9rem;
  height: 0.9rem;
  margin: 0;
}

.calendar-subscribe-btn {
  width: auto;
  flex: 0 0 auto;
  min-width: clamp(134px, 20vw, 160px);
  height: 36px;
  background: #1a5fc8;
  color: #fff;
  border: 1px solid #1656b5;
  font-weight: 600;
  padding: 0.5rem 0.8rem;
}

@media (max-width: 1100px) {
  .week-controls {
    gap: 0.45rem;
  }
  .inline-field {
    min-width: 108px;
    max-width: 132px;
  }
  .inline-field label {
    display: none;
  }
  .inline-field select {
    height: 36px;
    padding: 0.42rem 0.42rem;
    font-size: 0.84rem;
  }
  .calendar-subscribe-btn {
    min-width: 106px;
    padding: 0.4rem 0.58rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 920px) {
  .orders-overview-header h2 {
    font-size: 1rem;
  }
  .orders-overview-header .button-link {
    padding: 0.44rem 0.58rem;
    font-size: 0.82rem;
  }
}

.calendar-subscribe-btn:hover {
  background: #174ea1;
}

.calendar-subscribe-panel {
  border: 1px solid #d6dfef;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.65rem;
  display: grid;
  gap: 0.5rem;
}

.calendar-subscribe-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.calendar-subscribe-row input {
  flex: 1 1 280px;
  min-width: 220px;
  background: #fff;
}

.calendar-subscribe-copy-btn,
.calendar-subscribe-rotate-btn {
  min-height: 36px;
  padding: 0.48rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #cad5ea;
  background: #fff;
  color: #29406b;
  font-weight: 600;
}

.calendar-subscribe-copy-btn:hover,
.calendar-subscribe-rotate-btn:hover {
  background: #edf3ff;
}

.calendar-subscribe-actions {
  display: flex;
  justify-content: flex-start;
}

#calendarSubscribeMsg.success {
  color: #146c2e;
}

#calendarSubscribeMsg.error {
  color: #b30f2f;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(170px, 1fr));
  gap: 0.65rem;
  margin-top: 0.8rem;
  overflow-x: auto;
}

.week-grid.day-mode {
  display: block;
  grid-template-columns: none;
  overflow: visible;
}

.week-grid.month-mode {
  display: block;
  grid-template-columns: none;
}

.week-grid.timetable-mode {
  display: block;
  grid-template-columns: none;
}

.week-timetable {
  border: 1px solid #d5e1ff;
  border-radius: 12px;
  overflow: hidden;
  background: #fbfcff;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 0 1px #dfe7ff;
}

.week-timetable-scroll {
  overflow: auto;
  background: #fff;
}

.week-timetable-header {
  display: grid;
  grid-template-columns: 90px repeat(var(--day-count, 7), minmax(150px, 1fr));
  background: #f5f7fb;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
  min-width: max-content;
  border-bottom: 1px solid #d5e1ff;
}

.week-timetable-header-cell {
  padding: 0.65rem 0.75rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #304369;
  border-right: 1px solid #dfe7ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-timetable-body {
  max-height: 70vh;
}

.week-timetable-row {
  display: grid;
  grid-template-columns: 90px repeat(var(--day-count, 7), minmax(150px, 1fr));
  border-bottom: 1px solid #dfe7ff;
  min-height: 36px;
  min-width: max-content;
}

.week-timetable-row.is-dragging .week-timetable-cell {
  background: #e8f0ff;
}

.week-timetable-row.is-working-hour {
  background: #f2f3f5;
}

.week-timetable-row.is-working-hour .week-timetable-time {
  background: #e6e8eb;
  color: #3a475f;
}

.week-timetable-row.is-working-hour .week-timetable-cell {
  background: #f2f3f5;
}

.week-timetable-time {
  padding: 0.35rem 0.6rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.8rem;
  color: #61708d;
  background: #fff;
  border-right: 1px solid #dfe7ff;
}

.week-timetable-cell {
  padding: 0.3rem 0.35rem;
  border-right: 1px solid #dfe7ff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  justify-content: center;
  background: #fff;
}

.week-timetable-row .week-timetable-cell:last-child {
  border-right: 0;
}

.week-slot-chip {
  display: inline-block;
  padding: 0.2rem 0.3rem;
  border-radius: 8px;
  background: #edf3ff;
  border: 1px solid #d5e1ff;
  font-size: 0.78rem;
  color: #20345a;
  text-decoration: none;
}

.week-slot-chip:hover {
  background: #dfeaff;
}

.day-grid {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcff;
  overflow: hidden;
  margin-top: 0.8rem;
}

.day-grid-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.day-grid-header h3 {
  margin: 0;
  font-size: 1rem;
}

.day-grid-body {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow-y: auto;
}

.day-grid-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: stretch;
  padding: 0.45rem 0.75rem;
  gap: 0.75rem;
}

.day-grid-row:nth-child(odd) {
  background: #f5f8ff;
}

.day-grid-time {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82rem;
  color: #506180;
}

.day-grid-events {
  display: grid;
  gap: 0.35rem;
  align-content: center;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 0.2rem;
  margin-top: 0.8rem;
}

.month-weekday {
  font-weight: 700;
  font-size: 0.85rem;
  color: #304369;
  padding: 0.35rem 0.4rem;
  text-align: center;
}

.month-cell {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 110px;
  padding: 0.45rem 0.4rem 0.6rem;
  background: #fbfcff;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.month-cell.other-month {
  background: #f6f7fb;
  color: #8a93a5;
}

.month-cell-date {
  font-weight: 700;
  font-size: 0.9rem;
}

.month-cell-events {
  display: grid;
  gap: 0.3rem;
}

.month-event-chip {
  display: inline-block;
  padding: 0.25rem 0.35rem;
  border-radius: 8px;
  background: #edf3ff;
  border: 1px solid #d5e1ff;
  font-size: 0.78rem;
  color: #20345a;
  text-decoration: none;
}

.month-event-chip:hover {
  background: #dfeaff;
}

.month-more {
  font-size: 0.75rem;
  color: #506180;
}

.ghost-icon-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #1f2f4d;
  padding: 0.2rem 0.4rem;
}

.ghost-icon-btn:hover {
  color: #0e1f3d;
}

/* Modal for calendar quick entry */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.4);
  backdrop-filter: blur(2px);
  z-index: 900;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 901;
}

.modal.hidden,
.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  box-shadow: 0 15px 40px rgba(9, 30, 66, 0.25);
  width: min(520px, 92vw);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.modal-body {
  margin-top: 0.6rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

.form-field {
  display: grid;
  gap: 0.35rem;
}

.form-field span {
  font-size: 0.85rem;
  font-weight: 650;
  color: #2f3e5f;
}

.form-field input,
.form-field textarea {
  width: 100%;
}

.form-error {
  color: #b4233f;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.week-day-column {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcff;
  min-height: 220px;
  padding: 0.6rem;
}

.week-day-column h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.week-day-events {
  display: grid;
  gap: 0.5rem;
}

.week-event-card {
  display: block;
  border: 1px solid #cfdaf0;
  border-radius: 10px;
  background: #edf3ff;
  padding: 0.5rem;
}

.week-event-card strong {
  font-size: 0.82rem;
}

.week-event-card p {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: #314564;
}

.kanban-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 280px);
  gap: 0.7rem;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: start;
  padding-bottom: 0.25rem;
}

.kanban-column {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbff;
  padding: 0.6rem;
}

.kanban-column header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.kanban-column h3 {
  margin: 0;
  font-size: 0.98rem;
}

.kanban-column header span {
  font-size: 0.85rem;
  color: var(--muted);
}

.kanban-items {
  display: grid;
  gap: 0.5rem;
}

.kanban-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  cursor: grab;
}

.kanban-card p {
  margin: 0.4rem 0;
  font-size: 0.9rem;
  color: #344565;
}

.kanban-card.dragging {
  opacity: 0.55;
}

.kanban-column.drag-over {
  border-color: #7ea7ea;
  background: #eef4ff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cdd7ec;
  background: #eaf0fc;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
}

.order-history-wrap {
  margin-top: 1.1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
}
.order-history-wrap h3 {
  margin: 0 0 0.45rem;
  font-size: 0.98rem;
}
.order-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.history-item {
  background: #fff4fa;
  border: 1px solid #ffd3e8;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
}
.history-item p {
  margin: 0.22rem 0 0;
}
.history-meta {
  font-size: 0.8rem;
  color: #7b3c5b;
}
