/* Vistun UI components */

/* === Buttons === */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 40px;
    padding: 0 var(--space-5);
    font-size: var(--text-body);
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: background-color var(--transition),
                border-color var(--transition),
                color var(--transition),
                box-shadow var(--transition),
                transform var(--transition);
}

.btn-primary { background: var(--accent); color: var(--text-on-accent); }
.btn-primary:hover  { background: var(--accent-hover);  color: var(--text-on-accent); }
.btn-primary:active { background: var(--accent-active); color: var(--text-on-accent); transform: scale(0.98); }

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover  { background: var(--surface-hover); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:active { color: var(--text-primary); transform: scale(0.98); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-ghost:hover  { color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost:active { color: var(--text-primary); transform: scale(0.98); }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover  { background: var(--danger-dim); color: var(--danger); }
.btn-danger:active { color: var(--danger); transform: scale(0.98); }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-icon:hover  { color: var(--text-primary); border-color: var(--border-strong); }
.btn-icon:active { color: var(--text-primary); transform: scale(0.94); }

.btn-sm { height: 32px; padding: 0 var(--space-3); font-size: var(--text-caption); }
.btn-lg { height: 48px; padding: 0 var(--space-6); font-weight: 700; }

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled,
.btn-danger:disabled,
.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* === Cards === */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5);
}
@media (max-width: 768px) {
    .card { padding: var(--space-4); }
}

.card-raised {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.card-interactive {
    cursor: pointer;
    transition: border-color var(--transition), transform var(--transition);
}
.card-interactive:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.card-header {
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
    font-size: var(--text-h3);
    font-weight: 600;
    line-height: var(--leading-h3);
}

/* === Inputs === */
.input,
input.input,
textarea.input,
select.input {
    width: 100%;
    height: 40px;
    padding: 0 var(--space-3);
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--text-body);
    transition: border-color var(--transition), box-shadow var(--transition);
}
textarea.input {
    height: auto;
    min-height: 96px;
    padding: var(--space-3);
    resize: vertical;
    line-height: var(--leading-body);
}
.input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.input:disabled {
    border-color: var(--border-disabled);
    color: var(--text-disabled);
    cursor: not-allowed;
}
.input.has-error { border-color: var(--danger); }
.input.has-error:focus { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.35); }

.label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--text-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.error-text {
    margin-top: var(--space-1);
    font-size: var(--text-caption);
    color: var(--danger);
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger); }
.badge-info    { background: var(--info-dim);    color: var(--info); }

.badge-tag {
    background: var(--surface-raised);
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    font-size: var(--text-caption);
    border: 1px solid var(--border);
}

/* === Empty / Error states === */
.empty-no-items,
.empty-filtered,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-7) var(--space-5);
}

.empty-no-items .icon {
    color: var(--accent);
    filter: drop-shadow(0 0 24px var(--focus-ring));
    margin-bottom: var(--space-4);
}
.empty-no-items .title { font-size: var(--text-h2); font-weight: 600; margin-bottom: var(--space-2); }
.empty-no-items .desc  { color: var(--text-muted); margin-bottom: var(--space-5); max-width: 360px; }

.empty-filtered .icon  { color: var(--text-muted); margin-bottom: var(--space-3); }
.empty-filtered .title { font-size: var(--text-h3); font-weight: 600; margin-bottom: var(--space-2); }
.empty-filtered .desc  { color: var(--text-muted); }

.error-state .title { font-size: var(--text-h2); font-weight: 600; margin-bottom: var(--space-2); }
.error-state .desc  { color: var(--text-muted); margin-bottom: var(--space-5); }

/* === Toasts === */
.toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 400px;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: toast-in 200ms ease;
}
.toast-error   { border-color: var(--danger); }
.toast-success { border-color: var(--success); }
.toast-warning { border-color: var(--warning); }
.toast-info    { border-color: var(--info); }

.toast .toast-icon { flex-shrink: 0; }
.toast-error   .toast-icon { color: var(--danger); }
.toast-success .toast-icon { color: var(--success); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    .toast-icon { color: var(--info); }

.toast .toast-text  { flex: 1; font-size: var(--text-body); }
.toast .toast-close { color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.toast .toast-close:hover { color: var(--text-primary); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* === Skeleton (existing pattern) === */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}
.animate-pulse { animation: pulse 1.8s ease-in-out infinite; }

/* === Analytics Widgets (universal renderer) === */
.aw { padding: var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: var(--space-2); min-height: 92px; }
.aw-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.aw-value { font-size: 1.8rem; font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.aw-msg { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.aw--loading .aw-skel { height: 32px; background: var(--surface-raised); border-radius: 6px; animation: aw-pulse 1.5s ease-in-out infinite; }
@keyframes aw-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.aw--error { border-color: var(--danger-dim); }
.aw--error .aw-msg { color: var(--danger); }
.aw--locked, .aw--unknown { background: repeating-linear-gradient(45deg, transparent 0, transparent 9px, var(--surface-hover) 9px, var(--surface-hover) 10px); }
.aw-lock-icon { font-size: 18px; opacity: 0.6; }
.aw--progress .aw-bar { height: 4px; background: var(--surface-raised); border-radius: 2px; overflow: hidden; }
.aw--progress .aw-fill { height: 100%; background: var(--accent); transition: width 0.3s ease; }
.aw-progress-text { font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.aw-dist-list { display: flex; flex-direction: column; gap: 6px; }
.aw-dist-row { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-2); align-items: center; font-size: 11px; }
.aw-dist-name { color: var(--text-primary); font-weight: 500; }
.aw-dist-bar { height: 6px; background: var(--surface-raised); border-radius: 3px; overflow: hidden; }
.aw-dist-fill { display: block; height: 100%; background: var(--accent); }
.aw-dist-val { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.aw-period-selector { display: inline-flex; align-items: center; gap: var(--space-2); }
.aw-period-selector select { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; color: var(--text-primary); font-size: 12px; }
.aw--in-cell { padding: 0; background: transparent; border: none; min-height: 0; gap: 4px; }
.aw--in-cell .aw-value { font-size: inherit; }
.aw--in-w { padding: var(--space-3); background: transparent; border: none; min-height: 0; }

/* === Accordion list (shared: services / appointments / payments) ===
 * Uniform list+row baseline + expandable panel. Row inner content and panel
 * body are domain-specific (each page renders its own); the shell, sizing,
 * tab strip and confirm modal live here so all lists look and size the same.
 */

/* Shared list container — identical params on every module (fixed-height
 * column fills + internal scroll); only the rows inside differ. Lives in one
 * place so all module lists size and scroll the same. */
.acc-list {
    flex: 0 1 auto; min-height: 0; overflow-y: auto;
    background: var(--surface); border-radius: var(--radius);
    /* Shrinks to content: the unfilled part of the fixed-height column stays
     * page background, so the block "hides" when the list is short/empty. */
}

/* Item + row — fixed height + status rail (game "database entry" style).
 * The 3px left rail is coloured per status (--acc-rail set by an s-* tone
 * class on the item); it brightens + emits on hover/open. Row height is fixed
 * so 1-line and 2-line rows align across every page.
 */
.acc-item {
    position: relative;
    border-bottom: 1px solid var(--border);
    --acc-rail: var(--border-strong);
}
.acc-item:last-child { border-bottom: none; }
.acc-item.s-accent  { --acc-rail: var(--accent); }
.acc-item.s-success { --acc-rail: var(--success); }
.acc-item.s-warning { --acc-rail: var(--warning); }
.acc-item.s-info    { --acc-rail: var(--info); }
.acc-item.s-danger  { --acc-rail: var(--danger); }
.acc-item.s-muted   { --acc-rail: var(--text-muted); }
.acc-row {
    position: relative;
    display: flex; align-items: center; gap: var(--space-3);
    min-height: 58px; box-sizing: border-box;
    padding: 11px var(--space-4) 11px calc(var(--space-4) + 10px);
    color: inherit; cursor: pointer; user-select: none;
    transition: background var(--transition);
}
/* Status rail — lives on the ROW only, never on the open panel */
.acc-row::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--acc-rail); opacity: 0.5;
    transition: opacity var(--transition), box-shadow var(--transition);
    pointer-events: none;
}
.acc-row:hover::before,
.acc-item.is-open > .acc-row::before { opacity: 1; box-shadow: 0 0 10px var(--acc-rail); }
.acc-row:hover { background: var(--surface-hover); }
.acc-item.is-open > .acc-row { z-index: 2; background: var(--surface-hover); }
.acc-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.acc-row-arrow { color: var(--text-muted); opacity: 0.35; flex-shrink: 0; transition: transform var(--transition), opacity var(--transition), color var(--transition); }
.acc-row:hover .acc-row-arrow { opacity: 0.9; color: var(--accent); }
.acc-item.is-open .acc-row-arrow { transform: rotate(90deg); opacity: 0.9; color: var(--accent); }

/* Panel — animated unfold; indented from the left and flush to the right edge,
 * so the open block reads as a nested "database entry". Flat top, no colour rail.
 */
.acc-panel {
    display: grid; grid-template-rows: 0fr;
    background: var(--bg);
    padding-left: 40px;
    transition: grid-template-rows 260ms cubic-bezier(.4, 0, .2, 1);
}
.acc-item.is-open .acc-panel { grid-template-rows: 1fr; }
/* Frame — ONE cohesive surface block holding actions + details (so buttons read
 * as part of the panel, not floating). Clips smoothly while the row collapses,
 * and carries the cyber cuts: concave bottom-right corner + a shallow RECTANGULAR
 * notch bitten out of the left edge a bit above the bottom (Cyberpunk menu). */
.acc-panel-frame {
    min-height: 0; overflow: hidden;
    background: var(--surface);
    clip-path: polygon(
        0 0, 100% 0,
        100% calc(100% - 16px), calc(100% - 16px) 100%,
        0 100%, 0 calc(100% - 12px),
        5px calc(100% - 12px), 5px calc(100% - 30px), 0 calc(100% - 30px)
    );
}

/* Actions — top row of thin parallelogram buttons (edit + status change).
 * Default neutral; on hover/active the TEXT takes the status colour (--st-color),
 * no fill. Cyberpunk slant via skewX (inner text un-skewed). */
.acc-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; padding: 12px 16px 2px; }
.acc-act {
    flex: 0 0 auto; cursor: pointer; text-decoration: none; font-family: inherit;
    background: var(--surface-hover); border: 1px solid var(--border);
    transform: skewX(-11deg);
}
.acc-act-inner {
    display: inline-block; transform: skewX(11deg);
    padding: 4px 11px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap;
    color: var(--text-muted); transition: color var(--transition);
}
/* Hover + active: only the TEXT takes the status colour; border stays neutral. */
.acc-act:hover .acc-act-inner { color: var(--st-color, var(--accent)); }
.acc-act.is-active .acc-act-inner { color: var(--st-color); }
.acc-act:disabled { opacity: 0.45; cursor: not-allowed; }

/* Split layout — content (body) on the left, action buttons on the right.
 * Used where there are few buttons (payments / services); appointments keep the
 * default (buttons as a right-aligned top row, body below). */
.acc-panel-frame--split { display: flex; align-items: flex-start; justify-content: flex-end; }
.acc-panel-frame--split .acc-body { order: 1; flex: 1 1 auto; min-width: 0; }
.acc-panel-frame--split .acc-acts { order: 2; flex: 0 0 auto; max-width: 55%; }
.acc-act.t-accent  { --st-color: var(--accent); }
.acc-act.t-success { --st-color: var(--success); }
.acc-act.t-warning { --st-color: var(--warning); }
.acc-act.t-danger  { --st-color: var(--danger); }
.acc-act.t-muted   { --st-color: var(--text-secondary); }

/* Body — sits inside the shared surface frame (no own bg) */
.acc-body { padding: 14px 18px 16px; }
.acc-body-head { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted); margin-bottom: 6px; }

/* Info lines inside a body */
.acc-info { display: flex; flex-direction: column; gap: 8px; }
.acc-info-line { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.acc-info-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); min-width: 70px; flex-shrink: 0; }
.acc-info-val { color: var(--text-primary); min-width: 0; }
.acc-info-val.muted { color: var(--text-muted); }

/* Confirm modal — shared, created lazily by accordion.js */
.acc-modal-bd { position: fixed; inset: 0; z-index: 9000; background: rgba(8,10,18,0.66); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; padding: 20px; }
.acc-modal-bd.is-open { display: flex; animation: accModalFade 0.18s ease; }
@keyframes accModalFade { from { opacity: 0; } to { opacity: 1; } }
.acc-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; max-width: 420px; width: 100%; color: var(--text-primary); box-shadow: 0 18px 60px rgba(0,0,0,0.5); animation: accModalPop 0.18s ease; }
@keyframes accModalPop { from { transform: translateY(8px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.acc-modal-title { font-size: 1.05rem; font-weight: 800; margin: 0 0 10px; }
.acc-modal-body { font-size: 0.86rem; line-height: 1.5; color: var(--text-muted); margin: 0 0 18px; }
.acc-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.acc-modal-btn { font-size: 0.82rem; font-weight: 700; padding: 9px 18px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; transition: background var(--transition), border-color var(--transition); }
.acc-modal-cancel { background: var(--surface-hover); color: var(--text-primary); border-color: var(--border); }
.acc-modal-cancel:hover { border-color: var(--border-strong); }
.acc-modal-confirm { background: var(--danger); color: #fff; }
.acc-modal-confirm:hover { filter: brightness(0.92); }

@media (max-width: 600px) {
    .acc-act-inner { padding: 9px 4px; font-size: 9px; letter-spacing: 0.02em; }
    .acc-body { padding: 14px 16px; }
}

/* ───────────────────────── Line items (service cart) + adjustments ─────────
   Shared by appointment / payment add+edit forms (static/js/line-items.js).
   Uses theme tokens so it themes with the rest of the app. */
.li-palette { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow-y: auto; padding: 2px; }
.li-empty { font-size: 13px; color: var(--text-muted); padding: 8px 4px; }
.li-link { color: var(--accent); font-weight: 700; text-decoration: none; }
.li-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--radius-pill);
  background: var(--surface-hover); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: all var(--transition);
}
.li-chip:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); border-color: var(--border-strong); }
.li-chip-price { font-weight: 700; opacity: 0.75; font-variant-numeric: tabular-nums; }
.li-chip-tag {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 6px; border-radius: var(--radius-pill);
  background: var(--accent-dim); color: var(--accent);
}

.li-lines { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.li-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface-hover); border: 1px solid var(--border);
}
.li-row-main { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.li-row-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.li-variant-wrap { max-width: 260px; }
.li-variant {
  width: 100%; box-sizing: border-box; appearance: none; cursor: pointer;
  background: var(--input-bg, rgba(255,255,255,0.04)); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 30px 8px 11px;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary);
  color-scheme: dark; outline: none;
}
.li-qty { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.li-qty-btn {
  width: 28px; height: 32px; border-radius: 7px;
  background: var(--surface-hover); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 16px; font-weight: 700; line-height: 1;
  cursor: pointer; transition: all var(--transition);
}
.li-qty-btn:hover { background: rgba(255,255,255,0.08); border-color: var(--border-strong); }
.li-qty-input {
  width: 44px; text-align: center; box-sizing: border-box;
  background: var(--input-bg, rgba(255,255,255,0.04)); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 4px;
  font-family: inherit; font-size: 13px; font-weight: 700; color: var(--text-primary);
  color-scheme: dark; outline: none;
}
.li-price { position: relative; flex-shrink: 0; }
.li-price-input, .li-adj-amount {
  width: 96px; box-sizing: border-box;
  background: var(--input-bg, rgba(255,255,255,0.04)); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 26px 8px 11px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-primary);
  color-scheme: dark; outline: none;
}
.li-cur {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 700; color: var(--text-muted); pointer-events: none;
}
.li-sub {
  min-width: 78px; text-align: right; flex-shrink: 0;
  font-size: 13px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums;
}
.li-remove {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 7px;
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; line-height: 1; cursor: pointer; transition: color var(--transition);
}
.li-remove:hover { color: var(--danger); }
.li-variant:focus, .li-qty-input:focus, .li-price-input:focus,
.li-adj-amount:focus, .li-adj-note:focus, .li-adj-reason:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Adjustments (tips / discounts) */
.li-adj-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.li-adj-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface-hover);
  color: var(--text-primary); cursor: pointer; transition: all var(--transition);
}
.li-adj-btn:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.08); }
.li-adj-list { display: flex; flex-direction: column; gap: 8px; }
.li-adj-list:not(:empty) { margin-bottom: 12px; }
.li-adj {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface-hover); border: 1px solid var(--border);
}
.li-adj-kind {
  flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill);
}
.li-adj-kind.discount { background: rgba(248,113,113,0.10); color: var(--danger); border: 1px solid rgba(248,113,113,0.25); }
.li-adj-kind.tip { background: rgba(74,222,128,0.10); color: #4ADE80; border: 1px solid rgba(74,222,128,0.25); }
.li-adj-reason-wrap { min-width: 150px; }
.li-adj-reason {
  width: 100%; box-sizing: border-box; appearance: none; cursor: pointer;
  background: var(--input-bg, rgba(255,255,255,0.04)); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 30px 8px 11px;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary);
  color-scheme: dark; outline: none;
}
.li-adj-note {
  flex: 1 1 140px; min-width: 0; box-sizing: border-box;
  background: var(--input-bg, rgba(255,255,255,0.04)); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 11px;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary);
  color-scheme: dark; outline: none;
}

/* ── Selected service chip (filled accent) ── */
.li-chip.selected { background: var(--accent-dim); border-color: rgba(34,211,238,0.45); color: var(--accent); }
.li-chip.selected::before { content: "\2713"; font-weight: 700; margin-right: 1px; }

/* ── Custom dropdown (theme-stable replacement for native <select>) ── */
.dd { position: relative; }
.dd-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box;
  background: var(--input-bg, rgba(255,255,255,0.04)); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 14px;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text-primary); cursor: pointer;
}
.dd-btn .dd-chev { margin-left: auto; font-size: 13px; color: var(--text-muted); transition: transform var(--transition); }
.dd.open .dd-chev { transform: rotate(180deg); }
.dd-menu {
  display: none; position: absolute; left: 0; top: calc(100% + 4px); z-index: 60; min-width: 100%;
  background: #1F2235; border: 1px solid rgba(255,255,255,0.10); border-radius: 9px;
  overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.dd.open .dd-menu { display: block; }
.dd-menu button {
  display: flex; width: 100%; align-items: center; gap: 8px; padding: 10px 14px;
  background: none; border: none; font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text-primary); cursor: pointer; text-align: left;
}
.dd-menu button:hover { background: rgba(255,255,255,0.06); }

/* ── Segmented status toggle ── */
.pay-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.pay-seg button {
  background: none; border: none; font-family: inherit; font-size: 10.5px; font-weight: 700;
  padding: 4px 10px; color: var(--text-muted); cursor: pointer;
  text-transform: none; letter-spacing: normal;
  transition: background var(--transition), color var(--transition);
}
.pay-seg button.active.unpaid { background: rgba(251,191,36,0.12); color: #FBBF24; }
.pay-seg button.active.paid { background: rgba(74,222,128,0.12); color: #4ADE80; }

/* ── Collapsible section bar (optional fields) ── */
.fold-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 16px; cursor: pointer; transition: border-color var(--transition);
}
.fold-bar:hover { border-color: var(--border-strong); }
.fold-bar .fold-icon { font-size: 17px; color: var(--text-muted); flex-shrink: 0; }
.fold-bar .fold-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.fold-bar .fold-opt { font-size: 12px; color: var(--text-muted); }
.fold-bar .fold-badge { font-size: 11px; font-weight: 700; color: var(--accent); margin-left: 4px; }
.fold-bar .fold-chev { margin-left: auto; font-size: 16px; color: var(--text-muted); transition: transform var(--transition); }
.fold-bar.open .fold-chev { transform: rotate(180deg); }
.fold-bar.open { border-radius: 12px 12px 0 0; }
.fold-panel {
  background: var(--surface); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 12px 12px; padding: 18px;
}

/* ── Shared modal (tags, confirmations) ── */
.modal-bd { position: fixed; inset: 0; z-index: 9000; background: rgba(8,10,18,0.66); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bd.is-open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; max-width: 440px; width: 100%; color: var(--text-primary); box-shadow: 0 18px 60px rgba(0,0,0,0.5); }
.modal-title { font-size: 1.05rem; font-weight: 800; margin: 0 0 14px; color: var(--text-primary); }
.modal-body { font-size: 0.86rem; line-height: 1.5; color: var(--text-muted); margin: 0 0 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-btn { font-family: inherit; font-size: 0.82rem; font-weight: 700; padding: 9px 18px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; transition: background var(--transition), border-color var(--transition); }
.modal-cancel { background: var(--surface-hover); color: var(--text-primary); border-color: var(--border); }
.modal-cancel:hover { border-color: var(--border-strong); }
.modal-confirm { background: var(--danger); color: #fff; }
.modal-confirm:hover { filter: brightness(0.92); }

/* ── Compact "+ add" meta buttons (tags / notes) ── */
.pay-meta-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pay-meta-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-hover); color: var(--text-primary);
  font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: border-color var(--transition);
}
.pay-meta-btn:hover { border-color: var(--border-strong); }

/* ── Adjustments subsection header (inside services block) ── */
.li-adj-head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.li-adj-head .li-adj-title { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.li-adj-head .li-adj-actions { margin-left: auto; }
.li-adj-section { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }

/* ── Service group (a selected service with 1+ variant rows) ── */
.li-group { background: var(--surface-hover); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.li-group-head { display: flex; align-items: center; margin-bottom: 6px; }
.li-group-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.li-group-head .li-remove { margin-left: auto; }
.li-vrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; }
.li-vrow + .li-vrow { border-top: 1px dashed var(--border); }
/* Push qty / price / subtotal / × to the right edge in both simple and variant rows. */
.li-row .li-qty, .li-vrow .li-qty { margin-left: auto; }
.li-add-variant {
  margin-top: 8px; background: none; border: 1px dashed var(--border); border-radius: 8px;
  padding: 6px 12px; color: var(--accent); font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: border-color var(--transition);
}
.li-add-variant:hover { border-color: var(--accent); }

/* === Period filter (shared: appointments / payments / future modules) ===
   Chip button + popup: preset rows on top, monobank-style range calendar below.
   Behaviour lives in static/js/period-filter.js (global PeriodFilter). */
.pf-wrap { position: relative; flex-shrink: 0; }
.pf-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 12px; font-weight: 700; color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.pf-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.pf-btn.has-range { color: var(--accent); border-color: rgba(34, 211, 238, 0.35); background: var(--accent-dim); }
.pf-wrap.is-open .pf-btn { color: var(--accent); border-color: rgba(34, 211, 238, 0.35); }
.pf-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 120; width: 292px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.45); padding: 12px;
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity var(--transition), transform var(--transition);
}
.pf-wrap.is-open .pf-pop { opacity: 1; pointer-events: auto; transform: translateY(0); }
.pf-bd { display: none; }
.pf-presets { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.pf-preset {
  background: var(--surface-hover); border: 1px solid transparent; border-radius: 7px;
  padding: 6px 10px; font-family: inherit; font-size: 11.5px; font-weight: 700;
  color: var(--text-muted); cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.pf-preset:hover { color: var(--text-primary); }
.pf-preset.active { color: var(--accent); background: var(--accent-dim); border-color: rgba(34, 211, 238, 0.35); }
.pf-cal { padding-top: 12px; }
.pf-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pf-cal-title { font-size: 13px; font-weight: 800; color: var(--text-primary); }
/* Рік-селект у single-date режимі (форми) — стилізований під заголовок */
.pf-year {
  appearance: none; -webkit-appearance: none;
  background: none; border: none; padding: 0 2px;
  font-family: inherit; font-size: 13px; font-weight: 800; color: var(--text-primary);
  cursor: pointer;
}
.pf-year:focus { outline: none; color: var(--accent); }
.pf-nav {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border); background: none;
  font-size: 16px; line-height: 1; color: var(--text-muted); cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.pf-nav:hover { color: var(--text-primary); border-color: var(--border-strong); }
.pf-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.pf-dow {
  text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); padding: 4px 0 6px;
}
.pf-day {
  height: 32px; border: none; border-radius: 8px; background: none;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-primary);
  cursor: pointer; transition: background var(--transition), color var(--transition);
}
.pf-day:hover { background: var(--surface-hover); }
.pf-day.is-today { box-shadow: inset 0 0 0 1px var(--border-strong); }
.pf-day.in-range { background: var(--accent-dim); color: var(--accent); border-radius: 0; }
.pf-day.is-sel { background: var(--accent); color: #0B0D14; font-weight: 800; }
@media (max-width: 768px) {
  .pf-wrap.is-open .pf-bd {
    display: block; position: fixed; inset: 0; z-index: 199; background: rgba(0, 0, 0, 0.6);
  }
  .pf-pop {
    position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 200; width: auto;
    border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(12px);
  }
  .pf-day { height: 38px; }
}

/* Single-date mode as a form field (add/edit forms): the chip stretches to
   the .add-input dimensions so the picker sits naturally in a form row. */
.pf-wrap.pf-field { display: block; }
.pf-wrap.pf-field .pf-btn {
  width: 100%; height: auto; justify-content: flex-start;
  padding: 10px 14px; border-radius: 9px;
  background: var(--input-bg, var(--surface-hover));
  font-size: 0.87rem; font-weight: 600;
}
.pf-wrap.pf-field .pf-btn.has-range { color: var(--text-primary); background: var(--input-bg, var(--surface-hover)); border-color: var(--border); }
.pf-wrap.pf-field.is-open .pf-btn { border-color: rgba(34, 211, 238, 0.4); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ── Tag pill: live preview + remove badge (× top-right, on hover) ── */
.pay-tag-pill { position: relative; }
.pay-tag-pill.preview { opacity: 0.5; border-style: dashed; }
.pay-tag-pill .tag-x {
  display: none; position: absolute; top: -6px; right: -6px;
  width: 15px; height: 15px; border-radius: 50%;
  background: rgba(20, 22, 30, 0.85); color: var(--text-muted); border: 1px solid var(--border);
  align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; cursor: pointer; padding: 0; opacity: 0.85;
}
.pay-tag-pill:hover .tag-x { display: flex; }
.pay-tag-pill .tag-x:hover { opacity: 1; color: var(--text-primary); }
