:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #172b4d; background: #f7f8fa; }
* { box-sizing: border-box; } body { margin: 0; } button, input, textarea { font: inherit; } button { cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; } .sidebar { width: 248px; background: #172b4d; color: #dfe7f2; padding: 22px 14px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 12px; font-size: 20px; font-weight: 700; color: white; } .brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #6c5ce7; color: white; }
.workspace-switcher { display: flex; align-items: center; gap: 9px; padding: 9px 10px; color: #fff; background: #23395f; border: 1px solid #385074; border-radius: 7px; text-align: left; } .avatar, .profile { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #ffab00; color: #172b4d; font-size: 12px; font-weight: 700; border: 0; } .chevron { margin-left: auto; color: #aab8cc; }
nav { display: grid; gap: 4px; } .nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; color: #c7d2e1; text-align: left; } .nav-item:hover, .nav-item.active { background: #2c4369; color: #fff; } .icon { width: 18px; text-align: center; font-size: 17px; } .sidebar-bottom { margin-top: auto; display: grid; gap: 14px; } .version { padding: 0 12px; color: #8fa3bf; font-size: 11px; }
.content { width: min(1240px, 100%); margin: 0 auto; padding: 34px 44px 60px; } .topbar, .toolbar, .card-heading, .top-actions, .form-actions { display: flex; align-items: center; justify-content: space-between; } h1, h2, p { margin: 0; } h1 { font-size: 28px; letter-spacing: -.5px; } h2 { font-size: 17px; } .eyebrow { margin-bottom: 6px; color: #7a869a; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; font-weight: 700; }
.top-actions { gap: 12px; } .status-pill { color: #526173; font-size: 12px; } .status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #36b37e; } .profile { width: 32px; height: 32px; color: white; background: #6c5ce7; }
.toolbar { gap: 10px; margin: 28px 0 20px; justify-content: flex-end; } .search { display: flex; align-items: center; gap: 7px; flex: 0 1 240px; max-width: 240px; padding: 6px 12px; background: white; border: 1px solid #dfe3eb; border-radius: 20px; color: #7a869a; margin-right: auto; } .search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 13px; } .search-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; } .button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border: 1px solid transparent; border-radius: 6px; font-weight: 600; font-size: 13px; } .button.primary { color: white; background: #6c5ce7; } .button.primary:hover { background: #5848d1; } .button.secondary { color: #42526e; background: white; border-color: #dfe3eb; }
.icon-button { padding: 5px 8px; border: 0; border-radius: 5px; color: #6b778c; background: transparent; font-size: 17px; } .icon-button:hover { background: #ebecf0; color: #172b4d; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; } .metric-card, .card { border: 1px solid #e3e7ee; border-radius: 8px; background: white; box-shadow: 0 2px 7px #172b4d0b; } .metric-card { display: flex; align-items: center; gap: 14px; padding: 18px; } .metric-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; font-size: 20px; } .metric-icon.purple { color: #5e4db2; background: #e9e5ff; } .metric-icon.green { color: #16876b; background: #ddf5ec; } .metric-icon.orange { color: #b05d00; background: #fff0d6; } .metric-icon.blue { color: #1674d1; background: #dcebff; } .metric-label { display: block; margin-bottom: 5px; color: #7a869a; font-size: 12px; } .metric-card strong { font-size: 22px; }
.card { margin-bottom: 18px; padding: 20px; } .form-card { border-color: #cfc8ff; } .table-card { overflow: hidden; } .card-heading { margin-bottom: 18px; } .form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; align-items: start; } label { display: grid; gap: 6px; color: #526173; font-size: 12px; font-weight: 600; } label.wide, .form-actions.wide { grid-column: 1 / -1; } input, textarea, select { width: 100%; padding: 9px 10px; border: 1px solid #dfe3eb; border-radius: 5px; outline: 0; color: #172b4d; background: #fff; } input:focus, textarea:focus, select:focus { border-color: #6c5ce7; box-shadow: 0 0 0 2px #6c5ce722; } .form-actions { margin-top: 18px; } #message { color: #36b37e; font-size: 13px; } #message.error, .global-message.error { color: #de350b; } .global-message { min-height: 20px; margin: -8px 0 12px; color: #16876b; font-size: 13px; }
.table-list { border-top: 1px solid #ebecf0; } .item { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid #ebecf0; color: #526173; font-size: 13px; } .item strong { color: #172b4d; } .item small { color: #7a869a; } .item a { color: #5e4db2; font-weight: 600; text-decoration: none; } .empty { padding: 22px 4px; color: #7a869a; font-size: 13px; }
.master-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid #ebecf0; } .master-tab { padding: 9px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #6b778c; font-weight: 600; cursor: pointer; } .master-tab.active { border-bottom-color: #6c5ce7; color: #5e4db2; } .master-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; margin-bottom: 20px; } .master-form .button { height: 38px; justify-content: center; } .checkbox-label { display: flex; align-items: center; gap: 7px; min-height: 38px; } .checkbox-label input { width: auto; } .tag { color: #7a869a; font-size: 12px; } .tag.active { color: #16876b; font-weight: 700; }
.logo-upload { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-top: 22px; padding-top: 18px; border-top: 1px solid #ebecf0; } .logo-upload h3 { margin: 0 0 5px; font-size: 14px; } .help-text { color: #7a869a; font-size: 12px; } #logo-form { display: flex; align-items: center; gap: 10px; }
@media (max-width: 800px) { .content { padding: 24px 18px 96px; } .summary-grid { grid-template-columns: 1fr; } .master-form { grid-template-columns: 1fr 1fr; } } @media (max-width: 560px) { .toolbar { flex-wrap: wrap; } .search { min-width: 100%; } .form-grid { grid-template-columns: 1fr; } label.wide { grid-column: auto; } .item { grid-template-columns: 1fr auto; } .item small { display: none; } .master-form { grid-template-columns: 1fr; } }

/* Dashboard theme: compact navigation and high-contrast data cards. */
:root { --page: #131722; --sidebar: #1d2433; --card: #1e2637; --card-2: #242e42; --line: #344058; --text: #f2f5fb; --muted: #8e9ab2; --accent: #1674d1; --input: #171e2d; }
:root[data-theme="light"] { --page: #f4f6fa; --sidebar: #ffffff; --card: #ffffff; --card-2: #eef2f8; --line: #d8deea; --text: #172033; --muted: #68758b; --accent: #176dcc; --input: #ffffff; }
body { background: var(--page); color: var(--text); }
.app-shell { height: 100vh; overflow: hidden; }
.sidebar { width: 230px; padding: 0 8px 18px; gap: 12px; background: var(--sidebar); border-right: 1px solid var(--line); flex-shrink: 0; height: 100vh; overflow-y: auto; position: sticky; top: 0; }
main.content { flex: 1; height: 100vh; overflow-y: auto; }
.brand { min-height: 82px; justify-content: center; padding: 10px; border-bottom: 1px solid var(--line); color: var(--text); }
.brand-mark { background: var(--accent); }
.company-logo { display: block; max-width: 112px; max-height: 54px; object-fit: contain; }
[hidden] { display: none !important; }
.workspace-switcher { margin: 6px 0 4px; background: var(--card-2); border-color: var(--line); color: var(--text); }
.nav-item { color: #c5cede; border-radius: 7px; }
.nav-item:hover, .nav-item.active { background: var(--accent); color: #fff; }
:root[data-theme="light"] .nav-item { color: #3d4a63; }
:root[data-theme="light"] .nav-item:hover, :root[data-theme="light"] .nav-item.active { color: #fff; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
:root[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator { filter: none; }
.sidebar-bottom { gap: 4px; }
.version { color: var(--muted); }
.content { width: min(1180px, 100%); padding: 22px 24px 56px; }
h1 { color: var(--text); font-size: 21px; }
h2 { color: var(--text); }
.eyebrow, .metric-label, .help-text { color: var(--muted); }
.status-pill { color: var(--muted); }
.toolbar { margin: 20px 0 18px; }
.search { background: var(--input); border-color: var(--line); }
.search input, input, textarea, select { color: var(--text); background: var(--input); border-color: var(--line); }
.button.primary { background: var(--accent); }
.button.secondary { color: var(--text); background: var(--card-2); border-color: var(--line); }
.icon-button { color: var(--muted); }
.icon-button:hover { background: var(--card-2); color: var(--text); }
.summary-grid { grid-template-columns: repeat(3, 1fr); }
.metric-card, .card { background: var(--card); border-color: var(--line); box-shadow: 0 4px 14px #00000020; }
.metric-card { min-height: 84px; border-top: 3px solid var(--accent); position: relative; }
.metric-card:nth-child(2) { border-top-color: #11b7d5; }
.metric-card:nth-child(3) { border-top-color: #18b58a; }
.metric-card:nth-child(4) { border-top-color: #1674d1; }
.metric-card:nth-child(5) { border-top-color: #7b5ee6; }
.metric-card:nth-child(6) { border-top-color: #18b58a; }
.metric-card strong, .item strong { color: var(--text); }
.metric-icon { background: transparent; color: #7d9bd2; }
.metric-card .metric-icon { position: absolute; top: 17px; right: 18px; }
.metric-card .metric-icon.purple,
.metric-card .metric-icon.green,
.metric-card .metric-icon.orange,
.metric-card .metric-icon.blue { background: transparent; }
.button.small { padding: 6px 9px; font-size: 11px; white-space: nowrap; }
.action-buttons { display: inline-flex; justify-content: flex-end; gap: 6px; }
.summary-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.table-list { border-color: var(--line); }
.item { border-color: var(--line); color: var(--muted); }
.item small { color: var(--muted); }
.item a { color: #62a7ff; }
.empty { color: var(--muted); }
.form-card { border-color: #356bb2; }
.master-tabs { border-color: var(--line); }
.master-tab { color: var(--muted); }
.master-tab.active { color: #62a7ff; border-color: #62a7ff; }
.tag.active { color: #32d39a; }
.logo-upload { border-color: var(--line); }
.global-message { color: #32d39a; }
.master-card { padding: 24px; }
.master-form { padding: 18px; margin-bottom: 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; align-items: start; }
.master-form label { color: var(--text); }
.master-form-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.master-form .button { width: fit-content; }
.master-form .checkbox-label { align-self: end; }
.master-list .item { min-height: 52px; }

/* Polished data table: header row, status pills, icon-only actions (reference dashboard style). */
.table-list { border-top: 0; }
.item.header-row { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding-top: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); background: transparent; }
.item.header-row:hover { background: transparent; }
.item { transition: background .12s ease; }
.item:not(.header-row):hover { background: var(--card-2); }
.item.pv-row { grid-template-columns: 1fr .8fr 1.1fr 1.8fr 1fr 104px; }
.item.settlement-row { grid-template-columns: 1.2fr .8fr 1.3fr .6fr 170px; }
.item.rate-row { grid-template-columns: 1.4fr 1fr .8fr .9fr .9fr 64px; }
.item.master-row { grid-template-columns: 1.1fr 1.4fr 1.2fr .8fr 64px; }
.item.user-row { grid-template-columns: 1.4fr .9fr .9fr 88px; }
.item.audit-row { grid-template-columns: 1.05fr .8fr 1.15fr .7fr 1.25fr 70px; align-items: start; }
.audit-filters { grid-template-columns: 1fr 1fr auto; align-items: end; margin-bottom: 12px; }
.audit-filters .form-actions { margin-top: 0; }
.audit-details { justify-self: end; }
.audit-details summary { cursor: pointer; color: #5e4db2; font-weight: 600; font-size: 12px; list-style: none; }
.audit-details summary::-webkit-details-marker { display: none; }
.audit-details[open] { grid-column: 1 / -1; justify-self: stretch; margin-top: 8px; }
table.audit-diff { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
table.audit-diff th, table.audit-diff td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.audit-diff th { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 10px; letter-spacing: .04em; }
.align-right { text-align: right; justify-self: end; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: inline-flex; justify-content: flex-end; gap: 6px; }

.status-badge { display: inline-flex; align-items: center; justify-content: center; justify-self: start; padding: 3px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; line-height: 1.6; width: 88px; text-align: center; }
.status-badge.success { color: #32d39a; background: #32d39a1f; }
.status-badge.warning { color: #f0a83c; background: #f0a83c1f; }
.status-badge.danger { color: #ef5c6e; background: #ef5c6e1f; }
.status-badge.neutral { color: var(--muted); background: #8e9ab21f; }
.status-badge.info { color: #62a7ff; background: #62a7ff1f; }
.status-badge.paid { color: #18b58a; background: #18b58a1f; }
.item.is-cancelled { opacity: .55; }
.icon-btn.danger-btn:hover { background: #ef5c6e; border-color: #ef5c6e; }
:root[data-theme="light"] .status-badge.success { color: #157a53; background: #15a36c22; }
:root[data-theme="light"] .status-badge.warning { color: #96600a; background: #d3860922; }
:root[data-theme="light"] .status-badge.neutral { color: #5a6579; background: #68758b22; }
:root[data-theme="light"] .status-badge.info { color: #176dcc; background: #176dcc22; }
:root[data-theme="light"] .status-badge.paid { color: #128a68; background: #18b58a22; }

.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--card-2); text-decoration: none; transition: all .12s ease; }
.icon-btn:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
.icon-btn.paid-btn:hover { background: #18b58a; border-color: #18b58a; }
.icon-btn.cancel-btn:hover { background: #f0a020; border-color: #f0a020; }
.icon-svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 700px) {
  .item.pv-row, .item.settlement-row, .item.rate-row, .item.master-row { grid-template-columns: 1fr auto; }
  .item.header-row { display: none; }
  .item.pv-row span:nth-child(2), .item.pv-row span:nth-child(3), .item.pv-row span:nth-child(4),
  .item.settlement-row span:nth-child(3), .item.rate-row span:nth-child(2),
  .item.master-row span:nth-child(2), .item.master-row span:nth-child(3) { display: none; }
  .settlement-filters { grid-template-columns: 1fr 1fr; }
}
.svg-icon { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item .icon { display: inline-flex; align-items: center; justify-content: center; }
.button, .master-tab, .icon-button, .profile, .workspace-switcher, .nav-item { transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.button:active, .nav-item:active { transform: translateY(1px); }

/* Remove the browser's default focus halo on non-text controls (it rendered as a stray soft
   shadow around buttons/checkboxes) and replace it with a deliberate, accessible focus ring. */
button, .icon-btn, .icon-button, input[type="checkbox"], a.icon-btn { outline: none; -webkit-tap-highlight-color: transparent; }
button:focus:not(:focus-visible), .icon-btn:focus:not(:focus-visible), input[type="checkbox"]:focus:not(:focus-visible) { outline: none; box-shadow: none; }
button:focus-visible, .icon-btn:focus-visible, .icon-button:focus-visible, input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none;
}

/* Simple flat buttons — no gradients/shadows. */
.button { position: relative; border-radius: 6px; font-weight: 600; }
.button.primary {
  background: var(--accent);
  border: 1px solid var(--accent);
}
.button.primary:hover { background: #1358a6; }
.button.secondary {
  background: var(--card-2);
  border: 1px solid var(--line);
}
.button.secondary:hover { border-color: var(--accent); color: var(--accent); }
.button.danger { background: #de350b; border: 1px solid #de350b; color: #fff; }
.button.danger:hover { background: #b3290a; }
.master-form .button.primary, #logo-form .button { min-height: 40px; }
.button.icon-only { width: 38px; height: 38px; padding: 0; justify-content: center; gap: 0; }

.confirm-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(10, 14, 22, .55); backdrop-filter: blur(2px); }
.confirm-dialog { width: min(420px, calc(100vw - 40px)); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: confirm-pop .14s ease-out; }
.confirm-dialog h3 { margin: 0 0 10px; font-size: 16px; color: var(--text); }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@keyframes confirm-pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.button.icon-only .icon-svg { width: 17px; height: 17px; }
.profile.has-avatar { padding: 0; overflow: hidden; background: var(--card-2); border: 2px solid var(--accent); }
.profile.has-avatar img { width: 100%; height: 100%; object-fit: cover; animation: avatar-float 3.2s ease-in-out infinite; }
.profile-dialog { width: min(560px, calc(100vw - 40px)); max-height: min(720px, calc(100vh - 40px)); overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: confirm-pop .14s ease-out; }
.profile-dialog-heading, .profile-summary, .profile-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.profile-dialog h3 { margin: 0; color: var(--text); font-size: 18px; }
.profile-summary { justify-content: flex-start; margin: 16px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.profile-summary strong { display: block; color: var(--text); font-size: 15px; }
.profile-summary span { color: var(--muted); font-size: 12px; }
.profile-preview, .avatar-option { border: 1px solid var(--line); border-radius: 50%; background: #26344b; overflow: hidden; }
.profile-preview { width: 58px; height: 58px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; }
.profile-preview img, .avatar-option img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 16px; }
.avatar-option { position: relative; aspect-ratio: 1; padding: 0; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.avatar-option:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 0 0 3px #1674d133; }
.avatar-option.selected { border-color: var(--accent); box-shadow: 0 0 0 3px #1674d155; }
.avatar-option.selected::after { content: "✓"; position: absolute; right: 4px; bottom: 4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; background: var(--accent); font-size: 12px; font-weight: 800; }
.avatar-option img { animation: avatar-float 3.8s ease-in-out infinite; animation-delay: calc(var(--avatar-index, 0) * -120ms); }
.profile-actions { margin-top: 18px; }
@keyframes avatar-float { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.02); } }

/* Dashboard charts */
.charts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.chart-card { display: flex; flex-direction: column; grid-column: span 2; }
.donut-card { grid-column: span 1; }
.bar-chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; height: 160px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar-value { color: var(--muted); font-size: 11px; font-weight: 700; }
.bar-col .bar { width: 100%; max-width: 34px; min-height: 4px; border-radius: 5px 5px 0 0; background: var(--accent); }
.bar-label { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 22px; flex: 1; padding-top: 6px; }
.donut-chart { position: relative; width: 128px; height: 128px; border-radius: 50%; flex-shrink: 0; }
.donut-hole { position: absolute; inset: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--card); color: var(--text); font-size: 22px; font-weight: 700; }
.donut-legend { display: grid; gap: 8px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.donut-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

/* Settlement filters toolbar */
.settlement-filters { display: grid; grid-template-columns: 1.2fr .8fr 1.3fr 1fr 112px; gap: 12px; margin-bottom: 16px; padding: 0 4px; }
.settlement-filters label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.settlement-filters select { min-height: 38px; }

/* Collapsible sidebar: toggled by adding .collapsed on .sidebar via JS, persisted in localStorage. */
.sidebar-toggle .svg-icon { width: 16px; height: 16px; }
.sidebar.collapsed { width: 68px; }
.sidebar.collapsed .brand { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .brand #brand-name { display: none; }
.sidebar.collapsed .company-logo { max-width: 34px; }
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; gap: 0; padding: 10px; }
.sidebar.collapsed .sidebar-toggle .svg-icon { transform: rotate(180deg); }
.sidebar.collapsed ~ main.content { width: min(1180px, 100%); }

/* Mobile shell: the desktop sidebar becomes a bottom tab bar so every primary section is reachable by thumb. */
@media (max-width: 760px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .app-shell { display: block; height: 100vh; overflow: hidden; }
  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 50;
    width: 100%;
    height: auto;
    max-height: none;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    overflow: visible;
    border-top: 1px solid var(--line);
    border-right: 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,.25);
  }
  .sidebar.collapsed { width: 100%; }
  .sidebar .brand, .sidebar .workspace-switcher, .sidebar-bottom, .version { display: none; }
  .sidebar nav { display: flex; justify-content: space-around; gap: 4px; }
  .sidebar .nav-item,
  .sidebar.collapsed .nav-item {
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    padding: 7px 4px;
    border-radius: 10px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    text-align: center;
  }
  .sidebar .nav-item[hidden] { display: none !important; }
  .sidebar .nav-label,
  .sidebar.collapsed .nav-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    line-height: 1.1;
  }
  .sidebar .icon { width: auto; font-size: 18px; }
  main.content {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    overflow-x: hidden;
    padding: 18px 14px calc(92px + env(safe-area-inset-bottom));
  }
  .view-panel, .card, .table-list, .item { min-width: 0; max-width: 100%; }
  .topbar { align-items: flex-start; gap: 12px; }
  .top-actions { flex-shrink: 0; }
  h1 { font-size: 20px; }
  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin: 18px 0 14px;
  }
  .search {
    min-width: 0;
    max-width: none;
    width: 100%;
    margin-right: 0;
    grid-column: 1 / 2;
  }
  .toolbar > .button { justify-self: end; }
  .card { padding: 14px; border-radius: 12px; margin-bottom: 12px; }
  .card-heading { gap: 12px; align-items: flex-start; margin-bottom: 12px; }
  .eyebrow { margin-bottom: 4px; font-size: 9.5px; }
  h2 { font-size: 15px; }
  input, textarea, select, .button { min-height: 44px; font-size: 14px; }
  .button.icon-only { width: 44px; height: 44px; }
  .icon-btn { width: 38px; height: 38px; border-radius: 10px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card {
    min-height: 70px;
    padding: 12px 38px 12px 12px;
    gap: 8px;
    border-top-width: 2px;
  }
  .metric-card strong { font-size: 18px; line-height: 1.15; word-break: break-word; }
  .metric-label { margin-bottom: 3px; font-size: 10.5px; line-height: 1.2; }
  .metric-card .metric-icon { top: 12px; right: 12px; width: 22px; height: 22px; }
  .summary-icon { width: 18px; height: 18px; }
  .charts-grid { grid-template-columns: 1fr; gap: 12px; }
  .chart-card, .donut-card { grid-column: auto; }
  .bar-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    height: 118px;
    gap: 4px;
    overflow: hidden;
    padding: 4px 0;
    min-width: 0;
  }
  .bar-col { min-width: 0; }
  .bar-col .bar { max-width: 20px; }
  .bar-value, .bar-label { font-size: 10px; }
  .donut-wrap { flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; }
  .donut-chart { width: 96px; height: 96px; }
  .donut-hole { inset: 14px; font-size: 18px; }
  .donut-legend { gap: 6px; }
  .donut-legend-item { font-size: 11px; }
  .master-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .master-tab { flex: 0 0 auto; min-height: 42px; white-space: nowrap; }
  .master-card { padding: 14px; }
  .master-form, .form-grid, .audit-filters, .settlement-filters { grid-template-columns: 1fr; gap: 12px; }
  .master-form { padding: 14px; margin-bottom: 16px; }
  .form-actions { margin-top: 8px; }
  .form-actions.wide { grid-column: auto; }
  #pv-form .form-actions, #settings-form .form-actions, #user-form .form-actions { align-items: flex-start; gap: 12px; }
  .logo-upload, #logo-form { align-items: stretch; flex-direction: column; }
  #logo-form { display: grid; grid-template-columns: 1fr auto; }
  .table-list { display: grid; gap: 10px; border-top: 0; }
  .item.pv-row, .item.settlement-row, .item.rate-row, .item.master-row, .item.user-row, .item.audit-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 8px 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card-2);
  }
  .item > * { min-width: 0; max-width: 100%; }
  .item.pv-row span:nth-child(2), .item.pv-row span:nth-child(3), .item.pv-row span:nth-child(4),
  .item.settlement-row span:nth-child(3), .item.rate-row span:nth-child(2),
  .item.master-row span:nth-child(2), .item.master-row span:nth-child(3) { display: inline; }
  .align-right, .row-actions, .action-buttons { justify-self: stretch; text-align: left; }
  .row-actions, .action-buttons { justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
  .item:not(.header-row) > span:not(.row-actions):not(.status-badge)::before,
  .item:not(.header-row) > strong.align-right::before {
    display: inline;
    margin-right: 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .item:not(.header-row) > span:not(.row-actions):not(.status-badge),
  .item:not(.header-row) > strong {
    font-size: 12.5px;
    line-height: 1.3;
  }
  .item:not(.header-row) > strong:first-child { font-size: 13.5px; }
  .item.pv-row:not(.header-row) > strong:first-child,
  .item.rate-row:not(.header-row) > strong:first-child,
  .item.master-row:not(.header-row) > strong:first-child,
  .item.audit-row:not(.header-row) > span:nth-child(5) { grid-column: 1 / -1; }
  .item.pv-row:not(.header-row) > span:nth-child(4),
  .item.settlement-row:not(.header-row) > strong:nth-child(3),
  .item.master-row:not(.header-row) > span:nth-child(2) { grid-column: 1 / -1; }
  .item.settlement-row:not(.header-row) > span:first-child { font-weight: 700; color: var(--text); }
  .item.settlement-row:not(.header-row) > .status-badge,
  .item.user-row:not(.header-row) > .status-badge { justify-self: end; }
  .item.audit-row:not(.header-row) > .audit-details { grid-column: 1 / -1; }
  .item.pv-row:not(.header-row) > span:nth-child(2)::before { content: "Data"; }
  .item.pv-row:not(.header-row) > span:nth-child(3)::before { content: "Subcontractor"; }
  .item.pv-row:not(.header-row) > span:nth-child(4)::before { content: "Descriere"; }
  .item.pv-row:not(.header-row) > strong:nth-child(5)::before { content: "Suma"; }
  .item.settlement-row:not(.header-row) > span:nth-child(3)::before { content: "Cheie deviz"; }
  .item.settlement-row:not(.header-row) > strong:nth-child(4)::before { content: "Total"; }
  .item.rate-row:not(.header-row) > span:nth-child(2)::before { content: "Subcontractor"; }
  .item.rate-row:not(.header-row) > strong:nth-child(3)::before { content: "Tarif"; }
  .item.rate-row:not(.header-row) > span:nth-child(4)::before { content: "Efectiv din"; }
  .item.master-row:not(.header-row) > span:nth-child(2)::before { content: "Adresa"; }
  .item.master-row:not(.header-row) > span:nth-child(3)::before { content: "Email"; }
  .item.user-row:not(.header-row) > span:nth-child(2)::before { content: "Rol"; }
  .item.audit-row:not(.header-row) > span:nth-child(1)::before { content: "Data/Ora"; }
  .item.audit-row:not(.header-row) > span:nth-child(2)::before { content: "Utilizator"; }
  .item.audit-row:not(.header-row) > span:nth-child(3)::before { content: "Actiune"; }
  .item.audit-row:not(.header-row) > span:nth-child(4)::before { content: "Numar PV"; }
  .item.audit-row:not(.header-row) > span:nth-child(5)::before { content: "Entitate"; }
  .status-badge { width: fit-content; min-width: 72px; padding: 2px 9px; font-size: 10.5px; }
  .truncate, .item span, .item strong { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
  .audit-details, .audit-details[open] { justify-self: stretch; grid-column: auto; text-align: left; }
  .row-actions, .action-buttons { align-self: end; }
  .icon-btn { width: 34px; height: 34px; }
  table.audit-diff { display: block; overflow-x: auto; white-space: nowrap; }
  .confirm-dialog { width: min(360px, calc(100vw - 28px)); padding: 20px; }
  .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .confirm-actions .button { justify-content: center; }
  .profile-dialog { width: calc(100vw - 24px); max-height: calc(100vh - 24px); padding: 16px; }
  .profile-summary { margin-top: 12px; }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .profile-actions { display: grid; grid-template-columns: 1fr; }
  .profile-actions .button { justify-content: center; }
  .login-shell { padding: 18px; align-items: center; }
  .login-form-side { width: 100%; padding: 0; }
  .login-card { max-width: 100%; padding: 24px 20px; border-radius: 12px; }
  .login-card h1 { font-size: 20px; }
  .login-submit { min-height: 44px; }
}

@media (max-width: 430px) {
  main.content { padding-inline: 10px; }
  .summary-grid { gap: 8px; }
  .metric-card { min-height: 66px; padding: 10px 34px 10px 10px; }
  .metric-card strong { font-size: 16px; }
  .metric-label { font-size: 10px; }
  .metric-card .metric-icon { right: 10px; }
  .sidebar { padding-inline: 4px; }
  .sidebar .nav-item,
  .sidebar.collapsed .nav-item { min-height: 50px; padding-inline: 2px; }
  .sidebar .nav-label,
  .sidebar.collapsed .nav-label { font-size: 9px; }
  .donut-wrap { flex-direction: column; }
}

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--page); }
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; padding: 36px 34px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: grid; gap: 14px; box-shadow: 0 10px 34px #00000014; }
.login-card .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.panda-login { display: grid; place-items: center; height: 144px; margin: -2px 0 2px; overflow: visible; }
.panda-stage { position: relative; width: 196px; height: 138px; filter: drop-shadow(0 18px 24px rgba(0,0,0,.22)); }
.panda-stage::before { content: ""; position: absolute; inset: 10px 8px 8px; border-radius: 999px; background: radial-gradient(circle at 50% 36%, #2c4369 0 26%, #1b2b42 64%, #121c2e 100%); opacity: .72; }
.panda-ear { position: absolute; top: 16px; z-index: 1; width: 44px; height: 48px; border: 3px solid #101a2b; border-radius: 50% 50% 46% 46%; background: linear-gradient(145deg, #40536d, #24344c); }
.panda-ear::after { content: ""; position: absolute; inset: 10px; border-radius: inherit; background: #5f7796; opacity: .46; }
.panda-ear.left { left: 28px; transform: rotate(-31deg); }
.panda-ear.right { right: 28px; transform: rotate(31deg); }
.panda-face { position: absolute; left: 35px; top: 24px; z-index: 2; width: 126px; height: 106px; border: 3px solid #53677f; border-radius: 54% 54% 48% 48% / 56% 56% 46% 46%; background: radial-gradient(circle at 50% 26%, #ffffff 0 30%, #edf4fb 70%, #d7e4f2 100%); box-shadow: inset 0 -8px 14px rgba(23,43,77,.08); }
.panda-patch { position: absolute; top: 34px; width: 35px; height: 43px; border-radius: 52% 48% 54% 46%; background: linear-gradient(145deg, #445a78, #22344f); transition: transform .24s ease, opacity .22s ease; }
.panda-patch.left { left: 24px; transform: rotate(-24deg); }
.panda-patch.right { right: 24px; transform: rotate(24deg); }
.panda-eye { position: absolute; left: 50%; top: 49%; width: 9px; height: 10px; border-radius: 50%; background: #0d1728; transform: translate(-50%, -50%); transition: transform .2s ease, height .2s ease; }
.panda-eye::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2.5px; height: 2.5px; border-radius: 50%; background: #e6f2ff; transform: translate(-50%, -50%); }
.panda-blush { position: absolute; top: 72px; width: 16px; height: 8px; border-radius: 999px; background: #79a8df; opacity: .22; transition: opacity .22s ease, transform .22s ease; }
.panda-blush.left { left: 15px; transform: rotate(9deg); }
.panda-blush.right { right: 15px; transform: rotate(-9deg); }
.panda-muzzle { position: absolute; left: 50%; top: 63px; width: 42px; height: 32px; border: 2px solid #b4c4d7; border-radius: 50% 50% 48% 48%; background: #fbfdff; transform: translateX(-50%); }
.panda-nose { position: absolute; left: 50%; top: 8px; width: 15px; height: 10px; border-radius: 58% 58% 48% 48%; background: #111b2d; transform: translateX(-50%); }
.panda-mouth { position: absolute; left: 50%; top: 18px; width: 23px; height: 11px; border-bottom: 2px solid #142033; border-radius: 0 0 999px 999px; transform: translateX(-50%); }
.panda-mouth::before { content: ""; position: absolute; left: 50%; top: -7px; width: 2px; height: 8px; border-radius: 2px; background: #142033; transform: translateX(-50%); }
.panda-hand { position: absolute; top: 93px; z-index: 4; width: 45px; height: 39px; border: 3px solid #111b2d; border-radius: 48% 48% 42% 42%; background: linear-gradient(145deg, #425873, #213149); transition: transform .32s cubic-bezier(.2,.85,.24,1.18), opacity .2s ease; }
.panda-hand::after { content: ""; position: absolute; left: 50%; top: 9px; width: 20px; height: 14px; border-radius: 999px; background: #6f87a6; opacity: .5; transform: translateX(-50%); }
.panda-hand.left { left: 12px; transform: rotate(-24deg); transform-origin: 92% 92%; }
.panda-hand.right { right: 12px; transform: rotate(24deg); transform-origin: 8% 92%; }
.panda-shadow { position: absolute; left: 44px; right: 44px; bottom: 0; height: 10px; border-radius: 999px; background: rgba(0,0,0,.16); filter: blur(2px); }
.login-card.panda-hello .panda-hand.left { transform: translate(15px, -24px) rotate(-72deg); }
.login-card.panda-hello .panda-blush { opacity: .36; transform: scale(1.05); }
.login-card.panda-password .panda-hand.left { transform: translate(49px, -55px) rotate(-88deg); }
.login-card.panda-password .panda-hand.right { transform: translate(-49px, -55px) rotate(88deg); }
.login-card.panda-password .panda-eye { height: 2px; transform: translate(-50%, -50%) scaleX(1.35); }
.login-card.panda-peek .panda-hand.left { transform: translate(22px, -48px) rotate(-54deg); }
.login-card.panda-peek .panda-hand.right { transform: translate(-22px, -48px) rotate(54deg); }
.login-card.panda-peek .panda-eye { height: 10px; transform: translate(-50%, -50%) scale(1); }
.login-card.panda-peek .panda-blush { opacity: .42; }
.login-card h1 { font-size: 22px; margin: 0; color: var(--text); letter-spacing: -.3px; text-align: center; }
.login-sub { margin: -8px 0 6px; color: var(--muted); font-size: 13.5px; text-align: center; }
.login-card label { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.login-card input { height: 42px; font-size: 14px; }
.password-field { position: relative; display: flex; align-items: center; }
.password-field input { padding-right: 40px; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.password-toggle:hover { background: var(--card-2); color: var(--text); }
.password-toggle .svg-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.password-toggle.is-visible { color: var(--accent); }
.login-submit { justify-content: center; align-items: center; text-align: center; width: 100%; height: 42px; font-size: 14px; margin-top: 4px; }

@media (max-width: 760px) {
  .login-shell { padding: 16px; align-items: center; }
  .login-form-side { width: 100%; padding: 0; }
  .login-card { max-width: 100%; padding: 24px 20px; border-radius: 12px; }
  .panda-login { height: 122px; margin-top: -10px; }
  .panda-stage { transform: scale(.86); transform-origin: center; }
  .login-card h1 { font-size: 20px; }
  .login-submit { min-height: 44px; }
}
