/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* GitHub Profile Link */
.github-profile {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}
.github-profile .gh-link { display: inline-flex; align-items: center; gap: 6px; }

/* Pill-style GitHub link */
.gh-link{
  display:inline-block;
  color:#31511E; /* palette deep olive for strong contrast */
  text-decoration:none;
  font-weight:700;
  letter-spacing:.4px;
  padding:.3rem .65rem; /* room for icon */
  border-radius:12px; /* becomes pill-ish on hover */
  transition:all .18s ease;
  font-size:1.1rem; /* larger for visibility */
}

.gh-link .gh-icon{ width:1.25rem; height:1.25rem; vertical-align:middle; margin-right:.4rem; }

/* Glassy button on hover */
.gh-link:hover{
  color:#1A1A19;
  background:rgba(246,252,223,.65); /* glassy tint from palette bg */
  backdrop-filter:saturate(140%) blur(6px);
  box-shadow:0 6px 18px rgba(49,81,30,.18), inset 0 0 0 1px rgba(133,159,61,.55);
  padding:.35rem .7rem; /* expand slightly */
  transform:translateY(-1px);
}

.gh-link:active{
  transform:translateY(0);
  box-shadow:0 2px 8px rgba(49,81,30,.22), inset 0 0 0 2px rgba(133,159,61,.8);
}

.gh-link:focus-visible{
  outline:none;
  box-shadow:0 0 0 2px rgba(133,159,61,.9);
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #1A1A19;
    background: #F6FCDF;
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 1rem;
}
html { overflow-x: hidden; }

/* Desktop-wide global scale to emulate 90% browser zoom */
@media (min-width: 1025px) {
    body.scale-90 { zoom: 0.9; }
    /* Firefox fallback: zoom unsupported */
    @supports not (zoom: 1) {
        body.scale-90 { transform: scale(0.9); transform-origin: top left; width: 111.111%; }
    }
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
    padding: 24px 0 0 0;
    gap: 32px;
    max-width: 2000px;
    margin: 0 auto;
    justify-content: center;
}
/* Mobile top bar */
.mobile-topbar {
    display: none;
}

.hamburger {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    padding: 10px;
    position: sticky;
    left: 0;
}
.hamburger span { width: 22px; height: 2px; background: #31511E; display: block; }
.topbar-title { font-weight: 700; color: #31511E; }
.topbar-gh { display: none; }

/* Mobile footer */
.mobile-footer { display: none; }

/* Mobile CTA */
.mobile-cta { display: none; text-align: center; padding: 24px; }
.mobile-cta p { margin-bottom: 12px; color: #31511E; font-weight: 600; }

/* Sidebar mobile overlay state */
.sidebar.is-open { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; overflow-y: auto; z-index: 2000; background: #F6FCDF; }

/* Sticky translucent topbar on scroll */
.mobile-topbar.sticky { position: sticky; top: 0; backdrop-filter: blur(6px); background: rgba(246,252,223,.7); z-index: 1500; }

/* Hide desktop-only close button by default */
.sidebar-close { display: none; }

@media (max-width: 768px) {
    /* Top bar is not fixed by default on mobile */
    .mobile-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; position: relative; height: 56px; z-index: 3000; background: rgba(246,252,223,.9); backdrop-filter: blur(6px); }
    /* Decorative separator under the top nav */
    .mobile-topbar::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 0; border-top: 2px solid #9DC08B; border-radius: 8px; box-shadow: 0 1px 0 rgba(64,81,59,.25); }
    /* When a group is selected, we add .topbar-fixed to body to pin it */
    .topbar-fixed .mobile-topbar { position: fixed; top: 0; left: 0; right: 0; }
    .mobile-topbar .topbar-title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 1.35rem; }
    .topbar-gh { display: inline-flex; }
    .topbar-gh .gh-icon { width: 20px; height: 20px; color: #31511E; }
    .sidebar { position: fixed; top: 0; left: -100%; width: 85%; max-width: 420px; height: 100vh; transition: left .25s ease; z-index: 2000; }
    .sidebar.is-open { left: 0; }
    .main-content { padding-left: 0; min-height: auto; }
    /* Hide desktop GitHub badge on mobile */
    .github-profile { display: none; }
    /* Footer GitHub fixed to bottom */
    .mobile-footer { display: flex; align-items: center; justify-content: center; padding: 12px; position: fixed; left: 0; right: 0; bottom: 0; background: #F6FCDF; border-top: 1px solid #859F3D; z-index: 1400; width: 100%; text-align: center; }
    .mobile-footer .gh-link { margin: 0 auto; }
    /* Prevent content from being obscured by footer without extra scroll */
    .app-container { padding-top: 56px; padding-bottom: 56px; }
    /* Center content cards */
    .main-content { display: flex; flex-direction: column; align-items: center; }
    .main-content > section, .main-content header, .mobile-cta { width: 100%; max-width: 680px; }
    .summary-stats { width: 100%; }
    section { margin-bottom: 16px; }
    section:last-of-type { margin-bottom: 56px; }
    .sidebar-close { display: block; position: absolute; top: 10px; left: 10px; background: transparent; border: none; font-size: 20px; color: #31511E; }
    .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 1900; }
    .sidebar.is-open + .sidebar-backdrop { display: block; }
    .mobile-cta { display: block; }

    /* Participant date control: show calendar button, hide date input */
    .participant-inputs .calendar-btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 12px; border: 1px solid #859F3D; border-radius: 8px; background: #fff; color: #31511E; }
    .participant-inputs input[type="date"] { position: absolute; left: -9999px; width: 0; height: 0; padding: 0; border: 0; }
}

/* Sidebar Styles */
.sidebar {
    width: 520px;
    background: #F6FCDF;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(26, 26, 25, 0.1);
    height: fit-content;
    position: sticky;
    top: 24px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #859F3D;
    margin-left: 2px
}

.sidebar-header {
    background: #ffffff;
    color: #1A1A19;
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid #859F3D;
}

.sidebar-header h2 {
    font-size: 3rem;
    margin: 0;
    font-weight: 600;
    color: #495057;
}

.sidebar-header h2 .icon {
    width: 60px;
    height: 60px;
    margin-right: 8px;
    vertical-align: middle;
}

.group-creation {
    padding: 24px;
    border-bottom: 1px solid #e9ecef;
}

.group-creation h3 {
    color: #495057;
    margin-bottom: 16px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.group-input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-input-section input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: all 0.2s ease;
    background: #ffffff;
}

.group-input-section input:focus {
    outline: none;
    border-color: #31511E;
    box-shadow: 0 0 0 3px rgba(49, 81, 30, 0.1);
}

.group-input-section input:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* User Selection Section */
.user-selection-section {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #859F3D;
    box-shadow: 0 2px 8px rgba(133, 159, 61, 0.1);
}

.user-selection-section label {
    display: block;
    font-weight: 600;
    color: #1A1A19;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.user-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #859F3D;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #ffffff;
    color: #1A1A19;
    transition: all 0.2s ease;
}

.user-select:focus {
    outline: none;
    border-color: #31511E;
    box-shadow: 0 0 0 3px rgba(49, 81, 30, 0.1);
}

.help-text {
    display: block;
    color: #859F3D;
    font-size: 0.8rem;
    margin-top: 6px;
    font-style: italic;
}

.groups-list-section {
    padding: 28px;
}

.groups-list-section h3 {
    color: #495057;
    margin-bottom: 16px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.groups-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-card {
    background: #ffffff;
    padding: 28px;
    border-radius: 12px;
    border: 2px solid #859F3D;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(133, 159, 61, 0.1);
}

.group-card:hover {
    border-color: #31511E;
    box-shadow: 0 4px 16px rgba(49, 81, 30, 0.15);
    transform: translateY(-2px);
}

.group-card.active {
    border-color: #31511E;
    background: #F6FCDF;
}

.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.group-card h3 {
    color: #1A1A19;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin: 0;
}

.delete-group-btn {
    padding: 8px 12px !important;
    font-size: 0.75rem !important;
    min-height: 36px !important;
    background: #dc3545 !important;
    color: white !important;
}

.delete-group-btn:hover {
    background: #c82333 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.group-card .group-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: #31511E;
    font-size: 0.95rem;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 500;
    margin: 20px 0;
    line-height: 1.4;
}

.group-card .group-stats span {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(133, 159, 61, 0.2);
}

.group-card .group-stats span:last-child {
    border-bottom: none;
}

.group-card .group-card-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
    flex-wrap: wrap;
}

.group-card .group-card-actions .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 12px 16px;
    min-width: 100px;
    font-weight: 600;
    letter-spacing: 0.3px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-card .group-card-actions .export-overlay {
    flex: 1;
    min-width: 100px;
}

.group-card .group-card-actions .export-overlay .btn {
    width: 100%;
    height: 44px;
}

.group-card .group-card-actions .btn .icon {
    width: 20px;
    height: 20px;
    margin-right: 4px;
    vertical-align: middle;
}

/* Main Content */
.main-content {
    flex: 1;
    min-height: 100vh;
    padding-left: 20px;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    color: #1a1a1a;
}

header h1 {
    font-size: 3.5rem;
    margin-bottom: 12px;
    font-weight: 700;
    color: #1A1A19;
}

header p {
    font-size: 1.125rem;
    color: #6c757d;
    font-weight: 400;
}

/* Section Styles */
section {
    background: white;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(49, 81, 30, 0.1);
    border: 1px solid #859F3D;
}

section:hover {
    box-shadow: 0 2px 8px rgba(49, 81, 30, 0.1);
}

section h2 {
    color: #1A1A19;
    margin-bottom: 24px;
    font-size: 1.75rem;
    border-bottom: 2px solid #859F3D;
    padding-bottom: 16px;
    font-weight: 600;
}

section h2 .icon {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    vertical-align: middle;
}

section h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

section h4 {
    color: #495057;
    margin-bottom: 16px;
    font-size: 1.15rem;
    font-weight: 600;
}

/* Group Header */
.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e9ecef;
}

.group-header h2 {
    margin: 0;
    border: none;
    padding: 0;
    color: #1a1a1a;
}

.group-actions {
    display: flex;
    gap: 12px;
}

/* Icon Styles */
.icon {
    width: 30px;
    height: 30px;
    vertical-align: middle;
    margin-right: 8px;
}

.icon-small {
    width: 20px;
    height: 20px;
    margin-right: 6px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    min-height: 44px;
}

.btn .icon {
    width: 20px;
    height: 20px;
    margin-right: 6px;
    vertical-align: middle;
}

.btn-primary {
    background: #31511E;
    color: white;
}

.btn-primary:hover {
    background: #1A1A19;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(49, 81, 30, 0.3);
}

.btn-secondary {
    background: #859F3D;
    color: white;
}

.btn-secondary:hover {
    background: #31511E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(133, 159, 61, 0.3);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.error-message {
    color: #1A1A19;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.error-message.show {
    display: block;
}

.input-error {
    border-color: #1A1A19 !important;
    box-shadow: 0 0 0 3px rgba(26, 26, 25, 0.1) !important;
}

input, select {
    padding: 12px 16px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: all 0.2s ease;
    background: #ffffff;
}

input:focus, select:focus {
    outline: none;
    border-color: #31511E;
    box-shadow: 0 0 0 3px rgba(49, 81, 30, 0.1);
}

.participant-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 20px;
    align-items: end;
    margin-bottom: 20px;
}

/* Participants List */
.participants-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
    justify-items: center;
}

.participant-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #9DC08B;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    min-width: 250px;
    box-shadow: 0 2px 8px rgba(96, 153, 102, 0.1);
}

.participant-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.participant-name {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.875rem;
}

.participant-date {
    font-size: 0.75rem;
    color: #6c757d;
    font-family: 'Courier New', monospace;
}

.participant-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.participant-card .remove-participant {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.participant-card .remove-participant .icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    display: block;
    margin: 0 auto;
}

.participant-card .remove-participant:hover {
    background: #c82333;
}

/* Expense Form */
.expense-form {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.split-options {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #e9ecef;
}

.split-option {
    margin-bottom: 16px;
}

.split-option h4 {
    margin-bottom: 12px;
    color: #495057;
    font-weight: 600;
}

.split-input {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: center;
    margin-bottom: 12px;
}

.split-input input {
    width: 100%;
}

/* Expenses List */
.expenses-list {
    display: grid;
    gap: 16px;
}

.expense-item {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 20px;
    align-items: center;
    transition: all 0.2s ease;
}

.expense-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.expense-item .expense-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.expense-item .expense-description {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.875rem;
}

.expense-item .expense-category {
    font-size: 0.75rem;
    color: #6c757d;
}

.expense-item .expense-amount {
    font-weight: 600;
    color: #007bff;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
}

.expense-item .expense-actions {
    display: flex;
    gap: 8px;
}

.expense-item .expense-actions button {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Balances Section */
.balances-summary {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    margin-bottom: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.balance-item:hover {
    border-color: #007bff;
}

.balance-positive {
    border-left: 4px solid #28a745;
}

.balance-negative {
    border-left: 4px solid #dc3545;
}

.balance-amount {
    font-weight: 600;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
}

.balance-positive .balance-amount {
    color: #28a745;
}

.balance-negative .balance-amount {
    color: #dc3545;
}

.settlement-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 20px;
    align-items: end;
}

/* Summary Section */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.875rem;
    font-weight: 500;
}



.export-section {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.export-section .btn {
    min-width: 140px;
    font-size: 0.875rem;
}

/* Export Overlay Styles */
.export-overlay {
    position: relative;
    display: inline-block;
}

.export-btn {
    position: relative;
    padding-right: 44px; /* add more space for caret */
}

.export-btn::after {
    content: '▼';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-48%);
    font-size: 0.85rem;
    color: #ffffff;
    pointer-events: none;
}

.export-overlay-content {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(26, 26, 25, 0.15);
    border: 1px solid #859F3D;
    border-radius: 8px;
    z-index: 1000;
    margin-bottom: 8px;
}

.export-overlay-content.show {
    display: block;
}

.export-option {
    padding: 10px 16px;
    cursor: pointer;
    display: block;
    color: #1A1A19;
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.export-option:hover {
    background: #F6FCDF;
}

.export-option:first-child {
    border-radius: 8px 8px 0 0;
}

.export-option:last-child {
    border-radius: 0 0 8px 8px;
}

.export-option:not(:last-child) {
    border-bottom: 1px solid #859F3D;
}

/* Group Export Dropdown Specific Styles */
.group-export-dropdown {
    min-width: 160px;
    font-size: 0.8rem;
}

.group-export-dropdown .export-option {
    padding: 8px 12px;
    font-size: 0.8rem;
}

/* Ensure proper positioning for group card export dropdowns */
.group-card .export-overlay {
    position: relative;
}

.group-card .export-overlay-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 32px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border: 1px solid #e9ecef;
}

.close {
    color: #6c757d;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 24px;
    transition: color 0.2s ease;
}

.close:hover {
    color: #31511E;
}

.edit-expense-form,
.edit-group-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.edit-expense-form input,
.edit-expense-form select,
.edit-group-form input {
    width: 100%;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .app-container {
        padding: 20px;
        gap: 24px;
    }
    
    .sidebar {
        width: 460px;
        margin-left: 16px;
    }
}

@media (max-width: 1024px) {
    .app-container {
        padding: 16px;
        gap: 20px;
    }
    
    .sidebar {
        width: 400px;
        margin-left: 12px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        padding: 16px;
        gap: 20px;
    }
    /* Keep sidebar off-canvas on mobile (avoid showing a sliver) */
    .sidebar { position: fixed !important; top: 0 !important; left: -100% !important; width: 85% !important; max-width: 420px !important; height: 100vh; }
    .sidebar.is-open { left: 0 !important; }
    
    .main-content {
        order: 1;
    }
    
    .form-row { grid-template-columns: 1fr; }

    /* Participant inputs layout: input + calendar, then full-width Add button */
    .participant-inputs { grid-template-columns: 1fr auto; }
    #addParticipant { grid-column: 1 / -1; }
    
    .group-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .group-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .expense-item {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .settlement-form {
        grid-template-columns: 1fr;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    

    
    .export-section {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 24px;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 12px;
    }
    
    section {
        padding: 20px;
    }
    
    .expense-form {
        padding: 20px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.8rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    .sidebar {
        border-radius: 8px;
    }
    

}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

section {
    animation: fadeIn 0.3s ease-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #00ADB5;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Logo-like titles: non-selectable in all views */
.sidebar-header h2,
header h1,
.topbar-title {
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.logo-title .logo-icon {
    width: 28px;
    height: 28px;
    vertical-align: middle;
    margin-right: 8px;
}
