/* 工作平台後台 - 極簡黑白 (Monochrome) 樣式 */

/* 1. 全域重設與基礎 */
:root {
    --app-font-sans: 'Inter', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', 'Heiti TC', 'Noto Sans CJK TC', Arial, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--app-font-sans);
    background-color: #F9FAFB; /* bg-gray-50 */
    color: #111827; /* text-gray-900 */
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.font-sans,
.font-sans,
button,
input,
select,
textarea {
    font-family: var(--app-font-sans) !important;
}

/* 2. 自定義捲軸樣式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* 隱藏預設滾動條但保持可滾動 */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 3. 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
}

/* 4. 導航欄 */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid #E5E7EB;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: none;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    flex-wrap: wrap;
    gap: 1rem;
    height: 64px;
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 16px;
        height: 56px;
    }
}

.nav-brand {
    color: #111827;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand-icon {
    width: 32px;
    height: 32px;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav-toggle:hover {
    background: #F3F4F6;
}

.hamburger {
    width: 20px;
    height: 2px;
    background: #374151;
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.nav-menu {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: #6B7280;
    text-decoration: none;
    transition: all 0.2s;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.nav-link:hover {
    color: #000;
    background: #F3F4F6;
}

.nav-link.active {
    color: #000;
    background: #000;
    color: #fff;
}

.nav-link.logout:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.nav-user {
    color: #6B7280;
    font-size: 0.875rem;
    padding: 8px 12px;
    border-left: 1px solid #E5E7EB;
    margin-left: 8px;
}

/* 手機版導航 */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 56px);
        background: #ffffff;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 16px;
        transition: left 0.3s ease;
        z-index: 999;
        gap: 4px;
        border-right: 1px solid #E5E7EB;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        padding: 12px 16px;
        width: 100%;
        font-size: 1rem;
        border-bottom: 1px solid #F3F4F6;
    }
    
    .nav-user {
        padding: 12px 16px;
        border-bottom: 1px solid #F3F4F6;
        border-left: none;
        margin-left: 0;
        width: 100%;
    }
}

/* 5. 卡片樣式 */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    width: 100%;
    overflow-x: auto;
}

@media (max-width: 768px) {
    .card {
        padding: 16px;
        border-radius: 10px;
        margin-bottom: 16px;
    }
}

.card-header {
    border-bottom: 1px solid #F3F4F6;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .card-header {
        padding-bottom: 12px;
        margin-bottom: 16px;
    }
}

.card-title {
    font-size: 1.25rem;
    color: #111827;
    font-weight: 600;
}

@media (max-width: 768px) {
    .card-title {
        font-size: 1.125rem;
    }
}

.card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 6. 統計卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

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

.stat-icon {
    width: 32px;
    height: 32px;
    background: #F9FAFB;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    border: 1px solid #F3F4F6;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.stat-change {
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    margin-left: 8px;
}

.stat-change.positive {
    color: #111827;
}

.stat-change.negative {
    color: #6B7280;
}

/* 7. 按鈕樣式 */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .btn {
        padding: 8px 14px;
        font-size: 0.8125rem;
    }
}

.btn-primary {
    background: #000;
    color: #fff;
    border: 1px solid #000;
}

.btn-primary:hover {
    background: #1F2937;
}

.btn-secondary {
    background: #ffffff;
    color: #374151;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: #F9FAFB;
}

.btn-success {
    background: #000;
    color: #fff;
    border: 1px solid #000;
}

.btn-success:hover {
    background: #1F2937;
}

.btn-danger {
    background: #ffffff;
    color: #374151;
    border: 1px solid #E5E7EB;
}

.btn-danger:hover {
    background: #FEE2E2;
    color: #DC2626;
    border-color: #FECACA;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

/* 8. 表單樣式 */
.form-group {
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 12px;
    }
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
}

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.form-input,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    font-size: 0.875rem;
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.form-input::placeholder {
    color: #9CA3AF;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px;
}

/* 複選框 */
input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
    accent-color: #000;
}

label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #374151;
    font-size: 0.875rem;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #F3F4F6;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .form-actions {
        flex-direction: column;
        gap: 8px;
        margin-top: 16px;
        padding-top: 12px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

.search-form {
    background: #F9FAFB;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .search-form {
        padding: 12px;
    }
}

/* 9. 表格樣式 */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #F3F4F6;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .table th,
    .table td {
        padding: 10px 12px;
    }
}

.table th {
    background: #F9FAFB;
    font-weight: 600;
    color: #6B7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    cursor: pointer;
}

.table th:hover {
    background: #F3F4F6;
    color: #374151;
}

.table tbody tr {
    transition: background 0.15s;
}

.table tbody tr:hover {
    background: #F9FAFB;
}

.table tbody tr:hover .table-primary-text {
    color: #000;
}

/* 表格主要文字 */
.table-primary-text {
    font-weight: 500;
    color: #374151;
    transition: color 0.15s;
}

/* 10. 狀態標籤 / Badges */
.status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active,
.status-present {
    background: #000;
    color: #fff;
}

.status-pending {
    color: #6B7280;
    border: 1px solid #E5E7EB;
}

.status-review {
    background: #F9FAFB;
    color: #6B7280;
    border: 1px solid #E5E7EB;
}

.status-completed {
    background: #F3F4F6;
    color: #6B7280;
    border: 1px solid transparent;
    text-decoration: line-through;
}

.status-inactive,
.status-absent {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FEE2E2;
}

.status-late {
    background: #FEF3C7;
    color: #B45309;
    border: 1px solid #FDE68A;
}

/* 傳統 status classes 映射 */
.status-present { background: #000; color: #fff; }
.status-late { background: #FEF3C7; color: #B45309; }
.status-absent { background: #FEF2F2; color: #DC2626; }
.status-active { background: #000; color: #fff; }
.status-inactive { background: #FEF2F2; color: #DC2626; }

/* Badge 樣式 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary { background: #000; color: #fff; }
.badge-success { background: #F3F4F6; color: #374151; border: 1px solid #E5E7EB; }
.badge-warning { background: #FEF3C7; color: #B45309; }
.badge-danger { background: #FEF2F2; color: #DC2626; }
.badge-info { background: #F3F4F6; color: #6B7280; }

/* 11. 訊息提示 */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid;
    font-size: 0.875rem;
}

.alert-success {
    background: #F9FAFB;
    border-color: #374151;
    color: #374151;
}

.alert-error {
    background: #FEF2F2;
    border-color: #DC2626;
    color: #DC2626;
}

.alert-info {
    background: #F3F4F6;
    border-color: #6B7280;
    color: #6B7280;
}

/* 12. 分頁 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination .btn {
    min-width: auto;
}

/* 13. 間距工具 */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }

/* 14. 文字工具 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-muted { color: #9CA3AF; }
.text-primary { color: #111827; }
.text-secondary { color: #6B7280; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* 15. 佈局工具 */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* 16. 時間顯示 */
.time-display {
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    text-align: center;
    margin: 12px 0;
    padding: 12px;
    background: #F9FAFB;
    border-radius: 8px;
    border: 1px solid #F3F4F6;
}

/* 17. 公告樣式 */
.announcement {
    background: #ffffff;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 16px;
    border: 1px solid #F3F4F6;
    position: relative;
}

.announcement-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.announcement-title {
    font-weight: 600;
    color: #111827;
    font-size: 1rem;
}

.announcement-content {
    color: #6B7280;
    line-height: 1.5;
    font-size: 0.875rem;
}

.announcement-meta {
    font-size: 0.75rem;
    color: #9CA3AF;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.announcement-time {
    font-size: 0.75rem;
    color: #9CA3AF;
    text-align: right;
}

.announcement-type {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.announcement-type-info { background: #F3F4F6; color: #6B7280; }
.announcement-type-warning { background: #FEF3C7; color: #B45309; }
.announcement-type-urgent { background: #FEF2F2; color: #DC2626; }
.announcement-type-success { background: #ECFDF5; color: #059669; }

/* 18. 休息狀態 */
.break-status {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #F9FAFB;
    color: #6B7280;
    border: 1px solid #E5E7EB;
}

/* 19. 進度條 */
.progress-bar {
    width: 100%;
    background: #F3F4F6;
    border-radius: 9999px;
    height: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #000;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* 20. 模態框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 48px 16px;
    box-sizing: border-box;
}

.modal .card {
    max-width: 500px;
    width: 100%;
    margin: 0;
    animation: modalSlideIn 0.3s ease-out;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 21. 響應式工具 */
@media (max-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    .text-md-center { text-align: center !important; }
}

@media (max-width: 480px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
    .text-sm-center { text-align: center !important; }
    .w-sm-full { width: 100%; }
}

/* 22. 空狀態 */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #9CA3AF;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 23. 載入動畫 */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #E5E7EB;
    border-radius: 50%;
    border-top-color: #000;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 24. 工具提示 */
[title] {
    cursor: help;
}

/* 25. 觸控優化 */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .nav-link,
    input,
    select,
    textarea {
        min-height: 44px;
    }
    
    input[type="checkbox"] {
        min-height: auto;
    }
}

/* 26. 無障礙 */
.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;
}

:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* 27. 設備圖標 */
.device-icon {
    font-size: 1rem;
}

/* 28. 側邊欄樣式（可用於未來） */
.sidebar {
    width: 256px;
    background: #ffffff;
    border-right: 1px solid #E5E7EB;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
}

/* 28.1 統一新版後台側邊欄外觀
   目前部分頁面仍使用舊版 Tailwind markup，這裡用共用樣式把員工與管理員頁面收斂成同一套視覺。 */
#sidebar {
    flex: 0 0 256px;
}

#sidebar > div:first-child {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid #E5E7EB;
}

#sidebar > div:first-child > span:first-child,
#sidebar > div:first-child > div.text-xl:first-child {
    display: flex;
    align-items: center;
    color: #111827;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0;
}

#sidebar > div:first-child > span:first-child::before,
#sidebar > div:first-child > div.text-xl:first-child::before {
    content: "W";
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    margin-right: 12px;
    border-radius: 8px;
    background: #000000;
    color: #ffffff;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1;
}

#sidebar nav {
    padding: 24px 16px;
}

#sidebar nav:not(:has(> p:first-child))::before {
    content: "主選單";
    display: block;
    padding: 0 8px;
    margin-bottom: 8px;
    color: #9CA3AF;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1rem;
}

#sidebar nav > p,
#sidebar nav > div > p {
    padding: 0 8px;
    margin: 0 0 8px;
    color: #9CA3AF;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1rem;
    letter-spacing: 0;
}

#sidebar nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: #4B5563;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

#sidebar nav a:hover {
    background: #F3F4F6;
    color: #000000;
}

#sidebar nav a.bg-black,
#sidebar nav a[class*="bg-black"] {
    background: #000000;
    color: #ffffff;
}

#sidebar nav a.bg-black:hover,
#sidebar nav a[class*="bg-black"]:hover {
    background: #000000;
    color: #ffffff;
}

#sidebar nav a i {
    margin-right: 12px !important;
    color: #9CA3AF;
    font-size: 1.25rem !important;
    line-height: 1;
    transition: color 0.15s ease;
}

#sidebar nav a:hover i {
    color: #000000;
}

#sidebar nav a.bg-black i,
#sidebar nav a[class*="bg-black"] i {
    color: #ffffff;
}

#sidebar nav a span {
    margin-left: 0 !important;
    color: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
}

#sidebar nav > div:has(a[href*="logout.php"]) > p {
    display: none;
}

#sidebar nav > div:has(a[href*="logout.php"]) {
    height: 0;
    padding-top: 0 !important;
}

#sidebar nav a[href*="logout.php"] {
    position: absolute;
    right: 24px;
    bottom: 24px;
    width: 32px;
    height: 32px;
    min-height: 32px;
    justify-content: center;
    padding: 0;
    color: #9CA3AF;
    background: transparent;
}

#sidebar nav a[href*="logout.php"]:hover {
    background: #E5E7EB;
    color: #000000;
}

#sidebar nav a[href*="logout.php"] i {
    margin-right: 0 !important;
    color: inherit;
    font-size: 1.125rem !important;
}

#sidebar nav a[href*="logout.php"] span {
    display: none;
}

#sidebar > div:last-child {
    position: relative;
    padding: 16px;
    border-top: 1px solid #E5E7EB;
}

#sidebar > div:last-child > div {
    min-height: 48px;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 44px 8px 12px;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

#sidebar > div:last-child > div:hover {
    background: #F3F4F6;
}

#sidebar > div:last-child img,
#sidebar > div:last-child .w-8.h-8 {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: 1px solid #E5E7EB;
    border-radius: 9999px;
    background: #000000 !important;
    color: #ffffff !important;
}

#sidebar > div:last-child .w-8.h-8 i,
#sidebar > div:last-child .w-8.h-8 span {
    color: #ffffff !important;
}

#sidebar > div:last-child a[href*="logout.php"] {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 6px;
    color: #9CA3AF;
    background: transparent;
    transition: color 0.15s ease, background-color 0.15s ease;
}

#sidebar > div:last-child a[href*="logout.php"]:hover {
    background: #E5E7EB;
    color: #000000;
}

#sidebar > div:last-child a[href*="logout.php"] i {
    margin: 0 !important;
    color: inherit;
    font-size: 1.125rem !important;
}

#sidebar > div:last-child a[href*="logout.php"] span {
    display: none;
}

.sidebar-logo {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid #E5E7EB;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #6B7280;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar-link:hover {
    background: #F3F4F6;
    color: #000;
}

.sidebar-link.active {
    background: #000;
    color: #fff;
}

.sidebar-link i {
    margin-right: 12px;
    font-size: 1.25rem;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #E5E7EB;
}

/* 主內容區偏移 */
.main-content {
    margin-left: 256px;
    min-height: 100vh;
    background: #F9FAFB;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* 29. 篩選器樣式 */
.quick-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: end;
}

.quick-filters .form-group {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .quick-filters {
        flex-direction: column;
        gap: 8px;
    }
    
    .quick-filters .form-input,
    .quick-filters select {
        width: 100%;
    }
}

/* 30. 統計卡片變體 */
.salary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.salary-stat-card {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.salary-stat-card.total { border-left: 3px solid #000; }
.salary-stat-card.records { border-left: 3px solid #6B7280; }
.salary-stat-card.average { border-left: 3px solid #374151; }
.salary-stat-card.paid { border-left: 3px solid #1F2937; }

/* 31. 類別顏色 */
.category-color {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.amount-cell {
    font-weight: 600;
    color: #111827;
}

/* 32. 請假類型卡片 */
.type-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #E5E7EB;
    border-left: 4px solid #000;
}

.type-card.type-inactive {
    border-left-color: #9CA3AF;
    opacity: 0.7;
}

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

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

/* 33. 系統動態時間線 */
.activity-item {
    position: relative;
    padding-left: 28px;
    padding-bottom: 24px;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 24px;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, #E5E7EB, transparent);
}

.activity-dot {
    position: absolute;
    left: 0;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #000;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #fff;
}

.activity-dot.secondary {
    background: #D1D5DB;
}

.activity-time {
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-top: 4px;
}

.activity-content {
    background: #F9FAFB;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #F3F4F6;
    margin-top: 8px;
    font-size: 0.875rem;
}

/* 34. 使用者頭像 */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6B7280;
    border: 1px solid #E5E7EB;
}

.user-avatar-lg {
    width: 40px;
    height: 40px;
    font-size: 0.875rem;
}

/* 35. 通知徽章 */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* 36. 手機版遮罩 */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
    display: none;
}

.mobile-overlay.active {
    display: block;
}

/* 37. 響應式圖表容器 */
.chart-container {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

/* 38. 螢光筆效果 */
.highlight {
    background: linear-gradient(120deg, #FEF3C7 0%, #FEF3C7 100%);
    background-repeat: no-repeat;
    background-size: 100% 40%;
    background-position: 0 90%;
}

/* 39. 許可證標籤 */
.permission-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #E5E7EB;
}

.permission-tag.admin {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* 40. 工作管理看板 */
.task-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    gap: 16px;
    align-items: start;
    overflow-x: auto;
    padding-bottom: 8px;
}

.task-column {
    min-height: 420px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 12px;
}

.task-column.is-over {
    background: #F3F4F6;
    border-color: #111827;
}

.task-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.task-card {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    min-width: 0;
    overflow: hidden;
}

.task-card:active {
    cursor: grabbing;
}

.task-card.is-dragging {
    opacity: 0.55;
}

.task-card .task-select {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    accent-color: #111827;
}

.task-priority {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #E5E7EB;
}

.task-priority-low {
    color: #6B7280;
    background: #F9FAFB;
}

.task-priority-normal {
    color: #374151;
    background: #F3F4F6;
}

.task-priority-high {
    color: #111827;
    background: #E5E7EB;
}

.task-priority-urgent {
    color: #ffffff;
    background: #000000;
    border-color: #000000;
}

.task-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 9999px;
    background: #E5E7EB;
}

.task-progress-bar {
    height: 100%;
    border-radius: inherit;
    background: #111827;
}

.task-description {
    font-size: 0.8125rem;
    line-height: 1.55;
    color: #4B5563;
    word-break: break-word;
}

.task-description p,
.task-rich-editor p {
    margin: 0 0 8px;
}

.task-description ul,
.task-description ol,
.task-rich-editor ul,
.task-rich-editor ol {
    margin: 6px 0 8px 18px;
    padding: 0;
}

.task-description ul,
.task-rich-editor ul {
    list-style: disc;
}

.task-description ol,
.task-rich-editor ol {
    list-style: decimal;
}

.task-description blockquote,
.task-rich-editor blockquote {
    margin: 8px 0;
    padding: 8px 10px;
    border-left: 3px solid #D1D5DB;
    background: #F9FAFB;
    color: #374151;
}

.task-description a,
.task-rich-editor a {
    color: #111827;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.task-editor {
    overflow: hidden;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    background: #F9FAFB;
}

.task-editor-toolbar {
    padding: 8px;
    border-bottom: 1px solid #E5E7EB;
    background: #ffffff;
}

.task-editor-toolbar button {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #4B5563;
    background: #ffffff;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.task-editor-toolbar button:hover {
    color: #111827;
    background: #F3F4F6;
    border-color: #E5E7EB;
}

.task-editor .ql-toolbar.ql-snow {
    border: 0;
    border-bottom: 1px solid #E5E7EB;
}

.task-editor .ql-container.ql-snow {
    border: 0;
    font-family: inherit;
}

.task-editor .ql-editor {
    min-height: 150px;
    padding: 12px;
    font-size: 0.875rem;
    line-height: 1.6;
}

.task-editor .ql-editor.ql-blank::before {
    color: #9CA3AF;
    font-style: normal;
    left: 12px;
    right: 12px;
}

.task-rich-editor {
    min-height: 150px;
    padding: 12px;
    background: #F9FAFB;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #111827;
    outline: none;
    word-break: break-word;
}

.task-rich-editor:empty::before {
    content: attr(data-placeholder);
    color: #9CA3AF;
}

.task-report-list {
    display: grid;
    gap: 6px;
}

.task-report-item {
    padding: 8px;
    border: 1px solid #F3F4F6;
    border-radius: 8px;
    background: #F9FAFB;
    font-size: 0.75rem;
    color: #6B7280;
}

.task-report-item span {
    font-weight: 600;
    color: #374151;
}

.task-report-date {
    margin-top: 4px;
    font-size: 0.6875rem;
    color: #9CA3AF;
}

.task-report-item p {
    margin: 4px 0 0;
    color: #6B7280;
    line-height: 1.45;
}

.task-progress-form {
    min-width: 0;
}

.task-progress-fields {
    display: grid;
    grid-template-columns: minmax(60px, 72px) minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
}

.task-progress-fields input[name="report_note"] {
    grid-column: 1 / -1;
}

.task-progress-fields input,
.task-progress-form button,
.task-status-select,
.task-progress-input {
    min-width: 0;
    max-width: 100%;
}

.task-overdue {
    color: #B91C1C;
}

.task-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
}

.task-modal.is-open {
    display: flex;
}

.task-modal-panel {
    width: min(720px, 100%);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}

.task-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 80;
    display: none;
    max-width: 360px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #111827;
    color: #ffffff;
    font-size: 0.875rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.task-toast.is-open {
    display: block;
}

.task-toast.is-error {
    background: #991B1B;
}

@media (max-width: 1024px) {
    .task-board {
        grid-template-columns: repeat(4, minmax(240px, 1fr));
    }
}
