/* Programator TudorMED - stiluri. Temele sunt definite prin variabile pe [data-theme]. */

:root, [data-theme="albastru"] {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --surface-hover: #f1f3f4;
  --text: #1f1f1f;
  --muted: #5f6368;
  --line: #dadce0;
  --line-soft: #ebedf0;
  --primary: #1a73e8;
  --primary-hover: #1765cc;
  --primary-contrast: #ffffff;
  --primary-soft: #e8f0fe;
  --primary-soft-text: #0b57d0;
  --sidebar-bg: #f6f8fc;
  --nav-active: #d3e3fd;
  --nav-active-text: #041e49;
  --danger: #d93025;
  --danger-soft: #fce8e6;
  --success: #188038;
  --success-soft: #e6f4ea;
  --warning: #b06000;
  --warning-soft: #fef7e0;
  --off: #f3f4f6;
  --off-stripe: #eceef1;
  --now: #ea4335;
  --event-mix: 17%;
  --shadow-1: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --shadow-2: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
  color-scheme: light;
}

[data-theme="verde"] {
  --bg: #f1f7f5;
  --surface: #ffffff;
  --surface-2: #e9f2ef;
  --surface-hover: #e6f0ed;
  --text: #1b2a27;
  --muted: #56655f;
  --line: #cfdcd7;
  --line-soft: #e4ece9;
  --primary: #00796b;
  --primary-hover: #00695c;
  --primary-contrast: #ffffff;
  --primary-soft: #d9f0eb;
  --primary-soft-text: #00574d;
  --sidebar-bg: #eaf3f0;
  --nav-active: #c4e6de;
  --nav-active-text: #00332d;
  --off: #eef3f1;
  --off-stripe: #e3ebe8;
  --now: #e53935;
}

[data-theme="intunecat"] {
  --bg: #131314;
  --surface: #1e1f20;
  --surface-2: #28292a;
  --surface-hover: #2d2e30;
  --text: #e3e3e3;
  --muted: #9aa0a6;
  --line: #3c4043;
  --line-soft: #2b2c2e;
  --primary: #8ab4f8;
  --primary-hover: #a8c7fa;
  --primary-contrast: #062e6f;
  --primary-soft: #1f3760;
  --primary-soft-text: #d3e3fd;
  --sidebar-bg: #131314;
  --nav-active: #004a77;
  --nav-active-text: #c2e7ff;
  --danger: #f28b82;
  --danger-soft: #3c1f1e;
  --success: #81c995;
  --success-soft: #1e3526;
  --warning: #fdd663;
  --warning-soft: #3a3217;
  --off: #19191a;
  --off-stripe: #222324;
  --now: #f28b82;
  --event-mix: 30%;
  --shadow-1: 0 1px 3px rgba(0,0,0,.6);
  --shadow-2: 0 6px 18px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 500; margin: 0; }
h2 { font-size: 17px; font-weight: 500; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.icon.sm { width: 16px; height: 16px; }

/* ---- layout -------------------------------------------------------------------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 248px; flex: none; background: var(--sidebar-bg); display: flex; flex-direction: column;
  padding: 8px 12px 12px; overflow-y: auto; overflow-x: hidden; transition: width .15s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 10px 4px 18px 8px; }
.brand-text { flex: 1; min-width: 0; }
.brand-toggle { width: 34px; height: 34px; }
.mobile-only { display: none !important; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: var(--primary-contrast);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none;
}
.brand-name { font-size: 18px; font-weight: 500; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 14px; padding: 9px 14px; border-radius: 999px; color: var(--text);
  font-weight: 500; text-decoration: none; white-space: nowrap;
}
.nav a:hover { background: var(--surface-hover); }
.nav a.active { background: var(--nav-active); color: var(--nav-active-text); }
.sidebar-bottom { margin-top: auto; padding-top: 16px; }
.user-box { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-soft-text);
  display: grid; place-items: center; font-weight: 600; flex: none;
}
.user-meta { min-width: 0; flex: 1; }
.user-meta .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-switch { display: flex; gap: 6px; padding: 6px 8px; }
.theme-dot {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0;
}
.theme-dot.active { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-dot[data-theme-value="albastru"] { background: linear-gradient(135deg, #1a73e8 50%, #fff 50%); }
.theme-dot[data-theme-value="verde"] { background: linear-gradient(135deg, #00796b 50%, #fff 50%); }
.theme-dot[data-theme-value="intunecat"] { background: linear-gradient(135deg, #8ab4f8 50%, #1e1f20 50%); }

body.nav-collapsed .sidebar { width: 104px; padding: 8px 10px 12px; }
body.nav-collapsed .sidebar .label, body.nav-collapsed .brand-text, body.nav-collapsed .nav-section,
body.nav-collapsed .user-meta, body.nav-collapsed .theme-switch { display: none; }
body.nav-collapsed .nav a { padding: 11px; justify-content: center; }
body.nav-collapsed .nav .icon { width: 24px; height: 24px; }
body.nav-collapsed .brand { justify-content: center; gap: 6px; padding: 10px 0 14px; }
body.nav-collapsed .user-box { justify-content: center; gap: 4px; padding: 4px 0; }
body.nav-collapsed .user-box .icon-btn { width: 34px; height: 34px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; min-height: 60px; flex-wrap: wrap; }
.topbar .spacer { flex: 1; }
.page { flex: 1; overflow: auto; padding: 4px 20px 24px; }
.page-narrow { max-width: 980px; }

/* ---- butoane & formulare ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: var(--danger); filter: brightness(.92); }
.btn-tonal { background: var(--primary-soft); border-color: transparent; color: var(--primary-soft-text); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-create {
  height: 52px; padding: 0 22px 0 16px; border-radius: 16px; border: none; box-shadow: var(--shadow-1);
  background: var(--surface); font-size: 15px;
}
.btn-create:hover { box-shadow: var(--shadow-2); background: var(--surface); }
.btn-create .icon { color: var(--primary); width: 26px; height: 26px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none; background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.btn-group { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.btn-group button {
  border: none; background: var(--surface); color: var(--text); padding: 0 14px; height: 34px; font: inherit;
  font-weight: 500; cursor: pointer;
}
.btn-group button + button { border-left: 1px solid var(--line); }
.btn-group button.active { background: var(--primary-soft); color: var(--primary-soft-text); }

input[type=text], input[type=password], input[type=email], input[type=date], input[type=time], input[type=number],
input[type=search], input[type=tel], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit;
  color: var(--text); background: var(--surface);
}
textarea { height: auto; min-height: 70px; padding: 8px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
input[type=color] { width: 56px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.field-help { font-size: 12px; color: var(--muted); font-weight: 400; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
/* grupuri pe coloane umplute de sus in jos (ex. export: categorii cu punctele lor) */
.cat-checks { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 6px 0 2px; font-weight: 400; }
.cat-columns { column-count: 2; column-gap: 18px; }
.cat-group { break-inside: avoid; padding-bottom: 14px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; }
.form-actions .spacer { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 16px; padding: 20px; }
.card + .card { margin-top: 16px; }

/* ---- tabele ------------------------------------------------------------------------ */
.table-wrap { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 16px; overflow: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-hover); }
.table td.actions { text-align: right; white-space: nowrap; }
.color-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; margin-right: 6px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.on { background: var(--success-soft); color: var(--success); }
.badge.off { background: var(--surface-2); color: var(--muted); }
.badge.web { background: var(--warning-soft); color: var(--warning); }
.status-badge { color: #fff; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.flash { padding: 10px 14px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-soft-text); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.success { background: var(--success-soft); color: var(--success); }
.default-pw { margin: 10px 20px 0; border-radius: 10px; }
.flash.warning { background: var(--warning-soft); color: var(--warning); }

.pagination { display: flex; gap: 6px; align-items: center; margin-top: 14px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { padding-left: 40px; border-radius: 999px; background: var(--surface-2); border-color: transparent; }
.search-input input:focus { background: var(--surface); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.key-box { font-family: Consolas, monospace; font-size: 15px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; word-break: break-all; user-select: all; }
pre.code { font-family: Consolas, monospace; font-size: 12.5px; background: var(--surface-2); padding: 14px; border-radius: 10px; overflow: auto; line-height: 1.5; }

/* ---- login -------------------------------------------------------------------------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 24px; padding: 36px 32px; box-shadow: var(--shadow-1); }
.login-card .brand { justify-content: center; padding-bottom: 24px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }

/* ---- modal ---------------------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(32,33,36,.45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal {
  background: var(--surface); border-radius: 24px; width: 100%; max-width: 740px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; box-shadow: var(--shadow-2);
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px 2px 24px; }
.modal-head h2 { margin: 0; flex: 1; font-size: 20px; font-weight: 400; }
.modal-body { padding: 6px 20px 4px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 12px 24px 16px; border-top: 1px solid var(--line-soft); }
.service-row { align-items: flex-end; }
.service-row label.field > span:first-child { height: 20px; display: flex; align-items: center; }
.service-row .check input { width: 15px; height: 15px; }
.service-row .status-actions { margin: 0; flex-wrap: nowrap; }
.service-row .status-actions .btn { height: 38px; padding: 0 14px; }
.modal label.field { gap: 4px; }
.modal textarea { min-height: 54px; }
.modal-foot .spacer { flex: 1; }
.modal .row { display: flex; gap: 12px; margin-bottom: 12px; }
.modal .row > * { flex: 1; min-width: 0; }
.modal .row-icon { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.modal .row-icon > .icon { margin-top: 9px; color: var(--muted); }
.modal .row-icon > .grow { flex: 1; min-width: 0; }
.modal .row-icon > .icon-spacer { width: 20px; flex: none; }
/* latimile campurilor din dialogul programarii (pe mobil se rearanjeaza, vezi @media mai jos) */
.modal .row > .f-loc { flex: 1.5; }
.modal .row > .f-day { flex: 1.1; }
.modal .row > .f-time { flex: 0 0 100px; }
.modal .row > .f-dur { flex: 0 0 116px; }
.modal .row > .f-service { flex: 1; }
.modal .row > .f-status { flex: 0 0 160px; }
.modal .row > .f-phone { flex: 0 0 150px; }
.modal .row > .f-email { flex: 1; }
.modal .row > .f-addr { flex: 1.5; }
.warn-box { background: var(--warning-soft); color: var(--warning); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.warn-box ul { margin: 4px 0 8px; padding-left: 20px; }
.err-box { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.req { color: var(--danger); font-weight: 600; margin-left: 4px; }
.meta-line { font-size: 12px; color: var(--muted); margin-top: 4px; }
.status-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.slot-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.slot-chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 3px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.slot-chip:hover { border-color: var(--primary); }
.slot-chip.active { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }

.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border-radius: 12px;
  box-shadow: var(--shadow-2); z-index: 10; max-height: 260px; overflow-y: auto; padding: 6px 0;
}
.ac-item { padding: 8px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.ac-item:hover, .ac-item.active { background: var(--surface-hover); }
.ac-item.add { color: var(--primary); font-weight: 500; }
.patient-chip {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; border-radius: 10px; background: var(--primary-soft);
  color: var(--primary-soft-text);
}
.patient-chip .grow { flex: 1; min-width: 0; }
.patient-chip .icon-btn { width: 30px; height: 30px; color: inherit; }
.new-patient { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; margin-top: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #323232; color: #fff; padding: 12px 20px;
  border-radius: 8px; z-index: 200; box-shadow: var(--shadow-2); display: flex; gap: 16px; align-items: center;
}
.toast button { background: none; border: none; color: #8ab4f8; font: inherit; font-weight: 600; cursor: pointer; }

/* ---- calendar ------------------------------------------------------------------------------ */
.cal-layout { display: flex; flex: 1; min-height: 0; }
.cal-side { width: 256px; flex: none; padding: 4px 12px 16px 16px; overflow-y: auto; display: none; }
body.cal-side-open .cal-side { display: block; }
.cal-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface);
  border-radius: 24px 0 0 0; overflow: hidden; margin-right: 0;
}
.cal-topbar { flex-wrap: nowrap; gap: 8px; }
.cal-topbar > * { flex: none; }
.cal-search { flex: 0 8 260px; min-width: 120px; }
.cal-tools { display: inline-flex; }
.cal-title { font: inherit; font-size: 20px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: none !important; min-width: 80px; background: none; border: none; color: var(--text); cursor: pointer;
  padding: 6px 10px; border-radius: 10px; }
.cal-title:hover { background: var(--surface-hover); }
.day-nav { display: inline-flex; align-items: center; gap: 2px; }
.cal-title .today-tag { color: var(--danger); font-size: 14px; margin-left: 6px; }
.pending-pill { background: var(--warning-soft); color: var(--warning); border: none; border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; }


.side-section { margin-top: 18px; }
.side-section h3 { font-size: 13px; font-weight: 600; margin: 0 0 6px; padding: 0 6px; display: flex; justify-content: space-between; align-items: center; }
.side-section h3 a { font-weight: 500; font-size: 12px; }
.filter-item { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; cursor: pointer; }
.filter-item:hover { background: var(--surface-hover); }
.filter-item input { width: 17px; height: 17px; margin: 0; }
.filter-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-item.sub { padding-left: 22px; font-size: 13px; }
.filter-item.radio.active { background: var(--primary-soft); color: var(--primary-soft-text); }
.legend { display: flex; flex-direction: column; gap: 4px; padding: 0 6px; font-size: 12.5px; }
.legend span { display: flex; align-items: center; gap: 8px; }

.cal-scroll { flex: 1; overflow: auto; position: relative; }
.cal-grid { display: grid; min-width: min-content; position: relative; }
.cal-grid.is-loading .cal-col, .cal-grid.is-loading .agenda-group { opacity: .3; transition: opacity .15s; pointer-events: none; }
.cal-pad { background: repeating-linear-gradient(135deg, var(--off) 0 8px, var(--off-stripe) 8px 16px); }
.cal-pad-head { position: sticky; top: 0; z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line); }
.cal-corner, .cal-head {
  position: sticky; top: 0; z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line);
}
.cal-corner { left: 0; z-index: 7; }
.cal-head { padding: 10px 8px 8px; text-align: center; border-left: 1px solid var(--line-soft); min-width: 0; }
.cal-head .h-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-head .h-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-head .h-quota { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-head .h-quota.over { background: var(--danger-soft); color: var(--danger); }
.cal-head .h-bar { height: 3px; border-radius: 3px; margin: 6px auto 0; width: 40px; }
.cal-head .h-day { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.cal-head .h-num { font-size: 24px; font-weight: 400; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; margin: 2px auto 0; cursor: pointer; }
.cal-head .h-num:hover { background: var(--surface-hover); }
.cal-head.today .h-day { color: var(--primary); }
.cal-head.today .h-num { background: var(--primary); color: var(--primary-contrast); }
.cal-gutter { position: sticky; left: 0; z-index: 5; background: var(--surface); }
.cal-gutter .t { position: absolute; right: 8px; font-size: 11px; color: var(--muted); transform: translateY(-50%); white-space: nowrap; }
.cal-gutter .t.hour { font-weight: 600; color: var(--text); font-size: 11.5px; }
.cal-col { position: relative; border-left: 1px solid var(--line-soft); cursor: pointer; }
.cal-col.readonly { cursor: default; }
.cal-off {
  position: absolute; left: 0; right: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, var(--off) 0 8px, var(--off-stripe) 8px 16px);
}
.cal-closed-label {
  /* ramane vizibila sub antetul coloanelor la derularea in jos */
  position: sticky; top: calc(var(--cal-head-h, 62px) + 12px); z-index: 1; margin: 12px 8px 0;
  text-align: center; font-size: 12px; color: var(--muted);
  background: var(--surface); border-radius: 8px; padding: 6px; pointer-events: none; box-shadow: var(--shadow-1);
}
.cal-hover {
  position: absolute; left: 2px; right: 2px; border-radius: 6px; background: var(--primary-soft); pointer-events: none;
  color: var(--primary-soft-text); font-size: 11.5px; font-weight: 600; padding: 2px 8px; z-index: 1;
  border: 1px dashed var(--primary);
}
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); z-index: 4; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--now); }

.ev {
  --ev: var(--primary);
  --s: var(--ev-scale, 1);
  position: absolute; border-radius: calc(6px * var(--s)); padding: calc(2px * var(--s)) calc(6px * var(--s)) calc(2px * var(--s)) calc(8px * var(--s));
  overflow: hidden; z-index: 2; cursor: pointer;
  background: color-mix(in srgb, var(--ev) var(--event-mix), var(--surface));
  border-left: 4px solid var(--ev); color: var(--text); font-size: calc(13.5px * var(--s)); line-height: 1.3;
  box-shadow: 0 0 0 1px var(--surface); user-select: none;
}
.ev:hover { box-shadow: var(--shadow-1); z-index: 3; }
.ev .ev-time { font-size: calc(12px * var(--s)); color: var(--muted); white-space: nowrap; margin-left: auto; flex: none; }
.ev-seq { color: var(--danger); font-weight: 700; margin-right: 4px; }
.agenda-row .ev-seq { display: inline-block; min-width: 26px; }
.ev .ev-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .ev-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.ev.compact { display: flex; gap: 6px; align-items: baseline; padding-top: 1px; }
.ev.compact .ev-name { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.ev.two { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; gap: calc(1px * var(--s)); }
.ev:not(.compact):not(.two) { display: flex; flex-direction: column; gap: calc(2px * var(--s)); padding-top: calc(4px * var(--s)); }
.ev .ev-row { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.ev .ev-row .ev-name { min-width: 0; }
.ev .ev-service { font-size: calc(12px * var(--s)); opacity: .85; min-width: 0; flex: 1 1 auto; }
.ev .ev-row2 { gap: 8px; }
.ev .ev-tags { position: absolute; right: 4px; top: calc(3px * var(--s)); display: flex; gap: 3px; }
.ev .tag { font-size: calc(9.5px * var(--s)); font-weight: 700; padding: 0 5px; border-radius: 4px; line-height: calc(15px * var(--s)); color: #fff; }
.ev.st-anulata { opacity: .55; }
.ev.st-anulata .ev-name { text-decoration: line-through; }
.ev.st-finalizata, .ev.st-neprezentat { opacity: .72; }
.ev.st-in_desfasurare { box-shadow: 0 0 0 2px var(--ev); }
.ev.dragging { opacity: .85; box-shadow: var(--shadow-2); z-index: 20; pointer-events: none; }
.ev.flash { animation: evflash 1.4s ease 2; }
@keyframes evflash { 50% { box-shadow: 0 0 0 4px var(--primary); } }
.drop-ghost { position: absolute; left: 2px; right: 2px; border: 2px dashed var(--primary); border-radius: 6px; z-index: 1; pointer-events: none; background: var(--primary-soft); font-size: 11px; font-weight: 600; color: var(--primary-soft-text); padding: 1px 6px; }

.agenda { padding: 8px 24px 24px; }
.agenda-group { margin-top: 18px; }
.agenda-group h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0 0 8px; }
.agenda-row { display: grid; grid-template-columns: 136px 1fr 180px 130px; gap: 12px; padding: 10px 12px; border-radius: 10px; align-items: center; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.agenda-row:hover { background: var(--surface-hover); }
.agenda-row.st-anulata { opacity: .55; text-decoration: line-through; }

.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; width: 460px; max-width: 90vw; background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-2); z-index: 50; max-height: 420px; overflow-y: auto; padding: 6px 0;
}
.search-results .sr { padding: 9px 16px; cursor: pointer; display: flex; gap: 12px; align-items: center; }
.search-results .sr:hover { background: var(--surface-hover); }
.search-results .sr .grow { flex: 1; min-width: 0; }
.search-results .head { padding: 6px 16px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---- responsive -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .cal-layout { position: relative; }
  body.cal-side-open .cal-side { position: absolute; z-index: 30; top: 0; bottom: 0; left: 0; background: var(--bg); box-shadow: var(--shadow-2); }
}
@media (max-width: 800px) {
  .sidebar { position: fixed; z-index: 60; height: 100vh; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-2); }
  body.nav-open .sidebar { transform: none; }
  body.nav-collapsed .sidebar { width: 248px; }
  .mobile-only { display: inline-grid !important; }
  .brand-toggle { display: none; }
  .btn-label { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .cat-columns { column-count: 1; }
  .topbar { padding: 8px 12px; }
  .page { padding: 4px 12px 20px; }
  .agenda-row { grid-template-columns: 80px 1fr; }
  .cal-topbar { flex-wrap: wrap; row-gap: 6px; }
  .cal-topbar .cal-search { order: 20; flex: 1 1 100%; }
  .cal-topbar .spacer, .cal-topbar #zoomIn, .cal-topbar #zoomOut, .cal-topbar .pending-pill { display: none; }
  .cal-title { font-size: 16px; flex: 1 1 100% !important; order: 10; }
  .cal-main { border-radius: 0; }
}

/* dialogul programarii pe telefon: cabinetul pe un rand; data, ora, durata pe altul; serviciu + status
   (mai mic); butoanele de status pe rand separat; telefon + email, apoi adresa */
@media (max-width: 640px) {
  .modal-backdrop { padding: 8px; }
  .modal { border-radius: 18px; max-height: calc(100vh - 16px); }
  .modal-head { padding: 12px 10px 2px 16px; }
  .modal-body { padding: 4px 14px 4px; }
  .modal-foot { padding: 10px 14px 12px; }
  .modal .row-icon { gap: 0; margin-bottom: 12px; }
  .modal .row-icon > .icon, .modal .row-icon > .icon-spacer { display: none; }
  .modal .row { flex-wrap: wrap; gap: 10px; }
  .modal .row > .f-loc { flex: 1 1 100%; }
  .modal .row > .f-day { flex: 1 1 0; }
  .modal-head h2 { font-size: 18px; }
  .modal input, .modal select { padding: 0 9px; }
  .modal .row > .f-time { flex: 0 0 94px; }
  .modal .row > .f-dur { flex: 0 0 104px; }
  .slot-chips { max-height: 118px; overflow-y: auto; }
  .modal .row > .f-service { flex: 1 1 0; }
  .modal .row > .f-status { flex: 0 0 132px; }
  .service-row .check { white-space: nowrap; }
  .service-row .status-actions { flex: 1 1 100%; }
  .service-row .status-actions .btn { flex: 1; justify-content: center; }
  .modal .row > .f-phone { flex: 1 1 0; }
  .modal .row > .f-email { flex: 1 1 0; }
  .modal .row > .f-addr { flex: 1 1 100%; }
  .slot-chip { padding: 5px 9px; font-size: 13px; }
}

/* ---- tiparire ------------------------------------------------------------------------------ */
.print-page { background: #fff; color: #000; padding: 24px; }
.print-group { page-break-after: always; margin-bottom: 30px; }
.print-group:last-child { page-break-after: auto; }
.print-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.print-table th, .print-table td { border: 1px solid #999; padding: 5px 7px; text-align: left; vertical-align: top; }
.print-table th { background: #eee; }
@media print { .no-print { display: none !important; } .print-page { padding: 0; } }
.ev.has-tag .ev-row:first-child, .ev.has-tag.compact { padding-right: calc(40px * var(--s)); }
.ev .ev-notes { font-style: italic; font-size: calc(12px * var(--s)); }

/* ---- confirmare ------------------------------------------------------------------------------- */
.confirm-backdrop { z-index: 300; }
.confirm-modal { max-width: 420px; }
.confirm-body { padding: 24px 24px 12px; font-size: 15px; line-height: 1.5; }
.confirm-modal .modal-foot { border-top: none; }

/* ---- selector de data --------------------------------------------------------------------------- */
.dp-wrap { position: relative; width: 100%; }
.dp-wrap .dp-display { padding-right: 40px; cursor: pointer; }
.dp-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 30px; border: none;
  background: none; color: var(--muted); border-radius: 6px; cursor: pointer; display: grid; place-items: center;
}
.dp-btn:hover { background: var(--surface-hover); color: var(--primary); }
.dp-pop {
  position: fixed; z-index: 400; width: 304px; background: var(--surface); color: var(--text); border-radius: 18px;
  box-shadow: var(--shadow-2); padding: 12px 12px 10px; user-select: none; border: 1px solid var(--line-soft);
}
.dp-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.dp-nav { width: 34px; height: 34px; border: none; background: none; border-radius: 50%; color: var(--text); cursor: pointer; display: grid; place-items: center; flex: none; }
.dp-nav:hover { background: var(--surface-hover); }
.dp-selects { flex: 1; display: flex; gap: 4px; justify-content: center; }
.dp-selects select { width: auto; height: 32px; padding: 0 6px; border-color: transparent; font-weight: 600; background: transparent; cursor: pointer; }
.dp-selects select:hover { background: var(--surface-hover); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-dow { font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0 6px; }
.dp-day {
  height: 36px; border: none; background: none; border-radius: 50%; color: var(--text); font: inherit; font-size: 13px;
  cursor: pointer; width: 36px; margin: 0 auto;
}
.dp-day:hover { background: var(--surface-hover); }
.dp-day.weekend { color: var(--muted); }
.dp-day.other { opacity: .4; }
.dp-day.in-week { background: var(--surface-2); border-radius: 8px; width: 100%; }
.dp-day.today { color: var(--primary); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--primary); }
.dp-day.disabled { opacity: .3; cursor: not-allowed; background: none; text-decoration: line-through; }
.dp-day.selected { background: var(--primary); color: var(--primary-contrast); font-weight: 600; box-shadow: none; }
.dp-foot { display: flex; gap: 8px; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }

/* ---- SMS ------------------------------------------------------------------------------ */
.sms-stats { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.sms-stats a.badge { text-decoration: none; }
.sms-new summary { cursor: pointer; }
.sms-new-form { display: grid; grid-template-columns: 220px 1fr auto; gap: 14px; align-items: end; margin-top: 14px; }
.sms-body { max-width: 560px; }
.sms-error { color: var(--danger); }
.sms-later { color: var(--warning); }
.sms-bulk { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.sms-bulk #smsSelCount { min-width: 150px; }
.sms-when { display: inline-flex; gap: 8px; }
@media (max-width: 800px) { .sms-new-form { grid-template-columns: 1fr; } }
