:root {
    --bg-light: #f0f9ff;
    --bg-darker: #e0f2fe;
    --card-bg: #ffffff;
    --input-bg: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #0284c7;
    --primary-light: #38bdf8;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --border-soft: rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #d1d5db; /* Gray background for desktop */
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* Mobile Constraint Container */
.mobile-app {
    width: 100%;
    max-width: 480px;
    background: linear-gradient(135deg, var(--bg-light), var(--bg-darker));
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    padding: 2rem 1.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(240, 249, 255, 1) 60%, rgba(240, 249, 255, 0));
}

#page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

/* Main Content */
.app-content {
    flex: 1;
    padding: 0 1.25rem 6rem; /* bottom padding for nav */
    overflow-y: auto;
}

.tab-content {
    display: none;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tab-content.active {
    display: block;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typography */
h2 {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-left: 0.5rem;
    margin-bottom: 0.75rem;
}

.dashboard-header {
    margin-bottom: 1rem;
}

.section-notice {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

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

.card.no-padding {
    padding: 0;
    overflow: hidden;
}

/* Forms & Inputs */
.mobile-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

input, select {
    background: var(--input-bg);
    border: 2px solid transparent;
    color: var(--text-main);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
    box-shadow: var(--shadow-inner);
    appearance: none;
}

input:focus, select:focus {
    border-color: var(--primary-light);
    background: var(--card-bg);
}

/* Select arrow custom */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix input {
    padding-right: 3rem;
}

.input-with-suffix span {
    position: absolute;
    right: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 800;
    cursor: pointer;
    border: none;
    transition: transform 0.1s ease, filter 0.2s ease;
    font-family: inherit;
    font-size: 1rem;
    text-align: center;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-main);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 0.75rem 1rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
}

.form-actions .btn {
    flex: 1;
}

.flex-form {
    display: flex;
    gap: 0.5rem;
}

/* Lists */
.mobile-list {
    list-style: none;
}

.mobile-list li {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.list-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.list-title {
    font-weight: 800;
    font-size: 1.25rem;
}

.list-sub {
    font-size: 1rem;
    color: #334155;
    font-weight: 600;
}

.list-badge {
    background: var(--bg-darker);
    color: var(--primary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 800;
}

.cal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.cal-dot.farm-color-0 { background: #14b8a6; }
.cal-dot.farm-color-1 { background: #f97316; }
.cal-dot.farm-color-2 { background: #3b82f6; }
.cal-dot.farm-color-3 { background: #10b981; }
.cal-dot.farm-color-4 { background: #f59e0b; }
.cal-dot.farm-color-5 { background: #8b5cf6; }
.cal-dot.farm-color-6 { background: #ef4444; }

.list-badge.farm-color-0 { background: #f0fdfa; color: #14b8a6; }
.list-badge.farm-color-1 { background: #fff7ed; color: #f97316; }
.list-badge.farm-color-2 { background: #eff6ff; color: #3b82f6; }
.list-badge.farm-color-3 { background: #ecfdf5; color: #10b981; }
.list-badge.farm-color-4 { background: #fffbeb; color: #f59e0b; }
.list-badge.farm-color-5 { background: #f5f3ff; color: #8b5cf6; }
.list-badge.farm-color-6 { background: #fef2f2; color: #ef4444; }

.summary-card.farm-color-0 { background: #ccfbf1; }
.summary-card.farm-color-1 { background: #ffedd5; }
.summary-card.farm-color-2 { background: #dbeafe; }
.summary-card.farm-color-3 { background: #d1fae5; }
.summary-card.farm-color-4 { background: #fef3c7; }
.summary-card.farm-color-5 { background: #ede9fe; }
.summary-card.farm-color-6 { background: #fee2e2; }

.list-actions button {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    padding: 0.5rem;
    margin-left: 0.5rem;
    cursor: pointer;
}

/* Dashboard */
/* Dashboard Tabs System */
.dash-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 14px;
    gap: 4px;
    box-shadow: var(--shadow-inner);
}

.dash-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.dash-tab.active {
    background: var(--primary);
    color: white;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

/* Banking Style Selector */
.banking-selector {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-radius: 50px;
    padding: 2px 12px;
    gap: 8px;
    box-shadow: var(--shadow-inner);
    border: 1px solid #e2e8f0;
}

.banking-selector .selector-value {
    flex: 1;
    display: flex;
    justify-content: center;
}

.banking-selector input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    text-align: center;
    font-weight: 800;
    padding: 10px 0;
    font-size: 1.1rem;
    color: var(--text-main);
    cursor: pointer;
}

/* 기본 달력 아이콘 숨기기 (크롬, 사파리 등) */
.banking-selector input::-webkit-calendar-picker-indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    cursor: pointer;
    opacity: 0;
}

.banking-selector .calendar-icon {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-left: 2px;
    flex-shrink: 0;
    pointer-events: none;
}

.banking-selector .btn-arrow {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.banking-selector .btn-arrow:active {
    transform: scale(0.85);
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-inputs {
    display: flex;
    gap: 0.5rem;
}

.summary-cards {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.summary-card {
    flex: 1;
    background: var(--bg-light);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-soft);
}

.summary-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.summary-cost {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-main);
}

.summary-hours {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.total-box {
    background: var(--primary);
    color: white;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.total-label {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
}

.total-cost {
    font-size: 1.5rem;
    font-weight: 800;
}

.total-hours {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 80px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-soft);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: var(--text-muted);
    width: 33%;
    height: 100%;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item .icon {
    font-size: 1.25rem;
    filter: grayscale(100%) opacity(0.5);
    transition: all 0.2s;
}

.nav-item .label {
    font-size: 0.7rem;
    font-weight: 600;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active .icon {
    filter: none;
    transform: translateY(-2px);
}

/* Utility */
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* Toast */
.toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: var(--shadow-soft);
    z-index: 1000;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 90%;
    text-align: center;
}

/* Calendar Styles */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--primary);
    cursor: pointer;
    padding: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    text-align: center;
}

.cal-day-header {
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

.text-red { color: var(--danger); }
.text-blue { color: var(--primary); }
.text-center { text-align: center; }

.cal-cell {
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    min-height: 85px;
    min-width: 0;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 2px solid transparent;
}

.cal-cell.empty {
    background: transparent;
    border-color: transparent;
}

.cal-cell.today {
    border: 2px solid var(--primary);
    background: var(--bg-light);
}

.cal-date-num {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.cal-hours-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    min-width: 0;
}

.cal-hour-item {
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-light);
    color: var(--text-main);
    padding: 2px;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dashboard dynamic cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--card-bg);
    margin: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 1rem;
}

/* Multi-select Grid Styles */
.chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.chip {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #475569;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.chip.selected {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.chip:active {
    transform: scale(0.95);
}

.farm-chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.farm-chip {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.9rem;
    color: #475569;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.farm-chip.selected {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
    font-weight: 600;
}
