:root {
  --bg: #f7f0e8;
  --surface: #fffdf9;
  --surface-2: #f4e3d6;
  --text: #294638;
  --muted: #68756e;
  --line: #e5d4c3;
  --brand: #416f56;
  --brand-dark: #315642;
  --brand-light: #5a8a70;
  --accent: #cb6028;
  --cream: #e5d4c3;
  --danger: #a43f35;
  --shadow: 0 16px 40px rgba(41, 70, 56, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
  background: var(--accent);
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(100%, 420px);
}

.login-logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: clamp(150px, 26vh, 210px);
  margin: 0 auto;
  clip-path: inset(0 2px 0 0);
  object-fit: contain;
}

.login-title {
  margin: 2px 0 4px;
  color: var(--brand-dark);
  font-size: 20px;
  text-align: center;
}

.login-brand {
  justify-content: center;
  color: var(--text);
}

.login-brand .brand-logo {
  width: 80px;
  height: 80px;
}

.login-brand span,
.login-hint {
  color: var(--muted);
}

.login-form {
  display: none;
}

.active-login-form {
  display: grid;
  gap: 12px;
  padding: 24px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-2);
}

.login-tab {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.login-tab.active {
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 4px 14px rgba(31, 42, 42, 0.08);
}

.login-hint {
  margin: 0;
  font-size: 13px;
  text-align: center;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: var(--brand);
  color: #eff8f4;
}

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

.brand-logo {
  display: block;
  width: 112px;
  height: 118px;
  border-radius: 8px;
  object-fit: contain;
  object-position: center;
}

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

.brand span,
.sidebar-footer span {
  color: #b8cfca;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #dcebe7;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent);
  color: #ffffff;
}

.mobile-logout {
  display: none;
}

.icon {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
}

.icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon .stroke-icon {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.primary-button,
.secondary-button,
.hotel-action-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: #ad4d20;
}

.hotel-action-button {
  background: var(--brand);
  color: #ffffff;
}

.hotel-action-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.danger-button {
  background: #fff2f2;
  color: var(--danger);
  border-color: #f2cdcd;
}

.view {
  display: none;
}

.hidden {
  display: none !important;
}

.clipboard-helper {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.active-view {
  display: block;
}

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

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.workspace-grid.single-column {
  grid-template-columns: minmax(0, 1fr);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 18px;
}

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

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

.panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.filter-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.filters-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  margin: -2px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.filters-panel.hidden {
  display: none;
}

.clear-filters {
  white-space: nowrap;
}

.modal {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 18px 55px rgba(22, 49, 36, 0.24);
}

.modal::backdrop {
  background: rgba(20, 38, 29, 0.58);
}

.modal-content {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header {
  margin-bottom: 18px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.form-section-title {
  margin: 8px 0 0;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 15px;
}

.icon-button {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.select-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
}

.manage-options-button,
.danger-icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand);
}

.manage-options-button:hover {
  border-color: var(--brand);
  background: #f1f7f3;
}

.manage-options-button svg,
.danger-icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.fee-preview {
  display: flex;
  min-height: 40px;
  align-self: end;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.fee-preview strong {
  color: var(--text);
}

.total-preview {
  border-color: #9dbeb0;
  background: #edf7f0;
}

.total-preview strong {
  font-size: 16px;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.service-picker {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.service-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 7px 9px;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

.service-choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.service-empty {
  margin: 4px;
  color: var(--muted);
  font-size: 13px;
}

.option-modal {
  width: min(520px, calc(100% - 32px));
}

.option-modal.services-mode {
  width: min(760px, calc(100% - 32px));
}

.option-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.service-option-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(120px, 1fr) minmax(110px, 0.8fr) auto;
  align-items: end;
  gap: 10px;
}

.service-option-row > span {
  display: grid;
  gap: 3px;
}

.service-option-row small {
  color: var(--muted);
  font-size: 12px;
}

.option-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.option-row {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.danger-icon-button {
  color: var(--danger);
}

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

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

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

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

.optional-label,
.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

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

.logo-upload input[type="file"] {
  min-width: 0;
  height: auto;
  padding: 8px;
  background: #ffffff;
}

.logo-upload input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--cream);
  color: var(--brand-dark);
  font-weight: 800;
  cursor: pointer;
}

.business-logo-preview,
.business-card-logo {
  flex: 0 0 auto;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.business-logo-preview {
  width: 72px;
  height: 72px;
}

.business-card-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.business-card-logo {
  width: 46px;
  height: 46px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(203, 96, 40, 0.18);
}

.search {
  max-width: 230px;
}

.full-button {
  width: 100%;
  margin-top: 14px;
}

.timeline,
.compact-list,
.card-list,
.appointment-list {
  display: grid;
  gap: 10px;
}

.empty {
  display: grid;
  min-height: 130px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.item-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.item-title {
  margin: 0;
  font-weight: 800;
}

.item-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.item-total {
  margin: 2px 0 0;
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 800;
}

.item-notes {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.pending-note {
  margin: 0;
  padding: 9px 10px;
  border-left: 3px solid #c7892c;
  border-radius: 6px;
  background: #fff4df;
  color: #76501e;
  font-size: 13px;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.warn {
  background: #fff0df;
  color: #90531d;
}

.badge.done {
  background: #e8f3ff;
  color: #2f608f;
}

.badge.cancel {
  background: #fff2f2;
  color: var(--danger);
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button {
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
}

.success-action {
  border-color: #a8c9b5;
  background: #edf7f0;
  color: var(--brand-dark);
}

.icon-copy-button {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  padding: 0;
  place-items: center;
  border-color: #9dbeb0;
  background: #ffffff;
  color: var(--brand-dark);
}

.icon-copy-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.delete-icon-button {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  padding: 0;
  place-items: center;
  border-color: #e2b8b3;
  color: var(--danger);
}

.delete-icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.warning-action {
  border-color: #e6c68f;
  background: #fff4df;
  color: #76501e;
}

.cancel-action {
  border-color: #e2b8b3;
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 14px;
    gap: 12px;
  }

  .brand {
    justify-content: center;
  }

  .brand-logo {
    width: 66px;
    height: 70px;
  }

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

  .mobile-logout {
    display: flex;
  }

  .nav-item {
    justify-content: center;
    min-height: 48px;
    padding: 8px;
  }

  .nav-item span:last-child,
  .sidebar-footer {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .panel-header {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .stats-grid,
  .workspace-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-tools {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .panel-tools .search {
    flex: 1 1 180px;
    min-width: 0;
  }

  .panel-tools > button {
    flex: 0 0 auto;
  }
}

@media (max-width: 700px) {
  .service-option-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-option-fields > label:first-child,
  .service-option-fields > button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  h1 {
    font-size: 26px;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

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

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

  .service-option-fields {
    grid-template-columns: 1fr;
  }

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

  .stat-card {
    min-height: 104px;
    padding: 14px;
  }

  .stat-card:nth-child(n + 3) {
    display: none;
  }

  .stat-card strong {
    margin-top: 6px;
    font-size: 26px;
  }

  .logo-upload {
    align-items: stretch;
    flex-direction: column;
  }

  .panel {
    padding: 14px;
  }

  .panel-header {
    flex-direction: column;
  }

  .panel-tools {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .panel-tools .search {
    flex: 0 0 auto;
    width: 100%;
  }

  .panel-tools .primary-button {
    width: 100%;
  }

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

  .clear-filters {
    width: 100%;
  }

  .modal {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
  }

  .modal-content {
    padding: 16px;
  }

  .search {
    max-width: none;
  }

  .item-top {
    flex-direction: column;
  }
}
