:root {
  --bg: #f7f4fb;
  --ink: #261b33;
  --muted: #7d6a90;
  --line: #e5dcec;
  --panel: #ffffff;
  --purple: #673196;
  --purple-dark: #4a2075;
  --lavender: #b98ed7;
  --accent: #8a4fc0;
  --red: #b64267;
  --shadow: 0 18px 48px rgba(76, 38, 111, .16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #fff;
  background: var(--purple);
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--purple-dark);
}

.ghost {
  color: var(--purple-dark);
  background: #efe8f6;
}

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

.hidden {
  display: none !important;
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-items: stretch;
  padding: 0;
  background: #f7f4fb;
  overflow: hidden;
}

.login-shell::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: url("logo.png") center / min(980px, 110vw) auto no-repeat;
  filter: blur(20px);
  opacity: .42;
  transform: scale(1.1);
}

.login-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(47, 21, 73, .78) 0%, rgba(82, 39, 123, .32) 47%, rgba(247, 244, 251, .8) 100%),
    rgba(255, 255, 255, .16);
}

.login-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  align-items: center;
  gap: 36px;
  width: 100%;
  max-width: 1220px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 42px;
}

.login-brand-block {
  max-width: 650px;
  color: #fff;
}

.login-panel {
  width: min(440px, 100%);
  justify-self: end;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
}

.login-brand-block h1 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 56px;
  line-height: 1;
}

.login-brand-block p {
  max-width: 570px;
  margin: 0;
  color: #f4edf9;
  font-size: 20px;
  line-height: 1.45;
}

.login-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.login-highlights span {
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, .13);
  font-weight: 800;
}

.login-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-panel h2 {
  margin: 8px 0 20px;
  color: var(--purple-dark);
  font-size: 28px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form input {
  min-height: 44px;
}

.login-form button {
  min-height: 46px;
}

.login-footnote {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
  padding: 22px;
  color: #f7f0fb;
  background: linear-gradient(180deg, #5d2b8a 0%, #3f1d62 100%);
}

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

.brand img {
  width: 118px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  padding: 4px;
}

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

.brand span {
  color: #dcc6ec;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 6px;
}

nav button {
  width: 100%;
  color: #eadcf4;
  background: transparent;
  text-align: left;
}

nav button:hover,
nav button.active {
  color: #fff;
  background: rgba(255, 255, 255, .14);
}

.nav-group {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .14);
}

.nav-group-title {
  color: #fff;
  cursor: default;
}

.nav-group-title:hover {
  background: rgba(255, 255, 255, .12);
}

.nav-submenu {
  display: grid;
  gap: 4px;
  padding-left: 12px;
}

.nav-submenu button {
  padding: 8px 12px;
  color: #ddc9ed;
  font-size: 14px;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

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

.topbar h2 {
  margin: 2px 0 0;
  font-size: 30px;
}

#eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

#actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(28, 44, 35, .06);
}

.metric {
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.home-navigation {
  margin-bottom: 16px;
}

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

.home-nav-grid button {
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 16px;
  border: 1px solid #e7ddef;
  color: var(--ink);
  background: #fbf9fd;
  text-align: left;
  box-shadow: 0 8px 20px rgba(76, 38, 111, .06);
}

.home-nav-grid button:hover {
  border-color: var(--lavender);
  background: #f3edf8;
}

.home-nav-grid button span,
.home-nav-parameters strong {
  color: var(--purple-dark);
  font-size: 16px;
  font-weight: 900;
}

.home-nav-grid button small {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

.home-nav-parameters {
  display: grid;
  gap: 12px;
  min-height: 86px;
  padding: 16px;
  border: 1px solid #e7ddef;
  border-radius: 8px;
  background: #fbf9fd;
  box-shadow: 0 8px 20px rgba(76, 38, 111, .06);
}

.home-nav-parameters div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-nav-parameters button {
  min-height: 34px;
  padding: 7px 10px;
  color: var(--purple-dark);
  background: #efe8f6;
  font-size: 13px;
  text-align: center;
  box-shadow: none;
}

.home-nav-parameters button:hover {
  color: #fff;
  background: var(--purple);
}

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

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

.dashboard-grid .panel {
  min-width: 0;
}

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

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

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

.bar-row {
  grid-template-columns: 120px 1fr auto;
}

.bar-row div {
  height: 10px;
  border-radius: 99px;
  background: #edf2ee;
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--lavender);
}

.mini-list,
.schedule-list {
  display: grid;
  gap: 8px;
}

.mini-row,
.schedule-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

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

.mini-row strong,
.schedule-row strong,
.schedule-row b {
  display: block;
}

.mini-row span,
.schedule-row span,
.schedule-row small {
  color: var(--muted);
  font-size: 13px;
}

.mini-row time,
.invoice-row b {
  color: var(--purple-dark);
  font-weight: 800;
}

.schedule-row {
  grid-template-columns: 90px 90px 1fr;
}

.cleaning-toolbar {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

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

.cleaning-stats article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(76, 38, 111, .06);
}

.cleaning-stats span,
.cleaning-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.cleaning-card span {
  color: var(--purple);
}

.cleaning-stats strong {
  display: block;
  margin-top: 6px;
  color: var(--purple-dark);
  font-size: 24px;
}

.cleaning-filters {
  display: grid;
  grid-template-columns: 1fr 190px 190px;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cleaning-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.day-column {
  min-height: 390px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf9fd;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.day-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  border-radius: 8px 8px 0 0;
}

.day-column h3 {
  margin: 0;
  color: var(--purple-dark);
  font-size: 15px;
}

.day-column header span {
  min-width: 28px;
  padding: 4px 8px;
  border-radius: 99px;
  color: #fff;
  background: var(--purple);
  text-align: center;
  font-weight: 800;
}

.shift-stack {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.shift-lane {
  min-height: 112px;
  border: 1px dashed #dac9e8;
  border-radius: 8px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.shift-lane.drop-target {
  border-color: var(--purple);
  background: #f1e8f8;
  box-shadow: inset 0 0 0 2px rgba(103, 49, 150, .16);
}

.shift-lane > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid #eee5f4;
  border-radius: 8px 8px 0 0;
  background: #faf6fd;
}

.shift-lane > header strong {
  color: var(--purple-dark);
  font-size: 13px;
}

.shift-lane > header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cleaning-cards {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.cleaning-cards p {
  margin: 6px 2px;
  color: var(--muted);
  font-size: 13px;
}

.cleaning-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e7ddef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(76, 38, 111, .07);
  cursor: grab;
}

.cleaning-card:active {
  cursor: grabbing;
}

.cleaning-card.dragging {
  opacity: .55;
  transform: scale(.98);
}

.cleaning-card strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.cleaning-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.assigned-person {
  padding: 8px;
  border-radius: 6px;
  background: #f3edf8;
}

.assigned-person b {
  display: block;
  color: var(--purple-dark);
}

.cleaning-card footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.cleaning-card footer button {
  padding: 7px 10px;
}

.staff-dashboard {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.staff-selector {
  padding: 14px;
}

.staff-week {
  max-height: none;
}

.staff-cleaning-card {
  cursor: default;
}

.staff-cleaning-card:active {
  cursor: default;
}

.staff-table {
  margin-top: 4px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.search {
  width: calc(100% - 32px);
  margin: 16px;
}

.table-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 16px;
}

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

.active-filter {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f4fb;
}

.active-filter-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.active-filter-field span {
  text-transform: uppercase;
}

.active-filter button {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--purple-dark);
  background: transparent;
  font-size: 13px;
  white-space: nowrap;
}

.active-filter button:hover {
  background: #efe8f6;
}

.active-filter button.active {
  color: #fff;
  background: var(--purple);
  box-shadow: 0 6px 14px rgba(76, 38, 111, .18);
}

.table-wrap {
  overflow: auto;
}

.limited-table-wrap {
  max-height: 486px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.limited-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: 0 1px 0 var(--line);
}

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

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

th {
  color: var(--muted);
  background: #f8faf8;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr.selected-row td {
  background: #f3edf8;
}

.row-actions {
  white-space: nowrap;
}

.row-actions button {
  margin-left: 6px;
  padding: 7px 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.form-grid.wide,
#dialogFields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

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

.check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check input {
  width: auto;
}

.error {
  display: block;
  min-height: 20px;
  margin-top: 12px;
  color: var(--red);
  font-weight: 700;
}

dialog {
  width: min(760px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog:has(.client-plan-dialog) {
  width: min(1180px, calc(100vw - 32px));
}

.client-plan-dialog {
  display: grid;
  gap: 14px;
}

.admin-detail-panel {
  margin-top: 16px;
}

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

.admin-detail-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-detail-header h3 {
  margin: 3px 0 0;
}

.admin-detail-header > strong {
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 99px;
  color: #fff;
  background: var(--purple);
  text-align: center;
}

.admin-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-detail-actions strong {
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 99px;
  color: #fff;
  background: var(--purple);
  text-align: center;
}

.admin-detail-actions button {
  white-space: nowrap;
}

dialog::backdrop {
  background: rgba(16, 31, 24, .46);
}

dialog form {
  padding: 20px;
}

dialog header,
dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

dialog h3 {
  margin: 0 0 16px;
}

dialog footer {
  margin-top: 18px;
  justify-content: flex-end;
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink);
  background: #edf2ee;
}

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

@media (max-width: 900px) {
  .login-hero {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 24px;
    padding: 24px;
  }

  .login-brand-block h1 {
    font-size: 42px;
  }

  .login-brand-block p {
    font-size: 17px;
  }

  .login-panel {
    justify-self: stretch;
    width: 100%;
  }

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

  .sidebar {
    min-height: auto;
  }

  .workspace {
    padding: 22px 16px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  #actions {
    display: grid;
    width: 100%;
  }

  #actions button {
    width: 100%;
  }

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

  .active-filter {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .metric-grid,
  .home-nav-grid,
  .split,
  .dashboard-grid,
  .form-grid.wide,
  #dialogFields {
    grid-template-columns: 1fr;
  }

  .wide-panel {
    grid-column: auto;
  }

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

  .cleaning-stats,
  .cleaning-filters {
    grid-template-columns: 1fr;
  }
}
