/* CSS Variables */
:root {
    color-scheme: light;

    /* Warm Workshop Palette - Paper & Burnt Orange */
    --primary: #000000;
    --primary-hover: #191c1e;
    --primary-foreground: #ffffff;
    --accent: #7a003c;
    --accent-hover: #5c002d;
    --accent-light: #f7e9f0;

    --danger: #b91c1c;
    --danger-hover: #991b1b;
    --danger-tint: rgba(185, 28, 28, 0.08);
    --danger-tint-strong: rgba(185, 28, 28, 0.16);
    --success: #16a34a;
    --warning: #a16207;

    /* Warm neutrals */
    --gray-50: #f7f9fb;
    --gray-100: #f2f4f6;
    --gray-200: #e6e8ea;
    --gray-300: #c6c6cd;
    --gray-400: #9a9ba1;
    --gray-500: #76777d;
    --gray-600: #45464d;
    --gray-700: #2f3035;
    --gray-800: #23262a;
    --gray-900: #191c1e;
    --white: #ffffff;

    /* UI Elements - borders over shadows */
    --shadow-sm: 0 1px 2px 0 rgba(25, 28, 30, 0.05);
    --shadow: 0 1px 2px 0 rgba(25, 28, 30, 0.06);
    --shadow-md: 0 2px 6px -1px rgba(25, 28, 30, 0.08);
    --shadow-lg: 0 4px 20px rgba(25, 28, 30, 0.1);

    --radius: 2px;
    --radius-sm: 2px;

    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-display: 'Manrope', 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    color-scheme: dark;

    --primary: #e8e6e7;
    --primary-hover: #f4f2f3;
    --primary-foreground: #1a1a1a;
    --accent: #e84a82;
    --accent-hover: #f06a9b;
    --accent-light: rgba(232, 74, 130, 0.16);

    --danger: #f87171;
    --danger-hover: #fca5a5;
    --danger-tint: rgba(248, 113, 113, 0.1);
    --danger-tint-strong: rgba(248, 113, 113, 0.2);
    --success: #4ade80;
    --warning: #facc15;

    --gray-50: #121212;
    --gray-100: #1e1e1e;
    --gray-200: #2c2c2c;
    --gray-300: #383838;
    --gray-400: #6b676a;
    --gray-500: #9a9498;
    --gray-600: #b8b3b6;
    --gray-700: #d0cccf;
    --gray-800: #e8e6e7;
    --gray-900: #f4f2f3;
    --white: #1e1e1e;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--gray-900);
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }

/* Navbar */
.navbar {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand a {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
}

.navbar-menu {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-link {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.9375rem;
    padding: 4px 0;
}

.nav-link:hover {
    color: var(--gray-900);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-name {
    color: var(--gray-700);
    font-size: 0.9375rem;
    font-weight: 500;
}

/* User Avatar Menu */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #fff;
    box-shadow: 0 0 0 2px var(--gray-50);
    transition: box-shadow 0.2s, transform 0.15s;
}

.user-avatar:hover {
    box-shadow: 0 0 0 2px var(--accent);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-900);
}

.user-dropdown-email {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 2px;
    word-break: break-all;
}

.user-dropdown-item {
    display: block;
    padding: 10px 16px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-700);
    transition: background 0.15s, color 0.15s;
}

.user-dropdown-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* Theme Toggle */
.theme-toggle {
    background: transparent;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    color: var(--gray-900);
    background: var(--gray-100);
}

/* Notification Bell */
.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--gray-500);
}

.notification-bell:hover {
    color: var(--gray-900);
    background: var(--gray-100);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.notification-header h4 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-900);
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    max-height: 360px;
}

.notification-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.875rem;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.notification-item:hover {
    background: var(--gray-50);
}

.notification-item.unread {
    background: rgba(122, 0, 60, 0.04);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900);
    line-height: 1.3;
    margin-bottom: 2px;
}

.notification-message {
    font-size: 0.8125rem;
    color: var(--gray-500);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.notification-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
}

.notification-item:hover .notification-dismiss {
    opacity: 1;
}

.notification-dismiss:hover {
    color: var(--gray-600);
}

.notification-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: center;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 4px 8px;
}

.btn-text:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Main Content */
main {
    padding: 32px;
    max-width: 1280px;
    margin: 0 auto;
}

main.full-page {
    padding: 0;
    max-width: none;
}

main.board-layout {
    max-width: none; /* Full width */
    padding: 0; /* Remove padding to let board take full space if needed, or control via container */
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

/* Link buttons would otherwise pick up the global a:hover colour and vanish
   against their own background. */
.btn-primary:hover,
.btn-primary:focus {
    color: var(--primary-foreground);
    opacity: 0.9;
}

.btn-outline {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-900);
}

.btn-danger {
    background: var(--white);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger-tint);
}

[data-theme="dark"] .btn-danger:hover {
    background: rgba(220, 38, 38, 0.1);
}

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

.btn-block {
    width: 100%;
    display: flex;
}

.btn-google {
    background-color: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.btn-google:hover {
    background-color: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-900);
}

.btn-google .google-icon {
    flex-shrink: 0;
}

/* Emoji Picker */
.emoji-picker-wrapper {
    position: relative;
}

.emoji-picker-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.5rem;
    min-width: 80px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.emoji-picker-trigger:hover {
    border-color: var(--primary);
}

.emoji-picker-trigger:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(122, 0, 60, 0.1);
}

.emoji-picker-arrow {
    font-size: 0.625rem;
    color: var(--gray-500);
}

.emoji-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    width: 320px;
    max-height: 350px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    margin-top: 4px;
    overflow: hidden;
}

.emoji-picker-search {
    padding: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.emoji-picker-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.875rem;
}

.emoji-picker-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.emoji-picker-categories {
    display: flex;
    gap: 2px;
    padding: 8px;
    border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
    scrollbar-width: none;
}

.emoji-picker-categories::-webkit-scrollbar {
    display: none;
}

.emoji-category-btn {
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--gray-600);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.emoji-category-btn:hover {
    background: var(--gray-100);
}

.emoji-category-btn.active {
    background: var(--primary);
    color: white;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.emoji-btn:hover {
    background: var(--gray-100);
    transform: scale(1.1);
}

[data-theme="dark"] .emoji-picker-trigger {
    background: var(--gray-800);
    border-color: var(--gray-600);
}

[data-theme="dark"] .emoji-picker-dropdown {
    background: var(--gray-800);
    border-color: var(--gray-700);
}

[data-theme="dark"] .emoji-picker-search input {
    background: var(--gray-700);
    border-color: var(--gray-600);
    color: var(--gray-100);
}

[data-theme="dark"] .emoji-category-btn {
    color: var(--gray-400);
}

[data-theme="dark"] .emoji-category-btn:hover {
    background: var(--gray-700);
}

[data-theme="dark"] .emoji-btn:hover {
    background: var(--gray-700);
}

.emoji-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
    color: var(--gray-900);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(122, 0, 60, 0.1);
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.form-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    max-width: 540px;
    margin: 0 auto;
}

.form-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-100);
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: var(--gray-50);
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 1.75rem;
    margin-bottom: 32px;
    text-align: center;
    color: var(--gray-900);
}

/* Page Header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.page-header h1 {
    font-size: 1.75rem;
    color: var(--gray-900);
}

.workspace-color-badge {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.breadcrumb a {
    color: var(--gray-500);
}

.breadcrumb a:hover {
    color: var(--gray-900);
}

/* Cards (Workspaces & Boards) */
.workspace-grid, .board-grid {
    display: grid;
    gap: 24px;
}

.workspace-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.board-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.workspace-card, .board-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.workspace-card:hover, .board-card:hover {
    border-color: var(--gray-400);
}

.workspace-card:hover .workspace-info h3,
.board-card:hover .board-info h3 {
    color: var(--accent);
}

/* Workspace Header Image/Emoji */
.workspace-header-image {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.workspace-header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.workspace-header-image .workspace-emoji {
    font-size: 2.5rem;
}

/* Workspace Badge (for show page) */
.workspace-badge {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.workspace-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.workspace-badge .workspace-emoji {
    font-size: 2rem;
}

.workspace-emoji {
    line-height: 1;
}

.board-color {
    height: 4px;
}

.workspace-info, .board-info {
    padding: 24px;
}

.workspace-info h3, .board-info h3 {
    font-family: var(--font-display);
    font-size: 1.1875rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-900);
    transition: color 0.15s;
}

.workspace-info p, .board-info p {
    font-size: 0.9375rem;
    color: var(--gray-500);
    margin-bottom: 16px;
    line-height: 1.5;
}

.workspace-meta {
    font-size: 0.8125rem;
    color: var(--gray-400);
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
}

/* Board Page (Kanban) */
.board-container {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding-bottom: 24px;
    align-items: flex-start;
    height: calc(100vh - 140px); /* Rough estimate */
}

.group {
    background: var(--gray-100);
    border-radius: var(--radius);
    min-width: 320px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    border: 1px solid var(--gray-200);
}

.group-header {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.group-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-800);
}

.items-list {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

.item-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 10px;
}

.item-priority {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.025em;
}

.add-item-btn, .add-group-btn {
    width: 100%;
    padding: 12px;
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.add-item-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--gray-800);
}

.add-group-btn {
    background: rgba(255,255,255,0.5);
    border: 2px dashed var(--gray-300);
    color: var(--gray-500);
}

.add-group-btn:hover {
    border-color: var(--gray-400);
    color: var(--gray-700);
    background: rgba(255,255,255,0.8);
}

/* Modals */
.modal {
    background: rgba(25, 28, 30, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-content form {
    padding: 24px;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

[data-theme="dark"] .alert-error {
    background: rgba(153, 27, 27, 0.2);
    color: #fca5a5;
    border-color: rgba(153, 27, 27, 0.5);
}

/* Image Upload */
.image-upload-area {
    position: relative;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    background: var(--gray-50);
    transition: border-color 0.2s;
}

.image-upload-area:hover {
    border-color: var(--gray-400);
}

.image-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.image-upload-placeholder {
    padding: 40px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray-500);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.image-preview {
    position: relative;
    padding: 12px;
}

.image-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.remove-image-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-900);
    color: var(--white);
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 3;
}

.remove-image-btn:hover {
    background: var(--danger);
}

/* Emoji Input */
.emoji-input {
    text-align: center;
    font-size: 1.5rem;
}

/* Page Header Left */
.page-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.workspace-description {
    color: var(--gray-500);
    font-size: 0.9375rem;
    margin-top: 4px;
}

/* Section */
.section {
    margin-bottom: 40px;
}

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

.section-header h2 {
    font-size: 1.25rem;
}

/* Members List */
.members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.member-name {
    font-weight: 500;
    display: block;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.empty-state p {
    margin-bottom: 16px;
}

/* Error Page */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 96px 24px;
}

.full-page .error-page {
    min-height: 100vh;
}

.error-page h1 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.error-page p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Danger Zone */
.form-card.danger-zone {
    margin-top: 24px;
    border-color: var(--danger);
    max-width: 540px;
}

.form-card.danger-zone h3 {
    color: var(--danger);
    font-size: 1rem;
    margin-bottom: 8px;
}

.form-card.danger-zone p {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

/* Flex helper */
.flex-1 {
    flex: 1;
}

/* Utilities */
.hidden { display: none !important; }

/* ========== Board Table Layout (Monday.com Style) ========== */
.board-page {
    padding: 0;
    width: 100%;
}

/* One grid column as wide as the widest group, and never narrower than the
   container. Every group gets that width, collapsed or not, and the container
   scrolls sideways to the last column of a wide board. */
.board-table-container {
    display: grid;
    grid-template-columns: minmax(max-content, 1fr);
    padding: 0 32px 32px;
    width: 100%;
    overflow-x: auto;
}

/* Group Section */
.group-section {
    margin-bottom: 24px;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    width: 100%;
}

/* A board group fills the grid column above, so nothing is left to cut off.
   Clip keeps the corners without making the group a scroll container, which
   would stop the header parts below from sticking. */
.board-table-container .group-section {
    overflow: clip;
}

/* The group title and its buttons stay where they are while a wide board
   scrolls sideways. The offset is the group border plus the header padding,
   measured from inside the container padding, so nothing moves at rest.
   Phones size the whole header in mobile.css. Dashboard groups do not scroll. */
@media (min-width: 769px) {
    .board-table-container:not(.dashboard-board-table) .group-header-left,
    .board-table-container:not(.dashboard-board-table) .group-header-actions {
        position: sticky;
        left: calc(1px + 16px);
        right: calc(1px + 16px);
    }
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.group-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--gray-500);
    font-size: 0.75rem;
    transition: color 0.2s;
}

.group-collapse-btn:hover {
    color: var(--gray-700);
}

.group-color-bar {
    width: 4px;
    height: 24px;
    border-radius: 2px;
}

.group-section .group-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--gray-900);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    cursor: text;
    min-width: 100px;
}

.group-section .group-name:hover {
    background: var(--gray-100);
}

.group-section .group-name:focus {
    outline: none;
    background: var(--white);
    box-shadow: 0 0 0 2px var(--accent);
}

.group-count {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.board-link {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-decoration: none;
    padding: 4px 8px;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-left: 8px;
}

.board-link:hover {
    background: var(--gray-100);
    color: var(--accent);
}

.group-header-actions {
    display: flex;
    gap: 4px;
}

/* Icon Buttons */
.btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--gray-500);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-icon-danger:hover {
    background: var(--danger-tint);
    color: var(--danger);
}

/* Table Layout */
.group-table {
    width: 100%;
}

.group-table.collapsed {
    display: none;
}

.table-header {
    display: flex;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-300);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

.table-row {
    display: flex;
    border-bottom: 1px solid var(--gray-300);
    transition: background 0.15s;
    align-items: stretch; /* Ensure children stretch to full height */
}

.table-row:hover {
    background: var(--gray-50);
}

.table-cell {
    padding: 0;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--gray-300);
    box-sizing: border-box;
}

.table-cell:last-child {
    border-right: none;
}

/* Column widths */
.cell-drag {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    flex-shrink: 0;
    justify-content: center;
    padding: 0 8px;
}

/* The width only feeds the max-content width of a board group, so a long item
   name is cut short instead of stretching the group. Flex still shares out
   the spare room. */
.cell-name {
    flex: 1;
    width: 200px;
    min-width: 200px;
    padding: 3px 12px;
}

.table-header .cell-name {
    position: relative;
    padding: 6px 12px;
}

/* Item column once someone has dragged it to a width of their own */
.has-name-width .cell-name {
    flex: 0 0 var(--name-col-width);
    width: var(--name-col-width);
    min-width: var(--name-col-width);
}

.has-name-width .cell-actions {
    margin-left: auto;
}

.cell-status {
    width: 140px;
}

.cell-priority {
    width: 120px;
}

.cell-assignee {
    width: 160px;
}

.cell-date {
    width: 140px;
}

.cell-add-column {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    flex-shrink: 0;
    justify-content: center;
}

.cell-actions {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    flex-shrink: 0;
    justify-content: center;
    padding: 0 8px;
}

/* Drag Handle */
.drag-handle {
    color: var(--gray-400);
    cursor: grab;
    font-size: 1rem;
    user-select: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.table-row:hover .drag-handle {
    opacity: 1;
}

.table-row .cell-drag {
    cursor: grab;
}

/* Set from the moment a row is picked up until it is dropped, wherever the
   pointer travels in between. */
body.is-dragging-item,
body.is-dragging-item * {
    cursor: grabbing !important;
}

/* Inline Item Name */
.table-row .item-name {
    font-size: 0.875rem;
    color: var(--gray-900);
    padding: 2px 8px;
    margin: 0; /* Cancel the kanban card .item-name bottom margin */
    border-radius: var(--radius-sm);
    cursor: text;
    min-width: 50px;
    flex: 0 1 auto;
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-row .item-name:hover {
    background: var(--gray-100);
}

.table-row .item-name:focus {
    outline: none;
    background: var(--white);
    box-shadow: 0 0 0 2px var(--accent);
}

/* Select Styles - FLUSH AND FULL HEIGHT */
.status-select,
.priority-select,
.assignee-select,
.cell-select,
.cell-input,
.cell-status-select,
.cell-priority-select {
    width: 100%;
    height: 100%;
    min-height: 30px;
    padding: 3px 10px;
    font-size: 0.8125rem;
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--gray-700);
    appearance: none; /* Remove default arrow to control styling better, or keep it */
    display: block;
}

.cell-status-select,
.cell-priority-select {
    text-align: center;
    font-weight: 600;
    color: var(--white); /* Text white on colored background */
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* When no color is selected/default */
.cell-status-select:not([style*="background-color"]),
.cell-priority-select:not([style*="background-color"]) {
    color: var(--gray-500);
    background: var(--gray-50);
}

.cell-select:hover,
.cell-input:hover {
    background-color: rgba(0,0,0,0.02);
}

.cell-select:focus,
.cell-input:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--accent);
    z-index: 1;
}

/* Date Input */
.date-input, .cell-date-picker {
    padding: 3px 10px;
    font-size: 0.8125rem;
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--gray-700);
    width: 100%;
    height: 100%;
}

.date-input:hover, .cell-date-picker:hover {
    background: var(--gray-50);
}

.date-input:focus, .cell-date-picker:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--accent);
}

/* Add Item Row */
.table-footer {
    padding: 4px 12px;
    border-top: 1px solid var(--gray-100);
}

/* Empty row at the foot of a group: click it and type to add an item */
.add-item-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--gray-500);
    cursor: text;
    transition: background 0.15s, box-shadow 0.15s;
}

.add-item-inline:hover {
    background: var(--gray-100);
}

.add-item-inline:focus-within {
    background: var(--white);
    box-shadow: inset 0 0 0 2px var(--accent);
}

.add-item-plus {
    font-size: 1rem;
    font-weight: 500;
}

.add-item-inline input.add-item-input,
.add-item-inline input.add-item-input:focus {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    outline: none;
    font-size: 0.875rem;
    color: var(--gray-900);
}

.add-item-inline input.add-item-input::placeholder {
    color: var(--gray-500);
}

/* The add-item row stays on screen while a wide board scrolls sideways, like
   the group title above. Each offset is the resting distance from the
   container's content edge: 1px group border, 12px footer padding, 12px row
   padding, then the plus sign and its gap (19px) for the box. */
@media (min-width: 769px) {
    .board-table-container:not(.dashboard-board-table) .add-item-plus {
        position: sticky;
        left: calc(1px + 12px + 12px);
    }

    /* Capped below the visible width (viewport less the open sidebar, the
       paddings and a scrollbar) so the box has room to stay put. */
    .board-table-container:not(.dashboard-board-table) .add-item-inline input.add-item-input {
        position: sticky;
        left: calc(1px + 12px + 12px + 19px);
        max-width: calc(100vw - 420px);
    }
}

/* ========== Drag and Drop Styles ========== */
.table-row.dragging {
    opacity: 0.3;
    background: var(--gray-200);
    border: 2px dashed var(--gray-400);
}

.table-body.drag-over {
    background: rgba(122, 0, 60, 0.05);
}

/* Empty Group Drop Zone */
.empty-group-drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    margin: 8px 12px;
    color: var(--gray-400);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.table-body.drag-over .empty-group-drop-zone {
    border-color: var(--accent);
    background: rgba(122, 0, 60, 0.08);
    color: var(--accent);
}

/* Automation-moved highlight animation */
.table-row.automation-moved {
    animation: automationMoveHighlight 1.5s ease-out;
}

@keyframes automationMoveHighlight {
    0% {
        background-color: rgba(34, 197, 94, 0.3);
        transform: translateX(-5px);
    }
    20% {
        transform: translateX(0);
    }
    100% {
        background-color: transparent;
    }
}

.drop-indicator {
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    margin: 2px 12px;
    pointer-events: none;
    animation: dropIndicatorPulse 1s ease-in-out infinite;
}

@keyframes dropIndicatorPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Change Column Type Modal */
.change-type-warning {
    color: var(--danger);
    font-size: 0.875rem;
    margin: 0 0 16px;
}

/* Drag Clone - floating row while dragging */
.drag-clone {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transform: rotate(2deg);
    opacity: 0.95;
}

.drag-clone .table-row {
    border: none;
    background: var(--white);
}

.drag-clone .drag-handle {
    opacity: 1;
}

/* Page Actions */
.page-actions {
    display: flex;
    gap: 12px;
}

/* Modal Improvements */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 1.25rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-700);
}

/* Color Input */
input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 2px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ========== Dynamic Columns ========== */
.cell-column {
    padding: 0;
    border-right: 1px solid var(--gray-100);
    flex-shrink: 0;
    flex-grow: 0;
    position: relative;
    box-sizing: border-box;
}

.table-header .cell-column {
    padding: 0;
}

.column-name {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: text;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-name:hover {
    background: var(--gray-100);
}

.column-name:focus {
    outline: none;
    background: var(--white);
    box-shadow: 0 0 0 2px var(--accent);
}

.column-actions {
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.table-cell:hover .column-actions {
    opacity: 1;
}

/* Column Resize Handle */
.column-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
    z-index: 10;
}

.column-resize-handle:hover,
.column-resize-handle.resizing {
    background: var(--accent);
}

.column-resize-handle::after {
    content: '';
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 16px;
    background: var(--gray-300);
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.15s;
}

.table-header .cell-name:hover .column-resize-handle::after,
.table-header .cell-column:hover .column-resize-handle::after {
    opacity: 1;
}

.btn-icon-sm {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-500);
    transition: all 0.15s;
}

.btn-icon-sm:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.cell-add-column {
    width: 40px;
    min-width: 40px;
}

.btn-add-column {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    color: var(--gray-400);
    transition: all 0.15s;
}

.btn-add-column:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(122, 0, 60, 0.05);
}

.cell-timeline {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
}

.cell-timeline-input {
    width: 100%;
    height: 100%;
    font-size: 0.75rem;
    padding: 3px 8px;
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.cell-timeline-input:hover {
    background: var(--gray-50);
}

.cell-timeline-input:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--accent);
    background: var(--white);
}

.cell-timeline-input::placeholder {
    color: var(--gray-400);
}

/* Flatpickr customizations */
.flatpickr-calendar {
    font-family: var(--font-sans);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.flatpickr-day.selected.startRange,
.flatpickr-day.startRange.startRange,
.flatpickr-day.endRange.startRange {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.flatpickr-day.selected.endRange,
.flatpickr-day.startRange.endRange,
.flatpickr-day.endRange.endRange {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.flatpickr-day.inRange {
    background: rgba(122, 0, 60, 0.15);
    border-color: transparent;
}

.btn-attachment {
    background: transparent;
    border: none;
    border-radius: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s;
}

.btn-attachment:hover {
    background: rgba(122, 0, 60, 0.05);
}

/* Dropdown Menu */
.dropdown-menu {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 1000;
    padding: 4px 0;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.15s;
}

.dropdown-menu button:hover {
    background: var(--gray-100);
}

.dropdown-menu button.danger {
    color: var(--danger);
}

.dropdown-menu button.danger:hover {
    background: var(--danger-tint);
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 0;
}

/* ========== Person Avatar ========== */
.person-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    gap: 4px;
    padding: 2px;
}

.person-avatars {
    display: flex;
    align-items: center;
}

.person-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
    transition: transform 0.15s, box-shadow 0.15s;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--white);
    margin-left: -6px;
}

.person-avatar:first-child {
    margin-left: 0;
}

.person-cell:hover .person-avatar {
    transform: scale(1.05);
}

.person-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.person-avatar.empty {
    width: 24px;
    height: 24px;
    background: var(--gray-100);
    color: var(--gray-400);
    border: 2px dashed var(--gray-300);
    margin-left: 0;
}

.person-avatar.empty:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.person-avatar.more-count {
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 0.625rem;
    border: 2px solid var(--white);
}

/* Person Picker Dropdown */
.person-picker {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 10000;
    padding: 4px 0;
}

.person-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.person-picker-item:hover {
    background: var(--gray-100);
}

.person-picker-item.selected {
    background: rgba(122, 0, 60, 0.08);
}

.person-picker-item .person-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-300);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.person-picker-item.selected .person-checkbox {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.person-picker-item .person-checkbox::after {
    content: '';
    display: none;
}

.person-picker-item.selected .person-checkbox::after {
    content: '';
    display: block;
    font-size: 0.625rem;
    font-weight: bold;
}

.person-picker-item .person-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.6875rem;
    margin-left: 0;
    border: none;
}

.person-picker-item .person-name {
    font-size: 0.875rem;
    color: var(--gray-800);
    flex: 1;
}

.person-picker-item.clear-option {
    color: var(--gray-500);
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 4px;
    padding: 10px 12px;
}

.person-picker-item.clear-option:hover {
    color: var(--danger);
    background: var(--danger-tint);
}

/* ========== Status/Priority Picker (Monday.com style) ========== */
.status-cell,
.priority-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
    position: relative;
}

.status-label,
.priority-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 30px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: filter 0.15s, transform 0.1s;
    user-select: none;
}

.status-label:hover,
.priority-label:hover {
    filter: brightness(1.05);
}

.status-label:active,
.priority-label:active {
    transform: scale(0.98);
}

.status-label.empty,
.priority-label.empty {
    background: var(--gray-100);
    color: var(--gray-400);
    font-weight: 500;
}

.status-label.empty:hover,
.priority-label.empty:hover {
    background: var(--gray-200);
    color: var(--gray-500);
}

/* Status/Priority Picker Dropdown */
.status-picker,
.priority-picker {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.status-picker-item,
.priority-picker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.status-picker-item:hover,
.priority-picker-item:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

.status-picker-item:active,
.priority-picker-item:active {
    transform: scale(0.98);
}

.status-picker-item.selected,
.priority-picker-item.selected {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.status-picker-clear,
.priority-picker-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.15s;
    border-top: 1px solid var(--gray-100);
    margin-top: 4px;
    padding-top: 12px;
}

.status-picker-clear:hover,
.priority-picker-clear:hover {
    color: var(--danger);
    background: var(--danger-tint);
}

/* Column Type Preview */
.column-type-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.type-icon {
    font-size: 2rem;
}

.type-description {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* ========== Dashboard Styles ========== */
.dashboard-page {
    padding: 0;
}


/* Dashboard Stats */
.dashboard-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px 24px;
    min-width: 140px;
    flex: 1;
    max-width: 200px;
}

.stat-card.stat-warning {
    border-left: 4px solid var(--warning);
}

.stat-card.stat-danger {
    border-left: 4px solid var(--danger);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Dashboard Filters */
.dashboard-filters {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}

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

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

.filter-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    min-width: 150px;
    background: var(--white);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(122, 0, 60, 0.1);
}

.filter-actions {
    margin-left: auto;
}

/* Dashboard Sections */
.dashboard-section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-200);
}

.section-title-warning {
    border-bottom-color: var(--warning);
}

.section-title-danger {
    border-bottom-color: var(--danger);
}

/* Dashboard Table */
.dashboard-table {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.dashboard-table-header {
    display: flex;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
}

.dashboard-table-body {
    max-height: 400px;
    overflow-y: auto;
}

.dashboard-row {
    display: flex;
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.dashboard-row.clickable {
    cursor: pointer;
}

.dashboard-row:hover {
    background: var(--gray-50);
}

.dashboard-row:last-child {
    border-bottom: none;
}

.dashboard-row-overdue {
    background: var(--danger-tint);
}

.dashboard-row-overdue:hover {
    background: var(--danger-tint-strong);
}

.dash-cell {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
}

.dash-cell-name {
    flex: 2;
    min-width: 200px;
    font-weight: 500;
    color: var(--gray-900);
}

.dash-cell-board {
    flex: 1.5;
    min-width: 180px;
}

.dash-cell-group {
    flex: 1;
    min-width: 120px;
}

.dash-cell-status {
    width: 120px;
    min-width: 120px;
}

.dash-cell-priority {
    width: 100px;
    min-width: 100px;
}

.dash-cell-assignee {
    width: 120px;
    min-width: 120px;
}

.dash-cell-date {
    width: 120px;
    min-width: 120px;
}

.dash-cell-overdue {
    color: var(--danger);
    font-weight: 500;
}

/* Dashboard Badges */
.board-tag {
    font-size: 0.75rem;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.group-tag {
    font-size: 0.75rem;
    color: var(--gray-700);
    padding: 4px 8px;
    padding-left: 10px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.status-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 500;
}

.priority-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
}

.priority-badge.priority-low {
    background: #e4ead9;
    color: #3f6212;
}

.priority-badge.priority-medium {
    background: #fef3c7;
    color: #92400e;
}

.priority-badge.priority-high {
    background: #fed7aa;
    color: #7a003c;
}

.priority-badge.priority-critical {
    background: #fecaca;
    color: #b91c1c;
}

.assignee-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 12px;
    font-weight: 500;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-card:hover {
    border-color: var(--card-color, var(--accent));
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-card-color {
    width: 8px;
    height: 32px;
    border-radius: 4px;
}

.dashboard-card-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.dashboard-card-description {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.5;
}

.dashboard-card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dashboard-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8125rem;
}

.role-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.role-owner {
    background: #fef3c7;
    color: #92400e;
}

.role-editor {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.role-viewer {
    background: var(--gray-100);
    color: var(--gray-600);
}

.creator {
    color: var(--gray-500);
}

/* Dashboard Info */
.dashboard-info {
    margin-bottom: 24px;
}

.dashboard-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.dashboard-color-badge {
    width: 8px;
    height: 40px;
    border-radius: 4px;
}

.dashboard-info h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.dashboard-description {
    color: var(--gray-600);
    margin: 0;
}

/* Dashboard Boards Section */
.dashboard-boards-section {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.dashboard-boards-section h3 {
    margin: 0 0 12px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.boards-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.board-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 0.8125rem;
}

.board-chip-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.btn-chip-remove {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    margin-left: 4px;
}

.btn-chip-remove:hover {
    color: var(--danger);
}

.inline-form {
    display: inline;
}

.empty-notice {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin: 0;
}

/* Side Panel */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: var(--white);
    border-left: 1px solid var(--gray-200);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.side-panel.hidden {
    display: none;
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.side-panel-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
}

.btn-close:hover {
    color: var(--gray-600);
}

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel-info {
    color: var(--gray-500);
    font-size: 0.8125rem;
    margin-bottom: 16px;
}

/* Available Boards List */
.available-boards-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.available-board-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.board-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.board-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.board-item-name {
    font-weight: 500;
    color: var(--gray-900);
}

.board-item-workspace {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Members List */
.members-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.member-name {
    font-weight: 500;
    color: var(--gray-900);
}

.member-email {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Invite Section */
.invite-section {
    border-top: 1px solid var(--gray-200);
    padding-top: 20px;
}

.invite-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.invite-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-form select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* Column Fields in Add Item Panel */
.column-fields {
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
    margin-top: 16px;
}

.column-fields .form-group {
    margin-bottom: 12px;
}

.column-fields .form-group:last-child {
    margin-bottom: 16px;
}

.column-fields label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.column-fields input,
.column-fields select {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
}

.column-fields input:focus,
.column-fields select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(122, 0, 60, 0.1);
}

/* Color Picker Grid */
.color-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-option {
    cursor: pointer;
}

.color-option input {
    display: none;
}

.color-swatch {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.color-option input:checked + .color-swatch {
    border-color: var(--gray-900);
    transform: scale(1.1);
}

.color-option:hover .color-swatch {
    transform: scale(1.1);
}

/* Danger Zone */
.danger-zone {
    margin-top: 40px;
    padding: 20px;
    background: var(--danger-tint);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
}

.danger-zone h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #b91c1c;
}

.danger-zone p {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}

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

/* Action buttons in edit panel */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.danger-zone h4 {
    margin: 0 0 12px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.side-panel .danger-zone {
    margin-top: 20px;
    padding: 16px;
}

/* Group Picker (for dashboard) */
.group-picker {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    max-width: 250px;
    overflow: hidden;
}

.group-picker-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.group-picker-item:hover {
    background: var(--gray-50);
}

.group-picker-item.selected {
    background: var(--gray-100);
    font-weight: 500;
}

/* Group selector cell styling */
.group-selector {
    cursor: pointer;
}

.group-selector:hover .group-tag {
    opacity: 0.8;
}

/* Dashboard board table adjustments */
.dashboard-board-table {
    padding: 0;
    margin-top: 16px;
}

.dashboard-board-table .group-section {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.dashboard-board-table .table-header {
    background: var(--gray-50);
}

.dashboard-board-table .cell-board,
.dashboard-board-table .cell-group {
    min-width: 140px;
    max-width: 180px;
}

.dashboard-board-table .cell-board a {
    text-decoration: none;
    color: inherit;
}

.dashboard-board-table .cell-board a:hover {
    text-decoration: underline;
}

/* ========== AUTOMATIONS PAGE ========== */
.automations-page {
    padding: 0;
}

.automations-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    margin-top: 24px;
}

.automations-main {
    min-width: 0;
}

.automations-sidebar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--gray-200);
    height: fit-content;
    position: sticky;
    top: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.section-header h2,
.section-header h3 {
    margin: 0;
}

.count-badge {
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Automation Cards */
.automations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.automation-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.automation-card:hover {
    box-shadow: var(--shadow-md);
}

.automation-card.inactive {
    opacity: 0.6;
}

.automation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.automation-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.automation-name {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 1rem;
}

.automation-trigger-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    background: var(--gray-100);
    color: var(--gray-600);
}

.automation-trigger-badge.trigger-status_change { background: #e4ead9; color: #3f6212; }
.automation-trigger-badge.trigger-priority_change { background: #fef3c7; color: #92400e; }
.automation-trigger-badge.trigger-assignment_change { background: #e0e7ff; color: #3730a3; }
.automation-trigger-badge.trigger-item_created { background: #d1fae5; color: #065f46; }
.automation-trigger-badge.trigger-item_moved { background: #fce7f3; color: #9d174d; }
.automation-trigger-badge.trigger-date_reached { background: #fee2e2; color: #991b1b; }

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

.automation-description {
    margin-bottom: 12px;
}

.automation-rule {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.automation-rule strong {
    color: var(--gray-700);
}

.automation-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-item svg {
    opacity: 0.7;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 22px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* Activity Log */
.activity-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.log-entry {
    display: flex;
    gap: 10px;
    padding: 8px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.log-status {
    flex-shrink: 0;
    padding-top: 2px;
}

.status-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.success { background: var(--success); }
.status-dot.failed { background: var(--danger); }
.status-dot.skipped { background: var(--gray-400); }

.log-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.log-automation {
    font-weight: 500;
    color: var(--gray-800);
}

.log-item {
    color: var(--gray-600);
}

.log-time {
    color: var(--gray-500);
    font-size: 0.7rem;
}

.no-activity {
    text-align: center;
    color: var(--gray-500);
    padding: 20px;
}

/* Automation Builder Modal */
.modal-lg .modal-content {
    max-width: 700px;
}

.automation-builder {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: start;
    margin: 24px 0;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.builder-section {
    background: var(--white);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.builder-section h4 {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.builder-arrow {
    padding-top: 60px;
    color: var(--gray-400);
}

.config-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.config-section.hidden {
    display: none;
}

.config-note {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-style: italic;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-icon {
    margin-bottom: 20px;
    color: var(--gray-300);
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--gray-700);
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 1024px) {
    .automations-content {
        grid-template-columns: 1fr;
    }

    .automations-sidebar {
        position: static;
    }

    .automation-builder {
        grid-template-columns: 1fr;
    }

    .builder-arrow {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar { padding: 0 16px; }
    main { padding: 20px; }

    /* Board table responsive */
    .board-table-container { padding: 0 16px 16px; }
    /* Groups keep their columns and scroll sideways inside the container */
    .group-section { min-width: 560px; }
}

/* ========== DEPENDENCIES ========== */

/* Dependency button in item row */
.btn-dependency {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    /* The auto margin pushes this button and the comments button after it to the right edge of the item cell */
    margin-left: auto;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    color: var(--gray-700);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-dependency:hover {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-900);
}

.dependency-icon {
    font-size: 14px;
}

.dependency-count {
    font-size: 11px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    padding: 0 4px;
}

.dependency-count.has-dependencies {
    display: inline-flex;
}

/* Modal large variant */
.modal-lg {
    max-width: 700px;
}

.modal-body {
    padding: 20px 24px;
}

/* Dependency add section */
.dependency-add-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.dependency-add-section h4 {
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.dependency-search-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.dependency-search-row input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--white);
    color: var(--gray-900);
}

.dependency-search-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.dependency-search-row select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--white);
    color: var(--gray-900);
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Search results */
.dependency-search-results {
    margin-top: 12px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
}

.dependency-search-results:empty {
    display: none;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--gray-100);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-name {
    flex: 1;
    font-weight: 500;
    color: var(--gray-800);
}

.search-result-group {
    font-size: 12px;
    color: var(--gray-500);
}

.search-no-results {
    padding: 16px;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}

/* Cross-board badge */
.cross-board-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 10px;
}

/* Dependency lists */
.dependency-lists {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dependency-section h4 {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.dependency-help {
    font-weight: 400;
    color: var(--gray-500);
    font-size: 12px;
}

.dependency-list {
    background: var(--gray-50);
    border-radius: var(--radius);
    min-height: 50px;
}

.dependency-empty {
    padding: 16px;
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
    font-style: italic;
}

.dependency-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
}

.dependency-item:first-child {
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.dependency-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.dependency-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.dependency-item-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dependency-item-status.status-complete {
    background: var(--success);
}

.dependency-item-status.status-incomplete {
    background: var(--gray-300);
    border: 2px solid var(--gray-400);
}

.dependency-item-name {
    font-weight: 500;
    color: var(--gray-800);
}

.dependency-item-group {
    font-size: 12px;
    color: var(--gray-500);
}

/* Blocked item indicator on row */
.table-row.is-blocked {
    background: var(--danger-tint);
}

.table-row.is-blocked .cell-name::before {
    content: '';
    margin-right: 6px;
    font-size: 12px;
}

/* ========== BLOCKED ITEMS ========== */
.blocked-indicator {
    margin-right: 6px;
    font-size: 14px;
    cursor: help;
    animation: pulse-blocked 2s infinite;
}

@keyframes pulse-blocked {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.table-row.blocked {
    background-color: rgba(220, 38, 38, 0.05);
    border-left: 3px solid var(--danger);
}

.table-row.blocked .cell-name .item-name {
    color: var(--gray-500);
}

.table-row.blocked:hover {
    background-color: rgba(220, 38, 38, 0.1);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--gray-400);
    animation: slideInRight 0.3s ease-out;
}

.toast-error {
    border-left-color: var(--danger);
    background: var(--danger-tint);
}

.toast-success {
    border-left-color: var(--success);
    background: #f0fdf4;
}

.toast-info {
    border-left-color: var(--accent);
    background: #eff6ff;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--gray-600);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-fade-out {
    animation: fadeOutRight 0.3s ease-out forwards;
}

@keyframes fadeOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ========== FORM ENHANCEMENTS ========== */
.form-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 4px;
    margin-bottom: 0;
}

.form-help-text {
    color: var(--gray-600);
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.save-indicator {
    color: var(--success);
    font-weight: 500;
    margin-left: 12px;
    animation: fadeIn 0.3s ease-out;
}

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

/* ==========================================
   Sidebar Styles
   ========================================== */

.app-container {
    display: flex;
    height: calc(100vh - 64px);
    overflow: hidden;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: width 0.3s ease, min-width 0.3s ease, transform 0.3s ease;
    z-index: 50;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    /* overflow must stay visible so the toggle tab, which hangs off the right edge, is still clickable */
    overflow: visible;
}

.sidebar.collapsed .sidebar-content {
    opacity: 0;
    visibility: hidden;
}

.sidebar.collapsed .toggle-icon {
    transform: rotate(180deg);
}

/* One tab on the sidebar's outer edge, vertically centred. It has the same
   shape and height open or closed, so collapsing only flips the arrow. When
   the sidebar is collapsed its edge sits at the viewport's left edge. */
.sidebar-toggle {
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    width: 24px;
    height: 56px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.toggle-icon {
    width: 16px;
    height: 16px;
    color: var(--gray-500);
    transition: transform 0.3s ease;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar-nav {
    padding: 16px 12px;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.sidebar-link.active {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar-link-main {
    font-weight: 600;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-icon.small {
    width: 14px;
    height: 14px;
}

.sidebar-link-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-link-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-section {
    padding: 8px 12px;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius);
    transition: background 0.2s ease;
}

.sidebar-section-header:hover {
    background: var(--gray-100);
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

.sidebar-chevron {
    width: 14px;
    height: 14px;
    color: var(--gray-400);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.sidebar-section-header.collapsed .sidebar-chevron {
    transform: rotate(-90deg);
}

.sidebar-section-content {
    margin-top: 4px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-section-content.collapsed {
    max-height: 0 !important;
}

.sidebar-workspace {
    margin-bottom: 4px;
}

.sidebar-workspace-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.2s ease;
}

.sidebar-workspace-header:hover {
    background: var(--gray-100);
}

.sidebar-workspace-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.workspace-chevron {
    margin-left: auto;
}

.sidebar-workspace-header.collapsed .workspace-chevron {
    transform: rotate(-90deg);
}

.sidebar-workspace-boards {
    padding-left: 12px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-workspace-boards.collapsed {
    max-height: 0 !important;
}

.sidebar-board-link {
    padding: 8px 12px;
    font-size: 0.8125rem;
}

.board-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sidebar-empty {
    padding: 16px 12px;
    text-align: center;
}

.sidebar-empty p {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid var(--gray-200);
}

.sidebar-link-action {
    color: var(--accent);
}

.sidebar-link-action:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* Main Content Area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    transition: margin-left 0.3s ease;
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 64px;
        height: calc(100vh - 64px);
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 260px;
        min-width: 260px;
    }

    .main-content {
        padding: 16px;
    }
}

/* Dark mode adjustments for sidebar */
[data-theme="dark"] .sidebar {
    background: var(--gray-100);
    border-right-color: var(--gray-200);
}

[data-theme="dark"] .sidebar-toggle {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

[data-theme="dark"] .sidebar-toggle:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .sidebar-section-header:hover,
[data-theme="dark"] .sidebar-workspace-header:hover,
[data-theme="dark"] .sidebar-link:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .sidebar-link.active {
    background: rgba(232, 74, 130, 0.2);
}

/* Workspace Dropdown */
.sidebar-workspace-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 4px;
}

.sidebar-add-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.sidebar-add-btn:hover {
    color: var(--accent);
    background: var(--gray-100);
}

.sidebar-add-btn svg {
    width: 14px;
    height: 14px;
}

.workspace-dropdown-wrapper {
    position: relative;
    padding: 0 12px;
    margin-bottom: 12px;
}

.workspace-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.workspace-dropdown-trigger:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

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

.workspace-dropdown-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-dropdown-arrow {
    width: 16px;
    height: 16px;
    color: var(--gray-400);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.workspace-dropdown-trigger[aria-expanded="true"] .workspace-dropdown-arrow {
    transform: rotate(180deg);
}

.workspace-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 12px;
    right: 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.workspace-dropdown.hidden {
    display: none;
}

.workspace-dropdown-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-200);
}

.workspace-dropdown-search .search-icon {
    width: 16px;
    height: 16px;
    color: var(--gray-400);
    flex-shrink: 0;
}

.workspace-dropdown-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--gray-900);
    outline: none;
}

.workspace-dropdown-search input::placeholder {
    color: var(--gray-400);
}

.workspace-dropdown-list {
    overflow-y: auto;
    max-height: 240px;
    padding: 4px;
}

.workspace-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}

.workspace-dropdown-item:hover {
    background: var(--gray-100);
}

.workspace-dropdown-item.active {
    background: var(--accent-light);
}

.workspace-item-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.workspace-item-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workspace-dropdown-item.active .workspace-item-name {
    color: var(--accent);
    font-weight: 600;
}

.workspace-item-count {
    font-size: 0.75rem;
    color: var(--gray-400);
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* Sidebar Boards Section */
.sidebar-boards-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 12px;
}

.sidebar-boards-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    margin-bottom: 4px;
}

.sidebar-boards-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

.sidebar-boards-list {
    flex: 1;
    overflow-y: auto;
}

.sidebar-boards-empty {
    padding: 16px 12px;
    text-align: center;
}

.sidebar-boards-empty p {
    color: var(--gray-400);
    font-size: 0.8125rem;
}

.workspace-overview-link {
    color: var(--gray-500);
}

.sidebar-add-board {
    color: var(--gray-400);
    margin-top: 4px;
}

.sidebar-add-board:hover {
    color: var(--accent);
}

.workspace-overview-link:hover {
    color: var(--gray-700);
}

/* Dark mode for workspace dropdown */
[data-theme="dark"] .workspace-dropdown-trigger {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

[data-theme="dark"] .workspace-dropdown-trigger:hover {
    background: var(--gray-300);
}

[data-theme="dark"] .workspace-dropdown {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

[data-theme="dark"] .workspace-dropdown-search {
    border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .workspace-dropdown-item:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .workspace-dropdown-item.active {
    background: rgba(232, 74, 130, 0.2);
}

[data-theme="dark"] .workspace-item-count {
    background: var(--gray-200);
}

/* ==========================================================================
   Board Toolbar - Search & Filters
   ========================================================================== */
.board-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 32px;
    flex-wrap: wrap;
}

.board-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.board-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.board-search {
    position: relative;
    display: flex;
    align-items: center;
}

.board-search-icon {
    position: absolute;
    left: 10px;
    pointer-events: none;
    font-size: 14px;
    opacity: 0.6;
}

.board-search-input {
    padding: 8px 32px 8px 32px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-900);
    font-size: 14px;
    width: 260px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.board-search-input:focus {
    outline: none;
    border-color: #7a003c;
    box-shadow: 0 0 0 3px rgba(122, 0, 60, 0.15);
}

.board-search-clear {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-700);
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

.board-search-clear:hover {
    background: var(--gray-100);
}

.board-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.board-filter {
    position: relative;
}

.board-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-700);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.board-filter-btn:hover {
    background: var(--gray-100);
}

.board-filter.active .board-filter-btn {
    border-color: #7a003c;
    color: #4f46e5;
    background: rgba(122, 0, 60, 0.06);
}

.board-filter-count {
    font-size: 11px;
    font-weight: 600;
}

.board-filter-count.active {
    background: var(--accent);
    color: #fff;
    padding: 1px 6px;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
}

.board-filter-caret {
    font-size: 10px;
    opacity: 0.6;
}

.board-filter-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
}

.board-filter-panel-wide {
    min-width: 280px;
}

.board-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: var(--gray-700);
}

.board-filter-option:hover {
    background: var(--gray-100);
}

.board-filter-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.board-filter-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.board-filter-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.board-filter-option-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-filter-daterange {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

.board-filter-daterange label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-700);
}

.board-filter-daterange input[type="date"] {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 12px;
}

.board-filter-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px 8px;
    border-top: 1px solid var(--gray-200);
}

.board-filter-presets button {
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: var(--gray-700);
}

.board-filter-presets button:hover {
    background: var(--gray-100);
}

.board-filter-summary {
    font-size: 12px;
    color: var(--gray-700);
    font-weight: 500;
}

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

/* Filtered-out rows + groups */
.table-row.filtered-out {
    display: none;
}

.group-section.all-filtered .group-table {
    opacity: 0.5;
}

.group-section.all-filtered .table-body::after {
    content: 'No items match the current filters';
    display: block;
    padding: 16px;
    text-align: center;
    color: var(--gray-700);
    font-size: 13px;
    font-style: italic;
}

[data-theme="dark"] .board-search-input,
[data-theme="dark"] .board-filter-btn,
[data-theme="dark"] .board-filter-panel,
[data-theme="dark"] .board-filter-presets button,
[data-theme="dark"] .board-filter-daterange input[type="date"] {
    background: var(--gray-100);
    color: var(--gray-900);
    border-color: var(--gray-300);
}

[data-theme="dark"] .board-search-clear:hover,
[data-theme="dark"] .board-filter-btn:hover,
[data-theme="dark"] .board-filter-option:hover,
[data-theme="dark"] .board-filter-presets button:hover {
    background: var(--gray-200);
}

/* ==========================================================================
   Personal Dashboard Views - My Items, Calendar, Workload
   ========================================================================== */

.page-subtitle {
    color: var(--gray-700);
    font-size: 14px;
    margin-top: 4px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.text-danger { color: #dc2626; font-weight: 600; }
.text-muted { color: var(--gray-500, #9a9ba1); }

/* My Items */
.my-items-page {
    padding: 0;
}

.my-items-board-section {
    margin-top: 24px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.my-items-board-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.my-items-board-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    text-decoration: none;
}

.my-items-board-name:hover { text-decoration: underline; }

.my-items-workspace-name {
    font-size: 12px;
    color: var(--gray-700);
}

.my-items-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--gray-700);
}

.my-items-table {
    width: 100%;
    border-collapse: collapse;
}

.my-items-table th,
.my-items-table td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    font-size: 13px;
}

.my-items-table th {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.my-items-table tr:last-child td { border-bottom: none; }

.my-items-table tr.row-overdue {
    background: rgba(254, 226, 226, 0.4);
}

.my-items-item-name {
    font-weight: 500;
    color: var(--gray-900);
    text-decoration: none;
}

.my-items-item-name:hover { text-decoration: underline; }

.my-items-status,
.my-items-priority,
.my-items-group {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    background: var(--gray-100);
    color: var(--gray-700);
}

.my-items-priority.priority-critical { background: var(--danger); color: #fff; }
.my-items-priority.priority-high { background: #fee2e2; color: #991b1b; }
.my-items-priority.priority-medium { background: #fef3c7; color: #92400e; }
.my-items-priority.priority-low { background: #e4ead9; color: #3f6212; }

.my-items-empty { color: var(--gray-500, #9a9ba1); }

/* Calendar */
.calendar-page { padding: 0; }

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 12px;
}

.calendar-title {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 1.4rem;
    color: var(--gray-900);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--gray-200);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.calendar-weekday {
    background: var(--gray-100);
    color: var(--gray-700);
    text-align: center;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calendar-day {
    background: var(--white);
    min-height: 110px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-day-blank { background: var(--gray-100); }

.calendar-day-today {
    background: var(--accent-light);
    box-shadow: inset 0 0 0 2px var(--accent);
}

.calendar-day-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
}

.calendar-day-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.calendar-item {
    display: block;
    padding: 3px 6px;
    border-left: 3px solid var(--gray-300);
    background: var(--gray-100);
    border-radius: 3px;
    font-size: 11px;
    line-height: 1.3;
    text-decoration: none;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-item:hover { filter: brightness(0.96); }

.calendar-item-mine {
    background: rgba(122, 0, 60, 0.12);
    font-weight: 600;
}

.calendar-item-board {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.8;
}

/* Workload */
.workload-page { padding: 0; }

.workload-table {
    width: 100%;
    margin-top: 24px;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.workload-table th,
.workload-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    font-size: 13px;
}

.workload-table th {
    background: var(--gray-100);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-700);
}

.workload-table tr:last-child td { border-bottom: none; }
.workload-table tr.row-self { background: rgba(122, 0, 60, 0.05); }

.col-num { text-align: center; width: 80px; }

.workload-person {
    display: flex;
    align-items: center;
    gap: 10px;
}

.workload-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #7a003c;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.workload-person-name { font-weight: 600; color: var(--gray-900); }
.workload-person-email { font-size: 11px; color: var(--gray-700); }

.priority-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.priority-pill.priority-critical { background: var(--danger); color: #fff; }
.priority-pill.priority-high { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .my-items-board-section,
[data-theme="dark"] .workload-table,
[data-theme="dark"] .calendar-grid {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

[data-theme="dark"] .calendar-day { background: var(--gray-100); }
[data-theme="dark"] .calendar-day-blank { background: var(--gray-200); }
[data-theme="dark"] .calendar-weekday,
[data-theme="dark"] .my-items-board-header,
[data-theme="dark"] .workload-table th { background: var(--gray-200); }

/* ==========================================================================
   Per-board view toggle (Table / Kanban / Calendar / Timeline)
   ========================================================================== */
.board-view-toggle {
    display: inline-flex;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
}

.board-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--gray-700);
    text-decoration: none;
    border-right: 1px solid var(--gray-300);
    background: var(--white);
    transition: background 0.12s;
}

.board-view-btn:last-child { border-right: none; }
.board-view-btn:hover { background: var(--gray-100); }

.board-view-btn.active {
    background: #7a003c;
    color: #fff;
}

/* Kanban */
.board-kanban-page { padding: 0; }

.kanban-board {
    display: flex;
    gap: 12px;
    padding: 0 32px 32px;
    overflow-x: auto;
    align-items: flex-start;
}

.kanban-column {
    flex: 0 0 280px;
    background: var(--gray-100);
    border-radius: 8px;
    border-top: 4px solid var(--group-color, #7a003c);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--gray-900);
    border-bottom: 1px solid var(--gray-200);
}

.kanban-column-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.kanban-column-name { flex: 1; }

.kanban-column-count {
    background: var(--white);
    color: var(--gray-700);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.kanban-column-body {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-column-body.drag-over {
    background: rgba(122, 0, 60, 0.08);
    outline: 2px dashed #7a003c;
    outline-offset: -4px;
    border-radius: 6px;
}

.kanban-card {
    background: var(--white);
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: grab;
    transition: box-shadow 0.12s, transform 0.12s;
}

.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.kanban-card-name {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 13px;
    margin-bottom: 4px;
}

.kanban-card-description {
    font-size: 12px;
    color: var(--gray-700);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.kanban-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 11px;
    color: var(--gray-700);
}

.kanban-card-priority {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.kanban-card-priority.priority-critical { background: var(--danger); color: #fff; }
.kanban-card-priority.priority-high { background: #fee2e2; color: #991b1b; }
.kanban-card-priority.priority-medium { background: #fef3c7; color: #92400e; }
.kanban-card-priority.priority-low { background: #e4ead9; color: #3f6212; }

.kanban-empty {
    text-align: center;
    padding: 20px;
    color: var(--gray-500, #9a9ba1);
    font-size: 12px;
    font-style: italic;
    border: 2px dashed var(--gray-200);
    border-radius: 6px;
}

/* Timeline */
.board-timeline-page { padding: 0; }

.timeline-page {
    padding: 0;
}

.timeline-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.timeline-controls label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-700);
}

.timeline-controls select {
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    font-size: 13px;
}

.timeline-wrapper {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
}

.timeline-header,
.timeline-row {
    display: flex;
    align-items: stretch;
}

.timeline-header {
    background: var(--gray-100);
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 2;
}

.timeline-row-label-cell {
    flex: 0 0 200px;
    padding: 8px 12px;
    border-right: 1px solid var(--gray-200);
    font-size: 13px;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: var(--white);
}

.timeline-row-bars {
    position: relative;
    flex: 1;
    min-height: 36px;
    display: flex;
}

.timeline-day-header {
    text-align: center;
    border-right: 1px solid var(--gray-200);
    padding: 4px 0;
    flex-shrink: 0;
}

.timeline-day-header.weekend { background: var(--gray-100); }
.timeline-day-header.today { background: rgba(122, 0, 60, 0.1); }

.timeline-day-num { font-size: 13px; font-weight: 600; }
.timeline-day-month { font-size: 10px; color: var(--gray-700); text-transform: uppercase; }

.timeline-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--gray-100);
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-900);
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timeline-group-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.timeline-group-count {
    margin-left: auto;
    font-weight: 400;
    color: var(--gray-700);
}

.timeline-row {
    border-bottom: 1px solid var(--gray-200);
}

.timeline-row:last-child { border-bottom: none; }

.timeline-bar {
    position: absolute;
    top: 6px;
    bottom: 6px;
    background: #7a003c;
    border-radius: 4px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    cursor: pointer;
    transition: filter 0.12s;
}

.timeline-bar:hover { filter: brightness(1.06); }

.timeline-bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .kanban-column,
[data-theme="dark"] .kanban-empty,
[data-theme="dark"] .timeline-wrapper { background: var(--gray-100); }
[data-theme="dark"] .kanban-card { background: var(--white); }
[data-theme="dark"] .timeline-row-label-cell,
[data-theme="dark"] .board-view-btn { background: var(--white); }
[data-theme="dark"] .board-view-btn.active { background: var(--accent); }

/* ==========================================================================
   Item Details Modal - Comments, Attachments, Activity
   ========================================================================== */
.modal-xl { max-width: 760px; width: 92%; }
.btn-details {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--gray-700);
    font-size: 13px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}
.btn-details:hover { background: var(--gray-100); }
.btn-details .comment-count {
    margin-left: 2px;
    font-size: 11px;
    color: var(--gray-700);
}

.item-details-body { padding: 16px 20px 20px; }

.item-details-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.item-details-meta-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-details-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-700);
    font-weight: 600;
}

.item-details-tabs {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.item-details-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--gray-700);
    font-weight: 500;
}

.item-details-tab.active {
    color: #7a003c;
    border-bottom-color: #7a003c;
}

.item-details-pane { padding: 16px 0; }

/* Comments */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}

.comments-empty,
.attachments-empty,
.activity-empty {
    text-align: center;
    padding: 24px;
    color: var(--gray-500, #9a9ba1);
    font-size: 13px;
    font-style: italic;
}

.comment-card {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: var(--gray-100);
    border-radius: 6px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #7a003c;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.comment-body { flex: 1; min-width: 0; }

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-900);
}

.comment-time {
    font-size: 11px;
    color: var(--gray-700);
}

.comment-delete {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-700);
    font-size: 16px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

.comment-delete:hover { background: var(--gray-200); color: #dc2626; }

.comment-content {
    margin-top: 4px;
    color: var(--gray-900);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.mention {
    background: rgba(122, 0, 60, 0.12);
    color: #4f46e5;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 12px;
}

.comment-composer {
    margin-top: 16px;
    position: relative;
    border-top: 1px solid var(--gray-200);
    padding-top: 12px;
}

.comment-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.comment-input:focus {
    outline: none;
    border-color: #7a003c;
    box-shadow: 0 0 0 3px rgba(122, 0, 60, 0.15);
}

.comment-composer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    justify-content: flex-end;
}

.comment-mentions-preview {
    margin-right: auto;
    font-size: 12px;
    color: var(--gray-700);
}

.mention-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 220px;
    overflow-y: auto;
    z-index: 20;
    min-width: 220px;
}

.mention-option {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--gray-900);
}

.mention-option:hover { background: rgba(122, 0, 60, 0.08); }

/* Attachments */
.attachments-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
}

.attachments-upload input[type="file"] { display: none; }

.attachment-hint {
    font-size: 11px;
    color: var(--gray-700);
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    max-height: 360px;
    overflow-y: auto;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--gray-100);
    border-radius: 6px;
}

.attachment-icon { font-size: 20px; }

.attachment-info { flex: 1; min-width: 0; }

.attachment-name {
    color: #7a003c;
    font-weight: 500;
    text-decoration: none;
    font-size: 13px;
}

.attachment-name:hover { text-decoration: underline; }

.attachment-meta {
    font-size: 11px;
    color: var(--gray-700);
    margin-top: 2px;
}

.attachment-delete {
    background: none;
    border: none;
    color: var(--gray-700);
    cursor: pointer;
    font-size: 18px;
    padding: 2px 8px;
    border-radius: 4px;
}

.attachment-delete:hover { background: var(--gray-200); color: #dc2626; }

/* Activity */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 360px;
    overflow-y: auto;
}

.activity-row {
    display: grid;
    grid-template-columns: 160px 140px 1fr;
    gap: 12px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px dashed var(--gray-200);
}

.activity-time { color: var(--gray-700); }
.activity-user { font-weight: 600; color: var(--gray-900); }
.activity-action { color: var(--gray-700); }

[data-theme="dark"] .comment-card,
[data-theme="dark"] .attachment-card { background: var(--gray-100); }
[data-theme="dark"] .mention-dropdown,
[data-theme="dark"] .comment-input { background: var(--gray-100); color: var(--gray-900); }





/* ==========================================================================
   Shared page shell
   One set of rules for page padding, headers, forms, tables and empty
   states, so every screen lines up the same way.
   ========================================================================== */

input,
select,
textarea,
button {
    font-family: inherit;
}

/* Board pages run edge to edge: the header bar and the content pad themselves. */
.board-layout .page-header {
    padding: 20px 32px;
}

.board-layout .page-header .breadcrumb {
    margin-bottom: 0;
}

.board-layout .calendar-page,
.board-layout .timeline-page,
.board-layout .automations-content {
    padding: 0 32px 32px;
}

.board-layout .automations-content {
    margin-top: 0;
}

.page-header-left {
    flex-wrap: wrap;
    min-width: 0;
}

.page-actions {
    flex-wrap: wrap;
    align-items: center;
}

.page-header .btn,
.board-view-btn {
    white-space: nowrap;
}

.page-subtitle {
    margin-top: 0;
}

/* Headings inside page sections and cards */
.section > h2,
.automations-sidebar h2,
.automations-sidebar h3 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.section:last-child {
    margin-bottom: 0;
}

/* Workspace members sit in a row of equal cards, avatar first. */
.section .members-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 12px;
    margin-bottom: 0;
}

.section .member-item {
    justify-content: flex-start;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.section .member-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
}

/* Forms */
.form-container {
    max-width: 540px;
    margin: 0 auto;
    padding: 32px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.form-container > h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.form-description {
    margin-bottom: 24px;
    font-size: 0.9375rem;
    color: var(--gray-600);
}

.form-card h3 {
    font-size: 1.125rem;
    margin-bottom: 12px;
}

.form-card h4 {
    font-size: 1rem;
    margin: 20px 0 8px;
}

.form-card + .form-card,
.form-card + .alert,
.alert + .form-card {
    margin-top: 24px;
}

.board-layout > .alert {
    max-width: 540px;
    margin-inline: auto;
}

.board-layout > .form-card:last-of-type {
    margin-bottom: 32px;
}

.alert-success {
    background: rgba(77, 124, 15, 0.1);
    border: 1px solid rgba(77, 124, 15, 0.25);
    color: var(--success);
}

/* Data tables (admin users, board members) */
.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.data-table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--gray-500);
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 12px 16px;
    vertical-align: middle;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-200);
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table .inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    vertical-align: middle;
}

.data-table .inline-form.hidden {
    display: none;
}

.data-table .actions {
    white-space: nowrap;
}

.data-table .actions > * + * {
    margin-left: 8px;
}

.data-table select,
.data-table input[type="password"] {
    height: 32px;
    padding: 0 8px;
    font-size: 0.875rem;
    color: var(--gray-900);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
}

.badge-success {
    background: rgba(77, 124, 15, 0.12);
    color: var(--success);
}

.badge-muted {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Empty states */
.empty-state h2,
.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.empty-state > :last-child {
    margin-bottom: 0;
}

/* Sign-in page */
.auth-page {
    flex-direction: column;
    gap: 24px;
}

.auth-brand {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--gray-900);
}

.auth-brand:hover {
    color: var(--accent);
}

.auth-card h1 {
    margin-bottom: 24px;
}

.auth-form + .btn-google {
    margin-top: 16px;
}

@media (max-width: 768px) {
    .board-layout .page-header {
        padding: 16px;
    }

    .table-scroll .data-table {
        min-width: 760px;
    }

    .board-layout .calendar-page,
    .board-layout .timeline-page,
    .board-layout .automations-content {
        padding: 0 16px 16px;
    }

    .btn:not(.btn-sm) {
        min-height: 44px;
    }

    .form-container,
    .form-card {
        padding: 20px;
    }
}

/* ==========================================
   Page navigation transitions
   The browser keeps the old page on screen until the new one is ready,
   holds the navbar and sidebar in place, and crossfades the content.
   Browsers without cross-document view transitions navigate as before.
   ========================================== */
@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }

    .navbar {
        view-transition-name: app-navbar;
    }

    .sidebar {
        view-transition-name: app-sidebar;
    }

    ::view-transition-group(root) {
        animation-duration: 0.15s;
    }

    /* The shell is the same on both pages, so swap it instantly instead of fading */
    ::view-transition-group(app-navbar),
    ::view-transition-group(app-sidebar) {
        animation: none;
    }

    ::view-transition-old(app-navbar),
    ::view-transition-old(app-sidebar) {
        display: none;
    }

    ::view-transition-new(app-navbar),
    ::view-transition-new(app-sidebar) {
        animation: none;
    }
}

/* ========== Label editor (status and priority options) ========== */
.status-picker-edit,
.priority-picker-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.status-picker-edit:hover,
.priority-picker-edit:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.label-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.label-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.label-row input.label-row-colour {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
}

.label-row input.label-row-name {
    flex: 1;
    min-width: 0;
    height: 36px;
    padding: 0 12px;
}

.label-row .label-row-remove {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    font-size: 1.125rem;
}

.label-row .label-row-remove:hover:not(:disabled) {
    color: var(--danger);
    background: var(--danger-tint);
}

.label-row .label-row-remove:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Status and priority menus: labels flow into columns (set by --picker-columns)
   and the Clear and Edit rows span the full width. */
.status-picker,
.priority-picker {
    display: grid;
    grid-template-columns: repeat(var(--picker-columns, 1), minmax(140px, 1fr));
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow-y: auto;
}

.status-picker-item,
.priority-picker-item {
    min-width: 0;
    text-align: center;
    overflow-wrap: anywhere;
}

.status-picker-clear,
.priority-picker-clear,
.status-picker-edit,
.priority-picker-edit {
    grid-column: 1 / -1;
}

/* ========== API tokens page ========== */
.api-token-new {
    align-items: flex-start;
}

.api-token-value {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.api-token-value code,
.api-token-example {
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-size: 0.8125rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    color: var(--gray-900);
}

.api-token-value code {
    padding: 8px 12px;
    overflow-wrap: anywhere;
    user-select: all;
}

.api-token-example {
    margin: 0 0 16px;
    padding: 12px 16px;
    overflow-x: auto;
}

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

.api-token-form .form-group {
    flex: 1;
    min-width: 240px;
    margin-bottom: 0;
}

/* ==========================================
   Read-only board pages (viewers)
   The page root carries data-can-write="false"; edit controls are not
   rendered at all, these rules only stop what is left from looking editable.
   ========================================== */
.board-page[data-can-write="false"] .cell-input:disabled {
    background: transparent;
    border-color: transparent;
    color: inherit;
    -webkit-text-fill-color: currentColor;
    opacity: 1;
    cursor: default;
}

.board-page[data-can-write="false"] .status-cell,
.board-page[data-can-write="false"] .priority-cell,
.board-page[data-can-write="false"] .person-cell,
.board-page[data-can-write="false"] .table-row,
.board-page[data-can-write="false"] .kanban-card {
    cursor: default;
}

.board-page[data-can-write="false"] .person-avatar.empty,
.board-page[data-can-write="false"] .person-avatar.empty:hover {
    border-color: transparent;
    background: transparent;
}

.automations-page[data-can-write="false"] .toggle-switch {
    cursor: default;
    opacity: 0.6;
}
