* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f5f5f7;
    --card: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border: rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.1);
    --radius: 16px;
    --radius-sm: 12px;
    --transition: 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    position: relative;
}

/* Top actions */
.top-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 4px;
}

.top-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 9px;
    border-radius: 10px;
    transition: all var(--transition);
    opacity: 0.6;
}

.top-action-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

.menu-wrap {
    position: relative;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
    min-width: 188px;
    padding: 6px;
    z-index: 200;
}

.menu-dropdown.open {
    display: block;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.menu-item:hover {
    background: rgba(0,0,0,0.04);
}

.menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.menu-item-danger {
    color: #ff3b30;
}

.menu-item-danger svg {
    color: #ff3b30;
}

.menu-divider {
    height: 1px;
    background: rgba(0,0,0,0.06);
    margin: 4px 0;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 36px;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    font-weight: 400;
    margin-top: 4px;
    letter-spacing: -0.01em;
}

/* Navigation */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.controls h2 {
    min-width: 200px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: -0.01em;
}

.nav-btn {
    background: var(--card);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    color: var(--text-primary);
}

.nav-btn:hover {
    box-shadow: var(--shadow-hover);
    transform: scale(1.05);
}

.nav-btn:active {
    transform: scale(0.97);
}

/* Legend / Members */
.legend {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: nowrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--card);
    padding: 5px 10px 5px 5px;
    border-radius: 100px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    white-space: nowrap;
}

.legend-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.legend-item.active {
    box-shadow: 0 0 0 2px #007aff, var(--shadow);
    transform: translateY(-1px);
}

.legend-item {
    cursor: pointer;
    user-select: none;
}

.legend-avatar-wrap {
    position: relative;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

.legend-avatar-wrap img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-edit-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #007aff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    opacity: 0;
    transition: opacity var(--transition);
}

.legend-avatar-wrap:hover .avatar-edit-badge {
    opacity: 1;
}

.legend-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.legend-avatar-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

.drag-hint {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Calendar */
.calendar {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 28px;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.weekdays div {
    padding: 14px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.days {
    user-select: none;
    -webkit-user-select: none;
}

.week-row {
    position: relative;
}

.week-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    align-items: stretch;
}

.day {
    min-height: 80px;
    border: 0.5px solid var(--border);
    padding: 6px 8px;
    cursor: pointer;
    transition: background var(--transition);
}

.day:hover {
    background: rgba(0, 0, 0, 0.015);
}

.day.drag-highlight {
    background: color-mix(in srgb, var(--drag-color) 12%, transparent);
}

.day.drag-highlight .day-number {
    color: var(--drag-color);
    font-weight: 700;
}

.day.other-month {
    background: rgba(0, 0, 0, 0.015);
}

.day.other-month .day-number {
    color: var(--text-secondary);
    opacity: 0.5;
}

.day.today {
    background: rgba(0, 122, 255, 0.04);
}

.day-number {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.day.day-blocked {
    background: repeating-linear-gradient(
        -45deg,
        rgba(204, 51, 51, 0.04),
        rgba(204, 51, 51, 0.04) 4px,
        transparent 4px,
        transparent 8px
    );
    cursor: not-allowed;
}

.day.day-blocked .day-number {
    color: var(--text-secondary);
    opacity: 0.5;
}

.day.today .day-number {
    background: #007aff;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Day events (holidays, birthdays) */
.day-event {
    font-size: 0.52rem;
    font-weight: 500;
    line-height: 1.2;
    padding: 0;
    margin-top: 1px;
    white-space: normal;
    word-break: break-word;
    letter-spacing: 0;
    color: #b0b0b5;
}

.day-event.birthday {
    color: #c4a0d4;
}

/* Spanning booking bars */
.booking-span {
    position: absolute;
    height: 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 6px 0 2px;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    z-index: 2;
    cursor: default;
    transition: filter 0.15s;
}

.booking-span.span-start {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    padding-left: 3px;
}

.booking-span.span-end {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.booking-span:hover {
    filter: brightness(1.1);
}

.booking-span-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.booking-span-desc {
    opacity: 0.6;
    overflow: hidden;
    text-overflow: ellipsis;
}

.booking-span-delete {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
    transition: background 0.15s;
}

.booking-span:hover .booking-span-delete {
    display: flex;
}

.booking-span-delete:hover {
    background: rgba(0, 0, 0, 0.55);
}

/* Pending booking spans on calendar */
.booking-span.span-pending {
    opacity: 0.45;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        rgba(255, 255, 255, 0.25) 3px,
        rgba(255, 255, 255, 0.25) 6px
    ) !important;
    background-blend-mode: overlay;
}

/* Booking Panel */
.booking-panel {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 28px;
}

.booking-panel h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.form-group label {
    min-width: 90px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group select,
.form-group input[type="date"],
.form-group input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text-primary);
    transition: all var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-group select:focus,
.form-group input[type="date"]:focus,
.form-group input[type="text"]:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.member-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.btn {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    letter-spacing: -0.01em;
}

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

.btn-primary {
    background: #007aff;
    color: white;
    padding: 10px 28px;
}

.btn-primary:hover {
    background: #0066d6;
}

.btn-danger {
    background: transparent;
    color: #ff3b30;
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-danger:hover {
    background: rgba(255, 59, 48, 0.08);
}

/* Balance Section */
.balance-section:empty {
    display: none;
}

.balance-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 28px;
}

.balance-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 18px;
}

.balance-rows {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.balance-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.balance-member {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 155px;
    flex-shrink: 0;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.balance-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.balance-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.balance-days {
    min-width: 70px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Bookings List */
.bookings-list {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.bookings-list h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.booking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: all var(--transition);
}

.booking-item:hover {
    background: var(--bg);
}

.booking-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.booking-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.booking-item-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.booking-item-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.booking-item-name {
    font-weight: 600;
    display: block;
}

.booking-item-desc {
    display: block;
    font-size: 0.82rem;
    color: var(--text-primary);
    opacity: 0.7;
}

.booking-item-dates {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.booking-item-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

.booking-info-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.booking-info-btn svg,
.booking-info-btn svg * {
    pointer-events: none;
}

.booking-info-btn:hover {
    opacity: 0.7;
}

.info-tooltip {
    position: absolute;
    right: 0;
    top: -28px;
    background: #1d1d1f;
    color: white;
    font-size: 0.65rem;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.info-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Section header with badge */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-header h3 {
    margin-bottom: 0;
}

.pending-badge {
    background: #ff9500;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 100px;
    line-height: 1.4;
}

/* Pending booking item */
.booking-item-pending {
    background: rgba(255, 149, 0, 0.04);
    border: 1px dashed rgba(255, 149, 0, 0.25);
}

/* Approve / Decline buttons */
.btn-approve {
    background: rgba(52, 199, 89, 0.1);
    color: #28a745;
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-approve:hover {
    background: rgba(52, 199, 89, 0.18);
}

.btn-decline {
    background: transparent;
    color: #ff3b30;
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-decline:hover {
    background: rgba(255, 59, 48, 0.08);
}

.no-bookings {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 28px;
}

/* Undo Toast */
.conflict-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    background: #ffffff;
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 0 0 1px rgba(255,59,48,0.15);
    opacity: 0;
    transition: all 0.32s cubic-bezier(0.25, 0.1, 0.25, 1);
    pointer-events: none;
    z-index: 1100;
    max-width: 92vw;
}

.conflict-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.conflict-toast-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.conflict-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ff3b30;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.conflict-toast-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conflict-toast-text strong {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
}

.conflict-toast-text span {
    font-size: 13px;
    color: #86868b;
}

.undo-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1d1d1f;
    color: white;
    border-radius: 14px;
    padding: 10px 12px 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
    pointer-events: none;
    z-index: 1000;
    max-width: 90vw;
}

.undo-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.undo-toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 400;
}

.undo-toast-content strong {
    font-weight: 600;
}

.undo-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #56a8ff;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.undo-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* Popover */
.popover-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.popover-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.popover {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    padding: 24px;
    width: 340px;
    max-width: 90vw;
    transform: scale(0.95) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.popover-overlay.visible .popover {
    transform: scale(1) translateY(0);
}

.popover-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    font-weight: 600;
}

.popover-header .popover-dates {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.82rem;
    display: block;
}

.popover-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text-primary);
    transition: all var(--transition);
    margin-bottom: 16px;
}

.popover-input:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.popover-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.popover-actions .btn {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.popover-cancel {
    background: none;
    color: #ff3b30;
    padding: 8px 10px;
    margin-right: auto;
}

.popover-cancel:hover {
    background: rgba(255, 59, 48, 0.07);
}

.popover-skip {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
}

.popover-skip:hover {
    background: var(--bg);
    color: var(--text-primary);
}

.confirm-body {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.confirm-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.confirm-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.confirm-text strong {
    font-size: 15px;
    color: var(--text-primary);
}

.confirm-text span {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-danger-solid {
    background: #ff3b30;
    color: white;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-danger-solid:hover {
    background: #e0352b;
}

.popover-save {
    padding: 8px 20px;
    margin-left: 4px;
}

/* Settings Modal */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.settings-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.settings-modal {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.18);
    width: 480px;
    max-width: 92vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.settings-overlay.visible .settings-modal {
    transform: scale(1) translateY(0);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.settings-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.settings-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all var(--transition);
    line-height: 1;
}

.settings-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.settings-body {
    overflow-y: auto;
    padding: 8px 24px 24px;
    -webkit-overflow-scrolling: touch;
}

.settings-section {
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.settings-select {
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text-primary);
    transition: all var(--transition);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    width: 100%;
}

.settings-select:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.settings-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.settings-name-row img {
    flex-shrink: 0;
}

.settings-name-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text-primary);
    transition: all var(--transition);
}

.settings-name-row input:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.settings-name-row input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.03);
}

.settings-name-row .locked-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.04);
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Birthday rows */
.settings-birthday-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.settings-birthday-row input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text-primary);
    transition: all var(--transition);
}

.settings-birthday-row input[type="text"]:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.settings-birthday-row input[type="date"] {
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text-primary);
    transition: all var(--transition);
    -webkit-appearance: none;
}

.settings-birthday-row input[type="date"]:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.settings-birthday-delete {
    background: none;
    border: none;
    color: #ff3b30;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 1.1rem;
    line-height: 1;
    transition: background 0.15s;
    flex-shrink: 0;
}

.settings-birthday-delete:hover {
    background: rgba(255, 59, 48, 0.08);
}

.btn-add-birthday {
    background: transparent;
    color: #007aff;
    padding: 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-add-birthday:hover {
    color: #0066d6;
}

/* Calendar export */
.settings-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.4;
}

.calendar-export-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.btn-calendar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition);
}

.btn-calendar:hover {
    background: rgba(0, 122, 255, 0.06);
    color: #007aff;
}

.btn-calendar svg {
    flex-shrink: 0;
}

.settings-help {
    margin-top: 8px;
}

.settings-help summary {
    font-size: 0.82rem;
    color: #007aff;
    cursor: pointer;
    font-weight: 500;
    padding: 4px 0;
}

.settings-help summary:hover {
    color: #0066d6;
}

.settings-help-content {
    padding: 12px 0 4px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.settings-help-content p {
    margin: 8px 0 4px;
}

.settings-help-content ol {
    padding-left: 20px;
    margin: 4px 0;
}

.settings-help-content li {
    margin-bottom: 2px;
}

.settings-note {
    font-style: italic;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 600px) {
    .app {
        padding: 20px 12px 40px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .day {
        min-height: 60px;
        padding: 4px;
    }

    .day-number {
        font-size: 0.75rem;
    }

    .booking-span {
        font-size: 0.6rem;
        height: 18px;
    }

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

    .form-group label {
        min-width: unset;
    }

    .legend {
        gap: 5px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .legend-item {
        padding: 4px 8px 4px 4px;
        font-size: 0.7rem;
        gap: 4px;
    }

    .booking-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    .booking-item-info {
        flex: 1;
        min-width: 0;
    }

    .booking-item-right {
        width: 100%;
        justify-content: flex-end;
    }
}
