:root {
  --charcoal: #18181b;
  --charcoal2: #242426;
  --red: #c8102e;
  --red-dark: #9e0b24;
  --white: #fff;
  --paper: #f4f5f7;
  --muted: #67676f;
  --line: #e3e4e8;
  --green: #147a4b;
  --green-soft: #e9f7f0;
  --yellow: #9a6500;
  --yellow-soft: #fff5d8;
  --blue: #2856a8;
  --blue-soft: #edf3ff;
  --shadow: 0 20px 55px rgba(24, 24, 27, 0.1);
}
* {
  box-sizing: border-box;
}
html {
  font-size: 16px;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--charcoal);
  font-family: Inter, system-ui, sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 270px;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  background: #111113;
  color: #fff;
  z-index: 40;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 0 7px 22px;
  border-bottom: 1px solid #343438;
}
.admin-brand img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
}
.admin-brand span {
  display: grid;
  line-height: 1;
}
.admin-brand strong {
  font-size: 12px;
  letter-spacing: 0.09em;
}
.admin-brand em {
  margin-top: 5px;
  color: #ff6b80;
  font-family: "Archivo Black";
  font-style: normal;
  font-size: 18px;
}
.owner-badge {
  margin: 22px 6px;
  padding: 15px 16px;
  border: 1px solid #38383d;
  border-radius: 15px;
  background: #1d1d20;
}
.owner-badge span {
  display: block;
  color: #ff7187;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
}
.owner-badge strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
}
.side-nav {
  display: grid;
  gap: 7px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #bdbdc4;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
}
.nav-item span {
  width: 22px;
  text-align: center;
  font-size: 17px;
}
.nav-item b {
  margin-left: auto;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
}
.nav-item:hover,
.nav-item.active {
  background: #27272b;
  color: #fff;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 18px 8px 0;
  border-top: 1px solid #343438;
  font-size: 12px;
  color: #92929a;
}
.sidebar-bottom p {
  margin: 0 0 8px;
}
.sidebar-bottom a {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.main {
  grid-column: 2;
  padding: 0 34px 50px;
  min-width: 0;
}
.topbar {
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  margin: 5px 0 0;
  font-family: "Archivo Black";
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.035em;
}
.eyebrow {
  margin: 0;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.15em;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#newInvoiceBtn {
  border-color: rgba(200, 16, 46, 0.24);
  color: var(--red);
}
#newInvoiceBtn:hover {
  border-color: rgba(200, 16, 46, 0.42);
  background: #fff7f9;
}
.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--charcoal);
  color: #fff;
  font-weight: 800;
}
.mobile-menu {
  display: none;
  border: 0;
  background: var(--charcoal);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 10px;
}
.primary-button,
.ghost-button,
.text-button {
  border: 0;
  font-weight: 800;
}
.primary-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 11px;
  background: var(--red);
  color: #fff;
  box-shadow: 0 10px 25px rgba(200, 16, 46, 0.18);
}
.primary-button:hover {
  background: var(--red-dark);
}
.ghost-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--charcoal);
}
.text-button {
  background: none;
  color: var(--red);
  font-size: 13px;
}
.full {
  width: 100%;
}
.view {
  display: none;
  padding-top: 30px;
}
.view.active {
  display: block;
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(24, 24, 27, 0.04);
}
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.stat-card strong {
  display: block;
  margin-top: 11px;
  font-family: "Archivo Black";
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.04em;
}
.stat-card em {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.75fr);
  gap: 20px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 5px 0 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}
.ticket-list {
  display: grid;
}
.ticket-row {
  display: grid;
  grid-template-columns: 110px 1.1fr 1fr 110px;
  align-items: center;
  gap: 15px;
  width: 100%;
  padding: 18px 24px;
  border: 0;
  border-bottom: 1px solid #efeff2;
  background: #fff;
  text-align: left;
}
.ticket-row:last-child {
  border-bottom: 0;
}
.ticket-row:hover {
  background: #fafafa;
}
.ticket-row .number {
  font-weight: 900;
}
.ticket-row .customer strong {
  display: block;
  font-size: 14px;
}
.ticket-row .customer span,
.ticket-row .job {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.ticket-row .amount {
  text-align: right;
  font-weight: 800;
}
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status.New {
  background: #fff0f3;
  color: var(--red);
}
.status.Quoted {
  background: var(--yellow-soft);
  color: var(--yellow);
}
.status.Scheduled {
  background: var(--blue-soft);
  color: var(--blue);
}
.status.In-Progress {
  background: #f1edff;
  color: #6347a8;
}
.status.Completed {
  background: var(--green-soft);
  color: var(--green);
}
.status.Cancelled {
  background: #ececef;
  color: #6a6a72;
}
.quick-items {
  padding: 8px 22px 18px;
}
.quick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 0;
  border-bottom: 1px solid #efeff2;
}
.quick-item:last-child {
  border-bottom: 0;
}
.quick-item span {
  color: var(--muted);
  font-size: 13px;
}
.quick-item strong {
  font-size: 15px;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}
.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.search-box input {
  width: 100%;
  height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
}
.toolbar select {
  min-width: 180px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.table-panel {
  overflow: hidden;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}
th,
td {
  padding: 16px 20px;
  border-bottom: 1px solid #eeeef1;
  text-align: left;
  font-size: 13px;
}
th {
  background: #fafafa;
  color: #72727a;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
tbody tr {
  cursor: pointer;
}
tbody tr:hover {
  background: #fafafa;
}
td strong {
  font-size: 13px;
}
td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
.coupon-stats {
  grid-template-columns: repeat(3, 1fr);
}
.coupon-code {
  font-family: monospace;
  font-size: 14px;
  font-weight: 900;
}
.redeem-btn {
  border: 0;
  border-radius: 9px;
  padding: 8px 10px;
  background: var(--charcoal);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.redeem-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.empty-state {
  display: grid;
  place-items: center;
  min-height: 440px;
  padding: 40px;
  text-align: center;
}
.empty-state .empty-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #fff0f3;
  color: var(--red);
  font-size: 28px;
}
.empty-state h2 {
  margin: 15px 0 7px;
}
.empty-state p {
  max-width: 520px;
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.7;
}
.drawer-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 19, 0.52);
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
  z-index: 70;
}
.drawer-backdrop.show,
.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}
.ticket-drawer {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  width: min(570px, 100%);
  height: 100vh;
  padding: 26px;
  background: #fff;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.2);
  transform: translateX(105%);
  transition: 0.25s;
  overflow-y: auto;
}
.ticket-drawer.show {
  transform: translateX(0);
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  margin: 5px 0 0;
  font-family: "Archivo Black";
  font-size: 29px;
  font-weight: 400;
}
.close-drawer {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 23px;
}
.detail-block {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}
.detail-block small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.detail-block strong,
.detail-block p {
  display: block;
  margin: 5px 0 0;
  font-size: 14px;
  line-height: 1.55;
}
.drawer-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.drawer-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.drawer-controls select,
.drawer-controls input,
.drawer-controls textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.drawer-controls .wide {
  grid-column: 1/-1;
}
.contact-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.contact-actions a {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 10px;
  background: var(--charcoal);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}
.contact-actions a:last-child {
  background: var(--red);
}
.new-ticket-modal {
  position: fixed;
  z-index: 90;
  left: 50%;
  top: 50%;
  width: min(700px, calc(100% - 30px));
  max-height: 90vh;
  overflow: auto;
  padding: 26px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -45%) scale(0.98);
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
}
.new-ticket-modal.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  visibility: visible;
}
.ticket-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-top: 20px;
}
.ticket-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.ticket-form input,
.ticket-form select,
.ticket-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ticket-form .wide {
  grid-column: 1/-1;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 25px;
  background:
    radial-gradient(
      circle at 80% 20%,
      rgba(200, 16, 46, 0.33),
      transparent 30%
    ),
    var(--charcoal);
}
.login-card {
  width: min(480px, 100%);
  padding: 38px;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.35);
}
.login-logo {
  display: block;
  width: 84px;
  height: 84px;
  margin-bottom: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.login-card h1 {
  margin: 8px 0 10px;
  font-family: "Archivo Black";
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -0.04em;
}
.login-copy {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}
.prototype-note {
  margin: 22px 0;
  padding: 13px 15px;
  border-radius: 12px;
  background: #fff5d8;
  color: #725000;
  font-size: 12px;
  line-height: 1.55;
}
.login-card form {
  display: grid;
  gap: 14px;
}
.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.login-card input {
  height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
}
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .ticket-row {
    grid-template-columns: 105px 1.2fr 1fr 90px;
  }
}
@media (max-width: 800px) {
  .admin-shell {
    display: block;
  }
  .sidebar {
    transform: translateX(-102%);
    transition: 0.2s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    padding: 0 18px 35px;
  }
  .topbar {
    min-height: 0;
    padding: 14px 0 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .mobile-menu {
    display: block;
  }
  .topbar > div:first-of-type {
    flex: 1;
    min-width: 0;
  }
  .topbar h1 {
    font-size: 26px;
  }
  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 8px;
  }
  .top-actions .ghost-button,
  #newInvoiceBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 12px;
    font-size: 12px;
    white-space: nowrap;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .ticket-row {
    grid-template-columns: 90px 1fr auto;
  }
  .ticket-row .job,
  .ticket-row .amount {
    display: none;
  }
  .toolbar {
    flex-direction: column;
  }
  .search-box {
    max-width: none;
  }
  .toolbar select {
    height: 46px;
  }
  .coupon-stats {
    grid-template-columns: 1fr 1fr;
  }
  .ticket-form {
    grid-template-columns: 1fr;
  }
  .ticket-form .wide {
    grid-column: auto;
  }
}
@media (max-width: 520px) {
  .stats,
  .coupon-stats {
    grid-template-columns: 1fr;
  }
  .main {
    padding-inline: 13px;
  }
  .topbar h1 {
    font-size: 22px;
  }
  .avatar {
    display: none;
  }
  .top-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .panel-head {
    padding: 18px;
  }
  .ticket-row {
    padding: 16px 18px;
  }
  .ticket-row .status {
    display: none;
  }
  .detail-grid,
  .drawer-controls,
  .contact-actions {
    grid-template-columns: 1fr;
  }
  .drawer-controls .wide {
    grid-column: auto;
  }
  .ticket-drawer {
    padding: 20px;
  }
  .login-card {
    padding: 28px 22px;
  }
  .login-card h1 {
    font-size: 36px;
  }
}

/* Supabase-connected states */
.login-message {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff2f4;
  color: #8f0b20;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}
.login-message[data-type="success"] {
  background: #eefbf2;
  color: #176b36;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
.empty-copy {
  padding: 22px;
  color: #6b6b72;
  font-size: 14px;
  line-height: 1.6;
}

/* Website quote photo previews */
.ticket-photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.ticket-photo {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f4f4f5;
  aspect-ratio: 4 / 3;
}
.ticket-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 520px) {
  .ticket-photos {
    grid-template-columns: 1fr;
  }
}

/* Customer status messages + ticket activity */
.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-title-row h3 {
  margin: 5px 0 0;
  font-size: 18px;
}
.message-recipient,
.history-count {
  max-width: 220px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #f4f4f5;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-update-block {
  display: grid;
  gap: 12px;
}
.message-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.message-field select,
.message-field input,
.message-field textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--charcoal);
}
.message-field textarea {
  resize: vertical;
  min-height: 130px;
  line-height: 1.55;
}
.message-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.message-actions button:last-child {
  grid-column: 1 / -1;
}
.message-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.message-help {
  margin: 0 !important;
  color: var(--muted);
  font-size: 12px !important;
}
.activity-timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin-top: 4px;
}
.activity-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 0 0 20px;
}
.activity-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 13px;
  bottom: -1px;
  width: 2px;
  background: var(--line);
}
.activity-dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 1px #d6d6db;
}
.activity-content {
  min-width: 0;
}
.activity-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.activity-heading strong {
  margin: 0;
  font-size: 13px;
}
.activity-heading time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}
.activity-content p {
  margin: 4px 0 0;
  color: #44444a;
  font-size: 12px;
  line-height: 1.55;
}
.activity-content small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
}
.activity-content blockquote {
  margin: 8px 0 0;
  padding: 9px 11px;
  border-left: 3px solid var(--red);
  border-radius: 0 8px 8px 0;
  background: #f7f7f8;
  color: #44444a;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.activity-empty {
  margin: 0 !important;
  color: var(--muted);
  font-size: 12px !important;
}

@media (max-width: 520px) {
  .section-title-row,
  .activity-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .message-recipient,
  .history-count {
    max-width: 100%;
  }
  .message-actions {
    grid-template-columns: 1fr;
  }
  .message-actions button:last-child {
    grid-column: auto;
  }
}

/* Permanent ticket deletion */
.danger-zone {
  border: 1px solid #f1b7c1;
  background: #fff7f8;
}
.danger-zone small,
.danger-zone h3 {
  color: #9f1239;
}
.danger-copy {
  margin: 0 0 14px !important;
  color: #5f2732 !important;
  font-size: 12px !important;
  line-height: 1.6;
}
.danger-button {
  border: 0;
  border-radius: 10px;
  padding: 11px 15px;
  background: #b91c1c;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.danger-button:hover:not(:disabled) {
  background: #991b1b;
}
.danger-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.delete-confirm {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #f1b7c1;
}
.delete-confirm[hidden] {
  display: none;
}
.delete-confirm-actions {
  display: flex;
  gap: 9px;
  margin-top: 12px;
}
.delete-confirm-actions button {
  flex: 1;
}
@media (max-width: 520px) {
  .delete-confirm-actions {
    flex-direction: column;
  }
}

/* Invoice builder */
.invoice-mobile-tabs {
  display: none;
}
.invoice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(10, 10, 12, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.invoice-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.invoice-modal {
  position: fixed;
  z-index: 80;
  inset: 22px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-width: 1240px;
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #f7f7f8;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.985);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  overflow: hidden;
}
.invoice-modal.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.invoice-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.invoice-modal-head h2 {
  margin: 3px 0 4px;
  font-size: 25px;
}
.invoice-modal-head p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.invoice-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.93fr) minmax(390px, 1.07fr);
  min-height: 0;
  overflow: hidden;
}
.invoice-editor,
.invoice-preview-wrap {
  min-height: 0;
  overflow-y: auto;
}
.invoice-editor {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
}
.invoice-preview-wrap {
  padding: 18px;
  border-left: 1px solid var(--line);
  background: #ececee;
  overflow-x: hidden;
}
.invoice-preview-label {
  margin: 0 0 8px 4px;
  color: #777780;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}
.invoice-builder-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(24, 24, 27, 0.04);
}
.invoice-builder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.invoice-builder-head small,
.square-connect-note small {
  display: block;
  color: var(--red);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
}
.invoice-builder-head h3 {
  margin: 4px 0 0;
  font-size: 17px;
}
.invoice-draft-badge {
  padding: 6px 9px;
  border-radius: 999px;
  background: #f4f4f5;
  color: #66666d;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.invoice-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}
.invoice-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.invoice-form-grid label.wide {
  grid-column: 1 / -1;
}
.invoice-form-grid input,
.invoice-form-grid textarea,
.invoice-item-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fff;
  color: var(--charcoal);
}
.invoice-form-grid textarea {
  resize: vertical;
}
.invoice-item-list {
  display: grid;
  gap: 10px;
}
.invoice-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px 112px 40px;
  gap: 8px;
  align-items: end;
}
.invoice-item-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.invoice-item-remove {
  width: 40px;
  height: 40px;
  border: 1px solid #f1c3cb;
  border-radius: 10px;
  background: #fff7f8;
  color: #b91c1c;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}
.invoice-item-remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.invoice-total-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.invoice-total-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.invoice-total-strip strong {
  font-size: 25px;
  color: var(--charcoal);
}
.square-connect-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 17px;
  border: 1px dashed #d4d4d8;
  border-radius: 16px;
  background: #fff;
}
.square-connect-note strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}
.square-connect-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.square-connect-note > span {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f4f4f5;
  color: #71717a;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.invoice-preview {
  min-height: 760px;
  padding: 34px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(24, 24, 27, 0.12);
  color: #1d1d20;
}
.invoice-preview-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 3px solid var(--red);
}
.invoice-preview-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.invoice-preview-brand img {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
}
.invoice-preview-brand strong {
  display: block;
  font-family: "Archivo Black", Inter, sans-serif;
  font-size: 18px;
  line-height: 1;
}
.invoice-preview-brand span {
  display: block;
  margin-top: 4px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.invoice-preview-title {
  text-align: right;
}
.invoice-preview-title h3 {
  margin: 0;
  font-family: "Archivo Black", Inter, sans-serif;
  font-size: 34px;
  letter-spacing: -0.03em;
}
.invoice-preview-title p {
  margin: 6px 0 0;
  color: #66666d;
  font-size: 11px;
  font-weight: 800;
}
.invoice-preview-meta {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 30px;
  padding: 24px 0;
}
.invoice-preview-meta > * {
  min-width: 0;
}
.invoice-preview-meta p {
  overflow-wrap: anywhere;
}
.invoice-preview-meta small,
.invoice-preview-summary small {
  display: block;
  margin-bottom: 6px;
  color: #8b8b93;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.invoice-preview-meta strong {
  display: block;
  font-size: 14px;
}
.invoice-preview-meta p {
  margin: 4px 0 0;
  color: #55555c;
  font-size: 11px;
  line-height: 1.55;
}
.invoice-preview-dates {
  display: grid;
  gap: 10px;
}
.invoice-preview-dates div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ededf0;
  font-size: 11px;
}
.invoice-preview-dates span {
  color: #777780;
}
.invoice-preview-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 4px;
}
.invoice-preview-table th {
  padding: 10px 8px;
  border-bottom: 2px solid #252529;
  color: #55555c;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}
.invoice-preview-table th:nth-child(n + 2),
.invoice-preview-table td:nth-child(n + 2) {
  text-align: right;
}
.invoice-preview-table td {
  padding: 13px 8px;
  border-bottom: 1px solid #ededf0;
  font-size: 11px;
  vertical-align: top;
}
.invoice-preview-table th:first-child,
.invoice-preview-table td:first-child {
  width: 52%;
  min-width: 0;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.invoice-preview-table th:nth-child(2),
.invoice-preview-table td:nth-child(2) {
  width: 10%;
}
.invoice-preview-table th:nth-child(3),
.invoice-preview-table td:nth-child(3) {
  width: 18%;
}
.invoice-preview-table th:nth-child(4),
.invoice-preview-table td:nth-child(4) {
  width: 20%;
}
.invoice-preview-table td:nth-child(n + 2) {
  white-space: nowrap;
}
.invoice-preview-table td:first-child {
  font-weight: 700;
}
.invoice-preview-summary {
  width: min(270px, 100%);
  margin: 24px 0 0 auto;
}
.invoice-preview-summary div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 7px 0;
  color: #55555c;
  font-size: 11px;
}
.invoice-preview-summary .invoice-grand-total {
  margin-top: 5px;
  padding-top: 12px;
  border-top: 2px solid #252529;
  color: #18181b;
  font-size: 16px;
  font-weight: 900;
}
.invoice-preview-note {
  margin-top: 34px;
  padding: 15px 16px;
  border-left: 4px solid var(--red);
  background: #f7f7f8;
  color: #55555c;
  font-size: 11px;
  line-height: 1.6;
}
.invoice-preview-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #ededf0;
  color: #777780;
  font-size: 10px;
  text-align: center;
}
.invoice-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.invoice-launch-card {
  border-color: #e7c1c8;
  background: linear-gradient(135deg, #fff, #fff8f9);
}
.invoice-launch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.invoice-launch-copy h3 {
  margin: 5px 0 4px;
  font-size: 18px;
}
.invoice-launch-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.invoice-launch-total {
  text-align: right;
}
.invoice-launch-total small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.invoice-launch-total strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
}
.invoice-launch-actions {
  display: flex;
  gap: 9px;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .invoice-modal {
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .invoice-modal-head {
    padding: 16px 17px 13px;
  }
  .invoice-modal-head h2 {
    font-size: 21px;
  }
  .invoice-modal-head p:not(.eyebrow) {
    font-size: 12px;
  }
  .invoice-mobile-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }
  .invoice-mobile-tab {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f7f7f8;
    color: var(--muted);
    font-weight: 900;
    cursor: pointer;
  }
  .invoice-mobile-tab.active {
    border-color: var(--red);
    background: var(--red);
    color: #fff;
  }
  .invoice-workspace {
    display: block;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .invoice-editor,
  .invoice-preview-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
  }
  .invoice-workspace .invoice-editor,
  .invoice-workspace .invoice-preview-wrap {
    display: none;
  }
  .invoice-workspace.show-editor .invoice-editor {
    display: grid;
  }
  .invoice-workspace.show-preview .invoice-preview-wrap {
    display: block;
  }
  .invoice-editor {
    padding: 13px;
  }
  .invoice-preview-wrap {
    padding: 12px;
    border-left: 0;
    border-top: 0;
  }
  .invoice-preview {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: auto;
    overflow: hidden;
    padding: 24px 18px;
    box-shadow: 0 8px 24px rgba(24, 24, 27, 0.1);
  }
  .invoice-preview-table {
    width: 100%;
    table-layout: fixed;
  }
  .invoice-preview-table th:first-child,
  .invoice-preview-table td:first-child {
    width: 48%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .invoice-preview-table th:nth-child(2),
  .invoice-preview-table td:nth-child(2) {
    width: 10%;
  }
  .invoice-preview-table th:nth-child(3),
  .invoice-preview-table td:nth-child(3) {
    width: 20%;
  }
  .invoice-preview-table th:nth-child(4),
  .invoice-preview-table td:nth-child(4) {
    width: 22%;
  }
  .invoice-preview-table th,
  .invoice-preview-table td {
    padding-left: 5px;
    padding-right: 5px;
  }
  .invoice-modal-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    padding: 9px 12px max(9px, env(safe-area-inset-bottom));
  }
  .invoice-modal-actions button {
    min-width: 0;
    min-height: 44px;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 11px;
  }
}
@media (max-width: 560px) {
  .invoice-form-grid {
    grid-template-columns: 1fr;
  }
  .invoice-form-grid label.wide {
    grid-column: auto;
  }
  .invoice-builder-card {
    padding: 14px;
  }
  .invoice-item-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }
  .invoice-item-row .invoice-item-field:first-child {
    grid-column: 1 / -1;
  }
  .invoice-item-remove {
    grid-column: 1 / -1;
    width: 100%;
    height: 38px;
  }
  .invoice-preview {
    padding: 18px 12px;
  }
  .invoice-preview-top,
  .invoice-preview-meta,
  .invoice-launch-row {
    flex-direction: column;
    display: flex;
    gap: 16px;
  }
  .invoice-preview-title {
    text-align: left;
  }
  .invoice-preview-title h3 {
    font-size: 28px;
  }
  .invoice-preview-brand img {
    width: 54px;
    height: 54px;
  }
  .invoice-preview-brand strong {
    font-size: 15px;
  }
  .invoice-preview-meta {
    padding: 18px 0;
  }
  .invoice-preview-table th {
    font-size: 7px;
    letter-spacing: 0.04em;
  }
  .invoice-preview-table td {
    font-size: 9px;
  }
  .invoice-preview-summary {
    width: 100%;
  }
  .invoice-preview-footer {
    overflow-wrap: anywhere;
  }
  .invoice-launch-total {
    text-align: left;
  }
  .invoice-launch-actions {
    flex-direction: column;
  }
}

.invoice-pdf-stage {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 816px;
  padding: 24px;
  background: #fff;
  z-index: -1;
}
.invoice-pdf-stage .invoice-preview {
  width: 100%;
  max-width: none;
  min-height: 0;
  box-shadow: none;
  border-radius: 0;
}
.invoice-pdf-stage .invoice-preview-top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.invoice-pdf-stage .invoice-preview-title {
  text-align: right;
}
.invoice-pdf-stage .invoice-preview-title h3 {
  font-size: 34px;
}
.invoice-pdf-stage .invoice-preview-brand img {
  width: 68px;
  height: 68px;
}
.invoice-pdf-stage .invoice-preview-brand strong {
  font-size: 18px;
}
.invoice-pdf-stage .invoice-preview-meta {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 30px;
}
.invoice-pdf-stage .invoice-preview-table {
  table-layout: fixed;
}
.invoice-pdf-stage .invoice-preview-table th {
  font-size: 9px;
  letter-spacing: 0.08em;
}
.invoice-pdf-stage .invoice-preview-table td {
  font-size: 11px;
}
.invoice-pdf-stage .invoice-preview-summary {
  width: 270px;
  margin-left: auto;
}

/* Invoice preview containment + full-view action refinements */
.invoice-preview,
.invoice-preview * {
  min-width: 0;
}
.invoice-preview {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.invoice-preview-top > *,
.invoice-preview-brand,
.invoice-preview-brand > div,
.invoice-preview-title,
.invoice-preview-meta > * {
  min-width: 0;
}
.invoice-preview-brand strong,
.invoice-preview-brand span,
.invoice-preview-title p,
.invoice-preview-meta strong,
.invoice-preview-meta p,
.invoice-preview-note,
.invoice-preview-footer {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.invoice-preview-table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
}
.invoice-preview-table col.invoice-col-description {
  width: 52%;
}
.invoice-preview-table col.invoice-col-qty {
  width: 10%;
}
.invoice-preview-table col.invoice-col-rate {
  width: 18%;
}
.invoice-preview-table col.invoice-col-amount {
  width: 20%;
}
.invoice-preview-table th,
.invoice-preview-table td {
  min-width: 0;
  max-width: 0;
  overflow: hidden;
  padding-left: 6px;
  padding-right: 6px;
}
.invoice-preview-table th:first-child,
.invoice-preview-table td:first-child {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}
.invoice-preview-table th:nth-child(n + 2),
.invoice-preview-table td:nth-child(n + 2) {
  white-space: nowrap;
}
.invoice-modal-actions {
  grid-template-columns: repeat(4, minmax(0, auto));
}

@media (max-width: 900px) {
  .invoice-preview-wrap {
    overflow-x: hidden !important;
  }
  .invoice-preview-table col.invoice-col-description {
    width: 46%;
  }
  .invoice-preview-table col.invoice-col-qty {
    width: 10%;
  }
  .invoice-preview-table col.invoice-col-rate {
    width: 20%;
  }
  .invoice-preview-table col.invoice-col-amount {
    width: 24%;
  }
  .invoice-preview-table th,
  .invoice-preview-table td {
    padding-left: 3px;
    padding-right: 3px;
  }
  .invoice-modal-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.invoice-pdf-stage .invoice-preview-table col.invoice-col-description {
  width: 52%;
}
.invoice-pdf-stage .invoice-preview-table col.invoice-col-qty {
  width: 10%;
}
.invoice-pdf-stage .invoice-preview-table col.invoice-col-rate {
  width: 18%;
}
.invoice-pdf-stage .invoice-preview-table col.invoice-col-amount {
  width: 20%;
}

/* Schedule calendar */
.calendar-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.calendar-summary .stat-card {
  min-width: 0;
}
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.calendar-nav-controls,
.calendar-filters {
  display: flex;
  align-items: center;
  gap: 9px;
}
.calendar-nav-button {
  width: 44px;
  padding: 0;
}
.calendar-month-title {
  display: grid;
  margin-left: 6px;
}
.calendar-month-title small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}
.calendar-month-title strong {
  margin-top: 2px;
  font-family: "Archivo Black";
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.03em;
}
.calendar-filters label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.calendar-filters select {
  min-width: 150px;
  height: 44px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--charcoal);
  text-transform: none;
}
.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.75fr);
  gap: 18px;
  align-items: start;
}
.calendar-panel {
  overflow: hidden;
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #f8f8f9;
}
.calendar-weekdays span {
  padding: 12px 8px;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.calendar-day {
  position: relative;
  min-height: 126px;
  padding: 9px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--charcoal);
  text-align: left;
  cursor: pointer;
}
.calendar-day:nth-child(7n) {
  border-right: 0;
}
.calendar-day:hover,
.calendar-day:focus-visible {
  z-index: 1;
  outline: 2px solid rgba(200, 16, 46, 0.22);
  outline-offset: -2px;
  background: #fffafb;
}
.calendar-day.outside {
  background: #fafafa;
  color: #aaaab0;
}
.calendar-day.selected {
  box-shadow: inset 0 0 0 2px var(--red);
}
.calendar-day.today .calendar-day-number {
  background: var(--red);
  color: #fff;
}
.calendar-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
}
.calendar-day-number {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}
.calendar-day-total {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}
.calendar-event {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 6px 7px;
  overflow: hidden;
  border: 0;
  border-left: 3px solid var(--red);
  border-radius: 7px;
  background: #fff0f3;
  color: #7d0a1d;
  text-align: left;
  cursor: pointer;
}
.calendar-event:hover,
.calendar-event:focus-visible {
  background: #ffe2e8;
}
.calendar-event-time,
.calendar-event-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-event-time {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.05em;
}
.calendar-event-name {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 800;
}
.calendar-more {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}
.calendar-agenda-panel {
  position: sticky;
  top: 14px;
  overflow: hidden;
}
.calendar-agenda-head {
  align-items: center;
}
.calendar-day-count {
  padding: 7px 10px;
  border-radius: 999px;
  background: #f4f4f5;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}
.calendar-agenda {
  padding: 14px;
}
.calendar-slot {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.calendar-slot:last-child {
  border-bottom: 0;
}
.calendar-slot-time {
  padding-top: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}
.calendar-slot-content {
  min-width: 0;
}
.calendar-free-slot {
  width: 100%;
  min-height: 44px;
  border: 1px dashed #d5d5da;
  border-radius: 10px;
  background: #fafafa;
  color: var(--muted);
  text-align: left;
  padding: 9px 11px;
  font-weight: 800;
}
.calendar-free-slot:hover {
  border-color: var(--red);
  background: #fff7f9;
  color: var(--red);
}
.calendar-agenda-job {
  padding: 11px;
  border-left: 4px solid var(--red);
  border-radius: 10px;
  background: #fff7f9;
}
.calendar-agenda-job + .calendar-agenda-job {
  margin-top: 7px;
}
.calendar-agenda-job strong,
.calendar-agenda-job small {
  display: block;
  min-width: 0;
}
.calendar-agenda-job strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}
.calendar-agenda-job small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.calendar-agenda-actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}
.calendar-agenda-actions button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--charcoal);
  font-size: 9px;
  font-weight: 900;
}
.calendar-agenda-actions button:hover {
  border-color: var(--red);
  color: var(--red);
}
.calendar-other-jobs {
  margin: 12px 0 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.calendar-other-jobs > small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.unscheduled-panel {
  margin-top: 18px;
  overflow: hidden;
}
.unscheduled-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}
.unscheduled-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.unscheduled-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.unscheduled-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.unscheduled-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.unscheduled-card-actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}
.unscheduled-card-actions button {
  flex: 1;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 10px;
  font-weight: 900;
}
.unscheduled-card-actions .schedule-now {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}
.schedule-backdrop {
  position: fixed;
  inset: 0;
  z-index: 88;
  opacity: 0;
  visibility: hidden;
  background: rgba(17, 17, 19, 0.58);
  backdrop-filter: blur(3px);
  transition: 0.18s ease;
}
.schedule-backdrop.show {
  opacity: 1;
  visibility: visible;
}
.schedule-modal {
  position: fixed;
  z-index: 89;
  left: 50%;
  top: 50%;
  width: min(620px, calc(100% - 26px));
  max-height: min(820px, calc(100vh - 26px));
  overflow-y: auto;
  transform: translate(-50%, -48%) scale(0.98);
  opacity: 0;
  visibility: hidden;
  padding: 24px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.24);
  transition: 0.18s ease;
}
.schedule-modal.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  visibility: visible;
}
.schedule-modal .drawer-head {
  margin-bottom: 18px;
}
.schedule-modal-copy {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.schedule-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}
.schedule-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.schedule-form label.wide,
.schedule-form .wide {
  grid-column: 1 / -1;
}
.schedule-form input,
.schedule-form select {
  width: 100%;
  height: 46px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--charcoal);
}
.schedule-field-help {
  color: #8b8b92;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.4;
}
.schedule-conflict {
  display: none;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--yellow-soft);
  color: #7a5400;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}
.schedule-conflict.show {
  display: block;
}
.schedule-conflict.clear {
  display: block;
  background: var(--green-soft);
  color: var(--green);
}
.schedule-ticket-preview {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f8f9;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.schedule-ticket-preview strong {
  color: var(--charcoal);
}
.schedule-actions {
  align-items: center;
}
.schedule-view-ticket {
  margin-left: auto;
}

@media (max-width: 1200px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }
  .calendar-agenda-panel {
    position: static;
  }
  .unscheduled-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 800px) {
  .calendar-summary {
    grid-template-columns: 1fr 1fr;
  }
  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .calendar-nav-controls,
  .calendar-filters {
    width: 100%;
  }
  .calendar-month-title {
    margin-left: auto;
  }
  .calendar-filters label {
    flex: 1;
  }
  .calendar-filters select {
    width: 100%;
    min-width: 0;
  }
  .calendar-panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .calendar-weekdays,
  .calendar-grid {
    min-width: 700px;
  }
  .calendar-day {
    min-height: 110px;
  }
}
@media (max-width: 560px) {
  .calendar-summary {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  .calendar-summary .stat-card {
    padding: 15px;
  }
  .calendar-summary .stat-card strong {
    font-size: 27px;
  }
  .calendar-nav-controls {
    flex-wrap: wrap;
  }
  .calendar-month-title {
    width: 100%;
    margin: 5px 0 0;
  }
  .calendar-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .calendar-filters label {
    min-width: 0;
  }
  .calendar-filters #scheduleJobBtn {
    align-self: end;
  }
  .calendar-agenda {
    padding: 10px 13px;
  }
  .calendar-slot {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .unscheduled-list {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .schedule-modal {
    width: calc(100% - 14px);
    max-height: calc(100vh - 14px);
    padding: 17px;
    border-radius: 16px;
  }
  .schedule-form {
    grid-template-columns: 1fr;
  }
  .schedule-form label.wide,
  .schedule-form .wide {
    grid-column: auto;
  }
  .schedule-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .schedule-actions .schedule-view-ticket {
    margin-left: 0;
  }
  .schedule-actions #saveSchedule {
    grid-column: 1 / -1;
  }
}

.schedule-remove-button {
  min-height: 42px;
  margin-right: auto;
  padding: 0 14px;
  border: 1px solid #efb2bd;
  border-radius: 10px;
  background: #fff4f6;
  color: var(--red);
  font-weight: 900;
  cursor: pointer;
}
.schedule-remove-button:hover,
.schedule-remove-button:focus-visible {
  border-color: var(--red);
  background: #ffe7ec;
}
.schedule-remove-button[hidden] {
  display: none !important;
}
@media (max-width: 560px) {
  .schedule-actions .schedule-remove-button {
    grid-column: 1 / -1;
    width: 100%;
    margin-right: 0;
  }
}

.ticket-form select {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--charcoal);
}
