* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; line-height: 1.5; color: #222; background: #f3f5f7; min-height: 100vh; }

/* ---- Top bar ---- */
.topbar { background: #305d8c; color: white; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.topbar .brand { color: white; text-decoration: none; font-size: 20px; font-weight: bold; padding: 0 16px 0 0; border-right: 1px solid rgba(255,255,255,0.2); margin-right: 8px; display: inline-flex; align-items: center; gap: 8px; }
.brand-logo { height: 28px; width: 28px; object-fit: contain; }
.top-nav { display: flex; gap: 2px; flex: 1; }
.top-nav a { color: white; text-decoration: none; padding: 8px 14px; border-radius: 4px; font-size: 14px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; margin: 0 5px; }
.top-nav a:hover { background: rgba(255,255,255,0.15); }
.top-nav a.active { background: rgba(255,255,255,0.2); }

/* Monochrome icons — match BPay WPF look. Force text presentation
   (variation selector U+FE0E on the glyph, plus font-variant-emoji)
   and desaturate with a filter as a fallback for browsers that
   ignore the text-presentation hint. */
.top-nav .ico, .side-nav .nav-ico, .topbar-user .btn-link .ico, .topbar .brand .ico {
    font-family: "Segoe UI Symbol", "Segoe UI", system-ui, sans-serif;
    font-variant-emoji: text;
    filter: grayscale(1) brightness(2);
}
.side-nav .nav-ico { filter: grayscale(1); }   /* keep readable on white bg */
.top-nav .ico { font-size: 18px; line-height: 1; }

.topbar-user { display: flex; align-items: center; gap: 12px; color: white; font-size: 13px; margin-left: auto; }
.topbar-user a { color: white; text-decoration: none; }
.user-name { opacity: 0.8; }
.btn-link { background: none; border: 0; color: white; cursor: pointer; padding: 6px 10px; border-radius: 4px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.btn-link:hover { background: rgba(255,255,255,0.15); }

/* ---- Filter bar ---- */
.filter-bar { background: white; padding: 12px 24px; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid #e0e4e8; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.filter-bar select { padding: 8px 12px; border: 1px solid #ccd2d8; border-radius: 4px; font-size: 14px; background: white; min-width: 120px; }
.filter-bar .grow { flex: 1; }
.filter-bar .btn-load { background: #305d8c; color: white; border: 0; padding: 9px 18px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.filter-bar .btn-load:hover { background: #244769; }
.filter-bar .btn-load .caret { font-size: 11px; margin-left: 6px; }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: 100%; margin-top: 4px; background: white; border: 1px solid #d0d6dc; border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,0.12); list-style: none; min-width: 220px; z-index: 50; padding: 4px 0; }
.dropdown-menu li { margin: 0; }
.dropdown-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 16px; cursor: pointer; font-size: 14px; color: #2d3748; }
.dropdown-item:hover { background: #f0f4f7; }

/* ---- Workspace (sidebar + content) ---- */
.workspace { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 56px - 49px); }

.side-nav { background: #fff; border-right: 1px solid #e0e4e8; padding: 0; }
.side-nav-title { padding: 16px 20px; font-size: 13px; font-weight: 600; color: white; background: #305d8c; letter-spacing: 0.3px; }
.side-nav ul { list-style: none; }
.side-nav a { display: block; padding: 14px 20px; color: #2d3748; text-decoration: none; border-bottom: 1px solid #f0f2f5; font-size: 14px; }
.side-nav a:hover { background: #f7f9fb; }
.side-nav a.active { background: #305d8c; color: white; }
.side-nav .nav-ico { font-size: 18px; margin-right: 8px; vertical-align: middle; }
.side-nav .nav-label { font-weight: 600; display: block; }
.side-nav .nav-sub { display: block; font-size: 12px; color: #888; margin-top: 2px; }
.side-nav a.active .nav-sub { color: rgba(255,255,255,0.7); }

.content { padding: 24px 32px; overflow-y: auto; }
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.content-header h1 { color: #2d3748; font-size: 22px; }

/* ---- Stats / cards ---- */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-pill { padding: 20px; border-radius: 6px; }
.stat-pill .top { display: flex; justify-content: space-between; align-items: center; }
.stat-pill h3 { font-size: 36px; font-weight: bold; margin-top: 8px; }
.stat-pill .label { font-size: 13px; }
.stat-pill.red { background: #fdecea; border: 1px solid #f7c4be; color: #b71c1c; }
.stat-pill.orange { background: #fff4e0; border: 1px solid #ffd6a0; color: #c95b0a; }
.stat-pill.green { background: #e8f5e9; border: 1px solid #b6dcb7; color: #1b5e20; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card { background: white; border-radius: 6px; padding: 18px 20px; border-left: 4px solid #305d8c; }
.card.blue { border-left-color: #4a90e2; background: #ebf3fc; }
.card.dark { border-left-color: #305d8c; background: #d8e3f0; }
.card .card-label { font-size: 13px; color: #666; display: flex; align-items: center; gap: 6px; }
.card .card-value { font-size: 28px; font-weight: bold; color: #2d3748; margin-top: 6px; }
.card .card-sub { font-size: 12px; color: #888; margin-top: 4px; }

/* ---- Anonymous pages (login/register) ---- */
.anon-page { background: linear-gradient(135deg, #305d8c 0%, #1e3d5c 100%); min-height: 100vh; display: grid; place-items: center; margin: 0; }
.anon-main { width: 100%; max-width: 420px; padding: 24px; }
.auth-card { background: white; padding: 32px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.auth-card h1 { color: #305d8c; margin-bottom: 24px; text-align: center; }

/* ---- Forms / common ---- */
.form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.form-row.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.form-row label { font-size: 13px; color: #666; }
.form-row input, .form-row select, .form-row textarea { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
.error { color: #c33; font-size: 12px; }
.error-summary { background: #fee; border: 1px solid #fcc; color: #c33; padding: 8px 12px; border-radius: 4px; margin-bottom: 16px; }

.btn { padding: 8px 16px; border-radius: 4px; text-decoration: none; display: inline-block; cursor: pointer; border: 0; font-size: 14px; }
.btn-primary { background: #305d8c; color: white; }
.btn-primary:hover { background: #244769; }
.btn-secondary { background: #e0e0e0; color: #333; }
.btn-block { width: 100%; padding: 12px 24px; }

.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 6px; overflow: hidden; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
.data-table thead { background: #f5f5f5; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table td.num, .data-table th.num { text-align: right; }
.row-paid { background: #e8f5e9; }
.row-ordered { background: #fff8e1; }
.row-unselected { opacity: 0.45; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.inline { display: inline; }
.details dt { font-weight: 600; margin-top: 12px; color: #555; }
.details dd { margin-left: 0; }

/* ---- Entity forms (Companies, Employees, BankAccounts) ---- */
.entity-form { background: white; padding: 28px 32px; border-radius: 8px; max-width: 880px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.entity-form fieldset { border: 0; border-top: 1px solid #e0e4e8; padding: 18px 0 8px; margin-top: 8px; }
.entity-form fieldset:first-of-type { border-top: 0; padding-top: 0; }
.entity-form legend { font-size: 13px; font-weight: 600; color: #305d8c; padding: 0 8px 8px 0; text-transform: uppercase; letter-spacing: 0.4px; }
.entity-form .form-row { margin-bottom: 14px; }
.entity-form .form-row input,
.entity-form .form-row select,
.entity-form .form-row textarea { padding: 9px 11px; border: 1px solid #ccd2d8; border-radius: 4px; font-size: 14px; background: white; }
.entity-form .form-row input:focus,
.entity-form .form-row select:focus { outline: none; border-color: #305d8c; box-shadow: 0 0 0 3px rgba(48,93,140,0.12); }
.entity-form .form-row label { font-weight: 600; color: #2d3748; font-size: 13px; }
.entity-form .form-row.checkbox label { font-weight: normal; }
.entity-form .form-row small { color: #888; font-size: 12px; margin-top: 2px; }
.entity-form .form-actions { margin-top: 24px; padding-top: 18px; border-top: 1px solid #e0e4e8; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
@@media (max-width: 720px) { .form-grid-2 { grid-template-columns: 1fr; } }

.import-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 24px; }
.import-card { background: white; padding: 24px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.import-card h3 { color: #305d8c; margin-bottom: 8px; }
.import-card form { display: flex; flex-direction: column; gap: 8px; }
