:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #101b4b;
  background: #f7f8fc;
  font-synthesis: none;
  --blue: #0872f9;
  --blue-dark: #075bd0;
  --text: #101b4b;
  --muted: #62749f;
  --line: #e2e8f5;
  --surface: #fff;
  --soft: #f0f4fc;
  --sidebar: #17191e;
  --shadow: 0 1px 5px rgba(27, 55, 112, .06);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f7f8fc; color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.login-screen { position: relative; display: grid; min-height: 100vh; place-items: center; padding: 28px 16px; background: linear-gradient(rgba(15, 25, 45, .28), rgba(15, 25, 45, .36)), url("fotos/background.png") center / cover no-repeat; }
.login-card { width: min(100%, 440px); padding: 38px 40px 28px; border: 1px solid #e6ebf4; border-radius: 20px; background: #fff; box-shadow: 0 20px 70px rgba(27, 45, 80, .12); }
.login-brand { height: auto; align-items: center; justify-content: center; margin: 0 auto 29px; padding: 0; color: var(--text); }
.login-brand .brand-cart { width: 65px; height: 65px; flex-basis: 65px; }
.login-brand .brand-name { padding-top: 0; }
.login-card h1 { margin: 0 0 7px; font-size: 27px; text-align: center; }
.login-subtitle { margin: 0 0 27px; color: var(--muted); line-height: 1.5; text-align: center; }
.login-form { display: grid; gap: 18px; }
.login-field { display: grid; gap: 8px; color: var(--text); font-weight: 600; }
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-wrap > svg { position: absolute; left: 14px; width: 21px; height: 21px; fill: none; stroke: #7181a7; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.login-input-wrap input { width: 100%; height: 49px; padding: 0 48px; outline: none; border: 1px solid #dce3f0; border-radius: 11px; color: var(--text); background: #fff; }
.login-input-wrap input:focus { border-color: #70aaff; box-shadow: 0 0 0 3px rgba(8, 114, 249, .1); }
.password-toggle { position: absolute; right: 8px; display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 8px; color: #7181a7; background: transparent; }
.password-toggle:hover { color: var(--blue); background: #f0f5ff; }
.password-toggle svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-submit { width: 100%; min-height: 49px; margin-top: 4px; font-size: 15px; }
.login-message { min-height: 0; margin: -8px 0 0; color: #d53939; text-align: center; }
.login-message:empty { display: none; }
.login-note { margin: 22px 0 0; color: #8793a8; font-size: 12px; text-align: center; }
.pwa-install { margin-top: 21px; padding: 16px; border: 1px solid #e2e8f5; border-radius: 14px; background: linear-gradient(135deg, #f8faff, #f0f5ff); }
.pwa-install[hidden] { display: none; }
.pwa-install-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pwa-install-icon { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 12px; color: var(--blue); background: #e4efff; }
.pwa-install-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pwa-install-heading h2 { margin: 0 0 3px; font-size: 14px; }
.pwa-install-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.pwa-install-button { display: flex; width: 100%; min-height: 43px; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 10px; color: #fff; background: var(--blue); font-weight: 700; }
.pwa-install-button:hover { background: var(--blue-dark); }
.pwa-install-button:disabled { cursor: not-allowed; opacity: .6; }
.pwa-install-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pwa-install-message { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.setup-link { color: var(--blue-dark); text-decoration: none; }
.setup-link:hover { text-decoration: underline; }
.sidebar { position: fixed; z-index: 4; inset: 0 auto 0 0; width: 270px; display: flex; flex-direction: column; padding: 18px 11px 35px; color: #f7f8fb; background: linear-gradient(145deg, #191b20, #101116); transition: width .22s ease, transform .22s ease; }
.sidebar-backdrop { display: none; }
.brand { height: 83px; display: flex; align-items: flex-start; gap: 8px; padding: 1px 11px; color: #fff; text-decoration: none; }
.brand-cart { width: 59px; height: 59px; flex: 0 0 59px; fill: none; stroke: #ff6a0a; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { padding-top: 7px; font-size: 24px; line-height: .96; font-weight: 800; letter-spacing: -.8px; }
.brand-name strong { color: #ff6a0a; font-size: 23px; }
.main-nav, .secondary-nav { display: grid; gap: 3px; }
.nav-link { display: flex; align-items: center; gap: 15px; min-height: 56px; padding: 0 15px; border: 0; border-radius: 12px; color: #f0f2f7; background: transparent; text-align: left; font-size: 15px; font-weight: 500; }
.nav-link:hover, .nav-link.active { background: linear-gradient(110deg, #303846, #252b35); }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; color: #0780ff; }
.nav-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.secondary-nav { margin-top: auto; margin-bottom: 125px; }
.system-status { display: flex; align-items: center; gap: 15px; min-height: 87px; margin: 0 8px; padding: 15px 19px; border: 1px solid #333845; border-radius: 13px; font-size: 14px; line-height: 1.7; }
.system-status small { font-size: 13px; }
.status-check { display: grid; place-items: center; width: 33px; height: 33px; border: 3px solid #04ca82; border-radius: 50%; color: #04ca82; font-size: 21px; font-weight: 700; }
.app-shell { min-height: 100vh; margin-left: 270px; transition: margin-left .22s ease; }
.topbar { height: 65px; display: flex; align-items: center; justify-content: space-between; padding: 0 27px; background: #1b1d22; color: #f8f9fc; border-bottom: 1px solid #333740; }
.icon-button, .avatar-button { border: 0; color: #f4f6fb; background: transparent; }
.icon-button { min-width: 38px; height: 42px; font-size: 26px; }
.menu-button { font-size: 23px; }
.top-actions { display: flex; align-items: center; gap: 19px; }
.logout-form { margin: 0; }
.logout-button { min-height: 36px; padding: 0 13px; border: 1px solid #555b66; border-radius: 9px; color: #f4f6fb; background: transparent; font-weight: 600; }
.logout-button:hover { background: #30343c; }
.avatar-button { display: grid; width: 41px; height: 41px; place-items: center; border: 3px solid #c9dfff; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #8ec2ff, #4e8fe2); }
.avatar-button svg { width: 23px; height: 23px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.avatar-button img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.main-content { max-width: 1700px; margin: 0 auto; padding: 22px 19px 36px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; min-height: 79px; padding: 0 8px 18px 22px; border-bottom: 1px solid #e8ebf3; }
.page-heading > div { padding-left: 18px; border-left: 6px solid var(--blue); border-radius: 4px; }
h1 { margin: 0 0 6px; font-size: 27px; line-height: 1.2; letter-spacing: -.8px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 16px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 11px; min-height: 45px; padding: 0 19px; border: 0; border-radius: 12px; font-weight: 600; transition: background .15s, transform .15s; }
.primary-button { color: white; background: var(--blue); box-shadow: 0 5px 12px rgba(0, 100, 255, .18); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.save-button { min-width: 185px; min-height: 55px; font-size: 15px; }
.save-icon { display: block; width: 40px; height: 36px; border-radius: 50%; object-fit: cover; background: #fff; }
.customer-row { display: grid; grid-template-columns: auto minmax(280px, 445px) minmax(280px, 1fr); align-items: center; gap: 20px; padding: 18px 14px 22px; }
.customer-row > label { font-size: 17px; font-weight: 700; }
.customer-select-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.new-client-from-account { min-height: 45px; padding: 0 12px; white-space: nowrap; }
.select-wrap { position: relative; display: flex; align-items: center; }
.select-wrap select { width: 100%; height: 62px; padding: 0 42px 0 68px; appearance: none; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--surface); font-size: 15px; font-weight: 600; box-shadow: var(--shadow); }
.select-wrap:after { position: absolute; right: 18px; content: "⌄"; font-size: 21px; pointer-events: none; }
.person-icon { position: absolute; z-index: 1; left: 13px; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--blue); background: #e9f2ff; font-size: 24px; }
.account-alert { display: flex; align-items: center; gap: 15px; min-height: 62px; padding: 10px 18px; border: 1px solid #cfe0ff; border-radius: 13px; color: var(--blue); background: #eff5ff; }
.account-alert strong, .account-alert small { display: block; }
.account-alert strong { margin-bottom: 3px; font-size: 14px; }
.account-alert small { color: #5b6f9c; font-size: 12px; }
.info-dot { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: white; background: var(--blue); font-family: Georgia, serif; font-size: 18px; font-weight: 700; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 14px; }
.card { border: 1px solid #e9edf6; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.product-card { padding: 17px 19px 15px; }
.card h2 { display: flex; align-items: center; gap: 13px; margin: 0; font-size: 19px; letter-spacing: -.5px; }
.section-icon { color: var(--blue); font-size: 24px; }
.product-form { display: grid; grid-template-columns: minmax(160px, 1.3fr) minmax(130px, .9fr) 139px; align-items: end; gap: 19px; margin: 12px 0 20px; }
.field { display: flex; flex-direction: column; gap: 7px; font-weight: 600; }
.input-with-icon { position: relative; display: block; }
.input-with-icon > span { position: absolute; top: 50%; left: 11px; display: grid; place-items: center; width: 25px; height: 25px; transform: translateY(-50%); border-radius: 50%; color: white; background: var(--blue); font-weight: 700; }
.field input, .field textarea, .select-wrap select, .search-field input { outline: none; }
.input-with-icon input { width: 100%; height: 42px; padding: 0 12px 0 48px; border: 1px solid #d6deef; border-radius: 10px; color: var(--text); background: var(--surface); box-shadow: inset 0 1px 2px rgba(20, 45, 99, .03); }
input::placeholder, textarea::placeholder { color: #7181a7; opacity: 1; }
.field input:focus, .field textarea:focus, .search-field:focus-within, .select-wrap select:focus { border-color: #70aaff; box-shadow: 0 0 0 3px rgba(8, 114, 249, .1); }
.add-button { height: 46px; }
.add-button span { font-size: 22px; font-weight: 400; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 10px 16px; text-align: left; }
thead th { color: var(--text); background: #f0f3fa; font-weight: 700; }
.items-table thead th:first-child, .clients-table thead th:first-child, .users-table thead th:first-child { border-radius: 9px 0 0 0; }
.items-table thead th:last-child, .clients-table thead th:last-child, .users-table thead th:last-child { border-radius: 0 9px 0 0; }
.items-table td, .clients-table td, .users-table td { border-bottom: 1px solid #e8edf5; font-size: 14px; font-weight: 500; }
.items-table th:nth-child(2), .items-table td:nth-child(2) { width: 23%; }
.items-table th:last-child, .items-table td:last-child { width: 90px; text-align: center; }
.delete-button { min-width: 38px; height: 33px; border: 0; border-radius: 10px; color: #f33434; background: #ffe0e0; font-size: 17px; }
.delete-button:hover { background: #ffcaca; }
.empty-state { margin: 0; padding: 13px; color: var(--muted); text-align: center; }
.running-total { display: flex; justify-content: flex-end; align-items: center; gap: 13px; margin: 14px 2px 6px; font-size: 15px; }
.running-total span { padding: 8px 15px; border-radius: 20px; color: var(--blue); background: #eaf2ff; font-size: 17px; font-weight: 700; }
.notes-field { margin-top: 6px; }
.notes-field textarea { width: 100%; min-height: 62px; padding: 11px 14px; resize: vertical; border: 1px solid #d6deef; border-radius: 10px; color: var(--text); background: var(--surface); font-weight: 400; }
.due-date-field { margin-top: 7px; }
.due-date-field input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #d6deef; border-radius: 10px; color: var(--text); background: var(--surface); }
.summary-card { padding: 21px 17px; }
.outline-icon { display: inline-flex; color: var(--blue); }
.outline-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.summary-card h2 { margin-bottom: 25px; }
.summary-item { display: flex; gap: 15px; margin: 0 0 16px; }
.summary-icon { display: inline-flex; width: 32px; flex: 0 0 32px; align-items: flex-start; justify-content: center; color: #0872df; }
.summary-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.summary-item div span, .summary-total div span { display: block; margin: 1px 0 4px; color: var(--muted); font-size: 15px; font-weight: 600; }
.summary-item strong { font-size: 15px; }
.summary-total { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 13px; border: 1px solid #c7dcff; border-radius: 12px; background: linear-gradient(110deg, #edf4ff, #f8faff); }
.money-bag { display: block; width: 58px; height: 58px; border-radius: 50%; object-fit: contain; background: #e2edff; }
.summary-total div span { color: var(--text); }
.summary-total strong { font-size: 27px; letter-spacing: -.8px; }
.clients-card { margin-top: 15px; padding: 13px 17px 8px; }
.users-card { padding: 13px 17px 8px; }
.clients-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.clients-title { display: flex; align-items: center; gap: 15px; }
.clients-title h2 { margin: 0 0 5px; font-size: 20px; }
.clients-title p { margin: 0; color: var(--muted); font-size: 13px; }
.people-icon { display: inline-flex; flex: 0 0 42px; align-items: center; justify-content: center; color: var(--blue); }
.people-icon svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.search-field { display: flex; align-items: center; gap: 8px; width: 228px; height: 42px; padding: 0 12px; border: 1px solid #d8e0ef; border-radius: 10px; color: #50638e; background: var(--surface); }
.search-field span { font-size: 25px; }
.search-field input { width: 100%; border: 0; color: var(--text); background: transparent; }
.client-tools { display: flex; align-items: center; gap: 10px; }
.new-client-button { min-height: 42px; padding: 0 13px; white-space: nowrap; }
.new-user-button { min-height: 42px; padding: 0 13px; white-space: nowrap; }
.clients-table th { padding-top: 9px; padding-bottom: 9px; white-space: nowrap; }
.clients-table td { padding-top: 8px; padding-bottom: 8px; white-space: nowrap; }
.clients-table th:last-child, .clients-table td:last-child { text-align: center; }
.client-access-search { display: flex; align-items: center; gap: 10px; margin: 18px 0; }
.client-access-search .search-field { flex: 1; width: auto; }
.client-access-form { max-width: 620px; margin: 22px auto 4px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.client-access-form h3 { margin: 0 0 5px; }
.client-access-form > div:first-of-type p, .client-access-help { margin: 0 0 16px; color: var(--muted); }
.client-access-form .field { display: grid; gap: 7px; margin: 12px 0; font-weight: 600; }
.client-access-form .field input { width: 100%; min-height: 43px; padding: 0 12px; border: 1px solid #d6deef; border-radius: 9px; color: var(--text); background: var(--surface); }
.users-table { min-width: 520px; }
.users-table th, .users-table td { padding-top: 10px; padding-bottom: 10px; }
.user-role-badge { display: inline-block; padding: 4px 10px; border-radius: 15px; color: #075bd0; background: #eaf2ff; font-size: 12px; font-weight: 700; }
.user-role-badge.admin { color: #8a4b00; background: #fff1d6; }
.row-actions { display: flex; justify-content: center; gap: 8px; }
.action-button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 18px; font-weight: 600; }
.edit-button { color: var(--blue); background: #dfebff; }
.remove-client-button { color: #ed3030; background: #ffe0e0; }
.action-button:hover { filter: brightness(.96); }
.hidden { display: none !important; }
.simple-panel { min-height: 300px; padding: 25px; }
.simple-panel h2 { margin-bottom: 12px; }
.simple-panel p { color: var(--muted); line-height: 1.7; }
.simple-panel .primary-button { margin-top: 8px; }
.dashboard-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0 13px; }
.dashboard-overview > div { display: grid; gap: 8px; min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.dashboard-overview span { color: var(--muted); font-size: 13px; font-weight: 600; }
.dashboard-overview strong { color: #397be2; font-size: 23px; }
.dashboard-overview .overdue-stat strong { color: #f36970; }
.dashboard-charts { display: grid; grid-template-columns: 1fr; overflow: hidden; margin: 0 0 12px; border-radius: 4px; background: #d7d7d7; }
.dashboard-chart-card { min-width: 0; min-height: 270px; padding: 14px 18px 18px; background: #d7d7d7; }
.dashboard-chart-card + .dashboard-chart-card { border-left: 1px solid #c8c8c8; }
.dashboard-chart-card h3 { margin: 0; color: #53647b; font-size: 14px; font-weight: 500; text-align: center; }
.chart-content { display: flex; min-height: 220px; align-items: center; justify-content: center; gap: clamp(16px, 3vw, 42px); }
.chart-pie { width: 150px; height: 150px; flex: 0 0 150px; border-radius: 50%; }
.chart-legend { display: grid; gap: 7px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.chart-legend li { display: grid; grid-template-columns: 10px minmax(0, auto) auto auto; align-items: center; gap: 6px; color: #52647a; font-size: 11px; }
.chart-legend-color { width: 9px; height: 9px; border-radius: 2px; }
.chart-legend strong { color: #334459; font-weight: 600; }
.chart-legend small { color: #718198; font-size: 10px; }
.overdue-customer-alert { margin: 0 0 14px; padding: 14px 18px; border: 1px solid #f2b8bb; border-left: 4px solid #f36970; border-radius: 4px; background: #fff1f1; }
.overdue-customer-alert h3 { margin: 0 0 10px; color: #b8323b; font-size: 14px; }
.overdue-customer-alert ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.overdue-customer-alert li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; color: #78343a; font-size: 13px; }
.overdue-customer-alert li span { color: #b8323b; font-weight: 600; }
.dark .dashboard-charts, .dark .dashboard-chart-card { background: #2b3548; }
.dark .dashboard-chart-card + .dashboard-chart-card { border-color: #3a465b; }
.dark .dashboard-chart-card h3, .dark .chart-legend li, .dark .chart-legend small { color: #b7c3d9; }
.dark .chart-legend strong { color: #e5ebfa; }
.dark .overdue-customer-alert { border-color: #7c4248; border-left-color: #f36970; background: #382a35; }
.dark .overdue-customer-alert h3, .dark .overdue-customer-alert li, .dark .overdue-customer-alert li span { color: #ffb5b9; }
.toast { position: fixed; z-index: 9; right: 24px; bottom: 24px; max-width: calc(100vw - 48px); padding: 13px 18px; transform: translateY(20px); border-radius: 10px; color: white; background: #182440; box-shadow: 0 8px 30px #15254c44; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.visible { transform: translateY(0); opacity: 1; }
dialog { width: min(440px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: var(--surface); box-shadow: 0 20px 70px #11182a55; }
dialog::backdrop { background: #10182b80; backdrop-filter: blur(2px); }
#profileDialog { width: min(500px, calc(100% - 32px)); max-height: min(90vh, 760px); overflow-y: auto; }
#userDialog { width: min(460px, calc(100% - 32px)); }
#accountHistoryDialog { width: min(720px, calc(100% - 32px)); max-height: min(90vh, 760px); overflow-y: auto; }
#accountEditorDialog { width: min(620px, calc(100% - 32px)); max-height: min(90vh, 800px); overflow-y: auto; }
#accountEditorForm .field { margin-bottom: 14px; }
#accountEditorForm .field > input, #accountEditorForm .field > textarea { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #d6deef; border-radius: 9px; color: var(--text); background: var(--surface); }
#accountEditorForm .field > textarea { resize: vertical; }
.account-product-entry { display: grid; grid-template-columns: minmax(0, 1fr) minmax(115px, .7fr) auto; align-items: end; gap: 10px; margin: 18px 0 14px; }
.account-product-entry .primary-button { min-height: 43px; padding: 0 14px; }
.account-editor-table { min-width: 420px; }
.account-editor-table th:last-child, .account-editor-table td:last-child { width: 75px; text-align: center; }
.account-history-card { margin-bottom: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.account-history-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.account-history-header h3 { margin: 0 0 5px; font-size: 16px; }
.account-history-header p { margin: 3px 0; color: var(--muted); font-size: 13px; }
.account-history-total { color: var(--blue-dark); font-size: 16px; font-weight: 700; white-space: nowrap; }
.account-history-items { display: grid; gap: 5px; margin: 12px 0; padding: 0; list-style: none; }
.account-history-items li { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.account-history-notes { margin: 10px 0; color: var(--muted); overflow-wrap: anywhere; }
.account-paid-status { margin: 12px 0 0; padding: 9px 11px; border-radius: 8px; color: #147247; background: #e8f7ef; font-size: 13px; font-weight: 600; }
.account-history-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.account-history-actions .action-button { min-height: 33px; }
.account-history-actions a.action-button { display: inline-flex; align-items: center; text-decoration: none; }
#settleAccountForm .field > select { width: 100%; min-height: 43px; padding: 0 12px; border: 1px solid #d6deef; border-radius: 9px; color: var(--text); background: var(--surface); }
#accountEditorDialog .running-total { margin-top: 10px; }
#accountEditorDialog .running-total span { font-size: 15px; }
#saveAccountChanges:disabled { cursor: wait; opacity: .7; }
#userForm .field { margin-bottom: 14px; }
#userForm .field > input, #userForm .field > select { width: 100%; min-height: 43px; padding: 0 12px; border: 1px solid #d6deef; border-radius: 9px; color: var(--text); background: var(--surface); }
.user-message { margin: 0; color: #d53939; text-align: center; }
.user-message:empty { display: none; }
.user-message:not(:empty) { margin-top: 12px; }
#saveUser:disabled { cursor: wait; opacity: .7; }
.client-portal-page { min-height: 100vh; background: #f7f8fc; }
.client-portal-header { display: flex; min-height: 82px; align-items: center; gap: 20px; padding: 8px max(20px, calc((100vw - 1100px) / 2)); color: #f8f9fc; background: #1b1d22; }
.client-portal-header .brand { height: auto; align-items: center; padding: 0; }
.client-portal-header .brand-cart { width: 48px; height: 48px; flex-basis: 48px; }
.client-portal-header .brand-name { font-size: 19px; }
.client-portal-header .brand-name strong { font-size: 18px; }
.client-portal-identity { display: grid; gap: 3px; margin-left: auto; text-align: right; }
.client-portal-identity span { color: #bbc3d1; font-size: 12px; }
.client-portal-identity strong { max-width: 36vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-portal-main { max-width: 1050px; margin: 0 auto; padding: 32px 20px 50px; }
.client-portal-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.client-portal-heading h1 { margin: 0 0 7px; color: var(--text); font-size: 27px; }
.client-portal-heading p { margin: 0; color: var(--muted); }
.client-cpf-badge { padding: 8px 12px; border-radius: 8px; color: #43516b; background: #e9eef7; font-size: 12px; }
.client-portal-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.client-portal-summary > div { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.client-portal-summary span { color: var(--muted); font-size: 13px; font-weight: 600; }
.client-portal-summary strong { color: var(--blue-dark); font-size: 21px; }
.client-portal-summary .portal-overdue { color: #d53939; }
.client-portal-message { color: var(--muted); }
.client-portal-accounts { display: grid; gap: 13px; }
.client-account-card { padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.client-account-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.client-account-card h2 { margin: 0 0 4px; font-size: 17px; }
.client-account-card > header p { margin: 0; color: var(--muted); font-size: 12px; }
.client-account-card > header > strong { color: var(--blue-dark); font-size: 17px; white-space: nowrap; }
.client-account-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 15px 0 10px; color: var(--muted); font-size: 13px; }
.client-account-meta > span:first-child strong { color: var(--text); }
.client-account-status { padding: 4px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.client-account-status.open { color: #255ea8; background: #e5efff; }
.client-account-status.overdue { color: #b8323b; background: #ffe7e8; }
.client-account-status.paid { color: #147247; background: #e8f7ef; }
.client-account-card ul { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.client-account-card li { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.client-account-card li strong { white-space: nowrap; }
.client-account-notes { margin: 12px 0 0; padding: 10px; border-radius: 7px; color: var(--muted); background: var(--soft); line-height: 1.5; overflow-wrap: anywhere; }
#profileForm .field { display: grid; gap: 7px; margin-bottom: 14px; font-weight: 600; }
#profileForm .field > input { width: 100%; }
.profile-optional { color: var(--muted); font-size: 12px; font-weight: 400; }
.profile-photo-field { display: grid; justify-items: center; gap: 8px; margin: 0 0 20px; }
.profile-photo-field > img, #profilePhotoPlaceholder { width: 82px; height: 82px; overflow: hidden; border: 3px solid #d5e5ff; border-radius: 50%; }
.profile-photo-field > img { object-fit: cover; }
#profilePreview[hidden], #profilePhotoPlaceholder[hidden] { display: none; }
#profilePhotoPlaceholder { display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #8ec2ff, #4e8fe2); }
#profilePhotoPlaceholder svg { width: 38px; height: 38px; fill: currentColor; }
#profileAvatar { max-width: 100%; font-size: 12px; }
.profile-photo-field small { color: var(--muted); }
.profile-message { margin: 0; color: #d53939; text-align: center; }
.profile-message:empty { display: none; }
.profile-message:not(:empty) { margin-top: 12px; }
#saveProfile:disabled { cursor: wait; opacity: .7; }
.dialog-heading { display: flex; justify-content: space-between; margin-bottom: 21px; }
.dialog-heading h2 { margin: 0 0 5px; font-size: 21px; }
.dialog-heading p { margin: 0; color: var(--muted); }
.dialog-close { width: 32px; height: 32px; border: 0; border-radius: 8px; color: var(--muted); background: var(--soft); font-size: 23px; }
#clientForm .field { margin-bottom: 15px; }
.field > input { min-height: 43px; padding: 0 12px; border: 1px solid #d6deef; border-radius: 9px; color: var(--text); background: var(--surface); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 23px; }
.secondary-button { border: 1px solid var(--line); color: var(--text); background: var(--surface); }
body.collapsed .sidebar { width: 78px; padding-right: 8px; padding-left: 8px; }
body.collapsed .app-shell { margin-left: 78px; }
body.collapsed .brand { justify-content: center; padding: 0; }
body.collapsed .brand-name, body.collapsed .nav-link span:not(.nav-icon), body.collapsed .system-status > span:not(.status-check) { display: none; }
body.collapsed .brand-cart { width: 42px; height: 42px; flex-basis: 42px; }
body.collapsed .nav-link { justify-content: center; padding: 0; }
body.collapsed .system-status { justify-content: center; margin: 0; padding: 10px 0; }
body.dark { --text: #e5ebfa; --muted: #a4b2d1; --line: #39445b; --surface: #202735; --soft: #2a3446; background: #151a24; color: var(--text); }
body.dark, body.dark .main-content { background: #151a24; }
body.dark .page-heading, body.dark .items-table td, body.dark .clients-table td, body.dark .users-table td { border-color: #30394c; }
body.dark thead th { background: #2b3548; }
body.dark .account-alert { border-color: #354e77; background: #202e44; }
body.dark .account-alert small { color: #a4b2d1; }
body.dark .account-paid-status { color: #91ddb3; background: #1d382b; }
body.dark .summary-total { border-color: #394e70; background: #263248; }
body.dark .running-total span { background: #263c5c; }
body.dark .person-icon { background: #2a3c59; }
@media (max-width: 1100px) {
  .sidebar { width: 230px; }
  .app-shell { margin-left: 230px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 290px; }
  .customer-row { grid-template-columns: auto minmax(0, 1.1fr) minmax(230px, 1fr); gap: 12px; }
  .product-form { gap: 10px; grid-template-columns: minmax(130px, 1fr) minmax(110px, .8fr) 120px; }
  .summary-total strong { font-size: 22px; }
}
@media (max-width: 820px) {
  .sidebar { z-index: 4; width: min(280px, 85vw); overflow-y: auto; overscroll-behavior: contain; padding: 18px 11px 20px; transform: translateX(-100%); }
  body.mobile-menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 3; inset: 0; border: 0; background: #10182b80; }
  body.mobile-menu-open .sidebar-backdrop { display: block; }
  body.mobile-menu-open { overflow: hidden; }
  .app-shell { margin-left: 0; }
  body.collapsed .sidebar { width: min(280px, 85vw); overflow-y: auto; padding: 18px 11px 20px; transform: translateX(-100%); }
  body.collapsed .app-shell { margin-left: 0; }
  body.collapsed .brand { justify-content: flex-start; padding: 1px 11px; }
  body.collapsed .brand-name, body.collapsed .nav-link span:not(.nav-icon), body.collapsed .system-status > span:not(.status-check) { display: initial; }
  body.collapsed .brand-cart { width: 59px; height: 59px; flex-basis: 59px; }
  body.collapsed .nav-link { justify-content: flex-start; padding: 0 15px; }
  body.collapsed .system-status { justify-content: flex-start; margin: 0 8px; padding: 15px 19px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-grid > * { min-width: 0; }
  .dashboard-chart-card { padding-right: 10px; padding-left: 10px; }
  .chart-content { gap: 14px; }
  .chart-pie { width: 125px; height: 125px; flex-basis: 125px; }
  .summary-card { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .summary-card h2, .summary-total { grid-column: 1 / -1; }
  .summary-card h2 { margin-bottom: 8px; }
  .summary-item { margin-bottom: 0; }
  .customer-row { grid-template-columns: auto minmax(0, 1fr); }
  .account-alert { grid-column: 1 / -1; }
  .dashboard-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .login-card { padding: 30px 22px 24px; }
  .login-brand .brand-cart { width: 56px; height: 56px; flex-basis: 56px; }
  .login-brand .brand-name { font-size: 21px; }
  .login-brand .brand-name strong { font-size: 20px; }
  .sidebar { width: min(280px, 85vw); padding: 18px 11px 20px; }
  .app-shell { margin-left: 0; }
  .brand { height: 72px; justify-content: flex-start; padding: 1px 11px; }
  .brand-cart { width: 48px; height: 48px; flex-basis: 48px; }
  .brand-name { display: initial; font-size: 20px; }
  .brand-name strong { font-size: 19px; }
  .nav-link { min-height: 48px; justify-content: flex-start; padding: 0 12px; gap: 11px; }
  .nav-link span:not(.nav-icon) { display: initial; }
  .nav-icon svg { width: 23px; height: 23px; }
  .secondary-nav { margin-bottom: 20px; }
  .system-status { min-height: 56px; justify-content: flex-start; margin: 0 3px; padding: 8px; gap: 9px; }
  .system-status > span:not(.status-check) { display: initial; }
  .status-check { width: 28px; height: 28px; }
  .topbar { height: 55px; padding: 0 12px; }
  .top-actions { gap: 6px; }
  .icon-button { min-width: 32px; font-size: 21px; }
  .avatar-button { width: 34px; height: 34px; }
  .main-content { padding: 13px 10px 25px; }
  .dashboard-overview { grid-template-columns: 1fr; }
  .dashboard-charts { grid-template-columns: 1fr; }
  .dashboard-chart-card + .dashboard-chart-card { border-top: 1px solid #c8c8c8; border-left: 0; }
  .chart-content { flex-wrap: wrap; justify-content: center; gap: 12px; }
  .chart-legend { width: 100%; }
  .chart-legend li { grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 5px; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; gap: 10px; padding: 4px 2px 14px 10px; }
  .page-heading > div { padding-left: 10px; border-left-width: 4px; }
  .page-heading > div, .save-button { width: 100%; min-width: 0; }
  h1 { font-size: 20px; }
  .page-heading p { font-size: 12px; }
  .save-button { min-height: 42px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
  .save-icon { width: 30px; height: 28px; }
  .customer-row { grid-template-columns: minmax(0, 1fr); gap: 9px; padding: 14px 2px; }
  .customer-row > label { font-size: 14px; }
  .customer-select-tools { min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .new-client-from-account { width: 100%; }
  .select-wrap select { height: 52px; }
  .account-alert { grid-column: auto; min-height: 52px; }
  .product-card { padding: 14px 11px; }
  .card h2 { font-size: 16px; }
  .product-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-name-field { grid-column: 1 / -1; }
  .add-button { grid-column: 1 / -1; }
  .summary-card { grid-template-columns: 1fr 1fr; padding: 15px 12px; }
  .summary-item, .summary-item > div { min-width: 0; }
  .summary-item { gap: 7px; }
  .summary-icon { width: 23px; flex-basis: 23px; }
  .summary-icon svg { width: 19px; height: 19px; }
  .summary-item div span { font-size: 12px; }
  .summary-item strong { font-size: 12px; overflow-wrap: anywhere; }
  .clients-card { padding: 12px 10px 8px; }
  .clients-heading { align-items: flex-start; flex-direction: column; }
  .clients-title, .clients-title > div { min-width: 0; }
  .clients-title { align-items: flex-start; gap: 10px; }
  .clients-title h2 { font-size: 18px; }
  .clients-title p { font-size: 12px; line-height: 1.4; }
  .client-tools { width: 100%; align-items: stretch; flex-direction: column; }
  .client-tools .search-field, .client-tools .primary-button { width: 100%; }
  .search-field { flex: 1; width: auto; }
  .table-wrap { min-width: 0; max-width: 100%; -webkit-overflow-scrolling: touch; }
  th, td { padding-right: 9px; padding-left: 9px; }
  .clients-table { min-width: 930px; }
  .users-card { padding: 12px 10px 8px; }
  .users-table { min-width: 520px; }
  .row-actions { flex-wrap: wrap; }
  .action-button { min-height: 40px; padding: 0 10px; }
  .account-product-entry { grid-template-columns: 1fr; }
  .client-access-search { align-items: stretch; flex-direction: column; }
  .client-access-search .primary-button { min-height: 42px; }
  .client-access-form { padding: 14px; }
  .client-portal-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 8px 12px; }
  .client-portal-header .brand { gap: 5px; }
  .client-portal-header .brand-cart { width: 38px; height: 38px; flex-basis: 38px; }
  .client-portal-header .brand-name { font-size: 15px; }
  .client-portal-header .brand-name strong { font-size: 14px; }
  .client-portal-header .client-portal-identity { grid-column: 1 / -1; grid-row: 2; margin: 0; text-align: left; }
  .client-portal-identity strong { max-width: 100%; }
  .client-portal-header .logout-form { grid-column: 2; grid-row: 1; }
  .client-portal-header .logout-button { padding: 0 8px; }
  .client-portal-main { padding: 24px 12px 36px; }
  .client-portal-heading { align-items: flex-start; flex-direction: column; }
  .client-portal-heading h1 { font-size: 23px; }
  .client-cpf-badge { max-width: 100%; overflow-wrap: anywhere; }
  .client-portal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .client-portal-summary > div { padding: 12px; }
  .client-portal-summary > div:last-child { grid-column: 1 / -1; }
  .client-account-card { padding: 13px; }
  .client-account-card > header { flex-direction: row; }
  .client-account-card > header > strong { font-size: 15px; }
  .client-account-card li span { min-width: 0; overflow-wrap: anywhere; }
  .client-account-card li strong { font-size: 13px; }
  .account-history-header { flex-direction: column; }
  .account-history-actions { justify-content: flex-start; }
  .items-table { min-width: 420px; }
  .running-total { flex-wrap: wrap; font-size: 13px; }
  .running-total span { font-size: 15px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions > button { flex: 1 1 110px; }
  dialog { width: calc(100vw - 24px); padding: 18px; }
  .toast { right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
}
