/* Boardigo - Main Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
    --shadow-lg: 0 4px 24px rgba(0,0,0,.1);
    --transition: all .25s cubic-bezier(.4,0,.2,1);
    --sidebar-width: 260px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-size: 14px; scroll-behavior: smooth; background-color: var(--bg-primary, #f1f5f9); }
body {
    font-family: var(--font);
    background: var(--bg-primary, #f1f5f9);
    color: var(--text-primary, #0f172a);
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: var(--transition);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}
.brand-icon {
    width: 42px; height: 42px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    background: transparent;
    flex-shrink: 0;
}
.login-logo {
    width: 72px; height: 72px; margin: 0 auto 16px;
    border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
}
.brand-icon img {
    width: 100%; height: 100%; object-fit: contain; display: block;
}
.brand-name { font-weight: 700; font-size: 1.15rem; display: block; color: var(--text-primary); }
.brand-tagline { font-size: .75rem; color: var(--text-muted); }

.sidebar-nav { list-style: none; padding: 16px 12px; flex: 1; }
.sidebar-nav li { margin-bottom: 4px; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none;
    font-weight: 500; transition: var(--transition);
}
.nav-link i { width: 20px; text-align: center; font-size: 15px; }
.nav-link:hover { background: var(--hover-bg); color: var(--primary); transform: translateX(2px); }
.nav-link.active {
    background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(139,92,246,.08));
    color: var(--primary); font-weight: 600;
}

.sidebar-footer {
    padding: 16px; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.user-name { display: block; font-weight: 600; font-size: .9rem; }
.user-role { display: block; font-size: .75rem; color: var(--text-muted); }
.logout-btn {
    color: var(--text-muted); padding: 8px; border-radius: var(--radius-sm);
    transition: var(--transition); text-decoration: none;
}
.logout-btn:hover { color: var(--danger); background: rgba(239,68,68,.08); }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1; padding: 28px 32px;
    min-height: 100vh;
    animation: fadeIn .4s ease;
}
.main-content.full-width { margin-left: 0; padding: 0; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }

.animate-in { animation: slideUp .5s ease; }
.animate-card { animation: scaleIn .4s ease backwards; }
.animate-card:nth-child(2) { animation-delay: .05s; }
.animate-card:nth-child(3) { animation-delay: .1s; }
.animate-card:nth-child(4) { animation-delay: .15s; }

/* Page Header */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.page-header h1 { font-size: 1.75rem; font-weight: 700; display: flex; align-items: center; gap: 12px; }
.page-header h1 i { color: var(--primary); }
.page-subtitle { color: var(--text-muted); margin-top: 4px; font-size: .95rem; }
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border: none; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: .9rem; font-weight: 600;
    cursor: pointer; transition: var(--transition); text-decoration: none;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,.45); }
.btn-secondary { background: var(--card-bg); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--hover-bg); }
.btn-sm { padding: 7px 14px; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }

/* Search */
.search-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0 14px;
    transition: var(--transition);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.search-box i { color: var(--text-muted); font-size: 13px; }
.search-box input {
    border: none; background: transparent; padding: 10px 0;
    font-family: var(--font); font-size: .9rem; color: var(--text-primary);
    width: 200px; outline: none;
}

/* Filters */
.filters-bar { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; align-items: center; }
.filter-select {
    padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--card-bg); color: var(--text-primary);
    font-family: var(--font); font-size: .85rem; cursor: pointer;
    transition: var(--transition);
}
.filter-select:focus { border-color: var(--primary); outline: none; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    min-width: 160px; z-index: 50; opacity: 0; visibility: hidden;
    transform: translateY(-8px); transition: var(--transition);
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu a, .dropdown-menu label {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; color: var(--text-primary); text-decoration: none;
    font-size: .88rem; cursor: pointer; transition: var(--transition);
}
.dropdown-menu a:hover, .dropdown-menu label:hover { background: var(--hover-bg); color: var(--primary); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .88rem; color: var(--text-secondary); }
.form-group label i { margin-right: 4px; color: var(--primary); }
.required { color: var(--danger); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--input-bg);
    color: var(--text-primary); font-family: var(--font); font-size: .9rem;
    transition: var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary); outline: none;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-error { color: var(--danger); font-size: .78rem; margin-top: 4px; display: block; min-height: 16px; }
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea { border-color: var(--danger) !important; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: var(--card-bg); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
}
.modal-lg { max-width: 640px; }
.animate-modal { animation: scaleIn .3s ease; }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }
.modal-close {
    background: none; border: none; font-size: 18px;
    color: var(--text-muted); cursor: pointer; padding: 6px;
    border-radius: var(--radius-sm); transition: var(--transition);
}
.modal-close:hover { background: var(--hover-bg); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 24px; border-top: 1px solid var(--border);
}

/* Detail Modal */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-full { grid-column: 1 / -1; }
.detail-section label {
    display: block; font-size: .78rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted); margin-bottom: 6px;
}
.detail-text { color: var(--text-secondary); line-height: 1.7; }
.detail-value { font-weight: 500; }

/* Badges */
.badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
}
.badge-critical { background: rgba(239,68,68,.12); color: #ef4444; }
.badge-high { background: rgba(245,158,11,.12); color: #f59e0b; }
.badge-medium { background: rgba(59,130,246,.12); color: #3b82f6; }
.badge-low { background: rgba(16,185,129,.12); color: #10b981; }
.badge-backlog { background: rgba(100,116,139,.12); color: #64748b; }
.badge-todo { background: rgba(59,130,246,.12); color: #3b82f6; }
.badge-inprogress { background: rgba(245,158,11,.12); color: #f59e0b; }
.badge-review { background: rgba(139,92,246,.12); color: #8b5cf6; }
.badge-done { background: rgba(16,185,129,.12); color: #10b981; }
.badge-priority {
    background: color-mix(in srgb, var(--p-color) 14%, transparent);
    color: var(--p-color);
}

.label-tag {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    background: rgba(99,102,241,.1); color: var(--primary);
    font-size: .75rem; font-weight: 500; margin: 2px 4px 2px 0;
}
.label-list { display: flex; flex-wrap: wrap; gap: 4px; }

/* Task progress & comments */
.progress-summary { display: flex; flex-direction: column; gap: 8px; }
.progress-summary.over .progress-summary-text { color: #ef4444; font-weight: 600; }
.progress-bar-track {
    height: 8px;
    background: var(--hover-bg);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width .25s ease;
}
.progress-bar-fill.over { background: #ef4444; }
.progress-summary-text { font-size: .88rem; font-weight: 500; }
.comment-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; max-height: 220px; overflow-y: auto; }
.comment-empty { margin: 0; }
.comment-item {
    padding: 10px 12px;
    background: var(--hover-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.comment-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: .82rem;
}
.comment-item-top strong { flex: 1; }
.comment-actions { display: flex; gap: 2px; margin-left: auto; }
.comment-edit,
.comment-delete {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
}
.comment-edit:hover { color: var(--primary); }
.comment-delete:hover { color: #ef4444; }
.comment-time { color: var(--text-muted); font-size: .72rem; flex: 1; }
.comment-edit-form { margin-top: 8px; }
.comment-edit-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: var(--font);
    margin-bottom: 8px;
    resize: vertical;
}
.comment-history-toggle {
    margin-top: 8px;
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-family: var(--font);
}
.comment-history-toggle:hover { text-decoration: underline; }
.comment-history {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.comment-revision {
    padding: 8px 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border);
}
.comment-revision.current { border-left-color: var(--primary); }
.comment-revision-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.comment-revision-meta {
    display: block;
    margin-top: 6px;
    font-size: .7rem;
    color: var(--text-muted);
}
.comment-amount-badge.muted {
    background: rgba(100,116,139,.12);
    color: var(--text-muted);
}
.comment-body { margin: 0 0 6px; font-size: .86rem; color: var(--text-secondary); line-height: 1.45; }
.comment-amount-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(16,185,129,.12);
    color: #10b981;
    font-size: .75rem;
    font-weight: 700;
}
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: var(--font);
    resize: vertical;
}
.comment-form-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}
.comment-amount-field { flex: 1; }
.comment-amount-field label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: none;
    letter-spacing: 0;
}
.comment-amount-field input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: var(--font);
}
.comment-hint {
    margin: 0;
    font-size: .75rem;
    color: var(--text-muted);
}

/* Toast */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px; border-radius: var(--radius-sm);
    background: var(--card-bg); box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    animation: slideInRight .35s ease;
    min-width: 280px; max-width: 420px;
}
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--info); }
.toast i { font-size: 18px; }
.toast-success i { color: var(--success); }
.toast-error i { color: var(--danger); }
.toast-message { flex: 1; font-size: .88rem; font-weight: 500; }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }

@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* Login */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.login-bg {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6366f1 100%);
}
.login-bg::after {
    content: ''; position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-card {
    position: relative; background: rgba(255,255,255,.95);
    backdrop-filter: blur(20px); border-radius: var(--radius-lg);
    padding: 40px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo img {
    width: 100%; height: 100%; object-fit: contain; display: block;
}
.login-logo i { color: #0f766e; font-size: 24px; }
.login-header h1 { font-size: 1.6rem; font-weight: 800; color: #1e293b; }
.login-header p { color: #64748b; font-size: .9rem; margin-top: 4px; }
.login-form .form-group label { color: #475569; }
.login-form input {
    background: #f8fafc; border-color: #e2e8f0; color: #1e293b;
}
.login-hint {
    text-align: center; margin-top: 20px; padding: 12px;
    background: rgba(99,102,241,.06); border-radius: var(--radius-sm);
    color: #64748b; font-size: .82rem;
}
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .88rem; }
.alert-success { background: rgba(16,185,129,.1); color: #10b981; border: 1px solid rgba(16,185,129,.2); }
.login-hint a { color: var(--primary); font-weight: 600; text-decoration: none; }
.login-hint a:hover { text-decoration: underline; }

/* Dashboard Switcher */
.sidebar-dashboard-switch {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-dashboard-switch label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.sidebar-dashboard-switch label i { margin-right: 4px; color: var(--primary); }
.board-switch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.board-switch-header label { margin-bottom: 0; }
.btn-new-board {
    border: none;
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary);
    font-size: .72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
}
.btn-new-board:hover { background: rgba(59, 130, 246, 0.22); }
.dashboard-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .82rem;
    cursor: pointer;
}
.board-status-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.dashboard-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 700;
}
.dashboard-badge.is-owner {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}
.dashboard-badge.is-member {
    background: rgba(139, 92, 246, 0.12);
    color: var(--secondary);
}
.dashboard-badge[hidden],
.invite-badge[hidden] {
    display: none !important;
}
.invite-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    font-size: .7rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.invite-badge:hover {
    background: rgba(239, 68, 68, 0.2);
}
.share-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Sharing Settings */
.settings-card-wide { grid-column: 1 / -1; }
.workload-settings-form .settings-hint { margin-top: 4px; margin-bottom: 14px; font-size: .82rem; color: var(--text-muted); }
.conversion-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.conversion-eq, .conversion-unit {
    font-size: .88rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.conversion-input-row input {
    width: 100px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: var(--font);
}
.sharing-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.sharing-section h4 { font-size: .9rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.sharing-section h4 i { color: var(--primary); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .88rem;
    flex: 1;
    min-width: 140px;
}
.shares-list { list-style: none; margin-top: 12px; }
.share-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--hover-bg);
    margin-bottom: 6px;
    font-size: .88rem;
}
.share-empty { color: var(--text-muted); font-size: .85rem; padding: 8px 0; }

.column-body.drag-over { background: rgba(99,102,241,.06); outline: 2px dashed var(--primary); outline-offset: -2px; border-radius: 0 0 var(--radius) var(--radius); }
.task-card.dragging { opacity: .4; cursor: grabbing; }

/* Settings */
.settings-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.settings-card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    transition: var(--transition);
}
.settings-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.settings-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.settings-card-header i { color: var(--primary); font-size: 20px; }
.settings-card-header h3 { font-size: 1.05rem; font-weight: 700; }
.settings-desc { color: var(--text-muted); font-size: .88rem; margin-bottom: 16px; }

.workflow-manage-list {
    list-style: none; margin-top: 14px; display: flex; flex-direction: column; gap: 8px;
}
.workflow-item {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 12px; background: var(--input-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.workflow-drag { cursor: grab; color: var(--text-muted); }
.workflow-drag:active { cursor: grabbing; }
.workflow-color {
    width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0;
    border: 1px solid var(--border);
}
.workflow-name { font-weight: 600; font-size: .9rem; }
.workflow-name-input {
    flex: 1; min-width: 120px; padding: 6px 10px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--card-bg); color: var(--text-primary); font-family: var(--font);
}
/* Color picker as a fixed square (not stretched by .inline-form flex:1) */
.workflow-color-input,
input[type="color"].color-swatch-input,
.inline-form input[type="color"].color-swatch-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
    flex: 0 0 32px !important;
    vertical-align: middle;
}
.workflow-color-input::-webkit-color-swatch-wrapper,
input[type="color"].color-swatch-input::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
}
.workflow-color-input::-webkit-color-swatch,
input[type="color"].color-swatch-input::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}
.workflow-color-input::-moz-color-swatch,
input[type="color"].color-swatch-input::-moz-color-swatch {
    border: none;
    border-radius: 5px;
}
.workflow-done-check {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .82rem; color: var(--text-secondary); white-space: nowrap;
}

.theme-toggle { display: flex; gap: 10px; }
.theme-btn {
    flex: 1; padding: 12px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); background: var(--input-bg);
    cursor: pointer; font-family: var(--font); font-weight: 600;
    color: var(--text-secondary); transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.theme-btn.active { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,.06); }
.about-brand {
    display: flex;
    justify-content: center;
    margin: 8px 0 16px;
}
.about-brand img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
}
.settings-danger-zone {
    border: 1px solid rgba(239, 68, 68, 0.35);
}
.settings-danger-zone .settings-card-header i { color: #ef4444; }
.board-delete-section {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}
.danger-zone-body {
    margin-top: 12px;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.04);
}
.danger-zone-body h4 {
    margin: 0 0 8px;
    font-size: .95rem;
    color: var(--text-primary);
}
.danger-zone-body .btn-danger:disabled {
    opacity: .45;
    cursor: not-allowed;
}
.about-info { display: flex; flex-direction: column; gap: 8px; }
.about-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.about-row:last-child { border-bottom: none; }

/* Skeleton Loading */
.skeleton-list { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.skeleton-item, .skeleton-card {
    height: 48px; border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--skeleton-from) 25%, var(--skeleton-to) 50%, var(--skeleton-from) 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite;
}
.skeleton-card { height: 80px; margin-bottom: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Empty State */
.empty-state {
    text-align: center; padding: 32px 16px; color: var(--text-muted);
}
.empty-state i { font-size: 32px; margin-bottom: 12px; opacity: .4; display: block; }
.empty-state p { font-size: .88rem; }

/* Responsive */
.mobile-header,
.bottom-nav,
.sidebar-overlay { display: none; }

.mobile-board-hint { display: none; }

@media (max-width: 1024px) {
    body {
        display: block;
        overflow-x: hidden;
        min-height: 100dvh;
        overscroll-behavior-x: none;
    }

    html {
        overscroll-behavior-x: none;
    }

    body.is-board-page,
    body.is-board-page .main-content {
        overscroll-behavior-x: none;
        overscroll-behavior: none;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 56px;
        padding: 0 16px;
        background: var(--sidebar-bg);
        border-bottom: 1px solid var(--border);
        z-index: 200;
        box-shadow: var(--shadow);
    }
    .mobile-menu-btn {
        width: 40px; height: 40px;
        border: none; border-radius: var(--radius-sm);
        background: var(--hover-bg);
        color: var(--text-primary);
        font-size: 18px;
        cursor: pointer;
        display: flex; align-items: center; justify-content: center;
        transition: var(--transition);
    }
    .mobile-menu-btn:hover { background: rgba(99,102,241,.12); color: var(--primary); }
    .mobile-header-logo {
        width: 28px; height: 28px;
        object-fit: contain;
        flex-shrink: 0;
        display: block;
    }
    .mobile-header-title { font-weight: 700; font-size: 1.05rem; color: var(--text-primary); }

    .sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 150;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.active { display: block; }

    .sidebar {
        transform: translateX(-100%);
        z-index: 160;
        transition: transform .3s cubic-bezier(.4,0,.2,1);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        padding-top: 72px;
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        padding-left: 16px;
        padding-right: 16px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .mobile-header { z-index: 9998; }

    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        width: 100%;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        min-height: 64px;
        background: var(--sidebar-bg);
        border-top: 1px solid var(--border);
        z-index: 9999;
        box-shadow: 0 -2px 12px rgba(0,0,0,.08);
        justify-content: space-around;
        align-items: stretch;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .bottom-nav-link {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: .65rem;
        font-weight: 600;
        transition: var(--transition);
        padding: 6px 0;
    }
    .bottom-nav-link i { font-size: 18px; }
    .bottom-nav-link.active { color: var(--primary); }
    .bottom-nav-link:active { transform: scale(.95); }

    .page-header { flex-direction: column; align-items: stretch; }
    .page-header-actions { flex-direction: column; }
    .page-header-actions .search-box { width: 100%; }
    .page-header-actions .search-box input { width: 100%; }
    .filters-bar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
    .filter-select { flex-shrink: 0; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .modal { max-width: 100%; margin: 0 8px; }
    .toast-container { left: 16px; right: 16px; top: 64px; }
    .toast { min-width: auto; max-width: none; }
    .settings-grid { grid-template-columns: 1fr; }
    .inline-form { flex-direction: column; }
    .inline-form input, .inline-form select { width: 100%; }

    .page-header h1 { font-size: 1.35rem; }
    .page-header-compact .page-subtitle { display: none; }
    .btn-icon { padding: 10px 14px; min-width: 44px; justify-content: center; }
    .calendar-nav-actions {
        flex-direction: row !important;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    .calendar-nav-actions .calendar-title {
        min-width: auto;
        flex: 1;
        text-align: center;
        font-size: .95rem;
    }
    .mobile-board-hint { display: flex; }
}
