/* CostShare - Main Stylesheet */

:root,
[data-theme="light"] {
    --primary: #1aad6b;
    --primary-dark: #159a5c;
    --secondary: #5b6b7a;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --bg: #f4f6f8;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #e1e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --input-bg: #ffffff;
    --nav-hover-bg: #f4f6f8;
    --alert-success-bg: #d4edda;
    --alert-success-text: #155724;
    --alert-success-border: #c3e6cb;
    --alert-error-bg: #f8d7da;
    --alert-error-text: #721c24;
    --alert-error-border: #f5c6cb;
    --positive-bg: #d4edda;
    --positive-text: #155724;
    --negative-bg: #f8d7da;
    --negative-text: #721c24;
    --radius: 8px;
    --btn-radius: 12px;
    --btn-height: 2.75rem;
    --btn-soft-bg: rgba(26, 173, 107, 0.1);
    --btn-soft-hover: rgba(26, 173, 107, 0.16);
    --btn-danger-soft: rgba(231, 76, 60, 0.1);
    --nav-height: 60px;
}

[data-theme="dark"] {
    --primary: #2ecc71;
    --primary-dark: #27ae60;
    --secondary: #95a5a6;
    --danger: #e74c3c;
    --success: #2ecc71;
    --warning: #f39c12;
    --bg: #1a1d21;
    --card-bg: #252830;
    --text: #ecf0f1;
    --text-muted: #95a5a6;
    --border: #3d4450;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    --input-bg: #2c3038;
    --nav-hover-bg: #2c3038;
    --alert-success-bg: #1e3a2f;
    --alert-success-text: #7dcea0;
    --alert-success-border: #2d5a45;
    --alert-error-bg: #3d2020;
    --alert-error-text: #f1948a;
    --alert-error-border: #5c3030;
    --positive-bg: #1e3a2f;
    --positive-text: #7dcea0;
    --negative-bg: #3d2020;
    --negative-text: #f1948a;
    --btn-soft-bg: rgba(46, 204, 113, 0.14);
    --btn-soft-hover: rgba(46, 204, 113, 0.22);
    --btn-danger-soft: rgba(231, 76, 60, 0.14);
}

[data-theme="ocean"] {
    --primary: #0891b2;
    --primary-dark: #0e7490;
    --secondary: #64748b;
    --danger: #dc2626;
    --success: #059669;
    --warning: #d97706;
    --bg: #e0f2fe;
    --card-bg: #f0f9ff;
    --text: #0c4a6e;
    --text-muted: #64748b;
    --border: #bae6fd;
    --shadow: 0 2px 8px rgba(8, 145, 178, 0.12);
    --input-bg: #ffffff;
    --nav-hover-bg: #e0f2fe;
    --alert-success-bg: #d1fae5;
    --alert-success-text: #065f46;
    --alert-success-border: #a7f3d0;
    --alert-error-bg: #fee2e2;
    --alert-error-text: #991b1b;
    --alert-error-border: #fecaca;
    --positive-bg: #d1fae5;
    --positive-text: #065f46;
    --negative-bg: #fee2e2;
    --negative-text: #991b1b;
    --btn-soft-bg: rgba(8, 145, 178, 0.1);
    --btn-soft-hover: rgba(8, 145, 178, 0.16);
    --btn-danger-soft: rgba(220, 38, 38, 0.1);
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --primary: #2ecc71;
        --primary-dark: #27ae60;
        --secondary: #95a5a6;
        --danger: #e74c3c;
        --success: #2ecc71;
        --warning: #f39c12;
        --bg: #1a1d21;
        --card-bg: #252830;
        --text: #ecf0f1;
        --text-muted: #95a5a6;
        --border: #3d4450;
        --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
        --input-bg: #2c3038;
        --nav-hover-bg: #2c3038;
        --alert-success-bg: #1e3a2f;
        --alert-success-text: #7dcea0;
        --alert-success-border: #2d5a45;
        --alert-error-bg: #3d2020;
        --alert-error-text: #f1948a;
        --alert-error-border: #5c3030;
        --positive-bg: #1e3a2f;
        --positive-text: #7dcea0;
        --negative-bg: #3d2020;
        --negative-text: #f1948a;
        --btn-soft-bg: rgba(46, 204, 113, 0.14);
        --btn-soft-hover: rgba(46, 204, 113, 0.22);
        --btn-danger-soft: rgba(231, 76, 60, 0.14);
    }
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(26, 173, 107, 0.15);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-brand a {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
    align-items: center;
}

.nav-links a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--nav-hover-bg);
    color: var(--primary);
    text-decoration: none;
}

.nav-logout {
    color: var(--danger) !important;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius);
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: transform 0.2s, opacity 0.2s;
}

/* Language & theme switchers */
.lang-bar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.lang-bar-inner {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.lang-switcher,
.theme-switcher {
    display: flex;
    align-items: center;
}

.preference-control {
    position: relative;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}

.preference-icon {
    position: absolute;
    left: 0.75rem;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    color: var(--primary);
    pointer-events: none;
}

.preference-icon svg {
    width: 1rem;
    height: 1rem;
}

.preference-select,
.lang-select,
.theme-select {
    appearance: none;
    -webkit-appearance: none;
    min-width: 8.5rem;
    max-width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 2.35rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background-color: var(--btn-soft-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237f8c8d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color-scheme: light;
}

/* Dropdown list uses its own colors; do not inherit light page text on a light popup. */
.preference-select option,
.lang-select option,
.theme-select option {
    background-color: #ffffff;
    color: #2c3e50;
}

[data-theme="dark"] .preference-select,
[data-theme="dark"] .lang-select,
[data-theme="dark"] .theme-select {
    color-scheme: dark;
}

[data-theme="dark"] .preference-select option,
[data-theme="dark"] .lang-select option,
[data-theme="dark"] .theme-select option {
    background-color: #252830;
    color: #ecf0f1;
}

.preference-select:hover,
.lang-select:hover,
.theme-select:hover {
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    background-color: var(--btn-soft-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.preference-select:focus,
.lang-select:focus,
.theme-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.preference-select:active,
.lang-select:active,
.theme-select:active {
    transform: translateY(1px);
}

.nav-lang .preference-select,
.nav-theme .preference-select,
.nav-lang .lang-select,
.nav-theme .theme-select {
    min-width: 7.25rem;
    max-width: 9rem;
}

.nav-lang,
.nav-theme {
    display: flex;
    align-items: center;
}

/* Mobile bottom navigation */
.mobile-bottom-nav {
    display: none;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    flex: 1;
    min-height: 56px;
    padding: 0.35rem 0.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: var(--primary);
    text-decoration: none;
}

.mobile-nav-icon svg {
    width: 22px;
    height: 22px;
}

.mobile-nav-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.nav-open {
    overflow: hidden;
}

body.has-mobile-nav {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Buttons */
button.btn,
a.btn,
input.btn {
    appearance: none;
    -webkit-appearance: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--btn-height);
    padding: 0 1.375rem;
    border: 1px solid transparent;
    border-radius: var(--btn-radius);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.12s ease;
    box-shadow: none;
}

.btn:hover {
    text-decoration: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 173, 107, 0.28);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-primary:focus-visible {
    box-shadow: 0 0 0 3px rgba(26, 173, 107, 0.35);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--nav-hover-bg);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.btn-danger:focus-visible {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.28);
}

/* Soft / chip buttons (e.g. "View all") */
.btn:not(.btn-primary):not(.btn-secondary):not(.btn-danger) {
    min-height: 2.125rem;
    padding: 0 0.875rem;
    background: var(--btn-soft-bg);
    color: var(--primary);
    border-color: transparent;
    border-radius: 999px;
    font-size: 0.8125rem;
}

.btn:not(.btn-primary):not(.btn-secondary):not(.btn-danger):hover {
    background: var(--btn-soft-hover);
    color: var(--primary-dark);
}

.btn-sm {
    min-height: 2.125rem;
    padding: 0 0.875rem;
    font-size: 0.8125rem;
    border-radius: 999px;
}

.btn-sm.btn-primary,
.btn-sm.btn-secondary,
.btn-sm.btn-danger {
    border-radius: var(--btn-radius);
}

.btn-sm.btn-danger {
    background: var(--btn-danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.btn-sm.btn-danger:hover {
    background: rgba(231, 76, 60, 0.18);
    color: #c0392b;
}

.btn-block {
    display: flex;
    width: 100%;
    border-radius: var(--btn-radius);
}

.hero-actions .btn {
    min-height: 3rem;
    padding: 0 1.625rem;
    font-size: 0.9375rem;
}

.hero-actions .btn-primary {
    border-radius: 999px;
}

.hero-actions .btn-secondary {
    border-radius: 999px;
    background: transparent;
}

.form-actions .btn + .btn {
    margin-left: 0;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 173, 107, 0.15);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.flex-2 {
    flex: 2 !important;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.inline-form {
    display: inline;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

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

.card-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.card h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

/* Alerts */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: var(--alert-success-bg);
    color: var(--alert-success-text);
    border: 1px solid var(--alert-success-border);
}

.alert-error {
    background: var(--alert-error-bg);
    color: var(--alert-error-text);
    border: 1px solid var(--alert-error-border);
}

/* Page header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.75rem;
}

.page-header p {
    margin: 0;
    color: var(--text-muted);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.625rem;
}

/* Auth */
.auth-card {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin-top: 0;
    text-align: center;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}

/* Hero */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.feature-card h3 {
    color: var(--primary);
    margin-top: 0;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.stat-value.positive { color: var(--success); }
.stat-value.negative { color: var(--danger); }

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Lists */
.list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.row-actions {
    white-space: nowrap;
}

.list-item a {
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.list-item.compact {
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.list-title {
    display: block;
    font-weight: 500;
}

.list-meta {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.amount {
    font-weight: 600;
    white-space: nowrap;
}

.amount-large {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Balance badges */
.balance-badge {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.balance-badge.positive {
    background: var(--positive-bg);
    color: var(--positive-text);
}

.balance-badge.negative {
    background: var(--negative-bg);
    color: var(--negative-text);
}

.balance-banner {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 500;
    text-align: center;
}

.balance-banner.positive {
    background: var(--positive-bg);
    color: var(--positive-text);
}

.balance-banner.negative {
    background: var(--negative-bg);
    color: var(--negative-text);
}

/* Groups grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.group-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.group-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    text-decoration: none;
}

.group-card h3 {
    margin: 0 0 0.5rem;
    color: var(--primary);
}

.group-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 0.75rem;
}

.group-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Group layout */
.group-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
}

.group-sidebar .card {
    margin-bottom: 1rem;
}

/* Tables */
.data-table-compact th,
.data-table-compact td {
    padding: 0.35rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.3;
}

.data-table-compact th {
    font-size: 0.8rem;
}

.expense-list-table .amount-col {
    text-align: right;
    white-space: nowrap;
}

.expense-description-cell {
    min-width: 0;
}

.expense-inline-edit {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.expense-inline-edit:hover {
    color: var(--primary);
    text-decoration: underline;
}

.expense-list-compact .list-item-compact {
    padding: 0.45rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.data-table tr:hover {
    background: var(--bg);
}

/* Activity */
.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-item {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-user {
    font-weight: 600;
}

.activity-time {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Balance list */
.balance-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.balance-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.balance-list li.positive span:last-child { color: var(--success); }
.balance-list li.negative span:last-child { color: var(--danger); }

.settlement-suggestions {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
}

.settlement-suggestions li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.member-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.member-list li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
}

.badge {
    display: inline-block;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.25rem;
}

/* Split form */
.allocation-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.allocation-fieldset legend {
    font-weight: 600;
    padding: 0 0.5rem;
}

.allocation-mode-options {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.allocation-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    line-height: 1.4;
}

.allocation-mode-option input {
    margin-top: 0.2rem;
    accent-color: var(--primary);
}

.allocation-hint {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
}

.split-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.split-fieldset legend {
    font-weight: 600;
    padding: 0 0.5rem;
}

.split-type-toggle {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.split-type-toggle label {
    cursor: pointer;
}

.split-member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.split-amount-input {
    width: 120px !important;
}

/* Expense detail */
.expense-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.detail-list dt {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.detail-list dd {
    margin: 0;
}

.receipt-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.receipt-thumb {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    object-fit: cover;
}

/* Friends */
.friends-layout,
.settings-grid,
.friend-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.inline-add-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.inline-add-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Empty states */
.empty-state,
.empty-card {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.empty-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-card h2 {
    margin-top: 0;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.payment-qr-modal .payment-qr-image-wrap {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.payment-qr-modal .payment-qr-intro {
    margin: 0 0 0.5rem;
}

.payment-qr-banner {
    margin-bottom: 1rem;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.settlement-suggestion-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
}

/* Filter form */
.filter-form {
    margin-bottom: 0;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 2rem;
}

.site-footer p {
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 0.75rem 1rem 1rem;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        max-height: calc(100vh - var(--nav-height));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        padding: 0.85rem 1rem;
        font-size: 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-lang,
    .nav-theme {
        width: 100%;
    }

    .nav-lang .preference-select,
    .nav-theme .preference-select,
    .nav-lang .lang-select,
    .nav-theme .theme-select {
        width: 100%;
        min-width: 0;
        max-width: none;
        min-height: 44px;
        font-size: 1rem;
        padding: 0.65rem 2.5rem 0.65rem 2.5rem;
    }

    .nav-lang .preference-icon,
    .nav-theme .preference-icon {
        left: 1rem;
    }

    .lang-bar-inner .preference-select,
    .lang-bar-inner .lang-select {
        min-width: 10rem;
        min-height: 44px;
        font-size: 1rem;
        padding: 0.65rem 2.5rem 0.65rem 2.5rem;
    }

    .lang-bar-inner .preference-icon {
        left: 1rem;
    }

    .navbar {
        position: sticky;
        top: 0;
        flex-wrap: wrap;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .lang-bar-inner {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 150;
        background: var(--card-bg);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
        padding-bottom: env(safe-area-inset-bottom, 0);
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }

    body.has-mobile-nav main.container {
        padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0));
    }

    body.has-mobile-nav .site-footer {
        padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0));
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .flex-between {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .header-actions .btn {
        width: 100%;
        min-height: 48px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-header .btn {
        width: 100%;
        min-height: 44px;
    }

    .stats-grid,
    .dashboard-grid,
    .friends-layout,
    .settings-grid,
    .friend-detail-grid,
    .expense-detail-grid {
        grid-template-columns: 1fr;
    }

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

    .group-layout {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 2.5rem 0.5rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .hero-actions .btn {
        width: 100%;
        min-height: 48px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        min-width: 0;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        min-height: 48px;
    }

    .btn {
        min-height: var(--btn-height);
        padding: 0 1.25rem;
    }

    .auth-card {
        margin: 1.5rem auto;
        padding: 1.5rem;
    }

    .inline-add-form {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-add-form .btn {
        width: 100%;
    }

    .split-type-toggle {
        flex-direction: column;
        gap: 0.75rem;
    }

    .split-member-row {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem 0;
    }

    .split-amount-input {
        width: 100% !important;
        min-height: 44px;
    }

    .checkbox-label {
        min-height: 44px;
        padding: 0.25rem 0;
    }

    .list-item {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 0.85rem 0;
    }

    .list-item a {
        min-width: 0;
        flex: 1 1 calc(100% - 5rem);
    }

    .balance-badge,
    .list-item .amount {
        margin-left: auto;
    }

    .activity-item {
        padding: 0.85rem 0;
    }

    .modal-content {
        width: 100%;
        max-width: none;
        max-height: 100vh;
        border-radius: var(--radius) var(--radius) 0 0;
        margin-top: auto;
        padding: 1.25rem;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0));
    }

    .modal {
        align-items: flex-end;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        padding: 0.85rem 1rem;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }

    .data-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        padding: 0.4rem 0;
        border-bottom: none;
        text-align: right;
    }

    .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        text-align: left;
        flex-shrink: 0;
    }

    .data-table tbody td.amount {
        font-size: 1.05rem;
        font-weight: 700;
        padding-top: 0.65rem;
        margin-top: 0.25rem;
        border-top: 1px solid var(--border);
    }

    .table-wrap {
        margin: 0 -0.25rem;
    }
}

@media (max-width: 380px) {
    .mobile-nav-label {
        font-size: 0.58rem;
    }

    .mobile-nav-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* Super Admin */
.admin-nav {
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
}

.admin-nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-nav-list a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius);
}

.admin-nav-list a.active,
.admin-nav-list a:hover {
    color: var(--primary);
    background: var(--btn-soft-bg);
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.5rem 0 0;
}

.stat-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-success { background: var(--positive-bg); color: var(--positive-text); }
.status-failed { background: var(--alert-error-bg); color: var(--alert-error-text); }
.status-error { background: var(--alert-error-bg); color: var(--alert-error-text); }
.status-running { background: var(--btn-soft-bg); color: var(--primary); }

.detail-list {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
}

.detail-list dt {
    font-weight: 600;
    color: var(--text-muted);
}

.detail-list dd {
    margin: 0;
}

.log-output {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow: auto;
    max-height: 480px;
    font-size: 0.8125rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-output-error {
    border-color: var(--alert-error-border);
}

.filter-form .filter-row,
.filter-form .filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.inline-form {
    display: inline;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: underline;
}

.btn-link.danger {
    color: var(--danger);
}

.actions-cell {
    white-space: nowrap;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 1rem;
}

.pagination a {
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
}

.pagination a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.trend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.spark-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    padding-top: 0.5rem;
}

.spark-bar-wrap {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.spark-bar {
    width: 100%;
    min-height: 4px;
    border-radius: 3px 3px 0 0;
    background: var(--primary);
}

.spark-bar.status-failed,
.spark-bar.failed-bar {
    background: var(--danger);
}

.spark-bar.status-error {
    background: var(--warning);
}

.output-details {
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.output-details summary {
    cursor: pointer;
    font-weight: 600;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.test-issue-heading {
    font-size: 0.9375rem;
    margin: 1rem 0 0.5rem;
}

.test-issues-title {
    margin: 0 0 0.75rem;
    font-size: 1.125rem;
}

.test-issues-block .test-issue-heading:first-of-type {
    margin-top: 0;
}

.test-issue-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.test-issue-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--input-bg);
}

.test-issue-item strong {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.test-issue-location {
    display: block;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-bottom: 0.35rem;
}

.test-issue-message {
    margin: 0.35rem 0 0;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Cookie notice */
.cookie-notice {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    padding: 0 0 calc(0.75rem + env(safe-area-inset-bottom, 0));
    pointer-events: none;
}

.cookie-notice-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--btn-radius);
    box-shadow: var(--shadow);
    pointer-events: auto;
}

.cookie-notice-text {
    margin: 0;
    flex: 1 1 16rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
}

.cookie-notice-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cookie-notice-link {
    font-size: 0.875rem;
    font-weight: 500;
}

.cookie-notice-form {
    margin: 0;
}

body.has-mobile-nav .cookie-notice {
    bottom: calc(56px + env(safe-area-inset-bottom, 0));
}

/* Footer legal links */
.footer-legal {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.footer-legal a {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
}

.footer-legal a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Policy pages */
.policy-content section + section {
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
}

.policy-content h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

.policy-content p,
.policy-content li {
    line-height: 1.6;
}

.text-muted {
    color: var(--text-muted);
}

/* Form checkbox */
.form-check {
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}

/* Remembered devices */
.device-list {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
}

.device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.device-item:last-child {
    border-bottom: 0;
}

.device-meta {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.device-revoke-form {
    margin: 0;
    flex-shrink: 0;
}

.settings-actions {
    margin-top: 1rem;
}

.badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    vertical-align: middle;
}

.badge-success {
    background: var(--positive-bg);
    color: var(--positive-text);
}

.delete-disabled-wrap {
    display: inline-block;
}

.group-meta-line {
    margin-top: 0.35rem;
    font-size: 0.875rem;
}

/* Avatars & group images */
.avatar,
.group-image {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 50%;
    background: var(--surface-muted, #e8ecef);
    color: var(--text-muted, #5c6670);
    font-weight: 600;
    line-height: 1;
}

.avatar--sm,
.group-image--sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.85rem;
}

.avatar--md,
.group-image:not(.group-image--sm):not(.group-image--lg):not(.group-image--header):not(.group-image--card) {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.1rem;
}

.avatar--lg,
.avatar--profile,
.group-image--lg,
.group-image--header {
    width: 5rem;
    height: 5rem;
    font-size: 1.5rem;
}

.avatar--nav {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.65rem;
    letter-spacing: -0.02em;
}

.avatar--photo,
.group-image--photo {
    object-fit: cover;
}

.avatar--placeholder,
.group-image--placeholder {
    user-select: none;
}

.group-image--card {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}

.group-image--list {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.9rem;
}

.group-page-header .group-header-main {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.group-card {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.group-card-body {
    flex: 1;
    min-width: 0;
}

.list-item-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.list-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nav-user-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.member-list-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.member-list-name {
    flex: 1;
}

.member-list-item--pending {
    opacity: 0.85;
}

.badge-muted {
    background: var(--border);
    color: var(--text-muted);
}

.invite-prompt {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--surface-alt, #f8fafc);
    border: 1px solid var(--border);
}

.invite-prompt h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.invite-prompt p {
    margin: 0 0 0.75rem;
}

.invite-prompt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.auth-invite-banner {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface-alt, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.profile-avatar-row {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.profile-avatar-actions {
    flex: 1;
    min-width: 220px;
}

.group-image-edit-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.group-image-upload-col {
    flex: 1;
    min-width: 200px;
}

.media-upload-zone {
    border: 2px dashed var(--border-color, #c5ccd3);
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.media-upload-zone:focus {
    outline: 2px solid var(--primary, #1aad6b);
    outline-offset: 2px;
}

.media-upload-zone.is-dragover {
    border-color: var(--primary, #1aad6b);
    background: rgba(26, 173, 107, 0.06);
}

.media-upload-text {
    margin: 0 0 0.35rem;
    font-weight: 500;
}

.media-upload-hint {
    margin: 0;
    font-size: 0.85rem;
}

.media-preview {
    margin-top: 0.75rem;
}

.media-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 0.5rem;
    object-fit: contain;
}

.media-upload-buttons {
    margin-top: 0.75rem;
}

.media-delete-form {
    margin-top: 0.75rem;
}

@media (max-width: 768px) {
    .group-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-avatar-row,
    .group-image-edit-row {
        flex-direction: column;
    }
}
