:root {
    --sidebar: #142033;
    --sidebar-soft: #1d2c45;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --success: #16a34a;
    --surface: #ffffff;
    --page: #f4f7fb;
    --text: #172033;
    --muted: #687385;
    --border: #e4e9f2;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--page);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

.login-page {
    min-height: 100vh;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(rgba(244, 247, 251, 0.2), rgba(244, 247, 251, 0.2)), url("../picture/loginBackgrond.png") center/cover no-repeat;
}

.login-card {
    width: min(100%, 430px);
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(8px);
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 0 auto 18px;
    text-align: center;
}

.login-logo {
    display: block;
    width: 150px;
    height: 80px;
    margin: 0 auto;
    object-fit: contain;
}

.brand-logo {
    width: 25px;
    height: 25px;
    object-fit: contain;
}
.login-brand strong,
.login-brand small {
    display: block;
}

.login-brand small {
    color: var(--muted);
    margin-top: 2px;
}

.login-card h1 {
    margin: 8px 0;
    font-size: 30px;
    font-weight: 750;
}

.login-card p {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.6;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    color: var(--text);
    font-weight: 700;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.login-input-icon,
.clear-input {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.login-input-icon {
    top: 50%;
    left: 12px;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 2;
}

.login-input-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-form input {
    min-height: 44px;
    width: 100%;
    max-width: none;
    padding: 10px 46px 10px 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
}

.login-form input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(37, 99, 235, 0.14);
}

.clear-input {
    top: 7px;
    right: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    transform: none;
    z-index: 2;
}

.clear-input:hover,
.clear-input:focus {
    color: var(--text);
    background: #eef2f7;
    outline: none;
}

.login-form .primary-action {
    margin-top: 8px;
}

.login-register-link,
.registration-login-link {
    margin-top: 18px;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

.login-register-link a,
.registration-login-link a {
    color: var(--accent);
    text-decoration: none;
}

.login-register-link a:hover,
.login-register-link a:focus,
.registration-login-link a:hover,
.registration-login-link a:focus {
    color: var(--accent-dark);
    text-decoration: underline;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    min-height: 100vh;
    padding: 22px 16px;
    color: #eaf0ff;
    background: var(--sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 18px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(203, 213, 225, 0.24);
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand small {
    color: #aebce0;
    font-size: 12px;
    margin-top: 2px;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #22c55e;
    color: #07111f;
    font-weight: 800;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
}

.sidebar-wordmark {
    display: block;
    max-width: 165px;
    max-height: 54px;
    object-fit: contain;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
    align-content: start;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(174, 188, 224, 0.55) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(174, 188, 224, 0.55); border-radius: 4px; }

.nav-item {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #c7d2fe;
    font-weight: 600;
    text-decoration: none;
}

.nav-expander {
    display: grid;
    gap: 3px;
}

.nav-expander summary {
    cursor: pointer;
    list-style: none;
}

.nav-expander summary::-webkit-details-marker {
    display: none;
}

.nav-expander summary::after {
    content: "+";
    margin-left: auto;
    color: #aebce0;
    font-weight: 800;
}

.nav-expander[open] summary::after {
    content: "-";
}

.nav-submenu {
    display: grid;
    gap: 2px;
    padding: 0 0 3px 38px;
}

.nav-subitem {
    min-height: 30px;
    padding: 6px 8px;
    border-radius: 8px;
    color: #aebce0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.nav-subitem:hover,
.nav-subitem:focus {
    background: var(--sidebar-soft);
    color: #ffffff;
    text-decoration: none;
}

.nav-subitem.nav-item-active {
    background: rgba(37, 99, 235, 0.28);
    color: #ffffff;
}

.nav-item-muted {
    cursor: default;
}

.nav-item:hover,
.nav-item:focus {
    background: var(--sidebar-soft);
    color: #ffffff;
    text-decoration: none;
}

.nav-item-active {
    background: var(--accent);
    color: #ffffff;
}

.nav-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: currentColor;
    flex: 0 0 24px;
}

.nav-icon svg,
.nav-subicon svg,
.logout-button svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: currentColor;
}

.nav-subicon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    flex: 0 0 18px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
    font-size: 13px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
}

.main-area {
    width: calc(100% - 260px);
    min-height: 100vh;
    margin-left: 260px;
}

.topbar {
    min-height: 76px;
    padding: 18px 40px;
    background: linear-gradient(90deg, #ffffff 0%, #f8fbff 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.page-label,
.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 4px 0 0;
    font-size: 28px;
    font-weight: 700;
}

.topbar-chip {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--muted);
    font-weight: 700;
}

.topbar-chip-connected {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.topbar-chip-connected .status-dot {
    background: #22c55e;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logout-button {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: #dc2626;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.24);
    text-decoration: none;
}

.logout-button:hover,
.logout-button:focus {
    color: #ffffff;
    background: #b91c1c;
    text-decoration: none;
}

.content-area {
    padding: 15px 15px;
}

.connect-screen {
    min-height: calc(100vh - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.connect-card {
    width: min(100%, 620px);
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.connect-card h2 {
    margin: 8px 0;
    font-size: 32px;
    font-weight: 750;
}

.connect-card p {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
}

.hero-panel,
.stat-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.hero-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    margin-bottom: 20px;
}

.hero-panel h2 {
    margin: 8px 0;
    font-size: 30px;
    font-weight: 750;
}

.hero-panel p {
    max-width: 620px;
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.quick-stats-grid {
    margin-bottom: 20px;
}

.quick-stats-grid .stat-card {
    border-radius: 18px;
    border-bottom-width: 5px;
    border-bottom-style: solid;
}

.stat-card-invoice {
    border-bottom-color: #2563eb;
}

.stat-card-credit {
    border-bottom-color: #16a34a;
}

.stat-card-purchase {
    border-bottom-color: #7c3aed;
}

.stat-card-debit {
    border-bottom-color: #db2777;
}

.connect-form {
    margin: 0;
    flex: 0 0 auto;
}

.primary-action {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
}

.primary-action:hover,
.primary-action:focus {
    background: var(--accent-dark);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.dashboard-company-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 20px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    background: #ffffff;
}

.dashboard-company-action strong {
    display: block;
    margin-top: 3px;
}

.dashboard-company-action button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.stat-card {
    padding: 20px;
}

.stat-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 10px;
    font-size: 28px;
    line-height: 1.1;
}

.stat-card small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.dashboard-panels {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 20px;
}

.panel {
    padding: 20px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.panel-heading h3 {
    margin: 4px 0 0;
}

.flow-steps {
    display: grid;
    gap: 14px;
}

.flow-step {
    display: flex;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.flow-step > span {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 800;
    flex: 0 0 auto;
}

.flow-step p {
    margin: 4px 0 0;
    color: var(--muted);
}

.health-list {
    display: grid;
    gap: 12px;
}

.health-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.health-item span {
    color: var(--muted);
}

.health-item strong {
    color: var(--success);
}

.token-panel,
.response-panel {
    max-width: 860px;
}

.panel-copy,
.response-text {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
}

.response-text {
    max-width: 100%;
    overflow-wrap: break-word;
    color: var(--text);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.status-success {
    background: #dcfce7;
    color: #166534;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-pending {
    background: #ffedd5;
    color: #9a3412;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
}

.grid-panel {
    max-width: 1180px;
}

.grid-toolbar {
    min-height: 46px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.grid-filter-form {
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    display: grid;
    grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
}

.filter-field {
    display: grid;
    gap: 6px;
}

.filter-field label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.filter-field input,
.filter-field select {
    min-height: 40px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.secondary-action {
    min-height: 34px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    text-decoration: none;
}

.secondary-action:hover,
.secondary-action:focus {
    color: var(--accent-dark);
    text-decoration: none;
}

.empty-state-panel {
    display: grid;
    gap: 6px;
    padding: 24px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
}

.empty-state-panel strong {
    color: var(--text);
    font-size: 16px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.42);
}

.modal-backdrop.modal-open {
    display: flex;
}

.modal-card {
    width: min(760px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
    padding: 22px;
}

.purchase-modal-card {
    width: min(860px, 100%);
}

.modal-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-heading h3 {
    margin: 2px 0 0;
    color: var(--text);
    font-size: 22px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-weight: 700;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.purchase-create-form {
    display: block;
}

.form-field-wide {
    grid-column: 1 / -1;
}

.data-grid-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-grid {
    width: 100%;
    border-collapse: collapse;
}

.data-grid th,
.data-grid td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    white-space: nowrap;
}

.invoice-grid th:nth-child(5),
.invoice-grid th:nth-child(6),
.invoice-grid th:nth-child(7),
.invoice-grid td:nth-child(5),
.invoice-grid td:nth-child(6),
.invoice-grid td:nth-child(7),
.manual-grid th:nth-child(6),
.manual-grid th:nth-child(7),
.manual-grid th:nth-child(8),
.manual-grid td:nth-child(6),
.manual-grid td:nth-child(7),
.manual-grid td:nth-child(8) {
    text-align: right;
}

.data-grid th {
    color: var(--muted);
    background: #f8fafc;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.data-grid td {
    color: var(--text);
}

.empty-cell {
    color: var(--muted);
    text-align: center;
}

.alert-box {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
}

.alert-success-box {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.settings-panel {
    max-width: 940px;
}

.registration-panel {
    width: min(100%, 940px);
    margin: 32px auto;
}

.registration-card {
    padding: 0;
    overflow: hidden;
}

.registration-title {
    margin: 0;
    padding: 22px 28px 8px;
    justify-content: center;
    text-align: center;
}

.registration-title h3 {
    margin: 0;
    font-size: 22px;
}

.settings-form {
    display: grid;
    gap: 16px;
}

.registration-form {
    display: block;
    padding: 16px 20px 24px;
}

.registration-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 22px;
}

.registration-steps {
    padding: 10px 0;
    border-right: 1px solid var(--border);
    display: grid;
    align-content: start;
    gap: 8px;
}

.registration-step {
    min-height: 44px;
    padding: 8px 12px 8px 0;
    color: var(--muted);
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.registration-step:hover,
.registration-step:focus {
    color: var(--accent);
    text-decoration: none;
}

.registration-step span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
}

.registration-step strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 12px;
    font-weight: 800;
}

.registration-step-active {
    color: var(--text);
}

.registration-step-active span {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.registration-main {
    display: grid;
    gap: 16px;
}

.registration-section {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.registration-section-heading {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.registration-section-heading > span {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 900;
}

.registration-section-heading h4 {
    margin: 1px 0 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
}

.registration-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.registration-grid-full {
    grid-column: 1 / -1;
}

.username-suggestion-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.username-suggestion-button {
    min-height: 40px;
    white-space: nowrap;
}

.username-suggestion {
    margin-top: 4px;
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
}

.registration-submit {
    width: 100%;
}

.field-validation-error {
    color: #b91c1c;
    font-size: 12px;
    font-weight: 800;
}

.settings-check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.settings-check {
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.einvoice-settings-page {
    display: grid;
    gap: 20px;
}

.einvoice-settings-page > h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
}

.einvoice-settings-form {
    display: grid;
    gap: 20px;
}

.settings-card {
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.settings-card h3 {
    margin: 0 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}

.settings-card h4 {
    margin: 22px 0 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.settings-field-grid {
    display: grid;
    gap: 16px;
}

.settings-general-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-two-column-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-field {
    display: grid;
    gap: 6px;
}

.settings-field label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.settings-field input,
.settings-field select {
    min-height: 42px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.settings-field input:focus,
.settings-field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.settings-field input[readonly] {
    background: #f8fafc;
    color: var(--muted);
}

.settings-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.settings-save-row {
    display: flex;
    justify-content: flex-end;
}

.settings-save-button {
    min-height: 44px;
    padding: 0 26px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.settings-save-button:hover,
.settings-save-button:focus {
    background: var(--accent-dark);
}

.pagination-bar {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-weight: 700;
}

.pagination-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.page-link {
    min-width: 36px;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    text-decoration: none;
}

.page-link:hover,
.page-link:focus {
    color: var(--accent);
    text-decoration: none;
}

.page-link-active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.page-link-disabled {
    pointer-events: none;
    opacity: 0.48;
}

.inline-action-form {
    margin: 0;
}

.manual-send-form {
    margin: 0;
}

.manual-progress {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.manual-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.manual-progress-status {
    color: var(--text);
    font-weight: 800;
}

.manual-progress-count {
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}

.manual-progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.manual-progress-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.35s ease;
}

.manual-progress-active .manual-progress-bar {
    background: #16a34a;
}

.manual-progress-warning {
    border-color: #f59e0b;
    background: #fffbeb;
}

.manual-progress-warning .manual-progress-status {
    color: #92400e;
}

.manual-send-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.grid-action-button {
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: var(--accent);
    background: #eff6ff;
    font-weight: 700;
    cursor: pointer;
}

.grid-action-button:hover,
.grid-action-button:focus {
    color: #ffffff;
    background: var(--accent);
}

.app-shell {
    font-size: 13px;
}

.app-shell .sidebar-brand strong {
    font-size: 13px;
}

.app-shell .sidebar-brand small,
.app-shell .nav-subitem,
.app-shell .sidebar-footer,
.app-shell .page-label,
.app-shell .eyebrow,
.app-shell .filter-field label,
.app-shell .data-grid th,
.app-shell .status-badge,
.app-shell .topbar-chip {
    font-size: 11px;
}

.app-shell .nav-item {
    font-size: 13px;
}

.app-shell .nav-item { min-height: 38px; padding: 8px 10px; }

.app-shell .topbar h1 {
    font-size: 22px;
}

.app-shell .hero-copy h2 {
    font-size: 26px;
}

.app-shell .connect-card h2 {
    font-size: 24px;
}

.app-shell .metric-value {
    font-size: 24px;
}

.app-shell .hero-copy p,
.app-shell .connect-card p,
.app-shell .empty-state {
    font-size: 14px;
}

.app-shell .panel-heading h3 {
    font-size: 16px;
}

.app-shell .filter-field input,
.app-shell .filter-field select,
.app-shell .data-grid td,
.app-shell .primary-action,
.app-shell .grid-action-button,
.app-shell .page-link {
    font-size: 12px;
}

@media (max-width: 980px) {
    .grid-filter-form {
        grid-template-columns: 1fr 1fr;
    }

    .registration-layout {
        grid-template-columns: 170px minmax(0, 1fr);
    }

    .sidebar {
        width: 86px;
        padding-inline: 12px;
    }

    .sidebar-brand span:last-child,
    .nav-item span:last-child,
    .nav-expander summary::after,
    .nav-submenu,
    .sidebar-footer span:last-child {
        display: none;
    }

    .main-area {
        width: calc(100% - 86px);
        margin-left: 86px;
    }

    .dashboard-grid,
    .dashboard-panels {
        grid-template-columns: 1fr 1fr;
    }

    .panel-large {
        grid-column: 1 / -1;
    }

    .settings-card-grid,
    .settings-general-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .topbar { padding-left: 20px; padding-right: 20px; }
    .grid-filter-form {
        grid-template-columns: 1fr;
    }

    .pagination-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .sidebar-brand,
    .sidebar-footer {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        width: 100%;
    }

    .nav-item {
        flex: 1 0 auto;
    }

    .main-area {
        width: 100%;
        margin-left: 0;
    }

    .topbar,
    .content-area {
        padding: 20px;
    }

    .topbar,
    .hero-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .connect-form,
    .primary-action {
        width: 100%;
    }

    .dashboard-grid,
    .dashboard-panels {
        grid-template-columns: 1fr;
    }

    .registration-form {
        padding: 12px 14px 20px;
    }

    .registration-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .registration-steps {
        padding: 0 0 12px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .registration-step {
        min-height: 38px;
        padding: 6px;
        grid-template-columns: 22px minmax(0, 1fr);
        gap: 6px;
    }

    .registration-grid {
        grid-template-columns: 1fr;
    }

    .username-suggestion-row {
        grid-template-columns: 1fr;
    }

    .registration-panel {
        margin: 16px auto;
    }

    .settings-two-column-grid {
        grid-template-columns: 1fr;
    }

    .settings-save-row {
        justify-content: stretch;
    }

    .settings-save-button {
        width: 100%;
    }
}
.purchase-capture-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.purchase-capture-actions label { display: grid; gap: 4px; }
.purchase-capture-actions > .primary-action, .purchase-capture-actions > .secondary-action { margin-top: 18px; }
.purchase-capture-actions .primary-action, .purchase-capture-actions .secondary-action { min-height: 34px; padding: 7px 16px; }
.purchase-table-scroll { overflow-x: auto; max-width: 100%; }
.purchase-mapping-dialog { width: min(1200px, 96vw); max-height: 90vh; overflow: auto; border: 1px solid #d5dae1; border-radius: 8px; padding: 24px; color: #202934; background: #fff; }
.purchase-mapping-dialog { margin: 5vh auto; box-shadow: 0 16px 48px rgba(20, 31, 48, .18); }
.purchase-mapping-dialog::backdrop { background: rgba(28, 39, 54, .24); }
.purchase-master-dialog { width: min(640px, 96vw); }
.purchase-inline-field { display: flex; align-items: center; gap: 8px; }
.purchase-inline-field select { flex: 1; min-width: 0; }
.purchase-mapping-dialog [hidden] { display: none !important; }
.purchase-mapping-dialog .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.purchase-mapping-dialog .form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.purchase-mapping-dialog .form-field label { font-size: 13px; font-weight: 600; }
.purchase-mapping-dialog input, .purchase-mapping-dialog textarea, .purchase-mapping-dialog select, .purchase-capture-actions input { padding: 8px 10px; border: 1px solid #cbd2dc; border-radius: 4px; font: inherit; min-width: 0; }
.purchase-mapping-dialog input, .purchase-mapping-dialog textarea { width: 100%; }
.purchase-table-scroll .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.purchase-table-scroll th, .purchase-table-scroll td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #e1e5eb; vertical-align: middle; }
.purchase-table-scroll td:last-child { width: 132px; min-width: 132px; white-space: nowrap; }
.purchase-table-scroll td:last-child .secondary-action { width: 24px; min-width: 24px; height: 28px; padding: 4px; white-space: nowrap; border: 0; background: transparent; }
.create-bill-icon { width: 18px; height: 18px; vertical-align: -3px; fill: none; color: #2463eb; }
.purchase-pagination { margin-top: 14px; }
.invoice-summary-cards { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:14px; margin-bottom:18px; }
.invoice-grid-panel { display:flex; flex-direction:column; }
.invoice-grid-panel .panel-heading { order:0; }
.invoice-grid-panel .grid-filter-form { order:1; align-self:flex-end; width:min(100%, 680px); grid-template-columns:minmax(250px, 1fr) minmax(190px, 220px); justify-content:end; gap:12px; margin:0 0 14px; }
.invoice-grid-panel .invoice-summary-cards { order:2; width:100%; }
.invoice-grid-panel .data-grid-wrap { order:3; }
.invoice-grid-panel .pagination-bar { order:4; }
.invoice-summary-card { min-height:76px; padding:14px 18px 12px; display:flex; flex-direction:column; justify-content:space-between; text-decoration:none; color:var(--text); background:#fff; border-radius:8px; border-bottom:4px solid var(--accent); box-shadow:0 2px 10px rgba(25, 39, 58, .08); transition:transform .15s ease, box-shadow .15s ease; }
.invoice-summary-card:hover, .invoice-summary-card:focus { color:var(--text); text-decoration:none; transform:translateY(-1px); box-shadow:0 5px 14px rgba(25, 39, 58, .14); }
.invoice-summary-card span { font-size:12px; color:#536174; }
.invoice-summary-card strong { font-size:25px; line-height:1; color:#111827; }
.invoice-summary-card.total-card { border-bottom-color:#2563eb; }
.invoice-summary-card.pending-card { border-bottom-color:#f59e0b; }
.invoice-summary-card.success-card { border-bottom-color:#16a34a; }
.invoice-summary-card.fail-card { border-bottom-color:#dc2626; }
@media (max-width:700px) { .invoice-summary-cards { grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; } .invoice-summary-card { min-height:68px; padding:11px 13px 10px; } }
.grid-filter-form { background: transparent; border: 0; padding: 4px 0 12px; }
.filter-field { min-height: 0; }
.data-grid-wrap { overflow-x: auto; }
.data-grid { width: 100%; }
.data-grid th { background: #2563eb; color: #fff; height: 36px; padding: 7px 10px; font-size: 11px; }
.data-grid td { height: 38px; padding: 7px 10px; font-size: 12px; }
.data-grid tr { height: 38px; }
.uuid-column { width: 150px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tracking-report-grid .tracking-message { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { padding: 3px 7px; font-size: 11px; }
.users-roles-grid { display:flex; flex-direction:column; gap:18px; align-items:stretch; }
.page-toolbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
.page-toolbar h2 { margin:0; }
.users-list-panel, .user-details-panel { width:100%; }
.users-list-panel .panel-heading { min-height:42px; padding:0 0 10px; }
.users-list-panel .data-table { table-layout:fixed; }
.users-list-panel .data-table th, .users-list-panel .data-table td { padding:8px 10px; height:36px; }
.users-list-panel .data-table th:nth-child(1) { width:16%; }
.users-list-panel .data-table th:nth-child(2) { width:23%; }
.users-list-panel .data-table th:nth-child(3) { width:25%; }
.users-list-panel .data-table th:nth-child(4) { width:24%; }
.users-list-panel .data-table th:nth-child(5) { width:12%; }
.user-details-panel { padding:22px 24px; }
.user-details-panel h3 { margin-bottom:18px; font-size:20px; }
.user-details-panel .settings-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:14px 20px; }
.user-details-panel .form-field { display:flex; flex-direction:column; gap:6px; min-width:0; }
.user-details-panel .form-field label { font-size:13px; font-weight:600; color:var(--text); }
.user-details-panel .form-field input[type="text"], .user-details-panel .form-field input[type="password"] { width:100%; min-height:38px; }
.user-details-panel .settings-save-row { margin-top:18px; }
.role-checks { display:flex; flex-wrap:wrap; gap:10px 18px; }
.role-checks label { display:flex; gap:6px; align-items:center; font-weight:600; }
@media (max-width: 640px) { .user-details-panel .settings-grid { grid-template-columns:1fr; } .user-details-panel { padding:18px; } }
.purchase-table-scroll th { background: #f3f5f8; font-weight: 600; }
.purchase-table-scroll .data-table th { background: #2563eb; color: #fff; height: 38px; padding: 6px 9px; font-size: 12px; }
.purchase-table-scroll .data-table td { height: 30px; padding: 5px 9px; font-size: 12px; }
#purchaseInbox #purchaseStatus { background: #f3f5f8; color: #293340; border-color: #dbe1e8; }
.purchase-mapping-dialog p { overflow-wrap: anywhere; }
.purchase-modal-title { padding: 2px 0 14px; border-bottom: 1px solid #e5e9ef; margin-bottom: 16px; }
.purchase-modal-title h3 { font-size: 20px; line-height: 1.25; margin: 0; color: #172334; }
.purchase-section-title { font-size: 16px; line-height: 1.3; margin: 20px 0 10px; padding: 6px 0; color: #253348; border-bottom: 1px solid #e5e9ef; }
.purchase-create-button { background: #2563eb !important; border-color: #2563eb !important; color: #fff !important; min-width: 124px; box-shadow: 0 2px 5px rgba(37, 99, 235, .22); }
.purchase-create-button:hover, .purchase-create-button:focus { background: #1d4ed8 !important; border-color: #1d4ed8 !important; }
.purchase-mapping-dialog .modal-actions { padding-top: 16px; margin-top: 16px; border-top: 1px solid #e5e9ef; }
@media (max-width: 640px) {
    .purchase-mapping-dialog .settings-grid { grid-template-columns: minmax(0, 1fr); }
    #purchaseInbox .panel-heading { flex-direction: column; align-items: stretch; gap: 14px; }
    .purchase-capture-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.purchase-mapping-dialog select { max-width: 100%; min-height: 36px; }
.purchase-mapping-table { min-width: 960px; }
.purchase-mapping-table select { width: 205px; }
#purchaseProgress { width: 100%; height: 6px; }
#purchaseStatus, #purchaseMappingStatus { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Keep every data grid dense, including grids rendered by the smaller pages. */
.data-grid th, .data-table th {
    height: 38px;
    min-height: 38px;
    padding: 8px 8px;
    line-height: 1.2;
}
.data-grid td, .data-table td {
    height: 30px;
    min-height: 30px;
    padding: 4px 8px;
    line-height: 1.15;
}
.data-grid tr, .data-table tr { height: 30px; }
.grid-action-cell { width: 72px; text-align: center; white-space: nowrap; }
.download-menu { position: relative; display: inline-block; }
.download-menu summary { list-style: none; cursor: pointer; color: #2463eb; font-weight: 600; font-size: 12px; width: 24px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 0; background: transparent; }
.download-menu summary::-webkit-details-marker { display: none; }
.download-menu summary::after { content: none; }
.download-action-icon { width: 16px; height: 16px; fill: currentColor; }
.download-menu-items { position: absolute; z-index: 20; right: 0; top: 22px; min-width: 84px; padding: 4px; background: #fff; border: 1px solid #d9e0eb; box-shadow: 0 6px 16px rgba(20, 36, 58, .14); }
.download-menu-items a { display: block; padding: 6px 8px; color: #1d3557; font-size: 12px; text-decoration: none; }
.download-menu-items a:hover { background: #eef4ff; color: #2463eb; }
.tracking-message-button { border: 0; background: transparent; color: #2463eb; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.tracking-message-dialog { width: min(680px, 92vw); max-height: 80vh; border: 1px solid #d5dae1; border-radius: 8px; padding: 20px; box-shadow: 0 16px 48px rgba(20, 31, 48, .18); }
.tracking-message-dialog::backdrop { background: rgba(28, 39, 54, .24); }
.tracking-message-content { max-height: 55vh; overflow: auto; white-space: pre-wrap; color: #202934; line-height: 1.45; }
