/* ============================================================
   KANBAN BOARD  —  Modern UI
   Font: Inter (Google Fonts via @import)
   Theme: Light + Dark via [data-theme] on <html>
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS RESET
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   DESIGN TOKENS — LIGHT MODE (default)
   ============================================================ */
:root {
    /* Brand / Primary */
    --primary:        #6366F1;
    --primary-hover:  #4F46E5;
    --primary-light:  rgba(99, 102, 241, 0.1);
    --primary-medium: rgba(99, 102, 241, 0.18);

    /* Semantic */
    --success:        #10B981;
    --success-hover:  #059669;
    --success-light:  rgba(16, 185, 129, 0.1);
    --warning:        #F59E0B;
    --warning-light:  rgba(245, 158, 11, 0.1);
    --danger:         #EF4444;
    --danger-hover:   #DC2626;
    --danger-light:   rgba(239, 68, 68, 0.1);

    /* Priority */
    --prio-low:       #6B7280;
    --prio-low-bg:    rgba(107, 114, 128, 0.1);
    --prio-med:       #F59E0B;
    --prio-med-bg:    rgba(245, 158, 11, 0.1);
    --prio-high:      #EF4444;
    --prio-high-bg:   rgba(239, 68, 68, 0.1);

    /* Surfaces */
    --bg-body:        #F1F5F9;
    --bg-surface:     #FFFFFF;
    --bg-muted:       #F8FAFC;
    --bg-column:      #F8FAFC;

    /* Text */
    --text-primary:   #0F172A;
    --text-secondary: #475569;
    --text-muted:     #94A3B8;

    /* Borders */
    --border:         #E2E8F0;
    --border-strong:  #CBD5E1;

    /* Shadows */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
    --shadow-lg:  0 10px 20px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
    --shadow-xl:  0 20px 40px rgba(0,0,0,0.12), 0 8px 12px rgba(0,0,0,0.06);
    --shadow-card:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 8px 20px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.04);

    /* Layout */
    --sidebar-w:    240px;
    --sidebar-col:  64px;
    --header-h:     64px;

    /* Radius */
    --r-xs:  4px;
    --r-sm:  6px;
    --r-md:  10px;
    --r-lg:  14px;
    --r-xl:  20px;
    --r-2xl: 24px;
    --r-full: 9999px;

    /* Transitions */
    --ease:        all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-slow:   all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================
   DARK MODE OVERRIDES
   ============================================================ */
[data-theme="dark"] {
    --bg-body:        #0D1117;
    --bg-surface:     #161B22;
    --bg-muted:       #21262D;
    --bg-column:      #161B22;

    --text-primary:   #F0F6FC;
    --text-secondary: #8B949E;
    --text-muted:     #484F58;

    --border:         #30363D;
    --border-strong:  #3D444D;

    --shadow-card:       0 1px 3px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.25);
    --shadow-card-hover: 0 8px 20px rgba(0,0,0,0.45), 0 2px 4px rgba(0,0,0,0.25);
    --shadow-lg:  0 10px 20px rgba(0,0,0,0.45), 0 4px 6px rgba(0,0,0,0.3);
    --shadow-xl:  0 20px 40px rgba(0,0,0,0.55), 0 8px 12px rgba(0,0,0,0.35);
}

/* ============================================================
   BODY BASE
   ============================================================ */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   APP LAYOUT (Sidebar + Main)
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: var(--ease-slow);
    overflow: hidden;
}

.sidebar-brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

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

.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--ease);
    white-space: nowrap;
    margin-bottom: 2px;
}

.nav-item i {
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.nav-item.nav-active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-bottom {
    padding: 10px 8px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--ease);
    white-space: nowrap;
    margin-bottom: 8px;
    font-family: inherit;
}

.theme-toggle:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.theme-toggle i {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    background: var(--bg-muted);
    border: 1px solid var(--border);
}

.sidebar-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--r-full);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar-username {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-role {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: var(--ease);
}

.logout-btn:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* ============================================================
   SIDEBAR MOBILE OVERLAY
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.42);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    height: var(--header-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.menu-toggle {
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: var(--ease);
}

.menu-toggle:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

header h1 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.header-center {
    flex: 1;
    max-width: 380px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 0 12px;
    height: 36px;
    transition: var(--ease);
}

.search-box:focus-within {
    background: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box i {
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
}

.search-input::placeholder { color: var(--text-muted); }

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.filter-select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--ease);
    outline: none;
}

.filter-select:hover,
.filter-select:focus { border-color: var(--primary); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    flex-shrink: 0;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--r-full);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--ease-bounce);
}

.user-avatar:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* API Status pill (appended by script.js) */
.api-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    font-size: 0.6875rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(16,185,129,0.3);
    animation: pulse 2s infinite;
}

.status-dot.offline { background: var(--text-muted); }

.status-text {
    color: var(--text-secondary);
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

/* ============================================================
   BUTTON SYSTEM
   ============================================================ */
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-ghost,
.btn-danger,
.btn-clear,
.btn-add-board {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--r-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--ease);
    white-space: nowrap;
    text-decoration: none;
    border: none;
    height: 34px;
    padding: 0 13px;
}

/* Primary */
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 10px rgba(99,102,241,0.38);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* Secondary */
.btn-secondary {
    background: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg-surface);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Outline */
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}
.btn-ghost:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

/* Danger */
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: var(--danger-hover);
    box-shadow: 0 2px 10px rgba(239,68,68,0.38);
    transform: translateY(-1px);
}

/* btn-clear (legacy, shown in header-actions when script uses it) */
.btn-clear {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid transparent;
}
.btn-clear:hover {
    background: var(--danger);
    color: #fff;
    transform: translateY(-1px);
}

/* btn-add-board (legacy) */
.btn-add-board {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-add-board:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

/* Sizes */
.btn-small  { height: 30px; padding: 0 10px; font-size: 0.75rem; }
.btn-icon   { width: 34px; padding: 0; }
.btn-header { height: 34px; }

/* ============================================================
   BOARD WRAPPER + KANBAN BOARD
   ============================================================ */
.board-wrapper {
    flex: 1;
    overflow: hidden;
    padding: 20px 20px 0;
    display: flex;
    flex-direction: column;
}

.kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    flex: 1;
    padding-bottom: 20px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
}

.kanban-board::-webkit-scrollbar          { height: 5px; }
.kanban-board::-webkit-scrollbar-track    { background: transparent; }
.kanban-board::-webkit-scrollbar-thumb    { background: var(--border-strong); border-radius: 3px; }
.kanban-board::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   KANBAN COLUMNS
   ============================================================ */
.kanban-column {
    background: var(--bg-column);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    max-height: calc(100vh - var(--header-h) - 52px);
    min-width: 280px;
    width: 300px;
    flex-shrink: 0;
    transition: var(--ease);
}

.kanban-column:hover { border-color: var(--border-strong); }

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

.column-title-wrapper {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    flex: 1;
}

.column-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--r-full);
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.edit-column-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    padding: 4px;
    border-radius: var(--r-xs);
    color: var(--text-muted);
    transition: var(--ease);
    flex-shrink: 0;
    line-height: 1;
}

.column-header:hover .edit-column-btn { opacity: 1; }

.edit-column-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    opacity: 1;
}

.add-task-btn {
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--ease);
    margin-bottom: 10px;
    font-family: inherit;
    text-align: left;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.add-task-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    border-style: solid;
}

.tasks-container {
    flex: 1;
    overflow-y: auto;
    padding: 2px;
    min-height: 50px;
}

.tasks-container::-webkit-scrollbar       { width: 3px; }
.tasks-container::-webkit-scrollbar-track { background: transparent; }
.tasks-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Drop highlight (task drag) */
.kanban-column.drag-over-column {
    border-color: var(--primary);
    background: rgba(99,102,241,0.04);
}

/* ── Column drag and drop ──────────────────────────────────── */
.column-drag-handle {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
    padding: 2px;
    border-radius: 3px;
}

.column-header:hover .column-drag-handle { opacity: 1; }

.column-drag-handle:active { cursor: grabbing; }

.column-drag-handle:hover { color: var(--text-secondary); }

.kanban-column.column-dragging {
    opacity: 0.4;
    border: 2px dashed var(--primary);
    background: var(--primary-light);
}

/* ============================================================
   TASK CARDS
   ============================================================ */
.task-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 13px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--ease);
    position: relative;
    user-select: none;
}

.task-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.task-card:active { transform: scale(0.99); }

.task-card.dragging {
    opacity: 0.45;
    transform: rotate(1.5deg) scale(1.02);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    cursor: grabbing;
}

.task-card.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* Priority left-strip */
.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    transition: var(--ease);
}

.task-card:has(.priority-high)::before   { background: var(--prio-high); }
.task-card:has(.priority-medium)::before { background: var(--prio-med); }
.task-card:has(.priority-low)::before    { background: var(--prio-low); opacity: 0.45; }

/* Task Number badge */
.task-number {
    display: inline-flex;
    align-items: center;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 7px;
    border-radius: var(--r-full);
    font-size: 0.6875rem;
    font-weight: 700;
    margin-bottom: 7px;
    letter-spacing: 0.3px;
}

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

.task-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
    word-break: break-word;
}

.task-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: var(--ease);
    flex-shrink: 0;
}

.task-card:hover .task-actions { opacity: 1; }

.task-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--r-sm);
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--ease);
    color: var(--text-muted);
}

.task-btn:hover     { background: var(--bg-muted); color: var(--text-primary); }
.edit-btn:hover     { color: var(--primary); background: var(--primary-light); }
.delete-btn:hover   { color: var(--danger);  background: var(--danger-light);  }

.task-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Dates strip */
.task-dates {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 7px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 6px 0;
    font-size: 0.75rem;
}

.task-date-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
}

.task-date-item strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Countdown pills */
.task-due-countdown {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: var(--r-full);
    font-size: 0.6875rem;
    font-weight: 600;
    margin-left: 4px;
}

.countdown-ok      { background: rgba(16,185,129,0.1);  color: var(--success); }
.countdown-warning { background: rgba(245,158,11,0.1);  color: var(--warning); }
.countdown-urgent  { background: rgba(239,68,68,0.1);   color: var(--danger);  }
.countdown-overdue { background: var(--danger);         color: #fff;           }

/* Card footer */
.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Priority badges */
.task-priority {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--r-full);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-low    { background: var(--prio-low-bg);  color: var(--prio-low);  }
.priority-medium { background: var(--prio-med-bg);  color: var(--prio-med);  }
.priority-high   { background: var(--prio-high-bg); color: var(--prio-high); }

.task-date { font-size: 0.6875rem; color: var(--text-muted); }

/* Comments button */
.task-comments-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    border-radius: var(--r-sm);
    transition: var(--ease);
    margin-top: 7px;
    font-family: inherit;
}

.task-comments-btn:hover { color: var(--primary); }

.comment-count {
    background: var(--primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: var(--r-full);
    font-size: 0.625rem;
    font-weight: 700;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    color: var(--text-muted);
    min-height: 100px;
}

.empty-state-icon  { font-size: 1.875rem; margin-bottom: 7px; opacity: 0.45; }
.empty-state-text  { font-size: 0.8125rem; font-weight: 500; }

/* Esconde o empty-state APENAS durante o drag (quando o card tem .dragging)
   Garante que o estado vazio apareça corretamente após remover todos os cards */
.tasks-container:has(.task-card.dragging) .empty-state { display: none; }

/* ============================================================
   NOTIFICATIONS (toast)
   ============================================================ */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: var(--r-md);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transform: translateX(calc(100% + 30px));
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 320px;
}

.notification.show { transform: translateX(0); }

.notification.success {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.notification.error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.notification.info {
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
}

[data-theme="dark"] .notification.success { background: #022C22; color: #6EE7B7; border-color: #064E3B; }
[data-theme="dark"] .notification.error   { background: #2B1515; color: #FCA5A5; border-color: #7F1D1D; }
[data-theme="dark"] .notification.info    { background: #172554; color: #93C5FD; border-color: #1E3A8A; }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.42);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
    overflow-y: auto;
    padding: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: var(--bg-surface);
    border-radius: var(--r-xl);
    width: 100%;
    max-width: 520px;
    margin: 20px auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border);
    overflow: hidden;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.modal-large   { max-width: 680px; }
.modal-small   { max-width: 440px; }
.modal-details {
    max-width: 900px;
    max-height: calc(100vh - 40px); /* 20px padding top + 20px bottom do .modal */
    margin: 0 auto;                 /* sem margem extra — usa só o padding do .modal */
    display: flex;
    flex-direction: column;
    overflow: hidden;               /* mantém rounded corners; scroll fica em .details-content */
}

@keyframes slideUp {
    from {
        transform: translateY(20px) scale(0.97);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h2,
#modalTitle {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
}

.modal-close-btn,
.close, .close-comments, .close-board {
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: normal;
    line-height: 1;
    transition: var(--ease);
    flex-shrink: 0;
    float: none; /* override legacy */
}

.modal-close-btn:hover,
.close:hover, .close-comments:hover, .close-board:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.modal-body {
    padding: 18px 22px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body::-webkit-scrollbar       { width: 5px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.modal-footer,
.modal-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 18px;
    margin-top: 18px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.modal-buttons .btn-danger { margin-left: auto; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-group { margin-bottom: 14px; }

.form-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.required { color: var(--danger); }

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--ease);
    outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover { border-color: var(--border-strong); }

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-surface);
}

.form-group textarea {
    resize: vertical;
    min-height: 76px;
    line-height: 1.6;
}

.form-group-small  { flex: 0 0 110px !important; }
.form-group-grow   { flex: 1 !important; }

.form-hint {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.form-section-divider {
    margin: 6px 0 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.form-section-divider h3 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

input:disabled {
    background: var(--bg-muted);
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: var(--border);
}

/* ============================================================
   EMOJI PICKER
   ============================================================ */
.emoji-picker-container { position: relative; }

.emoji-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 7px;
    padding: 8px;
    background: var(--bg-muted);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}

.emoji-option {
    font-size: 1.25rem;
    cursor: pointer;
    padding: 5px;
    border-radius: var(--r-sm);
    transition: var(--ease-bounce);
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-option:hover {
    background: var(--primary-light);
    transform: scale(1.25);
}

/* ============================================================
   COMMENTS MODAL
   ============================================================ */
.comments-container {
    max-height: 340px;
    overflow-y: auto;
    margin-bottom: 14px;
    padding-right: 3px;
}

.comments-container::-webkit-scrollbar       { width: 4px; }
.comments-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.comment-item {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: var(--r-md);
    margin-bottom: 8px;
    position: relative;
}

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

.comment-meta { display: flex; flex-direction: column; gap: 1px; }
.comment-author { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); }
.comment-date { font-size: 0.6875rem; color: var(--text-muted); }

.comment-text {
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}

.comment-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 4px;
    border-radius: var(--r-sm);
    transition: var(--ease);
}

.comment-delete:hover {
    color: var(--danger);
    background: var(--danger-light);
}

.comment-form {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.comment-form textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    transition: var(--ease);
    outline: none;
}

.comment-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.comment-form-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

.empty-comments {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
}

.empty-comments-icon { font-size: 2.25rem; margin-bottom: 7px; opacity: 0.45; }

/* ============================================================
   DETAILS MODAL
   ============================================================ */
.details-content {
    flex: 1;            /* ocupa o espaço disponível no flex column */
    min-height: 0;      /* permite que flex child comprima e role */
    overflow-y: auto;
    margin-bottom: 0;
    scroll-padding-top: 60px; /* compensa o cabeçalho sticky ao rolar por foco/ancora */
}

.details-content::-webkit-scrollbar       { width: 5px; }
.details-content::-webkit-scrollbar-track { background: transparent; }
.details-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.details-header {
    padding: 16px 22px 14px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-surface); /* cobre o conteúdo ao rolar */
}

.details-task-number {
    display: inline-flex;
    align-items: center;
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: var(--r-full);
    font-size: 0.6875rem;
    font-weight: 700;
    margin-bottom: 9px;
}

.details-title-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.details-task-title {
    font-size: 1.1875rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.details-priority-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: var(--r-full);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.details-priority-inline.priority-low    { background: var(--prio-low-bg);  color: var(--prio-low);  }
.details-priority-inline.priority-medium { background: var(--prio-med-bg);  color: var(--prio-med);  }
.details-priority-inline.priority-high   { background: var(--prio-high-bg); color: var(--prio-high); }

.details-status-row { margin-top: 8px; }

.details-task-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: var(--r-full);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-todo        { background: var(--prio-low-bg);       color: var(--prio-low);  }
.status-in-progress { background: var(--prio-med-bg);       color: var(--prio-med);  }
.status-done        { background: rgba(16,185,129,0.1);      color: var(--success);   }

.details-body {
    display: grid;
    gap: 14px;
    padding: 18px 22px;
}

.details-section,
.details-comments-section,
.details-attachments-section,
.details-history-section {
    background: var(--bg-muted);
    padding: 14px 16px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    transition: var(--ease);
}

.details-section:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }

.details-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.details-section-content {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.6;
}

.details-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.7;
    margin-top: 5px;
}

.details-table {
    display: grid;
    grid-template-columns: max-content 1fr max-content 1fr;
    gap: 5px 20px;
    margin-top: 8px;
    align-items: baseline;
}

.dt-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.dt-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.dt-group-title {
    grid-column: 1 / -1;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.details-metric {
    background: var(--bg-surface);
    padding: 12px 14px;
    border-radius: var(--r-md);
    text-align: center;
    border: 1px solid var(--border);
    transition: var(--ease);
}

.details-metric:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.details-metric-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.details-metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.details-metric-value.large { font-size: 1.625rem; }
.details-metric-icon        { font-size: 1.0625rem; }

.details-metric.urgent  { border-color: rgba(239,68,68,0.28);   background: var(--danger-light);  }
.details-metric.warning { border-color: rgba(245,158,11,0.28);  background: var(--warning-light); }
.details-metric.ok      { border-color: rgba(16,185,129,0.28);  background: var(--success-light); }
.details-metric.neutral { border-color: rgba(99,102,241,0.28);  background: var(--primary-light); }

.details-metric.urgent  .details-metric-value,
.details-metric.urgent  .details-metric-icon  { color: var(--danger);  }
.details-metric.warning .details-metric-value,
.details-metric.warning .details-metric-icon  { color: var(--warning); }
.details-metric.ok      .details-metric-value,
.details-metric.ok      .details-metric-icon  { color: var(--success); }
.details-metric.neutral .details-metric-value,
.details-metric.neutral .details-metric-icon  { color: var(--primary); }

.details-priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: var(--r-sm);
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
}

.details-priority-badge.priority-low    { background: var(--prio-low-bg);  color: var(--prio-low);  }
.details-priority-badge.priority-medium { background: var(--prio-med-bg);  color: var(--prio-med);  }
.details-priority-badge.priority-high   { background: var(--prio-high-bg); color: var(--prio-high); }

.details-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;     /* sempre visível — não colapsa com o scroll interno */
    background: var(--bg-surface); /* fundo sólido para separar visualmente do conteúdo */
}

.details-actions button {
    min-width: 110px;
    justify-content: center;
}


.details-modal-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px 10px;    /* afasta do topo arredondado do modal */
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    flex-shrink: 0;
    background: var(--bg-muted); /* leve diferenciação do header de contexto */
    border-radius: var(--r-xl) var(--r-xl) 0 0; /* arredonda apenas o topo */
}

.details-board-name {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-muted);
    padding: 3px 8px;
    border-radius: var(--r-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
}

.close-details {
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    transition: var(--ease);
}

.close-details:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Details: Comments */
.details-comments-list {
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.details-comments-list::-webkit-scrollbar       { width: 4px; }
.details-comments-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.details-comment-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 9px 11px;
    border-radius: var(--r-sm);
    margin-bottom: 7px;
    transition: var(--ease);
}

.details-comment-item:last-child { margin-bottom: 0; }
.details-comment-item:hover      { border-color: var(--border-strong); transform: translateX(2px); }

.details-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.details-comment-author { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); }
.details-comment-date { font-size: 0.6875rem; color: var(--text-muted); font-weight: 500; }

.details-comment-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 4px;
    border-radius: var(--r-sm);
    transition: var(--ease);
    flex-shrink: 0;
}
.details-comment-delete:hover { color: var(--danger); background: var(--danger-light); }

.details-comment-text {
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
    font-size: 0.875rem;
}

.details-comments-empty { text-align: center; padding: 20px 16px; color: var(--text-muted); }
.details-comments-empty-icon { font-size: 1.875rem; margin-bottom: 6px; opacity: 0.45; }

.details-add-comment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1.5px dashed var(--primary);
    border-radius: var(--r-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ease);
    font-family: inherit;
}

.details-add-comment-btn:hover {
    background: var(--primary);
    color: #fff;
    border-style: solid;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.details-comment-form {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.details-comment-input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 0.875rem;
    scroll-margin-bottom: 60px; /* garante que os botões abaixo fiquem visíveis ao focar */
    font-family: inherit;
    resize: vertical;
    transition: var(--ease);
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
}

.details-comment-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.details-comment-form-buttons { display: flex; gap: 7px; margin-top: 7px; }

.details-save-comment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1;
    padding: 8px 11px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ease);
    font-family: inherit;
}

.details-save-comment-btn:hover { background: var(--success-hover); transform: translateY(-1px); }

.details-cancel-comment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1;
    padding: 8px 11px;
    background: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--ease);
    font-family: inherit;
}

.details-cancel-comment-btn:hover {
    background: var(--bg-surface);
    border-color: var(--border-strong);
}

/* Details: Attachments */
.details-attachments-list {
    max-height: 210px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.details-attachments-list::-webkit-scrollbar       { width: 4px; }
.details-attachments-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.details-attachment-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 9px 11px;
    border-radius: var(--r-sm);
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 9px;
    transition: var(--ease);
}

.details-attachment-item:last-child { margin-bottom: 0; }
.details-attachment-item:hover      { border-color: var(--border-strong); transform: translateX(2px); }

.details-attachment-icon { font-size: 1.375rem; min-width: 28px; text-align: center; }
.details-attachment-info { flex: 1; min-width: 0; }

.details-attachment-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.details-attachment-meta { font-size: 0.6875rem; color: var(--text-muted); margin-top: 2px; }
.details-attachment-actions { display: flex; gap: 3px; }

.details-attachment-download,
.details-attachment-delete {
    background: none;
    border: none;
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--r-sm);
    transition: var(--ease);
}

.details-attachment-download         { color: var(--primary); }
.details-attachment-download:hover   { background: var(--primary-light); }
.details-attachment-delete           { color: var(--danger); }
.details-attachment-delete:hover     { background: var(--danger-light); }

.details-attachments-empty      { text-align: center; padding: 20px 16px; color: var(--text-muted); }
.details-attachments-empty-icon { font-size: 1.625rem; margin-bottom: 6px; opacity: 0.45; }

.details-add-attachment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 36px;
    background: rgba(16,185,129,0.08);
    color: var(--success);
    border: 1.5px dashed var(--success);
    border-radius: var(--r-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ease);
    font-family: inherit;
}

.details-add-attachment-btn:hover {
    background: var(--success);
    color: #fff;
    border-style: solid;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.details-attachments-limit {
    text-align: center;
    padding: 9px;
    background: var(--danger-light);
    border-radius: var(--r-sm);
    color: var(--danger);
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid rgba(239,68,68,0.2);
}

/* Details: History */
.details-history-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.details-history-list::-webkit-scrollbar       { width: 4px; }
.details-history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.details-history-item {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    position: relative;
}

.details-history-item:last-child              { margin-bottom: 0; }
.details-history-item:last-child .details-history-line { display: none; }

.details-history-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 18px;
    flex-shrink: 0;
}

.details-history-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-muted);
    box-shadow: 0 0 0 2px var(--primary);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.details-history-line {
    width: 2px;
    flex: 1;
    background: var(--border);
    margin-top: -2px;
    min-height: 20px;
}

.details-history-content { flex: 1; padding-bottom: 4px; }

.details-history-action {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.history-board {
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 1px 6px;
    border-radius: var(--r-sm);
    white-space: nowrap;
    font-size: 0.8125rem;
}

.details-history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.details-history-date     { display: flex; align-items: center; gap: 3px; }
.details-history-duration { display: flex; align-items: center; gap: 3px; color: var(--warning); font-weight: 600; }

.details-history-empty      { text-align: center; padding: 24px 16px; color: var(--text-muted); }
.details-history-empty-icon { font-size: 2rem; margin-bottom: 7px; opacity: 0.4; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    transition: opacity 0.4s ease;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    background: var(--bg-surface);
    border-radius: var(--r-2xl);
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    animation: loginIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes loginIn {
    from { opacity: 0; transform: translateY(-18px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
}

.login-brand-icon {
    width: 38px;
    height: 38px;
    background: var(--primary);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
}

.login-brand-name {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.login-header { text-align: center; margin-bottom: 24px; }

.login-header h2 {
    font-size: 1.1875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.login-header p { color: var(--text-muted); font-size: 0.875rem; }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-field { display: flex; flex-direction: column; gap: 5px; }

.login-field label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.login-field input {
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    font-size: 0.9375rem;
    font-family: inherit;
    background: var(--bg-muted);
    color: var(--text-primary);
    transition: var(--ease);
    outline: none;
}

.login-field input:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.login-error {
    padding: 9px 13px;
    background: var(--danger-light);
    border: 1px solid rgba(239,68,68,0.2);
    color: var(--danger);
    border-radius: var(--r-sm);
    font-size: 0.875rem;
    text-align: center;
    display: none;
    animation: shake 0.5s ease;
}

.login-error.show { display: block; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60%  { transform: translateX(-5px); }
    40%, 80%  { transform: translateX(5px); }
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: var(--r-md);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ease);
    font-family: inherit;
    margin-top: 4px;
}

.login-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 18px rgba(99,102,241,0.42);
    transform: translateY(-1px);
}

.login-btn:active   { transform: translateY(0); }
.login-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* ============================================================
   SIDEBAR COLLAPSED (desktop toggle)
   ============================================================ */
.app-layout.sidebar-collapsed .sidebar { width: var(--sidebar-col); }

.app-layout.sidebar-collapsed .brand-name,
.app-layout.sidebar-collapsed .nav-item span,
.app-layout.sidebar-collapsed .theme-toggle span,
.app-layout.sidebar-collapsed .sidebar-user-info,
.app-layout.sidebar-collapsed .logout-btn { display: none; }

.app-layout.sidebar-collapsed .sidebar-user { justify-content: center; padding: 8px 4px; }
.app-layout.sidebar-collapsed .main-content { margin-left: var(--sidebar-col); }
.app-layout.sidebar-collapsed .nav-item     { justify-content: center; padding: 10px; }
.app-layout.sidebar-collapsed .theme-toggle { justify-content: center; padding: 10px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .filter-select { display: none; }
    .header-center { max-width: 260px; }
}

@media (max-width: 768px) {
    /* Sidebar off-canvas */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }
    .sidebar.open   { transform: translateX(0); }
    .sidebar-overlay { display: block; }
    .main-content   { margin-left: 0; }

    header { padding: 0 14px; gap: 8px; }
    .header-center { display: none; }
    .header-right  { gap: 5px; }
    .header-divider { display: none; }
    .api-status     { display: none; }

    /* Collapse label text on action buttons */
    .header-actions .btn-header span { display: none; }
    .header-actions .btn-header      { width: 34px; padding: 0; justify-content: center; }

    .board-wrapper { padding: 12px 10px 0; }

    .kanban-column {
        min-width: 256px;
        width: 272px;
        max-height: calc(100vh - var(--header-h) - 40px);
    }

    .modal         { padding: 10px; }
    .modal-content { margin: 6px auto; border-radius: var(--r-lg); }
    .modal-body    { padding: 14px 16px; }
    .modal-header  { padding: 14px 16px 11px; }

    /* details modal no mobile: altura total menos padding do .modal */
    .modal-details { max-height: calc(100vh - 20px); margin: 0 auto; border-radius: var(--r-lg); }
    .details-modal-header-top { padding: 10px 14px 8px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
    .details-body  { padding: 12px 14px; }
    .details-header { padding: 12px 14px 10px; }
    .details-actions { padding: 10px 14px; }
    .details-grid  { grid-template-columns: 1fr; }
    .details-table { grid-template-columns: max-content 1fr; }
    .details-task-title { font-size: 1.0625rem; }
    .details-actions button { min-width: 90px; }

    .form-row { flex-direction: column; }
    .form-group-small { flex: 1 !important; }
}

@media (max-width: 480px) {
    .login-card { padding: 28px 20px; }
    .kanban-column { min-width: 238px; width: 252px; }
    header h1 { font-size: 0.875rem; }
}

/* ================================================================
   DASHBOARD / TEAM / SETTINGS — Páginas extras
   ================================================================ */

/* ── Page wrapper ─────────────────────────────────────────────── */
.page-content {
    padding: 24px;
    overflow-y: auto;
    height: 100%;
}

/* ── Stats row ────────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--r-lg);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Dashboard layout ─────────────────────────────────────────── */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--r-lg);
    padding: 20px;
}

.dashboard-card h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.history-card { margin-bottom: 24px; }

/* ── Chart card ───────────────────────────────────────────────── */
.chart-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-card canvas {
    max-width: 260px;
    max-height: 260px;
}

#chartLegend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: 14px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Overdue list ─────────────────────────────────────────────── */
.overdue-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}
.overdue-item:last-child { border-bottom: none; }

.overdue-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.overdue-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
}

.overdue-days {
    color: #EF4444;
    font-weight: 600;
}

/* ── History list ─────────────────────────────────────────────── */
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}
.history-item:last-child { border-bottom: none; }

.history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.history-task {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-move {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted, var(--text-secondary));
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Team grid ────────────────────────────────────────────────── */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.member-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--r-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    transition: box-shadow 0.2s;
}
.member-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }

.member-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.member-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.member-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.member-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.member-task-count {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── Assignee avatar on kanban card ───────────────────────────── */
.task-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

.task-footer-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-assignee-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    color: #fff;
    cursor: default;
    flex-shrink: 0;
}

/* ── Color picker (team modal) ────────────────────────────────── */
.color-picker-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
}
.color-option:hover { transform: scale(1.15); }
.color-option.selected {
    border-color: var(--text-primary);
    transform: scale(1.2);
}

/* ── Settings layout ──────────────────────────────────────────── */
.settings-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--r-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.settings-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.settings-section > .btn-primary {
    margin-bottom: 16px;
}

.settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.settings-option-label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}

.settings-option-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: block;
}

/* ── Column list rows ─────────────────────────────────────────── */
.column-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.column-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--r-md);
    padding: 10px 14px;
}

.column-icon { font-size: 1.125rem; flex-shrink: 0; }

.column-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.column-order {
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
    padding: 24px;
}

/* ── Badge (priority, reused in dashboard) ────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--r-sm, 4px);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
}
.badge.priority-high   { background: #FEE2E2; color: #B91C1C; }
.badge.priority-medium { background: #FEF3C7; color: #92400E; }
.badge.priority-low    { background: #D1FAE5; color: #065F46; }

/* ── Flow metrics section ─────────────────────────────────────── */
.flow-section-header {
    margin: 32px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.flow-section-header h2 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.flow-card-full {
    margin-bottom: 24px;
}

.flow-row {
    margin-bottom: 24px;
}

.echart-container {
    width: 100%;
    height: 270px;
}

.echart-tall {
    height: 320px;
}

/* ── Dashboard responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .dashboard-row { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .team-grid { grid-template-columns: 1fr; }
    .settings-option { flex-direction: column; align-items: flex-start; }
}

/* ── Team tabs ──────────────────────────────────────────────────── */
.team-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-body);
}

.team-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.team-tab:hover { color: var(--text-primary); }
.team-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ── Access tab toolbar ─────────────────────────────────────────── */
.access-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.access-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.access-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 20px 0;
}

.spinning { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Access badge on member card ────────────────────────────────── */
.access-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 999px;
}

.access-badge-ok   { background: var(--success-light); color: var(--success); }
.access-badge-none { background: var(--danger-light);  color: var(--danger);  }

/* ── Access modal: workspace checklist ──────────────────────────── */
.access-modal-user {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.access-workspace-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.access-ws-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 0.15s;
}

.access-ws-item:hover { background: var(--bg-muted); }

.access-ws-item input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.access-ws-icon { font-size: 1rem; flex-shrink: 0; }

.access-ws-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   BOARDS PAGE
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.boards-page-wrapper {
    padding: 24px;
    overflow-y: auto;
}

.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.boards-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-secondary);
    text-align: center;
}

/* ── Board Card ──────────────────────────────────────────────── */

.board-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}

.board-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.board-card-top {
    height: 6px;
    background: var(--card-color, #6366F1);
}

.board-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.board-card-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.board-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.board-card:hover .board-card-actions {
    opacity: 1;
}

.board-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.board-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Sidebar back link ───────────────────────────────────────── */
.nav-back {
    font-size: 0.82rem;
    opacity: .75;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
    padding-bottom: 8px;
}

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