/* ==========================================================================
   360 Degree M - v94 UI normalisation, motion and skeleton system
   One type scale, one control-size scale, one spacing rhythm, applied to every
   legacy component. Loaded after v93-glass.css.
   Type:    12 / 13 / 14 (base) / 16 / 20 / 28
   Control: 34 (sm) / 40 (md) / 44 (touch) ; radius 12 / 16 / 20
   Space:   4 / 8 / 12 / 16 / 20 / 24 / 32
   ========================================================================== */
:root {
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 16px; --fs-lg: 20px; --fs-xl: 28px;
  --h-sm: 34px; --h-md: 40px; --h-lg: 44px;
  --r-sm: 12px; --r-md: 16px; --r-lg: 20px;
  --surface: var(--glass-2);
  --dur-1: 120ms; --dur-2: 220ms; --dur-3: 420ms;
  --spring: cubic-bezier(.34,1.4,.64,1);
}
html { font-size: 16px; }
body { font-size: var(--fs-base); line-height: 1.5; font-weight: 450; letter-spacing: -.003em; }
p { margin: 0; }

/* ---------- Typography ---------- */
.page-header h1 { font-size: var(--fs-xl); line-height: 1.15; font-weight: 800; letter-spacing: -.035em; }
.page-header p { font-size: var(--fs-base); color: var(--text3); margin-top: 6px; }
.page-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card h3, .card-head h3 { font-size: var(--fs-md); line-height: 1.3; font-weight: 700; letter-spacing: -.02em; }
.card h4 { font-size: var(--fs-base); font-weight: 700; letter-spacing: -.01em; }
.muted, .card p, .card-subtitle { font-size: var(--fs-sm); color: var(--text3); line-height: 1.55; }
small { font-size: var(--fs-xs); }
label, .field-label { font-size: var(--fs-xs); font-weight: 650; color: var(--text2); letter-spacing: .01em; }
.kpi-label { font-size: var(--fs-xs); }
.kpi-value { font-size: 32px; }

/* ---------- Cards: one rhythm ---------- */
.card { padding: 20px !important; margin-bottom: 16px; border-radius: var(--r-lg) !important; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card h3 + p, .card h3 + .muted { margin-top: 4px; }
.card p + .btn, .card p + button, .card .muted + .btn, .card .muted + button, .card p + .btn-row { margin-top: 16px; }
.card .btn + .btn { margin-left: 8px; }
.kpi-grid { gap: 12px; margin-bottom: 20px; }
.kpi-card { padding: 18px !important; border-radius: var(--r-lg); }
.page > .card:last-child { margin-bottom: 0; }

/* ---------- Buttons: one size scale ---------- */
.btn { height: var(--h-md); min-height: var(--h-md); padding: 0 16px; border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; position: relative; overflow: hidden; font-weight: 650; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-sm { height: var(--h-sm); min-height: var(--h-sm); padding: 0 12px; font-size: var(--fs-xs); border-radius: 10px; gap: 6px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { width: var(--h-md); min-width: var(--h-md); height: var(--h-md); min-height: var(--h-md); padding: 0; border-radius: var(--r-sm); }
.btn-icon svg { width: 18px; height: 18px; }
.btn::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at var(--rx, 50%) var(--ry, 50%), rgba(255,255,255,.55), transparent 60%); opacity: 0; transform: scale(.6); transition: opacity .5s, transform .5s; pointer-events: none; }
.btn.is-rippling::after { opacity: 1; transform: scale(1.6); transition: none; }
.btn:disabled, .btn[disabled] { opacity: .5; pointer-events: none; }
.btn-danger, .btn-outline[onclick*="delete"], .btn-outline[onclick*="Delete"] { color: var(--red); }
.btn-danger:hover, .btn-outline[onclick*="delete"]:hover, .btn-outline[onclick*="Delete"]:hover { background: var(--red-light); border-color: rgba(220,38,38,.3); }
.team-card-actions .btn, .client-card-actions .btn { flex: 1 1 auto; }

/* ---------- Inputs: one size scale ---------- */
.field { margin-bottom: 14px; }
.field-input, select.field-input, input.field-input, textarea.field-input { height: var(--h-lg); min-height: var(--h-lg); font-size: var(--fs-base); padding: 0 14px; border-radius: var(--r-sm); }
textarea.field-input { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.55; }
select.field-input { padding-right: 38px; }
.mini-status-select { height: var(--h-sm); min-height: var(--h-sm); font-size: var(--fs-xs); padding: 0 32px 0 12px; }
input[type="date"].field-input, input[type="time"].field-input, input[type="month"].field-input { padding-right: 10px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; }
.form-grid { display: grid; gap: 12px; } .form-grid.two { grid-template-columns: 1fr 1fr; }

/* filter bars / chips */
.filter-chip, .chip, .pill, [class*="filter"] .btn { height: var(--h-sm); }
.filters, .filter-bar, .work-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar .field-input, .filters .field-input, .work-filters .field-input, .card select.field-input { height: var(--h-md); min-height: var(--h-md); font-size: var(--fs-sm); width: auto; min-width: 150px; }

/* ---------- Tags / avatars ---------- */
.tag { height: 24px; padding: 0 10px; font-size: var(--fs-xs); line-height: 1; }
.avatar { font-size: var(--fs-sm); }
.avatar-lg { width: 52px; height: 52px; font-size: var(--fs-md); }

/* ---------- Menus: sidebar, header, bottom nav ---------- */
.sidebar-link { font-size: var(--fs-base); height: var(--h-lg); min-height: var(--h-lg); }
.sidebar-link svg { width: 18px; height: 18px; }
.sidebar-nav-label { font-size: 11px; }
.sidebar-logo-text { font-size: var(--fs-md); }
.sidebar-logo-sub { font-size: 10.5px; }
.header { height: 56px; }
.header-breadcrumb { font-size: var(--fs-md); }
.header .btn-icon { width: 40px; height: 40px; }
.notification-badge::after { content: ""; position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--glass-solid); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.bottom-nav-item { font-size: 11px; gap: 3px; }
.bottom-nav-item svg { width: 21px; height: 21px; transition: transform var(--dur-2) var(--spring); }
.bottom-nav-item.active svg { transform: translateY(-1px) scale(1.12); }

/* ---------- Lists / rows ---------- */
.unified-work-row, .item-row, .work-row, .content-row { padding: 12px 14px; gap: 12px; align-items: center; margin-bottom: 8px; }
.unified-work-row:last-child, .item-row:last-child { margin-bottom: 0; }
.content-row-title, .work-row-title, .item-title, .row-title { font-size: var(--fs-base); font-weight: 650; letter-spacing: -.01em; line-height: 1.35; }
.item-meta, .row-meta { font-size: var(--fs-xs); color: var(--text3); }

/* ---------- Page chrome ---------- */
.page { padding: 20px 20px calc(110px + var(--safe-b)); max-width: 1440px; width: 100%; margin: 0 auto; }
@media (min-width: 1024px) { .page { padding: 24px 32px 48px; } }

/* ---------- Motion ---------- */
.page.page-enter > * { animation: rise var(--dur-3) var(--ease) both; }
.page-enter .card .unified-work-row, .page-enter .card .item-row, .page-enter .card .work-row, .page-enter .clients-grid-v79 > *, .page-enter .team-grid > *, .page-enter .kpi-grid > * { animation: rise var(--dur-3) var(--ease) both; }
.page-enter .kpi-grid > *:nth-child(1), .page-enter .clients-grid-v79 > *:nth-child(1), .page-enter .team-grid > *:nth-child(1) { animation-delay: .02s; }
.page-enter .kpi-grid > *:nth-child(2), .page-enter .clients-grid-v79 > *:nth-child(2), .page-enter .team-grid > *:nth-child(2) { animation-delay: .07s; }
.page-enter .kpi-grid > *:nth-child(3), .page-enter .clients-grid-v79 > *:nth-child(3), .page-enter .team-grid > *:nth-child(3) { animation-delay: .12s; }
.page-enter .kpi-grid > *:nth-child(4), .page-enter .clients-grid-v79 > *:nth-child(4), .page-enter .team-grid > *:nth-child(4) { animation-delay: .17s; }
.page-enter .kpi-grid > *:nth-child(n+5), .page-enter .clients-grid-v79 > *:nth-child(n+5) { animation-delay: .22s; }
.page-enter .card .unified-work-row:nth-child(2) { animation-delay: .05s; } .page-enter .card .unified-work-row:nth-child(3) { animation-delay: .09s; }
.page-enter .card .unified-work-row:nth-child(4) { animation-delay: .13s; } .page-enter .card .unified-work-row:nth-child(n+5) { animation-delay: .17s; }
.modal { animation: modal-in var(--dur-3) var(--spring) both; }
@keyframes modal-in { from { opacity: 0; transform: translateX(24px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 1023px) { .modal { animation-name: sheet-in; } @keyframes sheet-in { from { opacity: 0; transform: translateY(40px) scale(.98); } to { opacity: 1; transform: none; } } }
.sidebar { transition: transform var(--dur-3) var(--ease), box-shadow var(--dur-3); }
.progress-track > span { animation: grow .9s var(--ease) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.v91-toast { animation: toast-in .35s var(--spring) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
.tag, .avatar, .btn, .sidebar-link, .bottom-nav-item { transition-property: background, color, border-color, box-shadow, transform, filter; transition-duration: var(--dur-2); transition-timing-function: var(--ease); }

/* ---------- Skeletons ---------- */
.sk { position: relative; overflow: hidden; background: linear-gradient(90deg, rgba(100,116,139,.12) 0%, rgba(100,116,139,.22) 40%, rgba(100,116,139,.12) 80%); background-size: 220% 100%; animation: shimmer 1.4s linear infinite; border-radius: 10px; }
html[data-theme="dark"] .sk { background-image: linear-gradient(90deg, rgba(255,255,255,.05) 0%, rgba(255,255,255,.11) 40%, rgba(255,255,255,.05) 80%); }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.sk-line { height: 12px; } .sk-line.lg { height: 28px; border-radius: 12px; } .sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; }
.sk-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.sk-kpi { height: 96px; border-radius: var(--r-lg); }
.sk-card { padding: 20px; border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow); margin-bottom: 16px; }
.sk-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; } .sk-row + .sk-row { border-top: 1px solid var(--border2); }
.sk-dot { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.sk-col { flex: 1; display: grid; gap: 8px; }
.sk-btn { width: 92px; height: 34px; border-radius: 10px; }
.page-skeleton { animation: none !important; }
.page-skeleton > * { animation: none !important; }

/* Boot skeleton (replaces the old loading page) */
#bootScreen { position: fixed; inset: 0; z-index: 99999; display: flex; gap: 16px; padding: 14px; background: transparent !important; text-align: left; transition: opacity .35s var(--ease), visibility .35s; }
#bootScreen.boot-hide { opacity: 0; visibility: hidden; pointer-events: none; }
#bootScreen .bs-side { width: 268px; border-radius: 28px; background: var(--glass); border: 1px solid var(--glass-border); padding: 20px 16px; display: none; flex-direction: column; gap: 12px; box-shadow: var(--shadow-md); }
#bootScreen .bs-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; } #bootScreen .bs-brand .sk:first-child { width: 44px; height: 44px; border-radius: 14px; }
#bootScreen .bs-link { height: 44px; border-radius: 14px; }
#bootScreen .bs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
#bootScreen .bs-head { height: 56px; border-radius: 20px; background: var(--glass); border: 1px solid var(--glass-border); }
#bootScreen .bs-nav { position: absolute; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); height: 66px; border-radius: 26px; background: var(--glass-2); border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-around; padding: 0 16px; }
#bootScreen .bs-nav .sk { width: 40px; height: 40px; border-radius: 14px; }
@media (min-width: 1024px) { #bootScreen .bs-side { display: flex; } #bootScreen .bs-nav { display: none; } #bootScreen { padding: 14px 18px 14px 14px; } }
#bootScreen .boot-card { margin: auto; padding: 28px; border-radius: 24px; background: var(--glass-2); border: 1px solid var(--glass-border); text-align: center; display: grid; gap: 8px; justify-items: center; }
#bootScreen .boot-logo { font-weight: 800; font-size: var(--fs-lg); letter-spacing: -.03em; color: var(--text); }
#bootScreen .boot-copy { color: var(--text3); font-size: var(--fs-sm); }

/* ---------- Partner workspace layout ---------- */
.pp-form.pp-commit-form { grid-template-columns: 1fr 1fr auto; align-items: end; }
.pp-field { display: grid; gap: 6px; } .pp-field span { font-size: var(--fs-xs); font-weight: 650; color: var(--text2); }
.pp-block-head h4 { font-size: var(--fs-md); }
.pp-stats strong { font-size: 22px; }
@media (max-width: 760px) { .pp-form.pp-commit-form { grid-template-columns: 1fr; } }

/* ---------- Mobile sizing ---------- */
@media (max-width: 760px) {
  html { font-size: 16px; }
  .page { padding: 16px 14px calc(112px + var(--safe-b)); }
  .page-header h1 { font-size: 26px; }
  .card { padding: 16px !important; border-radius: var(--r-md) !important; }
  .field-input, select.field-input, input.field-input { font-size: 16px; }
  .btn-icon { width: var(--h-lg); height: var(--h-lg); min-width: var(--h-lg); }
  .btn { height: var(--h-lg); min-height: var(--h-lg); }
  .btn-sm { height: 38px; min-height: 38px; }
  .page-header-top .btn { width: 100%; }
  .form-grid.two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .sk, .notification-badge::after, .progress-track > span, .modal, .v91-toast { animation: none !important; } .btn::after { display: none; } }
@media (max-width: 760px) { .sk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sk-kpi { height: 84px; } }
.card > .btn, .card > div + .btn, .card > div + button { margin-top: 16px; }
@media (max-width: 760px) {
  .pp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pp-stats div:last-child { grid-column: auto; }
  .pp-stats div { padding: 10px; } .pp-stats span { font-size: 10px; letter-spacing: .04em; } .pp-stats strong { font-size: 17px; }
}
