:root {
  color-scheme: light;
  --bg: #f7f6fb;
  --surface: #ffffff;
  --surface-2: #f0edf8;
  --text: #1f1b2d;
  --muted: #6e687d;
  --line: #e4e0ec;
  --primary: #6d28d9;
  --primary-2: #8b5cf6;
  --primary-soft: #ede9fe;
  --success: #15803d;
  --success-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warning: #a16207;
  --warning-soft: #fef3c7;
  --shadow: 0 14px 36px rgba(45, 31, 78, .10);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; border-right: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(16px); display:flex; flex-direction:column; gap:20px; z-index:10; }
.brand { display:flex; align-items:center; gap:12px; padding: 0 8px; }
.brand-mark { width:42px; height:42px; border-radius:14px; display:grid; place-items:center; color:white; font-weight:900; background: linear-gradient(145deg,var(--primary),#ec4899); box-shadow: 0 9px 24px rgba(109,40,217,.25); }
.brand strong { display:block; font-size:1.05rem; }
.brand small { color:var(--muted); }
.nav { display:grid; gap:6px; overflow:auto; padding-right:2px; }
.nav-link { display:flex; align-items:center; gap:11px; padding:11px 12px; border-radius:12px; text-decoration:none; color:var(--muted); font-weight:700; border:1px solid transparent; }
.nav-link:hover { background:var(--surface-2); color:var(--text); }
.nav-link.active { color:var(--primary); background:var(--primary-soft); border-color:#ddd6fe; }
.nav-icon { width:24px; text-align:center; }
.sidebar-footer { margin-top:auto; display:grid; gap:10px; }
.plan-pill { border-radius:14px; padding:12px; background:linear-gradient(145deg,#2e1065,#6d28d9); color:white; }
.plan-pill small { opacity:.82; }
.main { min-width:0; }
.topbar { height:72px; display:flex; align-items:center; justify-content:space-between; gap:16px; padding: 0 28px; border-bottom:1px solid var(--line); background:rgba(247,246,251,.88); backdrop-filter:blur(12px); position:sticky; top:0; z-index:8; }
.topbar h1 { margin:0; font-size:1.25rem; }
.top-actions { display:flex; align-items:center; gap:10px; }
.language-switch { width:auto; min-width:72px; padding-right:28px; font-weight:850; }

.content { padding:26px 28px 90px; max-width:1480px; margin:0 auto; }
.page-head { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; margin-bottom:22px; }
.page-head h2 { margin:0 0 6px; font-size:clamp(1.45rem,3vw,2rem); }
.page-head p { margin:0; color:var(--muted); max-width:780px; line-height:1.55; }
.grid { display:grid; gap:16px; }
.grid-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
.grid-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
.grid-4 { grid-template-columns:repeat(4,minmax(0,1fr)); }
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:18px; box-shadow:0 2px 0 rgba(45,31,78,.02); }
.card h3 { margin:0 0 12px; font-size:1.03rem; }
.metric { display:grid; gap:8px; }
.metric .label { color:var(--muted); font-size:.9rem; font-weight:700; }
.metric .value { font-size:1.8rem; font-weight:900; letter-spacing:-.04em; }
.metric .hint { color:var(--muted); font-size:.84rem; }
.metric.primary { background:linear-gradient(145deg,#5b21b6,#7c3aed); color:white; border:none; }
.metric.primary .label,.metric.primary .hint { color:rgba(255,255,255,.8); }
.btn { border:1px solid var(--line); background:var(--surface); color:var(--text); border-radius:12px; padding:10px 14px; font-weight:800; display:inline-flex; align-items:center; justify-content:center; gap:8px; text-decoration:none; min-height:42px; }
.btn:hover { transform:translateY(-1px); box-shadow:0 7px 18px rgba(45,31,78,.08); }
.btn-primary { color:white; background:var(--primary); border-color:var(--primary); }
.btn-soft { color:var(--primary); background:var(--primary-soft); border-color:#ddd6fe; }
.btn-danger { color:var(--danger); background:var(--danger-soft); border-color:#fecaca; }
.btn-ghost { background:transparent; border-color:transparent; }
.btn-sm { padding:7px 10px; min-height:34px; font-size:.86rem; border-radius:10px; }
.icon-btn { width:42px; height:42px; padding:0; border-radius:12px; }
.input, .select, .textarea { width:100%; border:1px solid var(--line); border-radius:12px; padding:11px 12px; background:#fff; color:var(--text); outline:none; }
.input:focus,.select:focus,.textarea:focus { border-color:var(--primary-2); box-shadow:0 0 0 3px rgba(139,92,246,.13); }
.textarea { resize:vertical; min-height:100px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.field { display:grid; gap:7px; }
.field label { font-size:.86rem; font-weight:800; color:#453f53; }
.field.full { grid-column:1/-1; }
.toolbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:14px; }
.toolbar .input { max-width:360px; }
.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:16px; background:white; }
table { border-collapse:collapse; width:100%; min-width:760px; }
th,td { text-align:left; padding:13px 14px; border-bottom:1px solid var(--line); vertical-align:middle; }
th { color:var(--muted); font-size:.8rem; text-transform:uppercase; letter-spacing:.04em; background:#fbfaff; }
tr:last-child td { border-bottom:none; }
.row-title { font-weight:850; }
.row-sub { color:var(--muted); font-size:.84rem; margin-top:3px; }
.badge { display:inline-flex; align-items:center; gap:5px; border-radius:999px; padding:5px 9px; font-size:.78rem; font-weight:850; background:var(--surface-2); color:var(--muted); }
.badge.success { background:var(--success-soft); color:var(--success); }
.badge.danger { background:var(--danger-soft); color:var(--danger); }
.badge.warning { background:var(--warning-soft); color:var(--warning); }
.badge.primary { background:var(--primary-soft); color:var(--primary); }
.list { display:grid; gap:10px; }
.list-item { display:flex; justify-content:space-between; gap:14px; align-items:center; padding:13px 0; border-bottom:1px solid var(--line); }
.list-item:last-child { border-bottom:none; }
.list-main { min-width:0; }
.list-title { font-weight:850; }
.list-sub { color:var(--muted); font-size:.86rem; margin-top:3px; }
.empty { padding:34px 20px; text-align:center; color:var(--muted); border:1px dashed #d8d2e5; border-radius:16px; background:#fcfbff; }
.empty strong { color:var(--text); display:block; margin-bottom:6px; }
.progress { height:10px; border-radius:999px; background:#ece8f4; overflow:hidden; }
.progress > span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--primary),#ec4899); }
.quick-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.quick-action { text-align:left; min-height:86px; align-items:flex-start; flex-direction:column; }
.modal-backdrop { position:fixed; inset:0; z-index:100; background:rgba(28,20,42,.55); display:grid; place-items:center; padding:20px; }
.modal { width:min(720px,100%); max-height:90vh; overflow:auto; background:white; border-radius:22px; box-shadow:var(--shadow); border:1px solid rgba(255,255,255,.7); }
.modal-head { position:sticky; top:0; background:white; display:flex; justify-content:space-between; align-items:center; padding:18px 20px; border-bottom:1px solid var(--line); z-index:2; }
.modal-head h3 { margin:0; }
.modal-body { padding:20px; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; padding-top:18px; }
.toast-root { position:fixed; right:18px; bottom:18px; z-index:200; display:grid; gap:8px; }
.toast { max-width:380px; padding:13px 16px; border-radius:14px; background:#1f1b2d; color:white; box-shadow:var(--shadow); animation:toast-in .2s ease-out; }
.toast.error { background:#991b1b; }
@keyframes toast-in { from{opacity:0;transform:translateY(8px)} }
.mobile-nav { display:none; }
.hero { background:linear-gradient(145deg,#2e1065,#6d28d9 55%,#db2777); color:white; border:none; padding:24px; }
.hero p { color:rgba(255,255,255,.82); line-height:1.55; }
.hero .btn { background:white; color:#4c1d95; border:none; }
.online-preview { border:10px solid #24212b; border-radius:32px; background:white; max-width:390px; min-height:620px; margin:auto; overflow:hidden; box-shadow:var(--shadow); }
.preview-cover { height:150px; background:linear-gradient(145deg,var(--primary),#ec4899); }
.preview-cover { background-size:cover; background-position:center; }
.preview-body { padding:20px; }
.preview-avatar { width:82px;height:82px;border-radius:24px;background:white;box-shadow:0 7px 20px rgba(0,0,0,.13);display:grid;place-items:center;font-size:2rem;margin-top:-60px;border:4px solid white; }
.preview-avatar img { width:100%;height:100%;object-fit:cover;border-radius:18px; }
.service-card { padding:12px;border:1px solid var(--line);border-radius:14px;margin-top:10px;display:flex;justify-content:space-between;gap:12px; }
.notice { border-radius:14px; padding:13px 15px; background:var(--primary-soft); color:#4c1d95; border:1px solid #ddd6fe; line-height:1.45; }
.notice.warning { background:var(--warning-soft); color:#854d0e; border-color:#fde68a; }
.kpi-strip { display:flex; gap:8px; flex-wrap:wrap; }
.kpi-chip { padding:8px 10px; border-radius:10px; background:#f7f5fb; border:1px solid var(--line); font-size:.85rem; }
.onboarding { min-height:100vh; display:grid; place-items:center; padding:24px; background:radial-gradient(circle at 80% 10%,#ddd6fe,transparent 32%),radial-gradient(circle at 10% 90%,#fbcfe8,transparent 28%),var(--bg); }
.onboarding-card { width:min(760px,100%); background:white; border:1px solid var(--line); border-radius:28px; padding:28px; box-shadow:var(--shadow); }
.onboarding-card h1 { font-size:clamp(2rem,5vw,3rem); margin:14px 0 8px; letter-spacing:-.05em; }
.onboarding-card p { color:var(--muted); line-height:1.6; }
.split { display:grid; grid-template-columns:minmax(0,1fr) minmax(320px,.7fr); gap:18px; align-items:start; }
.chart-bars { height:170px; display:flex; align-items:end; gap:8px; padding-top:18px; }
.chart-bar { flex:1; background:linear-gradient(180deg,#8b5cf6,#6d28d9); border-radius:8px 8px 3px 3px; min-height:3px; position:relative; }
.chart-bar span { position:absolute; bottom:-24px; left:50%; transform:translateX(-50%); color:var(--muted); font-size:.72rem; }
.check-row { display:flex; gap:10px; align-items:flex-start; }
.check-row input { margin-top:4px; }
.online-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(320px,410px); gap:18px; align-items:start; }
.online-editor { display:grid; gap:16px; }
.online-side { display:grid; gap:16px; position:sticky; top:90px; }
.online-actions { display:flex; flex-wrap:wrap; gap:9px; margin:14px 0; }
.schedule-grid { display:grid; gap:8px; margin-top:14px; }
.schedule-row { display:grid; grid-template-columns:minmax(130px,1fr) minmax(105px,.6fr) auto minmax(105px,.6fr); gap:9px; align-items:center; padding:9px 0; border-bottom:1px solid var(--line); }
.schedule-row:last-child { border-bottom:none; }
.exception-editor { display:flex; justify-content:space-between; gap:16px; align-items:end; flex-wrap:wrap; margin-top:18px; padding-top:16px; border-top:1px solid var(--line); }
.exception-editor .field { min-width:190px; }
.exception-remove { border:0; background:transparent; color:var(--danger); font-weight:900; padding:0 0 0 6px; }
.locked-card { background:#fcfbfe; }
.locked-card::before { content:"Page Plus"; display:inline-flex; margin-bottom:10px; border-radius:999px; padding:5px 9px; font-size:.76rem; font-weight:850; color:var(--primary); background:var(--primary-soft); }
.gallery-admin-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.gallery-admin-item { margin:0; border:1px solid var(--line); border-radius:14px; overflow:hidden; background:#fff; }
.gallery-admin-item img { display:block; width:100%; aspect-ratio:1; object-fit:cover; }
.gallery-admin-item figcaption { display:flex; align-items:center; justify-content:space-between; gap:6px; padding:8px; }
.gallery-admin-actions { display:flex; gap:4px; flex-wrap:wrap; justify-content:flex-end; }
.share-card a { color:var(--primary); overflow-wrap:anywhere; }
.qr-box { width:min(220px,100%); margin:10px auto; }
.qr-box svg { display:block; width:100%; height:auto; }
.privacy-boundary { border-color:#c7e9d2; background:#f8fffa; }
.booking-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.booking-card .detail-list > div { padding:8px 0; }
.booking-message { padding:12px; border-radius:12px; background:var(--surface-2); white-space:pre-wrap; color:var(--muted); line-height:1.55; }
@media (max-width: 1050px) {
  .grid-4 { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .grid-3 { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .split { grid-template-columns:1fr; }
  .online-layout { grid-template-columns:1fr; }
  .online-side { position:static; }
}
@media (max-width: 760px) {
  .app-shell { display:block; }
  .sidebar { display:none; }
  .topbar { height:62px; padding:0 12px; }
  .topbar h1 { font-size:1.05rem; }
  .top-actions { gap:6px; }
  .language-switch { min-width:58px; padding:8px 22px 8px 9px; }
  .top-actions .btn-primary { padding-inline:10px; font-size:.82rem; }
  .content { padding:18px 14px 94px; }
  .page-head { flex-direction:column; }
  .grid-2,.grid-3,.grid-4,.form-grid { grid-template-columns:1fr; }
  .field.full { grid-column:auto; }
  .quick-actions { grid-template-columns:1fr; }
  .mobile-nav { position:fixed; bottom:0; left:0; right:0; z-index:50; display:grid; grid-template-columns:repeat(5,1fr); background:rgba(255,255,255,.96); backdrop-filter:blur(16px); border-top:1px solid var(--line); padding:7px 6px calc(7px + env(safe-area-inset-bottom)); }
  .mobile-nav a { display:grid; place-items:center; gap:2px; padding:5px; text-decoration:none; color:var(--muted); font-size:.68rem; font-weight:800; }
  .mobile-nav a.active { color:var(--primary); }
  .mobile-nav .nav-icon { font-size:1.05rem; }
  .top-actions .hide-mobile { display:none; }
  .modal-backdrop { padding:8px; align-items:end; }
  .modal { max-height:94vh; border-radius:22px 22px 12px 12px; }
  .toast-root { left:12px; right:12px; bottom:84px; }
  .toast { max-width:none; }
  .onboarding-card { padding:21px; }
}

/* v0.3 workflow and client-detail enhancements */
.text-link { color:inherit; text-decoration:none; font-weight:inherit; }
.text-link:hover { color:var(--primary); text-decoration:underline; }
.inline-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; justify-content:flex-end; }
.section-title-row { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; flex-wrap:wrap; }
.section-title-row h3 { display:inline-block; margin-right:8px; }
.attention-card { border-color:#fecaca; background:linear-gradient(180deg,#fff,#fffafa); }
.action-list { display:grid; gap:10px; margin-top:14px; }
.action-item { padding:14px; border:1px solid #f4d4d4; border-radius:15px; background:white; display:flex; justify-content:space-between; gap:16px; align-items:center; }
.action-item.compact { padding:12px; }
.action-main { min-width:220px; }
.action-buttons { display:flex; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.metric-date { font-size:1.25rem !important; letter-spacing:-.02em !important; }
.detail-list { display:grid; gap:0; }
.detail-list > div { display:flex; justify-content:space-between; gap:18px; padding:11px 0; border-bottom:1px solid var(--line); }
.detail-list > div:last-child { border-bottom:none; }
.detail-list span { color:var(--muted); }
.detail-list strong { text-align:right; word-break:break-word; }
.notes-box { white-space:pre-wrap; line-height:1.65; color:var(--muted); min-height:96px; margin:0; }
.borderless { border:none; border-radius:0; }
.danger-zone-card { display:flex; justify-content:space-between; align-items:center; gap:18px; border-color:#fecaca; background:#fffafa; }
.card-expired { border-color:#fecaca; background:#fffafa; }

@media (max-width: 900px) {
  .action-item { align-items:flex-start; flex-direction:column; }
  .action-buttons { justify-content:flex-start; }
}
@media (max-width: 760px) {
  .inline-actions { justify-content:flex-start; }
  .action-buttons { display:grid; width:100%; grid-template-columns:1fr 1fr; }
  .action-buttons .btn { width:100%; }
  .danger-zone-card { align-items:flex-start; flex-direction:column; }
  .detail-list > div { align-items:flex-start; flex-direction:column; gap:4px; }
  .detail-list strong { text-align:left; }
  .schedule-row { grid-template-columns:1fr 1fr; }
  .schedule-row > span { display:none; }
  .gallery-admin-grid,.booking-grid { grid-template-columns:1fr; }
}

/* v0.3.1 payment-pending and history-filter enhancements */
.metric-link { text-decoration:none; color:inherit; transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.metric-link:hover { transform:translateY(-2px); box-shadow:0 12px 28px rgba(45,31,78,.10); border-color:#c4b5fd; }
.outstanding-card { border-color:#fde68a; background:linear-gradient(180deg,#fff,#fffdf5); scroll-margin-top:88px; }
.pending-summary { display:flex; align-items:center; gap:10px; }
.pending-summary strong { font-size:1.2rem; }
.outstanding-list { display:grid; gap:10px; margin-top:15px; }
.outstanding-item { display:flex; justify-content:space-between; gap:16px; align-items:center; padding:15px; border:1px solid #fde7a6; border-radius:15px; background:#fff; }
.outstanding-main { min-width:220px; }
.debt-chip { color:#92400e; background:#fffbeb; border-color:#fde68a; font-weight:850; }
.pending-packages { margin-top:18px; padding-top:16px; border-top:1px solid #fde7a6; }
.pending-packages h4 { margin:0 0 8px; }
.filter-tabs { display:flex; gap:8px; flex-wrap:wrap; margin:14px 0; }
.filter-tab { border:1px solid var(--line); background:#fff; color:var(--muted); border-radius:999px; padding:8px 12px; font-weight:800; display:inline-flex; gap:7px; align-items:center; }
.filter-tab span { min-width:22px; height:22px; display:grid; place-items:center; padding:0 6px; border-radius:999px; background:var(--surface-2); font-size:.75rem; }
.filter-tab:hover { color:var(--primary); border-color:#c4b5fd; }
.filter-tab.active { color:var(--primary); background:var(--primary-soft); border-color:#c4b5fd; }
.filter-tab.active span { background:#fff; color:var(--primary); }

@media (max-width: 760px) {
  .outstanding-item { align-items:flex-start; flex-direction:column; }
  .outstanding-item .action-buttons { width:100%; grid-template-columns:1fr; }
  .pending-summary { width:100%; justify-content:space-between; }
  .filter-tabs { flex-wrap:nowrap; overflow:auto; padding-bottom:4px; }
  .filter-tab { flex:0 0 auto; }
}
