* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1e293b;
    background: #fff;
    min-height: 100vh;
}

.dev-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 0.35rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    background: #f59e0b;
    color: #1c1917;
}

.dev-banner[hidden] {
    display: none;
}

body:has(#dev-banner:not([hidden])) {
    padding-top: 2rem;
}

.container {
    max-width: 85%;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    min-height: 100vh;
}

.container:has(.admin-content),
.container:has(.onboarding-content) {
    max-width: 96%;
}

h1 {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 1.5rem 0;
    color: #0f172a;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: #0f172a;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    font-weight: 500;
    font-size: 0.9375rem;
    color: #334155;
}

input {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-width: 0;
    overflow-x: auto;
}

input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input::placeholder {
    color: #94a3b8;
}

button {
    padding: 0.875rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

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

button.secondary {
    background: #64748b;
}

button.secondary:hover {
    background: #475569;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.error {
    color: #dc2626;
    font-size: 0.875rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.invoice-list .card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.invoice-list .card:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #e2e8f0;
}

.invoice-list .status {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.invoice-list .status.draft {
    color: #64748b;
}

.invoice-list .status.sent {
    color: #2563eb;
}

.invoice-list .status.paid {
    color: #16a34a;
}

.invoice-list .card-amount {
    color: #0f172a;
}

/* Top nav bar */
.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 1.5rem;
}

.nav a {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.nav a:hover {
    color: #2563eb;
    background: #e0e7ff;
    text-decoration: none;
}

.nav a[href="#"] {
    margin-left: auto;
    color: #64748b;
    font-weight: 400;
}

.nav a[href="#"]:hover {
    color: #dc2626;
    background: #fee2e2;
}

.onboarding-cta {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.onboarding-cta p {
    margin: 0 0 0.75rem 0;
}

a.button {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    transition: background 0.15s;
}

a.button:hover {
    background: #1d4ed8;
    text-decoration: none;
}

a.button.pay-disabled {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

/* Pay page – full white background, matches app aesthetic */
.pay-page {
    background: #fff;
    min-height: 100vh;
}

.pay-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.25rem;
    margin: 0 -1.25rem 1.5rem -1.25rem;
}

.pay-header-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.pay-loading {
    margin: 0;
    color: #64748b;
}

/* Pay success (thank you) page */
.pay-success {
    text-align: center;
    padding: 2rem 0 3rem;
    max-width: 22rem;
    margin: 0 auto;
}

.pay-success-badge {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pay-success-icon {
    width: 2.25rem;
    height: 2.25rem;
}

.pay-success-title {
    margin: 0 0 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.pay-success-msg {
    margin: 0 0 1.75rem;
    font-size: 0.9375rem;
    color: #64748b;
    line-height: 1.5;
}

.pay-success-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #2563eb;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    transition: background 0.15s;
}

.pay-success-btn:hover {
    background: #1d4ed8;
}

.pay-invoice-invalid .pay-invalid-msg {
    margin: 0;
    color: #64748b;
}

.pay-invoice .pay-confirm-msg {
    margin: 1rem 0;
    font-size: 0.9375rem;
    color: #334155;
}

.pay-invoice .pay-confirm-msg label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
}

.pay-invoice .pay-confirm-msg input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.pay-invoice .invoice-status.paid {
    color: #16a34a;
    font-weight: 500;
}

.simple-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.875rem;
    border-radius: 10px;
    overflow: hidden;
}

.simple-table th,
.simple-table td {
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.simple-table th {
    background: #f8fafc;
    font-weight: 600;
}

.simple-table button {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 8px;
}

/* Home screen hero – card-style CTA */
.hero-cta {
    margin: 0 0 1.75rem 0;
}

.hero-cta a.button-hero {
    display: block;
    width: 100%;
    padding: 1.375rem 1.5rem;
    background: #2563eb;
    color: #fff;
    border-radius: 16px;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s;
}

.hero-cta a.button-hero:hover {
    background: #1d4ed8;
    text-decoration: none;
}

/* Section headers (Recent / See all) */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin: 0;
}

.section-see-all {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #2563eb;
}

.section-see-all:hover {
    text-decoration: underline;
}

.recent-list {
    margin-bottom: 1rem;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.recent-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #e2e8f0;
}

.recent-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.recent-item-main:hover {
    text-decoration: none;
    color: inherit;
}

.recent-paylink {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #2563eb;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.recent-paylink:hover {
    text-decoration: underline;
}

.recent-item .left {
    display: flex;
    flex-direction: column;
}

.recent-item .name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #0f172a;
}

.recent-item .meta {
    font-size: 0.8125rem;
    color: #64748b;
}

.recent-item .meta .status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.375rem;
    vertical-align: middle;
}

.recent-item .meta .status-dot.draft {
    background: #94a3b8;
}

.recent-item .meta .status-dot.sent {
    background: #2563eb;
}

.recent-item .meta .status-dot.paid {
    background: #16a34a;
}

.recent-item .amount {
    font-weight: 700;
    font-size: 1rem;
    color: #0f172a;
}

/* Footer nav (home screen) */
.footer-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
}

.footer-nav a {
    padding: 0.5rem 0.875rem;
    font-weight: 500;
    color: #475569;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.footer-nav a:hover {
    color: #2563eb;
    background: #e0e7ff;
    text-decoration: none;
}

.footer-nav a[href="#"] {
    color: #64748b;
    font-weight: 400;
}

.footer-nav a[href="#"]:hover {
    color: #dc2626;
    background: #fee2e2;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    color: #64748b;
    font-size: 0.9375rem;
}

/* Pay invoice page – card with border */
.pay-invoice .invoice-replica {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-top: 0;
    border: 1px solid #e2e8f0;
}

.pay-invoice .invoice-replica p {
    margin: 0.5rem 0;
    font-size: 0.9375rem;
    color: #334155;
}

.pay-invoice .invoice-replica p:first-child {
    margin-top: 0;
}

.pay-invoice .invoice-replica p:last-child {
    margin-bottom: 0;
}

.pay-invoice .invoice-replica strong {
    color: #0f172a;
}

.pay-images-label {
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

.pay-invoice-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.pay-invoice-image-link {
    display: block;
    flex-shrink: 0;
}

.pay-invoice-image-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: block;
}

.pay-invoice-image-link:hover .pay-invoice-image-thumb {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.pay-attachments-open-btn {
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.875rem;
    color: #2563eb;
    background: transparent;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    cursor: pointer;
}

.pay-attachments-open-btn:hover {
    background: #eff6ff;
}

.pay-invoice-image-link.pay-attachment-trigger {
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
}

/* Pay attachments modal */
.pay-attachments-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.pay-attachments-modal[hidden] {
    display: none;
}

.pay-attachments-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
}

.pay-attachments-dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 1rem 1.25rem;
    max-width: 36rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
}

.pay-attachments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.pay-attachments-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
}

.pay-attachments-close {
    padding: 0.25rem;
    font-size: 1.5rem;
    line-height: 1;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
}

.pay-attachments-close:hover {
    color: #0f172a;
}

.pay-attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 1rem;
}

.pay-attachment-modal-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.pay-attachment-modal-item a {
    display: block;
    width: 100%;
}

.pay-attachment-modal-item img {
    width: 100%;
    height: auto;
    max-height: 12rem;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.pay-attachment-modal-item a:hover img {
    border-color: #3b82f6;
}

.pay-attachment-modal-name {
    font-size: 0.8125rem;
    color: #64748b;
    text-align: center;
    word-break: break-word;
}

/* Pay page: full width on mobile */
@media (max-width: 640px) {
    .pay-page .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Auth forms – card wrapper */
.form-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.form-card .error {
    margin-bottom: 0.5rem;
}

.form-card+p {
    margin-top: 1rem;
}

/* ========== Auth screens (login / register) ========== */
.container:has(.auth-screen) {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-screen {
    width: 100%;
    max-width: 22rem;
    text-align: center;
}

.auth-screen-header {
    margin-bottom: 1.5rem;
}

.auth-screen-logo {
    display: block;
    width: 4rem;
    height: auto;
    margin: 0 auto 0.75rem;
}

.auth-screen-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.auth-screen .auth-form-card {
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
}

.auth-screen .auth-form-card form {
    gap: 1.25rem;
}

.auth-submit-btn {
    margin-top: 0.25rem;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
}

.auth-screen-footer {
    margin: 0;
    font-size: 0.9375rem;
    color: #64748b;
}

.auth-screen-footer a {
    color: #2563eb;
    font-weight: 500;
}

/* ========== Activity feed (home) ========== */
html:has(.container .main-content) {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

body:has(.container .main-content) {
    height: 100%;
    overflow: hidden;
}

.container:has(.main-content) {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 5rem;
}

.activity-list {
    margin-bottom: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.activity-list::-webkit-scrollbar {
    display: none;
}

.list-sentinel {
    height: 1px;
    visibility: hidden;
    pointer-events: none;
}

.list-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    padding: 2rem 1rem;
    text-align: center;
}

.list-loading-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.list-loading-text {
    margin: 0;
    font-size: 0.9375rem;
    color: #64748b;
}

.activity-list .empty-state-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    padding: 2rem 1rem;
    text-align: center;
}

.activity-list .empty-state-icon {
    width: 64px;
    height: 64px;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.activity-list .empty-state-center .empty-state {
    margin: 0;
    padding: 0;
}

.activity-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.activity-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.activity-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #e2e8f0;
    color: inherit;
    text-decoration: none;
}

.activity-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.activity-dot-paid {
    background: #16a34a;
}

.activity-dot-sent {
    background: #ea580c;
}

.activity-label {
    font-size: 0.9375rem;
    color: #0f172a;
    line-height: 1.4;
}

.activity-label strong {
    font-weight: 600;
}

.activity-time {
    font-size: 0.8125rem;
    color: #64748b;
}

.activity-summary {
    text-align: center;
    font-size: 0.9375rem;
    color: #64748b;
    margin: 0 0 1.5rem 0;
}

.button-send-invoice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: #2563eb;
    color: #fff;
    border-radius: 16px;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s;
}

.button-send-invoice-icon {
    display: inline-flex;
    flex-shrink: 0;
}

.button-send-invoice-icon svg {
    width: 0.875rem;
    height: 0.875rem;
}

.button-send-invoice:hover {
    background: #1d4ed8;
    color: #fff;
    text-decoration: none;
}

@media (max-width: 768px) {
    .main-content {
        padding-bottom: 10rem;
    }

    .main-content .button-send-invoice {
        position: fixed;
        bottom: 5.75rem;
        left: 1.25rem;
        right: 1.25rem;
        width: auto;
        z-index: 99;
        margin: 0;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ========== Bottom nav ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0.5rem 0;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.06);
    z-index: 100;
}

.bottom-nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: #64748b;
    border-radius: 12px;
    transition: color 0.15s, background 0.15s;
}

.bottom-nav-item:hover {
    color: #2563eb;
    background: #eff6ff;
    text-decoration: none;
}

.bottom-nav-item.active {
    color: #2563eb;
}

.bottom-nav-svg {
    width: 24px;
    height: 24px;
}

.bottom-nav-logo {
    width: 56px;
    height: 56px;
}

.bottom-nav-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* ========== Screen header (back / close) ========== */
.screen-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 1rem 1.25rem;
    margin: 0 -1.25rem 1.5rem -1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.header-back,
.header-close {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: #475569;
    text-decoration: none;
    line-height: 1;
    padding: 0.25rem;
}

.header-back:hover,
.header-close:hover {
    color: #0f172a;
    text-decoration: none;
}

.header-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
}

/* ========== Onboarding ========== */
.onboarding-content {
    padding-bottom: 5rem;
}

#connect-onboarding {
    display: flex;
    justify-content: center;
    width: 100%;
}

#connect-onboarding>*,
#connect-onboarding iframe {
    margin-left: auto;
    margin-right: auto;
}

.onboarding-intro {
    margin: 0 0 1rem;
    color: #475569;
}

.onboarding-logout {
    margin-top: 1.5rem;
    font-size: 0.9375rem;
}

.onboarding-logout a {
    color: #64748b;
    text-decoration: none;
}

.onboarding-logout a:hover {
    text-decoration: underline;
}

/* ========== Settings ========== */
.settings-content {
    padding-bottom: 5rem;
}

.settings-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: #e2e8f0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
    background-size: 48px 48px;
    background-position: center;
    background-repeat: no-repeat;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-row label {
    flex: 0 0 auto;
    min-width: 5.5rem;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.form-row input,
.form-row select {
    flex: 1;
    min-width: 0;
}

.form-row select {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #1e293b;
}

.settings-form label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.settings-form input[readonly] {
    background: #f8fafc;
    color: #64748b;
}

.settings-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.settings-actions .button-cancel {
    flex: 1;
    padding: 0.875rem 1.25rem;
    background: #fff;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.settings-actions .button-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.settings-actions .button-primary {
    flex: 1;
    padding: 0.875rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.settings-actions .button-primary:hover {
    background: #1d4ed8;
}

.settings-logout {
    margin-top: 1.5rem;
    text-align: center;
}

.settings-logout a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
}

.settings-logout a:hover {
    color: #1e293b;
    text-decoration: underline;
}

.settings-download {
    margin-top: 1rem;
    text-align: center;
}

/* Hide when already running as installed PWA */
@media (display-mode: standalone),
(display-mode: fullscreen),
(display-mode: minimal-ui) {
    .settings-download {
        display: none;
    }
}

html.standalone-pwa .settings-download {
    display: none;
}

.button-download-app {
    padding: 0;
    font-size: 0.875rem;
    color: #2563eb;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.button-download-app:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

/* ========== Invoice edit ========== */
.invoice-edit-content {
    padding-bottom: 5rem;
}

.invoice-edit-loading {
    color: #64748b;
    margin: 0;
}

.invoice-edit-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0;
}

.invoice-edit-form .form-row label {
    min-width: 8rem;
}

.invoice-edit-form label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.invoice-edit-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.invoice-edit-actions button {
    flex: 1;
}

.invoice-images-section {
    flex-direction: column;
    align-items: stretch;
}

.invoice-images-section label {
    min-width: 0;
}

.form-hint {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0.25rem 0 0 0;
}

.invoice-images-list {
    margin-top: 0.0rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.invoice-images-empty {
    color: #94a3b8;
    font-size: 0.9rem;
    margin: 0;
}

.invoice-image-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    background: #f8fafc;
}

.invoice-image-link {
    flex-shrink: 0;
}

.invoice-image-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.invoice-image-name {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-image-remove {
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
}

.invoice-image-remove:hover {
    background: #fee2e2;
    border-color: #fecaca;
}

/* ========== Admin (consolidated team + invite + payments + metrics) ========== */
.admin-content {
    padding-bottom: 5rem;
}

.accordion-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.accordion {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.accordion-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

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

.accordion-summary::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    margin-left: 0.5rem;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(45deg);
    transition: transform 0.2s;
}

.accordion[open] .accordion-summary::after {
    transform: rotate(-135deg);
}

.accordion-summary:hover {
    background: #f8fafc;
}

.accordion-content {
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid #e2e8f0;
}

.accordion-content .team-section,
.accordion-content .admin-section {
    margin-top: 1rem;
    margin-bottom: 0;
}

.accordion-content .team-section:first-child,
.accordion-content .admin-section:first-child {
    margin-top: 1rem;
}

.admin-section {
    margin-top: 1.5rem;
}

.admin-invite-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.admin-invite-form label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

/* ========== Team sections (Administrator, Team Members) ========== */
.team-content {
    padding-bottom: 2rem;
}

.team-section {
    margin-bottom: 1.5rem;
}

.team-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    margin: 0 0 0.75rem 0;
    text-transform: none;
}

.team-card,
.team-card-single {
    background: #f1f5f9;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    border: 1px solid #e2e8f0;
}

.team-card-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
}

.team-card-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #cbd5e1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2374756b'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
    background-size: 24px 24px;
    background-position: center;
    background-repeat: no-repeat;
}

.team-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    overflow: hidden;
}

.team-card-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #0f172a;
    overflow-wrap: break-word;
    word-break: break-word;
}

.team-card-role,
.team-card-email {
    font-size: 0.8125rem;
    color: #64748b;
    overflow-wrap: break-word;
    word-break: break-word;
}

.team-card-edit {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1.125rem;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.team-card-edit:hover {
    color: #2563eb;
    background: #eff6ff;
}

.team-members .empty-state {
    padding: 1rem;
    margin-bottom: 0.5rem;
}

/* ========== Session expired modal ========== */
.session-expired-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.session-expired-modal[hidden] {
    display: none;
}

.session-expired-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
}

.session-expired-dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    max-width: 20rem;
    width: 100%;
    border: 1px solid #e2e8f0;
}

.session-expired-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
}

.session-expired-text {
    margin: 0 0 1.25rem 0;
    font-size: 0.9375rem;
    color: #64748b;
    line-height: 1.5;
}

.session-expired-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.session-expired-btn:hover {
    background: #1d4ed8;
}

/* ========== Invoice sent confirmation modal ========== */
.invoice-sent-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.invoice-sent-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
}

.invoice-sent-dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    max-width: 20rem;
    width: 100%;
    border: 1px solid #e2e8f0;
}

.invoice-sent-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
}

.invoice-sent-text {
    margin: 0 0 0.5rem 0;
    font-size: 0.9375rem;
    color: #334155;
    line-height: 1.5;
}

.invoice-sent-link {
    color: #2563eb;
    font-weight: 500;
    text-decoration: none;
}

.invoice-sent-link:hover {
    text-decoration: underline;
}

.invoice-sent-id {
    margin: 0 0 1.25rem 0;
    font-size: 0.75rem;
    color: #94a3b8;
    letter-spacing: 0.02em;
}

.invoice-sent-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.invoice-sent-btn:hover {
    background: #1d4ed8;
}

/* ========== Invoice view modal ========== */
.invoice-view-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.invoice-view-modal[hidden] {
    display: none;
}

.invoice-view-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
}

.invoice-view-dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    max-width: 22rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
}

.invoice-view-title {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
}

.invoice-view-body {
    font-size: 0.9375rem;
    color: #334155;
    line-height: 1.5;
}

.invoice-view-body .invoice-view-row {
    margin-bottom: 0.75rem;
}

.invoice-view-body .invoice-view-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.invoice-view-body .invoice-view-value {
    color: #0f172a;
}

/* ========== Download app / Add to home screen modal ========== */
.download-app-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.download-app-modal[hidden] {
    display: none;
}

.download-app-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
}

.download-app-dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    max-width: 22rem;
    width: 100%;
    border: 1px solid #e2e8f0;
}

.download-app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.download-app-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
}

.download-app-close {
    padding: 0.25rem;
    font-size: 1.5rem;
    line-height: 1;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
}

.download-app-close:hover {
    color: #0f172a;
}

.download-app-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.download-app-tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
}

.download-app-tab:hover {
    color: #334155;
}

.download-app-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.download-app-panel {
    font-size: 0.9375rem;
    color: #334155;
    line-height: 1.5;
}

.download-app-chrome-install {
    margin: 0;
}

.download-app-install-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.download-app-install-btn:hover {
    background: #1d4ed8;
}

.download-app-chrome-fallback {
    margin: 0;
}

.download-app-chrome-fallback strong {
    color: #0f172a;
}

.download-app-steps {
    margin: 0;
    padding-left: 1.25rem;
}

.download-app-steps li {
    margin-bottom: 0.75rem;
}

.download-app-steps li:last-child {
    margin-bottom: 0;
}

.download-app-steps strong {
    color: #0f172a;
}

.invoice-view-body .invoice-view-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
}

.invoice-view-body .invoice-view-status.draft {
    background: #f1f5f9;
    color: #64748b;
}

.invoice-view-body .invoice-view-status.sent {
    background: #eff6ff;
    color: #2563eb;
}

.invoice-view-body .invoice-view-status.paid {
    background: #dcfce7;
    color: #16a34a;
}

.invoice-view-body .invoice-view-paylink-btn {
    padding: 0.5rem 0.875rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.invoice-view-body .invoice-view-paylink-btn:hover {
    background: #1d4ed8;
}

.invoice-view-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.invoice-view-btn {
    flex: 1;
    padding: 0.75rem 1.25rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.invoice-view-btn:hover {
    background: #1d4ed8;
}

.invoice-view-btn.secondary {
    background: #fff;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.invoice-view-btn.secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}