* {
box-sizing: border-box;
}

:root {
--bg: #0d0d0d;
--panel: #171717;
--panel-2: #101010;
--border: #2b2b2b;
--border-2: #2f2f2f;
--text: #ffffff;
--muted: #bfbfbf;
--gold: #d7a900;
--gold-2: #f4c430;
--danger: #ff6b6b;
--success: #5cffb0;
--info: #8fb8ff;
--warning: #ffd166;
}

html,
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background: var(--bg);
color: var(--text);
-webkit-text-size-adjust: 100%;
}

body {
min-height: 100vh;
overflow-x: hidden;
}

.page-center {
min-height: 100vh;
display: flex;
align-items: flex-start;
justify-content: center;
padding: 16px;
}

.card {
width: 100%;
max-width: 420px;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 16px;
padding: 18px;
text-align: center;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.dashboard-card {
max-width: 1120px;
text-align: left;
}

.compact-card {
max-width: 860px;
}

.invoice-builder-card {
max-width: 980px;
}

h1 {
margin: 0 0 6px;
font-size: 26px;
line-height: 1.12;
}

h2 {
margin: 0 0 10px;
font-size: 17px;
line-height: 1.18;
}

h3 {
margin: 0 0 5px;
font-size: 14px;
line-height: 1.2;
}

h4 {
margin: 0 0 5px;
font-size: 13px;
}

p {
margin: 0;
}

.subtitle {
margin: 0 0 12px;
color: var(--muted);
font-size: 13px;
}

input,
select,
textarea {
width: 100%;
padding: 10px 11px;
margin: 0 0 8px;
border: 1px solid #333;
border-radius: 10px;
background: var(--panel-2);
color: var(--text);
font-size: 14px;
transition: border-color 0.2s ease, opacity 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
outline: none;
border-color: var(--gold);
}

textarea {
min-height: 80px;
resize: vertical;
}

input[readonly] {
opacity: 0.85;
cursor: not-allowed;
}

button {
width: 100%;
padding: 10px 13px;
border: none;
border-radius: 10px;
background: var(--gold);
color: #111;
font-size: 14px;
font-weight: 700;
cursor: pointer;
transition: opacity 0.2s ease, transform 0.05s ease;
touch-action: manipulation;
}

button:hover {
opacity: 0.95;
}

button:active {
transform: translateY(1px);
}

button:disabled {
opacity: 0.55;
cursor: not-allowed;
}

.small-btn {
width: auto;
min-width: 96px;
padding: 9px 12px;
font-size: 12px;
}

.tiny-btn {
width: auto;
min-width: unset;
padding: 7px 9px;
font-size: 11px;
border-radius: 8px;
}

.print-btn {
background: #ffffff;
color: #111;
}

.secondary-btn {
background: #252525;
color: #fff;
border: 1px solid #383838;
}

.danger-btn {
background: #3b1414;
color: #fff;
border: 1px solid #6d2020;
}

.status {
min-height: 18px;
margin: 8px 0 0;
color: var(--muted);
font-size: 12px;
}

.error {
min-height: 18px;
margin: 8px 0 0;
color: var(--danger);
font-size: 12px;
}

.top-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 12px;
margin-bottom: 14px;
}

.dashboard-top-row {
align-items: flex-start;
}

.top-actions {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}

.section {
margin-top: 14px;
padding-top: 14px;
border-top: 1px solid var(--border);
}

.business-list {
display: grid;
grid-template-columns: 1fr;
gap: 8px;
}

.business-list.two-col {
grid-template-columns: 1fr;
}

.business-item {
background: var(--panel-2);
border: 1px solid var(--border-2);
border-radius: 12px;
padding: 11px 12px;
}

.business-item p {
margin: 3px 0;
color: var(--muted);
font-size: 12px;
line-height: 1.35;
}

.invoice-actions {
display: flex;
gap: 6px;
margin-top: 10px;
flex-wrap: wrap;
}

.line-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}

.line-grid.three-col {
grid-template-columns: 1fr 1fr 1fr;
}

.totals-stack {
background: var(--panel-2);
border: 1px solid var(--border-2);
border-radius: 12px;
padding: 12px;
margin: 0 0 10px;
}

.total-row {
display: flex;
justify-content: space-between;
gap: 10px;
padding: 6px 0;
border-bottom: 1px solid #222;
font-size: 13px;
}

.total-row:last-child {
border-bottom: none;
}

.total-main strong {
color: var(--gold-2);
font-size: 18px;
}

.badge-active,
.badge-inactive,
.badge-status {
display: inline-block;
padding: 4px 9px;
border-radius: 999px;
font-size: 11px;
font-weight: 700;
}

.badge-active {
background: rgba(0, 200, 120, 0.15);
color: var(--success);
border: 1px solid rgba(0, 200, 120, 0.35);
}

.badge-inactive {
background: rgba(255, 80, 80, 0.12);
color: #ff8a8a;
border: 1px solid rgba(255, 80, 80, 0.35);
}

.badge-status.paid,
.badge-status.active {
background: rgba(0, 200, 120, 0.15);
color: var(--success);
border: 1px solid rgba(0, 200, 120, 0.35);
}

.badge-status.pending,
.badge-status.sent,
.badge-status.partial,
.badge-status.reimbursed {
background: rgba(255, 209, 102, 0.15);
color: var(--warning);
border: 1px solid rgba(255, 209, 102, 0.35);
}

.badge-status.overdue {
background: rgba(255, 107, 107, 0.15);
color: var(--danger);
border: 1px solid rgba(255, 107, 107, 0.35);
}

.badge-status.cancelled,
.badge-status.dismissed,
.badge-status.skipped,
.badge-status.inactive {
background: rgba(158, 158, 158, 0.12);
color: #bdbdbd;
border: 1px solid rgba(158, 158, 158, 0.35);
}

.checkbox-group {
display: grid;
grid-template-columns: 1fr;
gap: 8px;
margin: 0 0 10px;
text-align: left;
}

.checkbox-group label,
.single-check-row {
display: flex;
align-items: center;
gap: 10px;
background: var(--panel-2);
border: 1px solid var(--border-2);
border-radius: 10px;
padding: 10px 11px;
color: #fff;
font-size: 13px;
margin-bottom: 8px;
}

.checkbox-group input[type="checkbox"],
.single-check-row input[type="checkbox"] {
width: auto;
margin: 0;
}

.hidden {
display: none !important;
}

.metric-number {
font-size: 22px;
font-weight: 700;
color: var(--gold-2);
}

.lang-select {
width: auto;
min-width: 110px;
max-width: 150px;
margin: 0;
}

.invoice-line-compact {
background: var(--panel-2);
border: 1px solid var(--border-2);
border-radius: 10px;
padding: 9px 10px;
}

.invoice-line-compact .line-top {
display: flex;
justify-content: space-between;
gap: 10px;
align-items: center;
}

.invoice-line-compact .line-top h3 {
margin: 0;
font-size: 13px;
}

.invoice-line-compact .line-mini {
margin-top: 5px;
color: var(--muted);
font-size: 11px;
}

.client-line {
padding: 8px 9px;
}

.no-print {
display: block;
}

.invoice-print-shell {
max-width: 850px;
}

.invoice-print-area {
border-top: none;
padding-top: 0;
margin-top: 0;
}

.invoice-header-block {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 6px 0 14px;
border-bottom: 1px solid var(--border);
margin-bottom: 14px;
}

.invoice-header-info h2 {
margin: 0 0 8px;
font-size: 18px;
}

.invoice-header-info p {
margin: 3px 0;
color: var(--muted);
font-size: 12px;
}

.invoice-company-title-only {
font-size: 22px;
font-weight: 700;
}

.notification-wrapper {
position: relative;
}

.notif-btn {
width: auto;
min-width: unset;
padding: 9px 11px;
border-radius: 10px;
background: var(--panel-2);
color: #fff;
border: 1px solid var(--border-2);
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
}

.notif-icon {
font-size: 18px;
line-height: 1;
}

.notif-badge {
position: absolute;
top: -6px;
right: -6px;
background: red;
color: white;
font-size: 10px;
font-weight: 700;
padding: 2px 6px;
border-radius: 999px;
min-width: 18px;
text-align: center;
}

.notif-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.62);
z-index: 1200;
display: flex;
align-items: flex-start;
justify-content: flex-end;
padding: 18px;
}

.notif-panel {
width: 360px;
max-width: 100%;
background: #111;
border: 1px solid var(--border-2);
border-radius: 16px;
padding: 12px;
box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
max-height: calc(100vh - 36px);
overflow: hidden;
display: flex;
flex-direction: column;
}

.notif-header {
padding-bottom: 10px;
border-bottom: 1px solid #222;
margin-bottom: 10px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}

.notif-header h3 {
margin: 0;
font-size: 15px;
}

.notif-close-btn {
width: auto;
min-width: unset;
padding: 8px 10px;
border-radius: 8px;
background: #222;
color: #fff;
font-size: 13px;
}

.notif-list {
display: flex;
flex-direction: column;
gap: 8px;
overflow-y: auto;
padding-right: 2px;
}

.notif-empty {
text-align: center;
color: #777;
padding: 20px 10px;
font-size: 12px;
}

.notif-group-title {
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.04em;
color: #cfcfcf;
margin: 2px 0;
}

.notif-item {
border-radius: 12px;
padding: 9px 10px;
border: 1px solid #2e2e2e;
background: #161616;
}

.notif-item h4 {
margin: 0 0 5px;
font-size: 13px;
}

.notif-item p {
margin: 0;
color: #c9c9c9;
font-size: 11px;
line-height: 1.35;
}

.notif-actions {
display: flex;
gap: 6px;
flex-wrap: wrap;
margin-top: 8px;
}

.notif-action-btn {
width: auto;
min-width: unset;
padding: 6px 8px;
font-size: 10px;
border-radius: 8px;
}

.notif-item.overdue {
border-color: rgba(255, 107, 107, 0.45);
background: rgba(255, 107, 107, 0.08);
}

.notif-item.due-soon {
border-color: rgba(255, 209, 102, 0.45);
background: rgba(255, 209, 102, 0.08);
}

.notif-item.reminder {
border-color: rgba(143, 184, 255, 0.45);
background: rgba(143, 184, 255, 0.08);
}

.notif-item.system {
border-color: rgba(158, 158, 158, 0.35);
background: rgba(158, 158, 158, 0.08);
}

.summary-row {
display: grid;
grid-template-columns: 1fr;
gap: 8px;
}

.summary-mini {
background: var(--panel-2);
border: 1px solid var(--border-2);
border-radius: 12px;
padding: 11px;
}

.summary-mini h3 {
margin-bottom: 6px;
}

.summary-mini p {
color: var(--muted);
font-size: 12px;
}

.report-collapsible {
margin-top: 10px;
}

.report-collapsible details {
background: var(--panel-2);
border: 1px solid var(--border-2);
border-radius: 12px;
padding: 10px 12px;
}

.report-collapsible details + details {
margin-top: 10px;
}

.report-collapsible summary {
cursor: pointer;
font-weight: 700;
font-size: 14px;
outline: none;
}

.report-collapsible .inner-block {
margin-top: 12px;
}

@media (min-width: 700px) {
.business-list.two-col,
.summary-row {
grid-template-columns: 1fr 1fr;
}
}

@media (max-width: 700px) {
.page-center {
padding: 10px;
}

.line-grid,
.line-grid.three-col {
grid-template-columns: 1fr;
}

.top-row,
.invoice-header-block {
flex-direction: column;
align-items: stretch;
}

.top-actions {
width: 100%;
display: grid;
grid-template-columns: auto 1fr auto;
gap: 8px;
align-items: center;
}

.lang-select {
max-width: 100%;
width: 100%;
min-width: 0;
}

.notif-overlay {
padding: 0;
align-items: flex-end;
justify-content: center;
}

.notif-panel {
width: 100%;
max-width: 100%;
border-radius: 18px 18px 0 0;
max-height: 78vh;
min-height: 48vh;
padding: 14px;
}

.notif-list {
padding-bottom: 10px;
}

.card {
padding: 14px;
border-radius: 14px;
}

.dashboard-card {
padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

h1 {
font-size: 22px;
}

h2 {
font-size: 16px;
}

.metric-number {
font-size: 20px;
}

.small-btn {
min-width: 84px;
padding: 8px 10px;
font-size: 11px;
}

.invoice-actions {
gap: 6px;
}

.invoice-actions .small-btn,
.invoice-actions .tiny-btn {
flex: 1 1 auto;
text-align: center;
}

.business-item {
padding: 10px 11px;
}

.section {
margin-top: 12px;
padding-top: 12px;
}

.totals-stack {
padding: 10px;
}

.invoice-header-info h2 {
font-size: 17px;
}

.invoice-company-title-only {
font-size: 18px;
}
}

@media print {
body {
background: white !important;
color: black !important;
}

.page-center {
padding: 0;
min-height: auto;
display: block;
}

.card,
.dashboard-card,
.business-item,
.totals-stack,
.invoice-line-compact,
.summary-mini,
.report-collapsible details {
background: white !important;
color: black !important;
border: 1px solid #ddd !important;
box-shadow: none !important;
}

.no-print,
.invoice-actions,
.status,
.error,
.subtitle,
.lang-select,
.notification-wrapper,
.notif-overlay {
display: none !important;
}

h1, h2, h3, h4, p, strong, span, div, summary {
color: black !important;
}

.invoice-header-block {
border-bottom: 1px solid #ccc !important;
margin-bottom: 18px !important;
}
}

body {
  opacity: 1;
  transform: none;
  transition: opacity .18s ease, transform .18s ease;
}
body.page-ready {
  opacity: 1;
  transform: none;
}
body.sheet-open {
  overflow: hidden;
}
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(66px + env(safe-area-inset-bottom));
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(13,13,13,.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid #272727;
  display: grid;
  grid-template-columns: 1fr 1fr auto 1fr auto;
  gap: 8px;
  align-items: center;
  z-index: 1500;
}
.bottom-nav a,
.bottom-nav button {
  width: 100%;
  min-width: 0;
  padding: 10px 8px;
  border-radius: 12px;
  text-align: center;
  font-size: 12px;
  text-decoration: none;
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #2e2e2e;
}
.bottom-nav a.active {
  border-color: var(--gold);
  color: var(--gold-2);
}
.bottom-nav .fab-trigger {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  background: var(--gold);
  color: #111;
  border: none;
}
.fab-overlay {
  position: fixed;
  inset: 0;
  z-index: 1550;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.fab-sheet {
  width: 100%;
  max-width: 560px;
  background: #111;
  border: 1px solid #262626;
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.fab-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.fab-sheet-header button {
  width: auto;
  min-width: unset;
  padding: 8px 10px;
  background: #232323;
  color: #fff;
}
.fab-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.fab-actions a {
  display: block;
  text-decoration: none;
  color: #fff;
  background: #1a1a1a;
  border: 1px solid #2f2f2f;
  border-radius: 12px;
  padding: 13px 12px;
  text-align: center;
  font-size: 13px;
}
.search-inline-wrap {
  border-top: none;
  padding-top: 0;
}
@media (max-width:700px){
  .page-center { padding-bottom: calc(94px + env(safe-area-inset-bottom)); }
  .card.dashboard-card, .card.compact-card, .card.invoice-builder-card, .card { scroll-margin-bottom: 90px; }
  .section h2 { margin-bottom: 8px; }
  .business-item h3 { font-size: 13px; }
}
@media (min-width:701px){
  .bottom-nav { display:none; }
  .fab-overlay { display:none; }
  body { opacity: 1; transform:none; }
}
