:root {
    --bg-base: #f4f6f9;
    --panel-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --border-subtle: #e5e9f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent: #4dcdff;
    --accent-glow: rgba(37, 99, 235, 0.15);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
    padding: 20px;
}

.app-window {
    display: flex;
    width: 100%;
    height: 100%;
    background-color: var(--bg-base);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #ffffff;
}

aside {
    width: 240px;
    background-color: var(--sidebar-bg);
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    padding: 28px 20px;
    justify-content: space-between;
}

.logo-area {
    font-weight: 700;
    font-size: 16px;
    color: #009ffc;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
    letter-spacing: 0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-links img {
    width: 28px;
    height: 28px;
}

.nav-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: #4d4c4c;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item:hover {
    background-color: rgba(134, 134, 134, 0.06);
    color: #000000;
}

.nav-item.active {
    background-color: #00b7ff;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(177, 177, 177, 0.4);
}

.nav-item.active .nav-icon {
    filter: brightness(0) invert(1);
}

.sidebar-footer-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-base);
    overflow-y: auto;
    padding: 24px 32px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.welcome-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.welcome-text p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-pill {
    background: var(--panel-bg);
    padding: 6px 14px 6px 6px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3bdaf6, #1da3d8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 13px;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.metrics-dual-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.stat-card {
    background-color: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.stat-value-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.stat-number {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.stat-badge.warning {
    background: #fef3c7;
    color: #b45309;
}

.stat-badge.info {
    background: #e0f2fe;
    color: #0369a1;
}

.middle-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.panel-box {
    background-color: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calc-input-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.calc-output {
    background: var(--sidebar-bg);
    color: rgb(0, 0, 0);
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}

.chart-card {
    background-color: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-bars-mock {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 140px;
    padding-top: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.bar {
    width: 24px;
    background: #e2e8f0;
    border-radius: 6px 6px 0 0;
    transition: height 0.3s;
}

.bar.active {
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.bar-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.calendar-card {
    background-color: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calendar-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 15px;
}

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

.cal-day-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding-bottom: 6px;
}

.cal-date {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    color: var(--text-main);
    position: relative;
}

/* 唯讀（主頁）日期：可點擊「預覽」當天待辦，但不可新增/刪除 */
#homeCalendarGrid .cal-date:not(.disabled) {
    cursor: pointer;
    transition: all 0.2s;
}

#homeCalendarGrid .cal-date.disabled {
    cursor: default;
}

#homeCalendarGrid .cal-date:not(.disabled):hover {
    background-color: #eff6ff;
    color: var(--accent);
}

#homeCalendarGrid .cal-date.preview-active {
    background-color: #e0f2fe;
    color: #0369a1;
    font-weight: 700;
    box-shadow: inset 0 0 0 1.5px #38bdf8;
}

/* 可互動（行事曆頁）日期：可點擊，滑鼠移入有反饋 */
#interactiveCalendarGrid .cal-date {
    cursor: pointer;
    transition: all 0.2s;
}

#interactiveCalendarGrid .cal-date:not(.disabled):hover {
    background-color: #eff6ff;
    color: var(--accent);
}

#interactiveCalendarGrid .cal-date.active {
    background-color: #00b7ff;
    color: #ffffff;
}

.cal-date.disabled {
    color: #cbd5e1 !important;
}

.dot-container {
    position: absolute;
    bottom: 3px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 2px;
    pointer-events: none;
}

/* 小圓點（行事曆格子內的待辦標記）：獨立於顏色選擇器的圓點樣式，避免尺寸互相干擾 */
.todo-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

/* 固定顏色選項的圓點樣式（新增待辦時的顏色選擇器） */
.color-dot-option {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.color-dot-option:hover {
    transform: scale(1.15);
}

.color-dot-option.active {
    border-color: #1e293b;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #cbd5e1;
    transform: scale(1.1);
}

.todo-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #ffffff;
    font-weight: 500;
}

.delete-btn {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.delete-btn:hover {
    background: rgba(0, 0, 0, 0.4);
}

.placeholder-box {
    background-color: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* 訂單管理頁面 */
#orderModal .tag-option {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    font-size: 12px;
    background: white;
    color: #475569;
    cursor: pointer;
    transition: all .12s ease;
}

#orderModal .tag-option.is-active {
    background: #00b7ff;
    border-color: #00b7ff;
    color: white;
    font-weight: 600;
}

#orderModal .tag-add-btn {
    padding: 6px 12px;
    border: 1px dashed #94a3b8;
    border-radius: 999px;
    font-size: 12px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}

#orderModal .tag-add-btn:hover {
    background: #f1f5f9;
}

.delete-row-btn:hover {
    background: #c0c0c0 !important;
    color: #b8b8b8 !important;
}

/* 頂部篩選標籤按鈕 */
.filter-tab {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.filter-tab.active {
    background: #00b7ff;
    color: #ffffff;
    border-color: #00b7ff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 183, 255, 0.3);
}

/* 主按鈕樣式 */
.primary-btn {
    background-color: #00b7ff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 183, 255, 0.3);
    transition: background 0.2s;
}

.primary-btn:hover {
    background-color: #009ffc;
}

/* 財務與匯率頁面專屬版型 */
.finance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.panel-card {
    background-color: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.input-group label {
    color: var(--text-muted);
    font-weight: 500;
}

.input-group input,
.input-group select {
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    background: #f8fafc;
}

.result-box {
    background: #00b7ff;
    color: white;
    padding: 14px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    margin-top: 4px;
}

/* 下方刷卡記錄表格區塊 */
.table-card {
    background-color: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px;
    border-bottom: 2px solid var(--border-subtle);
    background-color: #f8fafc;
}

.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
}