/* ===========================================================================
   Design system — Beauty / Soft-UI (pink + lavender), Hebrew RTL
   Palette from design skill (Beauty/Spa/Wellness)
   =========================================================================== */
:root {
  --primary: #EC4899;
  --primary-700: #BE185D;
  --primary-soft: #FCE7F3;
  --secondary: #F9A8D4;
  --accent: #8B5CF6;
  --accent-soft: #EDE9FE;
  --bg: #FDF2F8;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #FCE7F3 0%, rgba(252,231,243,0) 55%),
             radial-gradient(900px 500px at -10% 0%, #EDE9FE 0%, rgba(237,233,254,0) 50%),
             #FDF6FB;
  --fg: #831843;
  --text: #4A2540;
  --muted: #9B7A8E;
  --card: #FFFFFF;
  --card-border: #FBCFE8;
  --border: #F3D9E8;
  --bg-soft: #FCEFF8;
  --ring: #EC4899;
  --good: #16A34A;
  --good-soft: #DCFCE7;
  --warn: #D97706;
  --warn-soft: #FEF3C7;
  --bad: #DC2626;
  --bad-soft: #FEE2E2;
  --info: #2563EB;
  --info-soft: #DBEAFE;

  --shadow-sm: 0 1px 2px rgba(190, 24, 93, 0.06);
  --shadow: 0 8px 24px -10px rgba(190, 24, 93, 0.22);
  --shadow-lg: 0 20px 48px -16px rgba(139, 92, 246, 0.30);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --sidebar-w: 248px;

  --font: "Heebo", "Assistant", "Arial Hebrew", system-ui, -apple-system, sans-serif;
  --font-head: "Rubik", "Heebo", "Arial Hebrew", system-ui, sans-serif;
}

/* ----- Dark mode ----- */
[data-theme="dark"] {
  --primary-soft: #3a1f33;
  --accent-soft: #2a2350;
  --bg: #141019;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #2a1430 0%, rgba(42,20,48,0) 55%),
             radial-gradient(900px 500px at -10% 0%, #1c1840 0%, rgba(28,24,64,0) 50%),
             #120d18;
  --fg: #F7E9F1;
  --text: #E7D8E3;
  --muted: #A98BA0;
  --card: #221A2B;
  --card-border: #382C44;
  --border: #312540;
  --bg-soft: #2B2235;
  --good-soft: #14331f; --warn-soft: #3a2e10; --bad-soft: #3a1a1c; --info-soft: #16243f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 8px 24px -10px rgba(0,0,0,.55);
  --shadow-lg: 0 20px 48px -16px rgba(0,0,0,.7);
}
[data-theme="dark"] #sidebar { background: rgba(28,20,36,0.82); }
[data-theme="dark"] #topbar { background: rgba(18,13,24,0.78); }
[data-theme="dark"] .btn,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .chip,
[data-theme="dark"] .slot,
[data-theme="dark"] .checkline { background: #2A2034; color: var(--text); }
[data-theme="dark"] .segment button.on { background: #3a2c44; }
[data-theme="dark"] .toast { background: #3a2c44; }
[data-theme="dark"] .cal-ev { color: #2a1830; }
[data-theme="dark"] input::placeholder, [data-theme="dark"] textarea::placeholder { color: #8a7184; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-grad);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--fg); margin: 0; font-weight: 700; }
a { color: var(--primary-700); }
button { font-family: inherit; }

/* ----- Layout ----- */
#app-shell { display: flex; min-height: 100vh; }

#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(14px);
  border-inline-start: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; font-size: 24px;
  box-shadow: var(--shadow);
}
.brand-name { font-family: var(--font-head); font-weight: 800; color: var(--fg); font-size: 17px; }
.brand-sub { font-size: 12px; color: var(--muted); }

#nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 14px;
  color: var(--text); text-decoration: none; cursor: pointer;
  font-weight: 500; border: 1px solid transparent;
  transition: all .15s ease;
}
.nav-item .nav-ico { font-size: 18px; width: 22px; text-align: center; }
.nav-item:hover { background: var(--primary-soft); }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; box-shadow: var(--shadow);
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.25); color:#fff; }
.nav-badge {
  margin-inline-start: auto; background: var(--bad); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
}
.sidebar-foot { padding-top: 14px; border-top: 1px solid var(--border); }

#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 28px; position: sticky; top: 0; z-index: 5;
  background: rgba(253,246,251,0.75); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
#page-title { font-size: 22px; }
.topbar-spacer { flex: 1; }
#topbar-date { color: var(--muted); font-size: 14px; }
#menu-toggle { display: none; }

#view { padding: 24px 28px 60px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ----- Cards ----- */
.card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px;
}
.card-pad-lg { padding: 22px; }
.section-title { font-size: 17px; margin-bottom: 14px; display:flex; align-items:center; gap:8px; }
.grid { display: grid; gap: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.center { text-align: center; }

/* ----- KPI ----- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px; }
.kpi {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi .kpi-ico { font-size: 20px; position: relative; }
.kpi .kpi-val { font-family: var(--font-head); font-size: 27px; font-weight: 800; color: var(--fg); margin-top: 6px; position: relative; }
.kpi .kpi-label { color: var(--muted); font-size: 13px; position: relative; }
.kpi.good .kpi-val { color: var(--good); }

/* ----- Buttons ----- */
.btn {
  border: 1px solid var(--card-border); background: #fff; color: var(--text);
  padding: 9px 16px; border-radius: 12px; cursor: pointer; font-weight: 600;
  font-size: 14px; transition: all .15s ease; display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary-700); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border: none; box-shadow: var(--shadow);
}
.btn-primary:hover { color: #fff; filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-700); }
.btn-danger { color: var(--bad); border-color: var(--bad-soft); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn-success { color: var(--good); border-color: var(--good-soft); }
.btn-success:hover { background: var(--good-soft); color: var(--good); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ----- Forms ----- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--fg); }
input, select, textarea {
  font-family: inherit; font-size: 15px; color: var(--text);
  border: 1px solid var(--card-border); border-radius: 12px; padding: 10px 12px;
  background: #fff; width: 100%; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
/* clean white dropdowns with a soft custom arrow (room reserved on the left so text never overlaps) */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23EC4899' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; background-size: 12px;
}
/* time/date fields must read left-to-right even on an RTL page (else 09:00 shows as 00:09) */
input[type="time"], input[type="date"] { direction: ltr; text-align: right; }
textarea { resize: vertical; min-height: 70px; }

/* tidy filter toolbar — clean white selects, no overlap */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar > * { margin: 0; }
.toolbar input, .toolbar select { width: auto; }
.toolbar .grow { flex: 1 1 220px; min-width: 150px; }
.toolbar select { font-size: 14px; font-weight: 600; max-width: 210px; }
.toolbar select:hover, .toolbar input:hover { border-color: var(--primary); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.inline-fields { display:flex; gap:10px; }
.inline-fields .field { flex:1; }

/* segmented toggle */
.segment { display: inline-flex; background: var(--primary-soft); border-radius: 12px; padding: 4px; gap: 4px; }
.segment button {
  border: none; background: transparent; padding: 8px 16px; border-radius: 9px;
  cursor: pointer; font-weight: 600; color: var(--primary-700); font-size: 14px;
}
.segment button.on { background: #fff; color: var(--fg); box-shadow: var(--shadow-sm); }

/* ----- Badges ----- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.badge-lead { background: var(--info-soft); color: var(--info); }
.badge-client { background: var(--good-soft); color: var(--good); }
.badge-banned { background: var(--bad-soft); color: var(--bad); }
.badge-lost { background: #F3F4F6; color: #6B7280; }
.badge-fix { background: var(--accent-soft); color: var(--accent); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-paid { background: var(--good-soft); color: var(--good); }
.badge-overdue { background: var(--bad-soft); color: var(--bad); }

/* ----- Lists / rows ----- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-row {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .1s;
}
.list-row:hover { box-shadow: var(--shadow); }
.avatar {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px;
  font-family: var(--font-head);
}
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 700; color: var(--fg); display: flex; align-items: center; gap: 8px; }
.list-sub { color: var(--muted); font-size: 13px; }
.list-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: none; }

/* ----- Modal ----- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(74, 37, 64, 0.4);
  backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100;
  padding: 20px; animation: fade .15s ease;
}
.modal {
  background: var(--card); border-radius: var(--radius-lg); width: 100%;
  max-width: 560px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 18px 22px; }
.modal-foot {
  padding: 16px 22px; display: flex; gap: 10px; justify-content: flex-start;
  border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--card);
}
.modal-close { background: var(--primary-soft); border: none; width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 16px; color: var(--primary-700); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }

/* ----- Toast ----- */
#toast-root { position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--fg); color: #fff; padding: 12px 18px; border-radius: 13px;
  box-shadow: var(--shadow-lg); font-weight: 600; animation: pop .2s ease; max-width: 360px;
}
.toast.good { background: var(--good); }
.toast.bad { background: var(--bad); }

/* ----- Misc ----- */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .emoji { font-size: 44px; display:block; margin-bottom: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--card-border);
  background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text);
}
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.pill-stat { display:flex; flex-direction:column; gap:2px; background:var(--primary-soft); border-radius:14px; padding:12px 16px; }
.pill-stat b { font-family:var(--font-head); font-size:20px; color:var(--fg); }
.money { font-variant-numeric: tabular-nums; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px,1fr)); gap: 8px; }
.slot {
  padding: 10px 6px; text-align: center; border-radius: 11px; border: 1px solid var(--card-border);
  cursor: pointer; font-weight: 700; background: #fff; font-variant-numeric: tabular-nums;
}
.slot:hover { border-color: var(--primary); }
.slot.on { background: linear-gradient(135deg,var(--primary),var(--accent)); color:#fff; border:none; }
.checkline {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background:#fff;
}
.checkline input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); flex-shrink:0; }
.checkline.off { opacity: .5; }
.checkline .ci-name { flex: 1; font-weight: 600; }
.checkline .ci-price { width: 90px; }
.alert-banner {
  background: var(--warn-soft); border: 1px solid #FCD34D; color: #92400E;
  border-radius: var(--radius); padding: 14px 18px; display:flex; align-items:center; gap:12px;
}
.loading { text-align:center; padding: 40px; color: var(--muted); }

/* ----- Responsive ----- */
@media (max-width: 860px) {
  #sidebar {
    position: fixed; inset-inline-end: 0; top: 0; z-index: 50;
    transform: translateX(100%); transition: transform .2s ease;
  }
  #sidebar.open { transform: translateX(0); }
  #menu-toggle { display: inline-grid; place-items:center; background: var(--primary-soft); border:none; width:38px;height:38px;border-radius:10px; font-size:18px; color:var(--primary-700); cursor:pointer; }
  #view { padding: 16px; }
  #topbar { padding: 14px 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
.icon-btn { background:transparent; border:none; cursor:pointer; }

/* ----- Calendar ----- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-weight: 700; color: var(--muted); font-size: 13px; padding: 4px 0; }
.cal-cell { min-height: 104px; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 6px; overflow: hidden; }
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.cal-cell.today .cal-day { color: var(--primary-700); }
.cal-cell.sel { box-shadow: 0 0 0 2px var(--primary); background: var(--primary-soft); }
.cal-day { font-weight: 800; font-family: var(--font-head); color: var(--fg); font-size: 13px; margin-bottom: 4px; }
.cal-ev { font-size: 11px; padding: 3px 6px; border-radius: 7px; margin-bottom: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev:hover { filter: brightness(.97); }
.cal-ev.fin { background: var(--good-soft); color: var(--good); }
.cal-ev.sch { background: var(--primary-soft); color: var(--primary-700); }
.cal-ev.other { background: #F3F4F6; color: #6B7280; }
.cal-dot { display:inline-block; width:10px; height:10px; border-radius:3px; vertical-align:middle; }
.cal-dot.fin { background: var(--good); } .cal-dot.sch { background: var(--primary); } .cal-dot.other { background: #9CA3AF; }
@media (max-width: 860px) { .cal-cell { min-height: 64px; padding: 3px; } .cal-ev { font-size: 9px; padding: 1px 3px; } .cal-dow { font-size: 10px; } }

/* ---- tour-edit modal: prettier service lines ---- */
.svc-edit-head { display:flex; gap:8px; padding:0 12px 2px; font-size:12px; font-weight:700; color:var(--muted); }
.svc-edit-head .h-name { flex:1; }
.svc-edit-head .h-price { width:96px; text-align:center; }
.svc-edit-head .h-dur { width:78px; text-align:center; }
.svc-line { display:flex; gap:8px; align-items:center; background:var(--bg-soft); border:1px solid var(--border); border-radius:14px; padding:7px 10px; margin-bottom:8px; }
.svc-line input { margin:0; }
.svc-line .l-name { flex:1; min-width:80px; }
.svc-line .l-price { width:96px; text-align:center; }
.svc-line .l-dur { width:78px; text-align:center; }
.svc-total { display:flex; justify-content:space-between; align-items:center; gap:10px; background:var(--primary-soft); border-radius:14px; padding:11px 16px; margin-top:2px; }
.svc-total .t-money { font-family:var(--font-head); font-weight:800; font-size:21px; color:var(--primary-700); line-height:1.1; }
.svc-total .t-dur { font-size:13px; font-weight:700; color:var(--primary-700); text-align:left; }
