:root {
  --bg: #edf4ff;
  --panel: rgba(255, 255, 255, 0.68);
  --panel-strong: rgba(255, 255, 255, 0.86);
  --border: rgba(255, 255, 255, 0.5);
  --text: #1b2b4b;
  --muted: #5c6d8a;
  --accent: #0f9d91;
  --accent-2: #24c6a3;
  --danger: #dc4d67;
  --warning: #ef9e33;
  --success: #18a56a;
  --shadow: 0 10px 30px rgba(22, 35, 66, 0.14);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Manrope', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 20%, #b7edff 0%, transparent 30%),
    radial-gradient(circle at 80% 5%, #b6f6d8 0%, transparent 32%),
    linear-gradient(140deg, #d6e8ff 0%, #ecf4ff 45%, #d4f3ea 100%);
  overflow-x: hidden;
  line-height: 1.4;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  touch-action: manipulation;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(55px);
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

.orb-1 {
  width: 280px;
  height: 280px;
  background: #72cee5;
  top: -40px;
  left: -20px;
}

.orb-2 {
  width: 380px;
  height: 380px;
  background: #8fe8b1;
  right: -120px;
  top: 120px;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: #8ca7ff;
  bottom: -120px;
  left: 22%;
}

#app {
  min-height: 100vh;
}

.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.auth-card {
  width: min(94vw, 470px);
  padding: 28px;
  display: grid;
  gap: 22px;
  animation: slideIn 0.4s ease;
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #08aab2, #25d4a5);
  box-shadow: 0 10px 20px rgba(10, 145, 157, 0.3);
}

.auth-brand h1,
.sidebar-brand h2 {
  font-size: 1.3rem;
  font-weight: 800;
}

.auth-brand p,
.sidebar-brand p {
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 14px;
}

.auth-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 18px rgba(36, 54, 97, 0.12);
}

.auth-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}

input,
select,
textarea {
  border: 1px solid rgba(151, 174, 219, 0.4);
  border-radius: 12px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  transition: border 0.2s ease, box-shadow 0.2s ease;
  font-size: 16px;
  min-height: 44px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #66c8be;
  box-shadow: 0 0 0 4px rgba(39, 179, 158, 0.15);
}

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

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  font-weight: 700;
  min-height: 44px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 18px rgba(13, 157, 144, 0.3);
}

.btn-soft {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  border: 1px solid rgba(158, 178, 214, 0.45);
}

.btn-danger {
  background: linear-gradient(135deg, #d63b59, #e56b6b);
  color: white;
}

.auth-actions {
  display: flex;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.form-error {
  color: #b11642;
  font-size: 0.85rem;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  padding: 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 100vw;
}

.sidebar {
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

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

.nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.62);
  border-radius: 12px;
  padding: 11px 12px;
  min-height: 44px;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-item.active,
.nav-item:hover {
  background: linear-gradient(130deg, rgba(18, 163, 150, 0.15), rgba(40, 195, 160, 0.24));
  border-color: rgba(17, 167, 151, 0.35);
}

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

.main-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.topbar {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 1.35rem;
}

.topbar p {
  color: var(--muted);
  font-size: 0.9rem;
}

.session-badge {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(154, 178, 224, 0.4);
}

.view-root {
  padding-bottom: 10px;
  overflow-x: hidden;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.card {
  border-radius: var(--radius);
  padding: 16px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  animation: fadeLift 0.3s ease;
  min-width: 0;
}

.demo-sticky-upgrade {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(16, 31, 56, 0.95);
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.demo-sticky-upgrade .btn {
  min-height: 38px;
  padding: 8px 12px;
}

.demo-sticky-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.demo-sticky-upgrade .btn-soft {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.92);
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(24, 181, 159, 0.12);
  right: -32px;
  top: -46px;
}

.stat-card h3 {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
}

.stat-sub {
  margin-top: 8px;
  font-size: 0.82rem;
  color: #417266;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}

.section-head h3 {
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(174, 191, 224, 0.38);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.btn-xs {
  padding: 7px 9px;
  font-size: 0.77rem;
  border-radius: 9px;
}

.search-row,
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.search-row input,
.filter-row input,
.filter-row select {
  max-width: 280px;
}

.status {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  display: inline-block;
}

.status.booked {
  background: rgba(69, 134, 239, 0.15);
  color: #2756b3;
}

.status.completed {
  background: rgba(22, 165, 106, 0.15);
  color: #147849;
}

.status.cancelled {
  background: rgba(220, 77, 103, 0.18);
  color: #9f2241;
}

.status.paid {
  background: rgba(17, 166, 111, 0.14);
  color: #0f7e53;
}

.status.unpaid {
  background: rgba(239, 158, 51, 0.2);
  color: #976018;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
}

.activity-item p {
  font-size: 0.88rem;
}

.activity-time {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.chart-wrap {
  display: grid;
  gap: 10px;
}

.chart-row {
  display: grid;
  grid-template-columns: 140px 1fr 52px;
  align-items: center;
  gap: 10px;
}

.chart-label {
  font-size: 0.86rem;
  color: var(--muted);
}

.bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(161, 180, 214, 0.3);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(120deg, #1aa594, #49cdb5);
  transition: width 0.35s ease;
}

.kpi {
  font-size: 0.84rem;
  color: var(--muted);
  text-align: right;
}

.modal-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 41, 0.45);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: auto;
  animation: fadeIn 0.2s ease;
}

.modal {
  width: min(96vw, 620px);
  max-height: 88dvh;
  overflow-y: auto;
  border-radius: 18px;
  padding: 18px;
  background: #f4f8ff;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 24px 44px rgba(15, 34, 67, 0.3);
  animation: slideIn 0.25s ease;
}

.modal h3 {
  margin-bottom: 12px;
}

.modal form {
  display: grid;
  gap: 12px;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.line-items {
  display: grid;
  gap: 8px;
}

.line-item {
  display: grid;
  grid-template-columns: 1fr 120px 36px;
  gap: 8px;
}

.line-remove {
  border: none;
  border-radius: 10px;
  background: rgba(221, 83, 95, 0.18);
  color: #a7334e;
  font-weight: 800;
  cursor: pointer;
}

.toast-container {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: grid;
  gap: 8px;
  z-index: 2000;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #fff;
  font-size: 0.86rem;
  box-shadow: 0 12px 26px rgba(15, 20, 33, 0.25);
  animation: slideInRight 0.25s ease;
}

.toast.success {
  background: linear-gradient(130deg, #148a68, #2bb987);
}

.toast.error {
  background: linear-gradient(130deg, #bd3552, #e15f77);
}

.toast.info {
  background: linear-gradient(130deg, #2b72b9, #3ea2d7);
}

.invoice-print {
  background: white;
  color: #16233f;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid #d1dced;
}

.invoice-print h4 {
  margin-bottom: 10px;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.btn:focus-visible,
.nav-item:focus-visible,
.auth-tab:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(15, 157, 145, 0.3);
  outline-offset: 2px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeLift {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .sidebar {
    padding: 12px;
    gap: 12px;
  }

  .sidebar-brand {
    margin-bottom: 8px;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    overflow-x: hidden;
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    flex: 1 1 calc(50% - 8px);
    width: 100%;
    white-space: normal;
    text-align: center;
  }

  .sidebar-footer {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px;
    align-items: flex-start;
  }

  .topbar-right {
    width: 100%;
    display: flex;
    justify-content: flex-start;
  }

  .session-badge {
    display: inline-flex;
  }

  .form-grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .kpi {
    text-align: left;
  }

  .line-item {
    grid-template-columns: 1fr;
  }

  .search-row input,
  .filter-row input,
  .filter-row select {
    max-width: none;
    width: 100%;
  }

  .search-row,
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .table-actions {
    flex-wrap: wrap;
  }

  .table-actions .btn {
    flex: 1 1 auto;
  }

  .table-wrap {
    overflow: visible;
    width: 100%;
    max-width: 100%;
  }

  table {
    min-width: 0;
    width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    max-width: 100%;
  }

  table thead {
    display: none;
  }

  table tbody {
    display: grid;
    gap: 10px;
  }

  table tbody tr {
    display: block;
    border: 1px solid rgba(174, 191, 224, 0.38);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    padding: 6px 8px;
    max-width: 100%;
  }

  th,
  td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 4px;
    font-size: 0.82rem;
    vertical-align: top;
    word-break: break-word;
    border-bottom: 1px dashed rgba(174, 191, 224, 0.35);
  }

  table tbody tr td:last-child {
    border-bottom: none;
  }

  td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    min-width: 84px;
    flex: 0 0 84px;
  }

  .btn-xs {
    padding: 6px 8px;
    min-height: 38px;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    padding: 12px;
  }

  .auth-card {
    padding: 18px 14px;
    gap: 16px;
  }

  .layout {
    gap: 10px;
    padding: 8px;
  }

  .topbar h1 {
    font-size: 1.12rem;
  }

  .topbar p {
    font-size: 0.82rem;
  }

  .card {
    padding: 12px;
  }

  .topbar {
    padding: 10px;
  }

  .nav {
    gap: 6px;
  }

  .nav-item {
    min-height: 38px;
    padding: 8px 9px;
    font-size: 0.85rem;
  }

  .modal {
    width: 100%;
    max-height: 92dvh;
    border-radius: 14px;
    padding: 14px;
  }

  .demo-sticky-upgrade {
    justify-content: space-between;
    font-size: 0.86rem;
  }

  .demo-sticky-actions {
    gap: 6px;
  }
}

@media (hover: none) {
  .btn:hover {
    transform: none;
  }
}
