:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --surface-green: #eef6f3;
  --text: #17211f;
  --muted: #6f7d79;
  --muted-2: #98a39f;
  --line: #e2e9e6;
  --line-strong: #d5dfdb;
  --primary: #247c70;
  --primary-dark: #19675d;
  --primary-soft: #e4f2ee;
  --danger: #c94d54;
  --danger-soft: #fcebed;
  --warning: #a66a18;
  --warning-soft: #fff3dc;
  --blue: #4d6fa8;
  --blue-soft: #edf2fb;
  --shadow: 0 12px 35px rgba(32, 63, 55, .07);
  --shadow-lg: 0 24px 70px rgba(26, 49, 44, .18);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar: 244px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
svg { display: block; stroke: currentColor; }
[hidden], .is-hidden { display: none !important; }
body.modal-open { overflow: hidden; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar); padding: 26px 18px 20px; display: flex; flex-direction: column; background: #f9fbfa; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 29px; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; color: #fff; background: var(--primary); border-radius: 12px; box-shadow: 0 8px 18px rgba(36,124,112,.22); }
.brand-mark svg { width: 22px; }
.brand > div { display: flex; align-items: baseline; gap: 4px; font-size: 19px; letter-spacing: -.03em; }
.brand strong { font-weight: 760; }
.brand span { color: var(--muted); }
.sidebar-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-caption { margin: 0 11px 9px; color: var(--muted-2); font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.nav-item { border: 0; background: transparent; }
.sidebar .nav-item { width: 100%; min-height: 45px; padding: 0 12px; display: flex; align-items: center; gap: 12px; color: #65736f; border-radius: 12px; font-size: 14px; font-weight: 630; text-align: left; transition: .18s ease; }
.sidebar .nav-item svg { width: 20px; height: 20px; flex: 0 0 auto; }
.sidebar .nav-item:hover { color: var(--primary-dark); background: #f0f5f3; }
.sidebar .nav-item.active { color: var(--primary-dark); background: var(--primary-soft); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 13px; }
.user-chip { min-width: 0; padding: 14px 10px 3px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.user-avatar { width: 37px; height: 37px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #367f75, #1c645a); border-radius: 50%; font-size: 12px; font-weight: 800; }
.user-chip div { min-width: 0; display: grid; gap: 2px; }
.user-chip strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: var(--muted-2); font-size: 10px; }

.workspace { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { height: 86px; padding: 0 clamp(24px, 4vw, 54px); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: rgba(255,255,255,.82); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 20; }
.title-block { min-width: 130px; }
.eyebrow { margin: 0 0 4px; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; line-height: 1.15; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 22px; line-height: 1.22; letter-spacing: -.035em; }
h3 { margin-bottom: 0; }
.topbar-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.sync-state { max-width: 220px; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.sync-state i { width: 7px; height: 7px; flex: 0 0 auto; background: var(--warning); border-radius: 50%; }
.sync-state.ready i { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.sync-state.error { color: var(--danger); }
.sync-state.error i { background: var(--danger); }
select, input, textarea { width: 100%; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; outline: none; transition: border-color .18s, box-shadow .18s; }
select:focus, input:focus, textarea:focus { border-color: #77afa7; box-shadow: 0 0 0 3px rgba(36,124,112,.1); }
.topbar select { width: auto; max-width: 185px; height: 39px; padding: 0 32px 0 11px; color: #4f5e5a; background-color: var(--surface-soft); font-size: 11px; }
.button { min-height: 40px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 720; white-space: nowrap; transition: transform .15s, box-shadow .15s, background .15s; }
.button svg { width: 17px; height: 17px; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--primary); box-shadow: 0 8px 20px rgba(36,124,112,.17); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: #42504d; background: #fff; border-color: var(--line-strong); }
.button.secondary:hover { background: var(--surface-soft); }

.content { width: min(1480px, 100%); margin: 0 auto; padding: 32px clamp(24px, 4vw, 54px) 70px; }
.view { display: none; animation: reveal .22s ease; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.dashboard-intro { margin-bottom: 23px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.dashboard-intro h2 { margin-bottom: 6px; font-size: 25px; }
.dashboard-intro p, .view-toolbar p { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.refresh-button { min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); background: transparent; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 11px; font-weight: 700; }
.refresh-button svg { width: 16px; }
.refresh-button:hover { color: var(--primary); background: #fff; }

.metric-grid { margin-bottom: 15px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-width: 0; min-height: 157px; padding: 21px 21px 18px; position: relative; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(34,62,55,.035); }
.metric-card::after { content: ""; width: 94px; height: 94px; position: absolute; right: -38px; top: -42px; background: var(--primary-soft); border-radius: 50%; opacity: .5; }
.metric-icon { width: 34px; height: 34px; margin-bottom: 19px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 10px; }
.metric-icon svg { width: 18px; }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 650; }
.metric-card > strong { margin-top: 5px; font-size: 31px; line-height: 1; letter-spacing: -.045em; }
.metric-card small { margin-top: auto; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.metric-card.metric-primary { color: #fff; background: linear-gradient(145deg, #267c71, #1d6e64); border-color: transparent; }
.metric-primary::after { background: rgba(255,255,255,.12); }
.metric-primary .metric-icon { color: #fff; background: rgba(255,255,255,.15); }
.metric-primary .metric-label, .metric-primary small { color: rgba(255,255,255,.72); }
.metric-danger .metric-icon { color: var(--danger); background: var(--danger-soft); }
.metric-danger::after { background: var(--danger-soft); }

.progress-card { margin-bottom: 29px; padding: 19px 21px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(34,62,55,.035); }
.progress-main { margin-bottom: 13px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.progress-main > div:first-child { display: flex; align-items: baseline; gap: 12px; }
.progress-main strong { font-size: 22px; letter-spacing: -.04em; }
.progress-amounts { display: flex; align-items: center; gap: 24px; color: var(--muted); font-size: 10px; }
.progress-amounts b { margin-left: 4px; color: var(--text); font-size: 11px; }
.progress-track { height: 7px; overflow: hidden; background: #e8eeec; border-radius: 999px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #2c8a7d, #63ae9f); border-radius: inherit; transition: width .4s ease; }

.section-block { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(34,62,55,.035); }
.section-heading { padding: 21px 22px 16px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-heading h2 { font-size: 18px; }
.section-heading > div > span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.section-heading.compact { padding-bottom: 8px; }
.text-button { padding: 7px 0; display: inline-flex; align-items: center; gap: 7px; color: var(--primary); background: transparent; border: 0; font-size: 11px; font-weight: 750; }
.text-button:hover { color: var(--primary-dark); }

.kanban-grid { padding: 0 14px 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.kanban-column { min-width: 0; padding: 12px; background: var(--surface-soft); border: 1px solid #edf1ef; border-radius: 14px; }
.kanban-column > header { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; color: #4e5c58; font-size: 11px; font-weight: 750; }
.kanban-column > header span { display: flex; align-items: center; gap: 7px; }
.kanban-column > header span::before { content: ""; width: 7px; height: 7px; background: var(--muted-2); border-radius: 50%; }
.kanban-column.overdue > header span::before { background: var(--danger); }
.kanban-column.sent > header span::before { background: var(--warning); }
.kanban-column.planned > header span::before { background: var(--blue); }
.kanban-column > header b { min-width: 23px; height: 22px; padding: 0 7px; display: grid; place-items: center; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 10px; }
.kanban-cards { max-height: 420px; overflow: auto; display: grid; gap: 8px; scrollbar-width: thin; }
.payment-card { padding: 12px; position: relative; display: grid; gap: 5px; background: #fff; border: 1px solid var(--line); border-radius: 11px; transition: border-color .15s, box-shadow .15s; }
.payment-card:hover { border-color: #c7d8d3; box-shadow: 0 7px 18px rgba(38,67,60,.07); }
.payment-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.due-label { color: var(--muted); font-size: 9px; font-weight: 650; }
.due-label.danger { color: var(--danger); }
.payment-card > strong { overflow: hidden; padding-right: 5px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.card-legal { color: var(--muted); font-size: 9px; }
.payment-card-bottom { margin-top: 5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; }
.payment-card-bottom b { color: var(--text); font-size: 11px; }
.card-edit { position: absolute; inset: 0; width: 100%; opacity: 0; }
.kanban-empty { margin: 0; padding: 24px 10px; color: var(--muted-2); font-size: 10px; text-align: center; }

.status-badge { width: fit-content; padding: 5px 8px; display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; color: #57716b; background: var(--primary-soft); font-size: 8px; font-weight: 780; white-space: nowrap; }
.status-badge::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.status-badge.paid { color: #29776c; background: #e5f3ef; }
.status-badge.cancelled { color: #7a8581; background: #edf0ef; }
.status-badge.sent { color: #9b6319; background: var(--warning-soft); }
.status-badge.planned { color: #4c6c9f; background: var(--blue-soft); }
.status-badge.overdue { color: var(--danger); background: var(--danger-soft); }

.table-card { overflow: hidden; border-top: 1px solid var(--line); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 12px 15px; color: var(--muted-2); background: #fafcfb; border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 760; letter-spacing: .035em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 15px; color: #55625f; border-bottom: 1px solid #edf1ef; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdfc; }
td strong { color: var(--text); font-size: 11px; }
.align-right { text-align: right; }
.table-action, .receipt-link { padding: 0; color: var(--primary); background: transparent; border: 0; font-size: 9px; font-weight: 760; text-decoration: none; }
.table-action:hover, .receipt-link:hover { text-decoration: underline; }
.table-note { margin-top: 3px; display: block; color: var(--muted-2); font-size: 9px; }
.empty-cell { padding: 35px 20px; color: var(--muted-2); text-align: center; }
.mobile-card-list { display: none; }

.view-toolbar { margin-bottom: 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.view-toolbar h2 { margin-bottom: 6px; font-size: 25px; }
.filter-bar { margin-bottom: 10px; padding: 13px; display: grid; grid-template-columns: minmax(220px, 1fr) 200px 200px; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
.filter-bar input, .filter-bar select { height: 39px; padding: 0 11px; font-size: 11px; }
.search-field { position: relative; }
.search-field svg { width: 16px; position: absolute; left: 12px; top: 11px; color: var(--muted-2); }
.search-field input { padding-left: 38px; }
.results-line { min-height: 30px; padding: 0 3px; display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--muted-2); font-size: 9px; }
#paymentsView .table-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; }

.services-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.service-card { min-width: 0; padding: 18px; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 4px 15px rgba(36,64,57,.035); transition: transform .16s, box-shadow .16s, border-color .16s; }
.service-card:hover { transform: translateY(-2px); border-color: #cbdad6; box-shadow: var(--shadow); }
.service-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.service-card-main { min-width: 0; display: flex; align-items: center; gap: 11px; }
.service-logo { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #3b8f83, #247c70); border-radius: 11px; font-size: 10px; font-weight: 850; letter-spacing: -.02em; }
.service-card-main > div { min-width: 0; }
.service-card h3 { overflow: hidden; margin-bottom: 3px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.service-card p { margin-bottom: 0; color: var(--muted); font-size: 9px; }
.service-card-stats { margin: 18px 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.service-card-stats div { min-width: 0; padding: 10px; background: var(--surface-soft); border-radius: 10px; }
.service-card-stats span, .service-card-footer > span:first-child { display: block; color: var(--muted); font-size: 8px; }
.service-card-stats strong { display: block; margin-top: 4px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.service-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.service-card-edit { position: absolute; inset: 0; z-index: 1; border: 0; background: transparent; font-size: 0; }
.service-card .status-badge { position: relative; z-index: 2; }

.users-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.user-card { padding: 17px; display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 15px; }
.user-card-avatar { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; color: var(--primary-dark); background: var(--primary-soft); border-radius: 50%; font-size: 11px; font-weight: 800; }
.user-card-info { min-width: 0; display: grid; gap: 3px; }
.user-card-info strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-card-info span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.user-card .status-badge { margin-left: auto; }

.analytics-metrics { margin-bottom: 14px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.analytic-card { padding: 19px; display: grid; gap: 7px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.analytic-card span { color: var(--muted); font-size: 10px; }
.analytic-card strong { font-size: 22px; letter-spacing: -.04em; }
.analytic-card small { color: var(--muted-2); font-size: 8px; }
.analytics-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.analytics-panel { margin-top: 0; min-height: 320px; }
.category-bars, .status-breakdown { padding: 8px 22px 22px; display: grid; gap: 14px; }
.category-row { display: grid; grid-template-columns: minmax(90px, .8fr) 2fr auto; align-items: center; gap: 12px; font-size: 10px; }
.category-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-track { height: 7px; overflow: hidden; background: #edf1ef; border-radius: 999px; }
.category-track i { display: block; height: 100%; background: linear-gradient(90deg, #2d8478, #73b4aa); border-radius: inherit; }
.category-row b { font-size: 9px; }
.status-item { padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.status-item:last-child { border-bottom: 0; }
.status-item > div { display: flex; align-items: center; gap: 9px; }
.status-dot { width: 8px; height: 8px; background: var(--blue); border-radius: 50%; }
.status-dot.paid { background: var(--primary); }
.status-dot.sent { background: var(--warning); }
.status-dot.cancelled { background: var(--muted-2); }
.status-item span { color: var(--muted); font-size: 10px; }
.status-item strong { font-size: 11px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(19,31,28,.42); backdrop-filter: blur(4px); }
.modal { width: min(720px, calc(100vw - 30px)); max-height: calc(100vh - 34px); overflow: auto; position: fixed; z-index: 90; left: 50%; top: 50%; transform: translate(-50%, -47%) scale(.985); opacity: 0; visibility: hidden; background: #fff; border: 1px solid rgba(255,255,255,.8); border-radius: 20px; box-shadow: var(--shadow-lg); transition: opacity .18s, transform .18s, visibility .18s; }
.modal.open { transform: translate(-50%, -50%) scale(1); opacity: 1; visibility: visible; }
.modal.small { width: min(480px, calc(100vw - 30px)); }
.modal-head { padding: 21px 23px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 19px; }
.modal-head span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.close-button { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.close-button svg { width: 17px; }
.close-button:hover { color: var(--danger); }
.modal form { padding: 19px 23px 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.form-grid.single { grid-template-columns: 1fr; }
.form-grid label { min-width: 0; display: grid; gap: 6px; color: #53615d; font-size: 10px; font-weight: 680; }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select { height: 40px; padding: 0 11px; font-size: 11px; font-weight: 450; }
.form-grid textarea { min-height: 82px; padding: 11px; resize: vertical; font-size: 11px; font-weight: 450; }
.file-field input { height: auto; padding: 9px; }
.form-note { margin: 14px 0 0; padding: 10px 12px; color: var(--muted); background: var(--surface-soft); border-radius: 9px; font-size: 9px; line-height: 1.5; }
.form-state { min-height: 16px; margin: 12px 0 0; color: var(--primary); font-size: 10px; }
.form-state.error { color: var(--danger); }
.modal-actions { margin-top: 17px; display: flex; justify-content: flex-end; gap: 9px; }
.settings-list { display: grid; gap: 8px; }
.settings-list > label { min-height: 48px; padding: 0 13px; display: flex; align-items: center; gap: 10px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; color: #4b5955; font-size: 11px; }
.settings-list input { width: 16px; height: 16px; accent-color: var(--primary); }
.settings-list .modal-actions { margin-top: 9px; }

.toast { max-width: min(420px, calc(100vw - 30px)); padding: 12px 16px; position: fixed; z-index: 120; left: 50%; bottom: 22px; transform: translate(-50%, 15px); opacity: 0; visibility: hidden; color: #fff; background: #21332f; border-radius: 11px; box-shadow: var(--shadow-lg); font-size: 11px; font-weight: 650; text-align: center; transition: .2s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.error { background: #8e3238; }
.mobile-bottom-nav { display: none; }

@media (max-width: 1180px) {
  :root { --sidebar: 210px; }
  .sidebar { padding-inline: 13px; }
  .brand { padding-left: 7px; }
  .topbar { padding-inline: 27px; }
  .content { padding-inline: 27px; }
  .sync-state { display: none; }
  .services-grid, .users-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 880px) {
  :root { --sidebar: 0px; }
  body { padding-bottom: 70px; }
  .sidebar { display: none; }
  .workspace { margin-left: 0; }
  .topbar { height: 72px; padding: 0 17px; }
  .title-block .eyebrow { display: none; }
  h1 { font-size: 20px; }
  .desktop-action, .topbar select { display: none; }
  .topbar .button.primary { min-width: 39px; width: 39px; height: 39px; padding: 0; border-radius: 11px; }
  .topbar .button.primary span { display: none; }
  .content { padding: 22px 15px 30px; }
  .dashboard-intro { align-items: center; }
  .dashboard-intro h2 { font-size: 21px; }
  .dashboard-intro p { font-size: 11px; }
  .refresh-button span { display: none; }
  .refresh-button { width: 38px; padding: 0; justify-content: center; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metric-card:last-child { grid-column: 1 / -1; min-height: 126px; }
  .metric-card:last-child .metric-icon { margin-bottom: 12px; }
  .kanban-grid { overflow-x: auto; grid-template-columns: repeat(3, minmax(250px, 78vw)); scroll-snap-type: x mandatory; }
  .kanban-column { scroll-snap-align: start; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .analytics-grid { grid-template-columns: 1fr; }
  .mobile-bottom-nav { height: 65px; padding: 6px 8px calc(5px + env(safe-area-inset-bottom)); position: fixed; inset: auto 0 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(255,255,255,.95); border-top: 1px solid var(--line); backdrop-filter: blur(15px); }
  .mobile-nav-item { min-width: 0; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted-2); border-radius: 9px; font-size: 8px; font-weight: 680; }
  .mobile-nav-item svg { width: 20px; height: 20px; }
  .mobile-nav-item.active { color: var(--primary); background: var(--primary-soft); }
  .toast { bottom: 80px; }
}

@media (max-width: 650px) {
  .dashboard-intro p { max-width: 260px; }
  .metric-grid { gap: 9px; }
  .metric-card { min-height: 143px; padding: 16px; border-radius: 15px; }
  .metric-icon { margin-bottom: 16px; }
  .metric-card > strong { font-size: 27px; }
  .metric-card small { white-space: normal; }
  .progress-card { padding: 16px; border-radius: 15px; }
  .progress-main { align-items: flex-start; }
  .progress-main > div:first-child { display: grid; gap: 4px; }
  .progress-amounts { display: grid; gap: 4px; text-align: right; }
  .section-block { border-radius: 15px; }
  .section-heading { padding: 18px 16px 13px; align-items: flex-start; }
  .section-heading h2 { font-size: 17px; }
  .section-heading > div > span { font-size: 10px; }
  .section-heading .text-button { display: none; }
  .kanban-grid { padding: 0 10px 12px; }
  .desktop-table { display: none; }
  .mobile-card-list { display: grid; gap: 9px; }
  #dashboardView .mobile-card-list { padding: 0 10px 12px; }
  .payment-mobile-card { padding: 14px; display: grid; gap: 13px; background: #fff; border: 1px solid var(--line); border-radius: 13px; position: relative; }
  .payment-mobile-top { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .payment-mobile-service { min-width: 0; display: flex; align-items: center; gap: 10px; }
  .payment-mobile-service > div:last-child { min-width: 0; }
  .payment-mobile-service strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .payment-mobile-service small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
  .payment-mobile-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
  .payment-mobile-meta div { min-width: 0; display: grid; gap: 3px; }
  .payment-mobile-meta span { color: var(--muted-2); font-size: 8px; }
  .payment-mobile-meta strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .payment-mobile-actions { display: flex; align-items: center; justify-content: space-between; }
  .payment-mobile-actions .receipt-link { font-size: 9px; }
  .payment-mobile-edit { padding: 7px 10px; color: var(--primary); background: var(--primary-soft); border: 0; border-radius: 8px; font-size: 9px; font-weight: 750; }
  .view-toolbar { align-items: flex-start; }
  .view-toolbar h2 { font-size: 22px; }
  .view-toolbar p { font-size: 11px; }
  .view-toolbar .button { min-width: 39px; width: 39px; padding: 0; font-size: 0; }
  .view-toolbar .button svg { margin: 0; }
  .filter-bar { padding: 10px; grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .filter-bar input, .filter-bar select { height: 41px; }
  .results-line { margin-bottom: 7px; }
  .results-line span:last-child { display: none; }
  .services-grid, .users-grid, .analytics-metrics { grid-template-columns: 1fr; }
  .service-card { padding: 15px; }
  .analytic-card { padding: 16px; }
  .analytics-panel { min-height: 0; }
  .category-row { grid-template-columns: minmax(72px,.8fr) 1.4fr auto; gap: 8px; }
  .modal { width: 100%; max-height: calc(100vh - 10px); top: auto; bottom: 0; left: 0; transform: translateY(20px); border-radius: 20px 20px 0 0; }
  .modal.open { transform: translateY(0); }
  .modal.small { width: 100%; }
  .modal-head { padding: 18px 17px 14px; }
  .modal form { padding: 16px 17px calc(18px + env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.wide { grid-column: auto; }
  .modal-actions { position: sticky; bottom: 0; padding-top: 11px; background: #fff; }
  .modal-actions .button { flex: 1; }
}

@media (max-width: 390px) {
  .topbar { padding-inline: 13px; }
  .content { padding-inline: 11px; }
  .dashboard-intro p { display: none; }
  .metric-card { padding: 14px; }
  .metric-card > strong { font-size: 24px; }
  .metric-label { font-size: 10px; }
  .progress-amounts { font-size: 8px; }
}

.empty-card { grid-column: 1 / -1; margin: 0; padding: 34px 18px; color: var(--muted-2); background: #fff; border: 1px dashed var(--line-strong); border-radius: 14px; font-size: 10px; text-align: center; }
.service-card .status-badge { pointer-events: none; }

/* Authentication and role-based interface */
[hidden] { display: none !important; }

.login-screen {
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  place-items: center;
  padding: clamp(20px, 4vw, 56px);
  color: #10241f;
  background: #0e2d27;
}
.login-background { position: absolute; inset: 0; z-index: -2; overflow: hidden; background: linear-gradient(135deg, #0d2a25 0%, #16483e 44%, #0f332c 100%); }
.login-background::before {
  content: "";
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(circle at 18% 32%, rgba(114, 220, 188, .22), transparent 21%),
    radial-gradient(circle at 78% 24%, rgba(90, 165, 237, .17), transparent 23%),
    radial-gradient(circle at 65% 78%, rgba(242, 197, 106, .11), transparent 20%);
  animation: loginAurora 18s ease-in-out infinite alternate;
}
.login-grid {
  position: absolute;
  inset: -20%;
  opacity: .16;
  background-image:
    linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 54px 54px;
  transform: perspective(700px) rotateX(58deg) translateY(26%);
  transform-origin: center bottom;
  mask-image: linear-gradient(to bottom, transparent 2%, #000 54%, transparent 96%);
  animation: loginGridDrift 24s linear infinite;
}
.login-glow {
  position: absolute;
  width: 74vw;
  height: 74vw;
  max-width: 1000px;
  max-height: 1000px;
  left: 8%;
  top: 4%;
  border: 1px solid rgba(154, 237, 210, .16);
  border-radius: 50%;
  box-shadow: 0 0 0 90px rgba(123, 222, 190, .025), 0 0 0 180px rgba(123, 222, 190, .018);
  animation: loginGlowPulse 10s ease-in-out infinite;
}
.login-orb { position: absolute; display: block; border-radius: 50%; filter: blur(2px); mix-blend-mode: screen; will-change: transform; }
.login-orb-one { width: 420px; height: 420px; left: -120px; top: -100px; background: radial-gradient(circle at 35% 35%, rgba(126,239,201,.42), rgba(42,126,106,.04) 67%, transparent 71%); animation: loginFloatOne 15s ease-in-out infinite; }
.login-orb-two { width: 360px; height: 360px; right: -90px; top: 12%; background: radial-gradient(circle at 40% 42%, rgba(93,175,239,.30), rgba(45,92,127,.03) 66%, transparent 72%); animation: loginFloatTwo 19s ease-in-out infinite; }
.login-orb-three { width: 300px; height: 300px; left: 42%; bottom: -160px; background: radial-gradient(circle at 50% 42%, rgba(239,196,107,.20), rgba(113,85,34,.03) 68%, transparent 74%); animation: loginFloatThree 17s ease-in-out infinite; }

.login-layout { width: min(1180px, 100%); min-height: min(720px, calc(100svh - 80px)); display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(380px, .78fr); align-items: stretch; border: 1px solid rgba(255,255,255,.14); border-radius: 34px; background: rgba(8, 32, 27, .28); box-shadow: 0 36px 110px rgba(1, 13, 10, .36); backdrop-filter: blur(20px); overflow: hidden; }
.login-showcase { min-width: 0; padding: clamp(42px, 6vw, 78px); position: relative; display: flex; flex-direction: column; color: #fff; }
.login-showcase::after { content: ""; position: absolute; width: 180px; height: 180px; right: 9%; bottom: 11%; border: 1px solid rgba(255,255,255,.10); border-radius: 42% 58% 65% 35% / 45% 42% 58% 55%; animation: loginMorph 12s ease-in-out infinite alternate; }
.login-showcase-brand, .login-mobile-brand { display: flex; align-items: center; gap: 12px; }
.login-showcase-brand > div, .login-mobile-brand > div { display: flex; align-items: baseline; gap: 4px; font-size: 20px; letter-spacing: -.035em; }
.login-showcase-brand strong, .login-mobile-brand strong { font-weight: 790; }
.login-showcase-brand > div span { color: rgba(255,255,255,.62); }
.login-brand-mark { color: #0f392f; background: linear-gradient(145deg, #9fe8ce, #62c5a6); box-shadow: 0 12px 35px rgba(76, 205, 164, .22); }
.login-showcase-copy { max-width: 650px; margin: auto 0; padding: 54px 0 44px; position: relative; z-index: 1; }
.login-kicker { margin: 0 0 22px; display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.68); font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.login-kicker span { width: 28px; height: 1px; display: block; background: #83dcbf; box-shadow: 0 0 16px rgba(131,220,191,.7); }
.login-showcase-copy h1 { margin: 0 0 22px; color: #fff; font-size: clamp(43px, 5vw, 68px); line-height: .98; letter-spacing: -.065em; }
.login-showcase-copy h1 em { color: #99e2ca; font-style: normal; font-weight: 760; }
.login-showcase-copy > p:last-child { max-width: 560px; margin: 0; color: rgba(255,255,255,.68); font-size: clamp(15px, 1.4vw, 18px); line-height: 1.72; }
.login-benefits { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.login-benefits article { min-width: 0; padding: 14px; display: flex; align-items: center; gap: 11px; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; background: rgba(255,255,255,.055); }
.login-benefit-icon { width: 35px; height: 35px; flex: 0 0 auto; display: grid; place-items: center; color: #9be3ca; background: rgba(127,220,190,.12); border-radius: 10px; }
.login-benefit-icon svg { width: 19px; }
.login-benefits article div { min-width: 0; display: grid; gap: 3px; }
.login-benefits strong { overflow: hidden; color: rgba(255,255,255,.92); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.login-benefits small { overflow: hidden; color: rgba(255,255,255,.46); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.login-card-wrap { padding: clamp(18px, 2.8vw, 34px); display: flex; flex-direction: column; justify-content: center; background: rgba(247, 251, 249, .94); }
.login-card { width: min(450px, 100%); margin: auto; padding: clamp(26px, 4vw, 44px); border: 1px solid rgba(26,84,68,.10); border-radius: 27px; background: rgba(255,255,255,.83); box-shadow: 0 26px 70px rgba(21,57,48,.13); backdrop-filter: blur(18px); }
.login-mobile-brand { display: none; margin-bottom: 34px; }
.login-mobile-brand > div span { color: #71817b; }
.login-copy .eyebrow { margin-bottom: 10px; }
.login-copy h2 { margin: 0 0 11px; color: #13251f; font-size: clamp(29px, 4vw, 38px); line-height: 1.08; letter-spacing: -.05em; }
.login-copy > p:last-child { margin: 0; color: #73817c; font-size: 13px; line-height: 1.62; }
.login-form { display: grid; gap: 18px; margin-top: 30px; }
.login-field { display: grid; gap: 9px; color: #253b34; font-size: 12px; font-weight: 720; }
.login-input-wrap { min-height: 54px; padding: 0 13px; display: flex; align-items: center; gap: 10px; border: 1px solid #d9e5e0; border-radius: 14px; background: rgba(249,252,251,.95); transition: border-color .18s, box-shadow .18s, background .18s; }
.login-input-wrap:focus-within { border-color: #63a997; background: #fff; box-shadow: 0 0 0 4px rgba(36,124,112,.10); }
.login-input-wrap > svg { width: 19px; height: 19px; flex: 0 0 auto; color: #8b9b95; }
.login-input-wrap input { min-width: 0; height: 52px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 14px; }
.login-input-wrap input:focus { border: 0; box-shadow: none; }
.login-input-wrap input::placeholder { color: #a7b2ae; }
.password-toggle { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; color: #83938d; border: 0; border-radius: 9px; background: transparent; }
.password-toggle:hover { color: var(--primary); background: var(--primary-soft); }
.password-toggle svg { width: 19px; height: 19px; grid-area: 1 / 1; }
.password-toggle .eye-closed { display: none; }
.password-toggle[aria-pressed="true"] .eye-open { display: none; }
.password-toggle[aria-pressed="true"] .eye-closed { display: block; }
.login-submit { width: 100%; min-height: 54px; margin-top: 2px; justify-content: center; border-radius: 14px; background: linear-gradient(135deg, #247c70, #19675d); box-shadow: 0 13px 28px rgba(32,119,103,.22); }
.login-submit svg { transition: transform .18s ease; }
.login-submit:hover svg { transform: translateX(3px); }
.login-submit:disabled { cursor: wait; opacity: .72; transform: none; }
.login-submit.is-loading svg { animation: loginArrowPulse .8s ease-in-out infinite alternate; }
.login-form .form-state { min-height: 0; margin: -3px 0 -4px; color: #697a74; font-size: 11px; line-height: 1.45; }
.login-form .form-state:empty { display: none; }
.login-form .form-state.error { padding: 10px 12px; color: #a53e45; background: #fff0f1; border: 1px solid #f5d8db; border-radius: 11px; }
.login-security-note { margin-top: 25px; padding-top: 20px; display: flex; align-items: center; gap: 9px; color: #82908b; border-top: 1px solid #e7eeeb; font-size: 10px; line-height: 1.45; }
.login-security-note svg { width: 18px; height: 18px; flex: 0 0 auto; color: #4b9b83; }
.login-footer { margin: 18px 0 0; color: #82928c; font-size: 10px; text-align: center; }

@keyframes loginAurora { 0% { transform: translate3d(-2%, -1%, 0) rotate(-2deg) scale(1); } 100% { transform: translate3d(4%, 3%, 0) rotate(4deg) scale(1.08); } }
@keyframes loginGridDrift { to { background-position: 54px 54px, 54px 54px; } }
@keyframes loginGlowPulse { 0%,100% { transform: scale(.92); opacity: .55; } 50% { transform: scale(1.05); opacity: .9; } }
@keyframes loginFloatOne { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(55px,48px,0) scale(1.08); } }
@keyframes loginFloatTwo { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(-62px,34px,0) scale(.92); } }
@keyframes loginFloatThree { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(38px,-54px,0); } }
@keyframes loginMorph { 0% { transform: rotate(0deg) scale(.96); border-radius: 42% 58% 65% 35% / 45% 42% 58% 55%; } 100% { transform: rotate(22deg) scale(1.08); border-radius: 65% 35% 42% 58% / 55% 58% 42% 45%; } }
@keyframes loginArrowPulse { to { transform: translateX(5px); } }

@media (max-width: 980px) {
  .login-layout { width: min(520px, 100%); min-height: auto; grid-template-columns: 1fr; }
  .login-showcase { display: none; }
  .login-card-wrap { min-height: min(680px, calc(100svh - 40px)); padding: 24px; }
  .login-mobile-brand { display: flex; }
}
@media (max-width: 560px) {
  .login-screen { padding: 0; place-items: stretch; background: #f4f8f6; }
  .login-layout { width: 100%; min-height: 100svh; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .login-card-wrap { min-height: 100svh; padding: max(24px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); background: rgba(246,250,248,.90); }
  .login-card { padding: 28px 21px; border-radius: 23px; box-shadow: 0 20px 55px rgba(21,57,48,.12); }
  .login-mobile-brand { margin-bottom: 42px; }
  .login-copy h2 { font-size: 31px; }
  .login-orb-one { width: 300px; height: 300px; }
  .login-orb-two { width: 280px; height: 280px; }
  .login-grid { opacity: .08; }
}
@media (prefers-reduced-motion: reduce) {
  .login-background::before, .login-grid, .login-glow, .login-orb, .login-showcase::after, .login-submit.is-loading svg { animation: none !important; }
}

.role-chip { display: inline-flex; align-items: center; min-height: 38px; padding: 0 13px; border-radius: 999px; background: #e9f3ee; color: #276f53; font-size: 13px; font-weight: 750; white-space: nowrap; }
.logout-button { min-height: 38px; }
.user-card { position: relative; }
.user-card-info .user-meta-line { color: #6d7d75; font-size: 12px; }
.user-card-actions { display: flex; gap: 8px; margin-left: auto; }
.user-card-action { border: 0; border-radius: 9px; padding: 8px 10px; background: #eef4f1; color: #315c49; cursor: pointer; font-weight: 700; }
.user-card-action.danger { background: #fff0ed; color: #a74435; }
.readonly-banner { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: #eef4f1; color: #436456; font-size: 13px; }
.modal form.is-readonly input, .modal form.is-readonly select, .modal form.is-readonly textarea { pointer-events: none; background: #f4f7f5; color: #5d6b65; }
.modal form.is-readonly .file-field, .modal form.is-readonly .modal-actions button[type="submit"] { display: none; }
@media (max-width: 760px) {
  .login-card { padding: 26px 20px; border-radius: 22px; }
  .role-chip { max-width: 118px; overflow: hidden; text-overflow: ellipsis; }
  .logout-button { padding-inline: 11px; }
  .user-card-actions { width: 100%; margin: 12px 0 0; }
  .user-card-action { flex: 1; }
}
@media (max-width: 760px) {
  .mobile-bottom-nav { grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); }
}
.password-warning { color: #a55b21 !important; font-weight: 700; }
@media (max-width: 760px) {
  .mobile-bottom-nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; }
}
