html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    overscroll-behavior-y: none;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: #0f172a;
}

/* ── Mobile App Shell ── */
.mobile-app {
    margin: 0 auto;
    min-height: 100dvh;
    width: 100%;
    max-width: 430px;
    background: #f2f2f7;
    position: relative;
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
}

@media (min-width: 431px) {
    .mobile-app {
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 25px 50px -12px rgba(0, 0, 0, 0.18);
    }
}

.mobile-app-content {
    padding: 0 16px 20px;
}

/* ── Sticky App Header ── */
.mobile-app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: calc(0.75rem + env(safe-area-inset-top)) 16px 0.75rem;
    background: rgba(242, 242, 247, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

.mobile-app-header.large-title {
    padding-bottom: 1rem;
}

.mobile-app-header .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 0.5rem;
    padding: 4px 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #007aff;
}

.mobile-app-header .back-btn:active {
    opacity: 0.6;
}

.mobile-app-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: #000;
}

.mobile-app-header .subtitle {
    margin-top: 2px;
    font-size: 0.875rem;
    color: #8e8e93;
}

.mobile-app-header.compact h1 {
    font-size: 1.0625rem;
    font-weight: 600;
    text-align: center;
}

/* ── Cards & Lists ── */
.mobile-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.mobile-card + .mobile-card,
.mobile-section + .mobile-section {
    margin-top: 12px;
}

.mobile-section-title {
    margin: 20px 0 8px 4px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8e8e93;
}

.mobile-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    transition: background 0.15s;
}

.mobile-list-item:active {
    background: #f2f2f7;
}

.mobile-list-item + .mobile-list-item,
.mobile-list-divider + .mobile-list-item {
    border-top: 0.5px solid rgba(0, 0, 0, 0.08);
}

.mobile-list-icon {
    display: flex;
    height: 36px;
    width: 36px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1rem;
}

.mobile-list-chevron {
    margin-left: auto;
    color: #c7c7cc;
    flex-shrink: 0;
}

/* ── Stats Row ── */
.mobile-stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.mobile-stat-pill {
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.mobile-stat-pill .label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8e8e93;
}

.mobile-stat-pill .value {
    margin-top: 4px;
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ── Form Controls ── */
.mobile-input,
.mobile-select {
    width: 100%;
    border-radius: 12px;
    border: none;
    background: #fff;
    padding: 14px 16px;
    font-size: 1rem;
    color: #000;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
    -webkit-appearance: none;
    appearance: none;
}

.mobile-input:focus,
.mobile-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px #007aff;
}

.mobile-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.12s, opacity 0.12s;
    -webkit-user-select: none;
    user-select: none;
}

.mobile-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.mobile-btn-primary {
    background: #007aff;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35);
}

.mobile-btn-success { background: #34c759; color: #fff; }
.mobile-btn-danger { background: #ff3b30; color: #fff; }
.mobile-btn-secondary {
    background: #fff;
    color: #007aff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* ── Bottom Tab Bar ── */
.mobile-tab-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    z-index: 50;
    display: flex;
    width: 100%;
    max-width: 430px;
    transform: translateX(-50%);
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
}

.mobile-tab-item {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px 6px;
    font-size: 0.625rem;
    font-weight: 500;
    color: #8e8e93;
    text-decoration: none;
    transition: color 0.2s;
}

.mobile-tab-item svg {
    width: 24px;
    height: 24px;
}

.mobile-tab-item.active {
    color: #007aff;
}

.mobile-tab-item.active .tab-dot {
    display: block;
}

.tab-dot {
    display: none;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #007aff;
    margin-top: -2px;
}

/* ── Alerts ── */
.mobile-alert {
    margin-bottom: 12px;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.875rem;
    font-weight: 500;
}

.mobile-alert-success {
    background: #d1fae5;
    color: #065f46;
}

.mobile-alert-error {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Hero card on home ── */
.mobile-hero-card {
    border-radius: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.3);
}

.mobile-menu-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s;
}

.mobile-menu-card:active {
    transform: scale(0.98);
}

.mobile-menu-card + .mobile-menu-card {
    margin-top: 10px;
}

.mobile-menu-card.featured {
    background: linear-gradient(135deg, #007aff 0%, #0a84ff 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.3);
}

.mobile-menu-card.featured .menu-desc {
    color: rgba(255, 255, 255, 0.8);
}

.menu-desc {
    font-size: 0.8125rem;
    color: #8e8e93;
    margin-top: 2px;
}

/* ── Dashboard ── */
.dash-hero {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    padding: 22px 20px 20px;
    background: linear-gradient(145deg, #007aff 0%, #5856d6 55%, #af52de 100%);
    color: #fff;
    box-shadow: 0 12px 32px rgba(0, 122, 255, 0.28);
}

.dash-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

.dash-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.dash-hero-content {
    position: relative;
    z-index: 1;
}

.dash-hero-label {
    font-size: 0.8125rem;
    font-weight: 500;
    opacity: 0.85;
    letter-spacing: 0.02em;
}

.dash-hero-value {
    margin-top: 4px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.dash-hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}

.dash-hero-stat {
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.dash-hero-stat .label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.8;
}

.dash-hero-stat .value {
    margin-top: 4px;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dash-chart-card {
    background: #fff;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dash-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.dash-chart-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #000;
    letter-spacing: -0.02em;
}

.dash-chart-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
    background: #f2f2f7;
    color: #8e8e93;
}

.dash-chart-wrap {
    position: relative;
    height: 200px;
}

.dash-chart-wrap.tall {
    height: 220px;
}

.dash-chart-wrap.compact {
    height: 180px;
}

.dash-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 0.5px solid rgba(0, 0, 0, 0.06);
}

.dash-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #8e8e93;
}

.dash-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dash-director-card {
    background: #fff;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dash-director-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.dash-avatar {
    display: flex;
    height: 44px;
    width: 44px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fff;
}

.dash-director-name {
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    letter-spacing: -0.02em;
}

.dash-director-meta {
    font-size: 0.75rem;
    color: #8e8e93;
    margin-top: 1px;
}

.dash-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.dash-metric {
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
    background: #f8f8fa;
}

.dash-metric .label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8e8e93;
}

.dash-metric .value {
    margin-top: 4px;
    font-size: 0.8125rem;
    font-weight: 700;
}

.dash-progress-wrap {
    margin-top: 12px;
}

.dash-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: #8e8e93;
    margin-bottom: 6px;
}

.dash-progress-track {
    height: 6px;
    border-radius: 99px;
    background: #e5e5ea;
    overflow: hidden;
}

.dash-progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s ease;
}

.dash-empty-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 160px;
    text-align: center;
    color: #8e8e93;
    font-size: 0.8125rem;
    gap: 8px;
}

.dash-empty-chart svg {
    opacity: 0.4;
}

/* ── Month Report ── */
.month-report-card {
    background: #fff;
    border-radius: 18px;
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.month-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    background: linear-gradient(135deg, #f8f9fc 0%, #fff 100%);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
}

.month-report-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #000;
    letter-spacing: -0.02em;
}

.month-report-status {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.month-report-status.finalized {
    background: #e8faf0;
    color: #34c759;
}

.month-report-status.draft {
    background: #fff3e0;
    color: #ff9500;
}

.month-report-body {
    padding: 14px 16px 16px;
}

.month-report-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
}

.month-report-row.total {
    padding: 10px 12px;
    margin: 4px 0 8px;
    border-radius: 12px;
    background: #f8f8fa;
}

.month-report-row.remaining {
    padding: 12px;
    margin-top: 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e8f4fd 0%, #f0e8ff 100%);
}

.month-report-label {
    font-size: 0.8125rem;
    color: #8e8e93;
}

.month-report-label.bold {
    font-weight: 600;
    color: #000;
}

.month-report-value {
    font-size: 0.875rem;
    font-weight: 700;
    text-align: right;
    flex-shrink: 0;
}

.month-report-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0 6px 8px;
    font-size: 0.8125rem;
    border-left: 2px solid #ff3b3033;
}

.month-report-line.income-line {
    border-left-color: #34c75933;
}

.month-report-line .type {
    color: #3c3c43;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.month-report-line .eq {
    color: #c7c7cc;
    flex-shrink: 0;
}

.month-report-line .amount {
    font-weight: 600;
    flex-shrink: 0;
}

.month-report-divider {
    height: 0.5px;
    background: rgba(0, 0, 0, 0.06);
    margin: 8px 0;
}

.month-report-directors {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 0.5px solid rgba(0, 0, 0, 0.06);
}

.month-report-directors-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8e8e93;
    margin-bottom: 10px;
}

.month-report-director {
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8f8fa;
    margin-bottom: 8px;
}

.month-report-director:last-child {
    margin-bottom: 0;
}

.month-report-director-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 8px;
}

.month-report-director-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    text-align: center;
}

.month-report-director-grid .cell .lbl {
    font-size: 0.5625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8e8e93;
}

.month-report-director-grid .cell .val {
    margin-top: 2px;
    font-size: 0.75rem;
    font-weight: 700;
}

.month-report-summary {
    margin-top: 14px;
    padding: 14px;
    border-radius: 14px;
    background: #f8f8fa;
    border: 0.5px solid rgba(0, 0, 0, 0.06);
}

.month-report-balance-left {
    margin-top: 8px;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e8faf0 0%, #e8f4fd 100%);
}

.month-report-balance-left .month-report-value {
    font-size: 1.0625rem;
}

.month-report-formula {
    margin-top: 8px;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 500;
    color: #8e8e93;
    letter-spacing: 0.02em;
}

.month-add-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: #007aff;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 122, 255, 0.3);
}

.month-add-toggle:active {
    opacity: 0.9;
    transform: scale(0.98);
}

.month-report-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.month-export-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    background: #fff;
    color: #007aff;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 0 0 1px rgba(0, 122, 255, 0.2);
}

.month-export-btn:active {
    background: #f2f2f7;
    transform: scale(0.98);
}

.month-back-report {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 14px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #007aff;
    text-decoration: none;
}

/* ── Bulk Payouts ── */
.bulk-payout-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bulk-payout-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: #f8f8fa;
}

.bulk-payout-info {
    flex: 1;
    min-width: 0;
}

.bulk-payout-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #000;
}

.bulk-payout-meta {
    margin-top: 2px;
    font-size: 0.6875rem;
    color: #8e8e93;
}

.bulk-payout-input {
    width: 110px;
    flex-shrink: 0;
    border-radius: 12px;
    border: none;
    background: #fff;
    padding: 12px 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    text-align: right;
    color: #000;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.bulk-payout-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #007aff;
}

.bulk-payout-input::placeholder {
    color: #c7c7cc;
    font-weight: 500;
}

.bulk-payout-fill {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.bulk-payout-fill-btn {
    border: none;
    background: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: #007aff;
    padding: 4px 0;
}

.bulk-payout-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f0e8ff 0%, #e8f4fd 100%);
}

.bulk-payout-total-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #000;
}

.bulk-payout-total-value {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #af52de;
}

/* ── Bulk Month Entries ── */
.bulk-month-form {
    margin-bottom: 16px;
}

.bulk-entry-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.bulk-entry-row {
    display: grid;
    grid-template-columns: 1fr 92px 1fr 32px;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border-radius: 14px;
    background: #f8f8fa;
}

.bulk-entry-select,
.bulk-entry-amount,
.bulk-entry-note {
    border: none;
    border-radius: 10px;
    background: #fff;
    padding: 10px 10px;
    font-size: 0.8125rem;
    color: #000;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
    min-width: 0;
}

.bulk-entry-select:focus,
.bulk-entry-amount:focus,
.bulk-entry-note:focus {
    outline: none;
    box-shadow: 0 0 0 2px #007aff;
}

.bulk-entry-amount {
    font-weight: 600;
    text-align: right;
}

.bulk-entry-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 10px;
    background: #fff;
    color: #ff3b30;
    font-size: 0.875rem;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.bulk-add-row-btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: 12px;
    background: #f2f2f7;
    padding: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #007aff;
}

@media (max-width: 380px) {
    .bulk-entry-row {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "account account"
            "amount note"
            "remove remove";
    }

    .bulk-entry-select { grid-area: account; }
    .bulk-entry-amount { grid-area: amount; }
    .bulk-entry-note { grid-area: note; }
    .bulk-entry-remove { grid-area: remove; justify-self: end; }
}
