/* CardStack - Design System */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    /* Backgrounds - clean, subtle grays */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --bg-hover: #eee;
    --bg-active: #e8f0fe;
    --bg-card: #ffffff;
    --bg-column: #f1f3f5;

    /* Text - high contrast hierarchy */
    --text-primary: #1a1a1a;
    --text-secondary: #444;
    --text-tertiary: #555;
    --text-muted: #666;
    --text-faint: #888;

    /* Borders - very subtle */
    --border-color: #e5e5e5;
    --border-light: #eee;

    /* Accent - professional blue */
    --accent-color: #0066cc;
    --accent-hover: #0052a3;

    /* Status colors */
    --success: #059669;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --warning: #d97706;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;

    /* Header - dark, contrasting */
    --header-bg: #1a1a2e;
    --header-text: #ffffff;
    --header-text-muted: rgba(255, 255, 255, 0.7);

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-elevated: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-sidebar: 2px 0 8px rgba(0, 0, 0, 0.15);

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 6px;
    --space-3: 8px;
    --space-4: 12px;
    --space-5: 16px;
    --space-6: 20px;
    --space-7: 24px;
    --space-8: 32px;
    --space-9: 40px;
    --space-10: 48px;
    --space-11: 60px;

    /* Border radius - matches TodoStack/DocStack */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transitions - matches TodoStack */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;

    /* Layout */
    --header-height: 56px;
    --column-width: 280px;
    --max-width: 1600px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #242424;
        --bg-tertiary: #2d2d2d;
        --bg-hover: #333;
        --bg-active: #1e3a5f;
        --bg-card: #242424;
        --bg-column: #2d2d2d;

        --text-primary: #e5e5e5;
        --text-secondary: #ccc;
        --text-tertiary: #bbb;
        --text-muted: #999;
        --text-faint: #777;

        --border-color: #404040;
        --border-light: #333;

        --accent-color: #4da6ff;
        --accent-hover: #80bdff;

        --header-bg: #0d0d0d;

        --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2);
        --shadow-elevated: 0 4px 24px rgba(0, 0, 0, 0.3);
        --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

        --success-bg: #064e3b;
        --success-text: #6ee7b7;
        --danger-bg: #7f1d1d;
        --danger-text: #fca5a5;
    }
}

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

html {
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
}

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

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

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ============================================
   Site Header
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--header-bg);
    z-index: 1000;
}

.site-header > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 var(--space-5);
    max-width: var(--max-width);
    margin: 0 auto;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header-left {
    flex: 1;
}

.header-right {
    flex: 1;
    justify-content: flex-end;
}

.logo,
.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--header-text);
    text-decoration: none;
    white-space: nowrap;
}

.logo:hover,
.site-logo:hover {
    text-decoration: none;
    color: var(--header-text);
}

.site-logo img {
    height: 24px;
    width: auto;
    border-radius: var(--radius-sm);
}

.site-logo-emoji {
    font-size: 28px;
    line-height: 1;
}

.site-logo-text {
    /* Inherits from .site-logo */
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

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

.btn-danger:hover:not(:disabled) {
    background-color: var(--danger-hover);
    border-color: var(--danger-hover);
}

.btn-icon {
    padding: 8px;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    margin-right: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #059669;
    color: white;
    border-radius: 9999px;
}

.admin-badge svg {
    flex-shrink: 0;
}

.btn-block {
    width: 100%;
}

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

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

/* Ghost button - subtle, nearly invisible until hovered */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-ghost:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.btn-ghost:active {
    background-color: var(--bg-tertiary);
}

.btn-ghost:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Ghost button in header - light text on dark background */
.site-header .btn-ghost {
    color: rgba(255, 255, 255, 0.7);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.site-header .btn-ghost:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* External link in header - matches docstack/todostack */
.header-external-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--header-text-muted);
    padding: 8px 12px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.header-external-link:hover {
    color: var(--header-text);
    text-decoration: none;
}

.header-external-link img {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

/* ============================================
   Admin Controls
   ============================================ */
.admin-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    margin-right: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #059669;
    color: white;
    border-radius: 9999px;
}

.admin-badge svg {
    width: 12px;
    height: 12px;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    min-height: calc(100vh - var(--header-height));
}

/* ============================================
   Boards Page
   ============================================ */
.boards-page .main-content {
    padding: var(--space-8) var(--space-5);
    max-width: var(--max-width);
    margin: 0 auto;
}

.boards-container {
    max-width: 1200px;
}

.boards-heading {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--space-6);
    color: var(--text-primary);
}

.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-5);
}

.board-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    min-height: 110px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-card);
}

.board-card:hover {
    box-shadow: var(--shadow-elevated);
    text-decoration: none;
    color: white;
}

.board-card-title {
    font-size: 16px;
    line-height: 1.4;
}

.board-card-meta {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: auto;
}

.board-card-new {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    box-shadow: none;
}

.board-card-new:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.board-card-icon {
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
}

.board-card-label {
    font-weight: 500;
}

/* ============================================
   Board View
   ============================================ */
.board-page .main-content {
    min-height: calc(100vh - var(--header-height));
    overflow: hidden;
}

.board-wrapper {
    height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    background: var(--board-color, var(--accent-color));
}

.board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background-color: rgba(0, 0, 0, 0.2);
}

.board-header-left,
.board-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.board-title {
    font-size: 18px;
    font-weight: 600;
    color: white;
    background: transparent;
    border: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    outline: none;
    width: auto;
    max-width: 400px;
    transition: all 0.15s ease;
}

.board-title:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.board-title:focus {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.btn-star,
.btn-board-menu {
    color: white;
    padding: var(--space-2);
}

.btn-star:hover,
.btn-board-menu:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-star.active svg {
    fill: #fbbf24;
    stroke: #fbbf24;
}

/* ============================================
   Board Columns
   ============================================ */
.board-columns {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    align-items: flex-start;
}

.board-column {
    flex-shrink: 0;
    width: var(--column-width);
    background-color: var(--bg-column);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--header-height) - 140px);
    box-shadow: var(--shadow-card);
}

.board-column.dragging {
    opacity: 0.5;
}

.board-column.drag-over {
    background-color: var(--bg-hover);
}

.column-header {
    display: flex;
    align-items: center;
    padding: var(--space-4) var(--space-4) var(--space-3);
    cursor: grab;
    position: relative;
}

.column-header:active {
    cursor: grabbing;
}

.column-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    border: none;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    outline: none;
    cursor: text;
    transition: all 0.15s ease;
}

.column-title:hover {
    background-color: var(--bg-hover);
}

.column-title:focus {
    background-color: var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.column-menu-btn {
    color: var(--text-muted);
    padding: var(--space-1);
}

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

.column-menu-dropdown {
    position: absolute;
    top: 100%;
    right: var(--space-3);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-elevated);
    padding: var(--space-1) 0;
    z-index: 50;
    display: none;
    min-width: 160px;
}

.column-menu-dropdown.show {
    display: block;
}

.column-menu-item {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    text-align: left;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.15s ease;
}

.column-menu-item:hover {
    background-color: var(--bg-hover);
}

.column-menu-item.delete-column {
    color: var(--danger-color);
}

.column-menu-item.delete-column:hover {
    background-color: var(--danger-bg);
}

/* ============================================
   Card List
   ============================================ */
.card-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 var(--space-3);
    min-height: 8px;
}

.card-list.drag-over {
    background-color: var(--bg-hover);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-card);
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--border-color);
}

.card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.card.drag-placeholder {
    background-color: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    box-shadow: none;
}

.card-labels {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-2);
}

.card-label {
    width: 40px;
    height: 8px;
    border-radius: var(--radius-sm);
}

.card-title {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.5;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.card-badge {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--text-muted);
    font-size: 12px;
}

.card-badge svg {
    opacity: 0.7;
}

.card-badge-due.overdue {
    color: white;
    background-color: var(--danger-color);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
}

/* Card Cover Image */
.card-cover {
    width: calc(100% + 16px);
    height: 140px;
    margin: -8px -8px 8px -8px;
    overflow: hidden;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

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

/* ============================================
   Add Card Form
   ============================================ */
.add-card-wrapper {
    padding: var(--space-3);
    padding-top: 0;
}

.btn-add-card {
    width: 100%;
    justify-content: flex-start;
    color: var(--text-muted);
    padding: var(--space-2) 0;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.btn-add-card:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.add-card-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.card-input {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-primary);
    resize: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.card-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.add-card-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.btn-cancel {
    color: var(--text-muted);
    padding: var(--space-1);
}

.btn-cancel:hover {
    color: var(--text-primary);
}

/* ============================================
   Add Column
   ============================================ */
.add-column-wrapper {
    flex-shrink: 0;
    width: var(--column-width);
}

.btn-add-column {
    width: 100%;
    justify-content: flex-start;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    font-size: 14px;
    transition: all 0.15s ease;
}

.btn-add-column:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.add-column-form {
    background-color: var(--bg-column);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
}

.column-input {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--accent-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    font-size: 14px;
    transition: all 0.2s ease;
}

.column-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.add-column-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ============================================
   Modals (matches TodoStack modal styling)
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.modal.show .modal-dialog {
    transform: translateY(0);
}

.modal-lg {
    max-width: 768px;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    flex: 1;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    font-size: 24px;
    line-height: 1;
    color: var(--text-muted);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Card Modal
   ============================================ */
#cardModal .modal-body {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: var(--space-6);
}

.card-modal-title-wrapper {
    display: flex;
    align-items: flex-start;
    flex: 1;
}

.card-modal-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    border: none;
    background: transparent;
    resize: none;
    padding: 0;
    min-height: 28px;
    overflow: hidden;
    line-height: 1.4;
}

.card-modal-title:focus {
    outline: none;
    background-color: var(--bg-secondary);
    padding: var(--space-2);
    margin: calc(-1 * var(--space-2));
    border-radius: var(--radius-sm);
}

.card-modal-main {
    min-width: 0;
}

.card-modal-section {
    margin-bottom: var(--space-6);
}

.card-modal-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

.card-modal-section-title svg {
    color: var(--text-muted);
}

.card-description {
    width: 100%;
    min-height: 120px;
    padding: 14px 16px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    transition: all 0.2s ease;
}

.card-description:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.card-description::placeholder {
    color: var(--text-faint);
}

/* Attachments Section */
.card-attachments-section {
    margin-top: var(--space-6);
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
}

.attachment-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.attachment-icon {
    width: 80px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    color: var(--text-muted);
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.attachment-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* Cover Popover */
.cover-attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.cover-no-images {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
    padding: var(--space-3) 0;
}

.cover-image-option {
    width: 80px;
    height: 60px;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.cover-image-option:hover {
    border-color: var(--accent-color);
}

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

.card-modal-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: var(--space-4);
    padding: var(--space-2) 0;
}

.sidebar-title:first-child {
    margin-top: 0;
}

.btn-sidebar {
    width: 100%;
    justify-content: flex-start;
    gap: var(--space-3);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: var(--space-3);
    font-size: 14px;
}

.btn-sidebar:hover {
    background-color: var(--bg-tertiary);
}

.btn-sidebar.btn-danger {
    background-color: var(--bg-secondary);
    color: var(--danger-color);
    border-color: var(--border-color);
}

.btn-sidebar.btn-danger:hover {
    background-color: var(--danger-bg);
    border-color: var(--danger-color);
}

/* ============================================
   Popovers
   ============================================ */
.popover {
    position: fixed;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
    width: 300px;
    z-index: 1100;
    display: none;
}

.popover.show {
    display: block;
}

.popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.popover-header h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.popover-close {
    font-size: 18px;
    color: var(--text-muted);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.popover-close:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.popover-body {
    padding: var(--space-4);
}

.popover-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

/* Labels Popover */
.labels-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.label-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}

.label-option input {
    display: none;
}

.label-color {
    flex: 1;
    height: 32px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.label-option:hover .label-color {
    transform: scale(1.02);
}

.label-option input:checked + .label-color {
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2), 0 0 0 2px var(--accent-color);
}

/* Emoji Picker */
.emoji-picker-popover {
    width: 280px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-2);
}

.emoji-option {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
    cursor: pointer;
}

.emoji-option:hover {
    background-color: var(--bg-hover);
    transform: scale(1.15);
}

/* Column Emoji Button */
.btn-column-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-column-emoji:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.column-emoji {
    font-size: 18px;
    line-height: 1;
}

.column-emoji-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
}

.btn-column-emoji:hover .column-emoji-placeholder {
    opacity: 0.8;
}

/* ============================================
   Board Menu Modal (matches TodoStack modal styling)
   ============================================ */
.board-menu-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.board-menu-modal.show {
    opacity: 1;
    visibility: visible;
}

.board-menu-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.board-menu-dialog {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
    z-index: 1;
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.board-menu-modal.show .board-menu-dialog {
    transform: translateY(0);
}

.board-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.board-menu-header h5 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.board-menu-close {
    font-size: 20px;
    color: var(--text-muted);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

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

.board-menu-content {
    padding: 20px;
    overflow-y: auto;
    max-height: 70vh;
}

.board-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-5);
    text-align: left;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.15s ease;
}

.board-menu-item:hover {
    background-color: var(--bg-hover);
}

.board-menu-item svg {
    color: var(--text-muted);
}

.board-menu-section {
    margin-bottom: 16px;
}

.board-menu-section:last-child {
    margin-bottom: 0;
}

.board-menu-section-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.board-title-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.15s ease;
}

.board-title-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.board-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.board-color-option {
    cursor: pointer;
}

.board-color-option input {
    display: none;
}

.board-color-swatch {
    display: block;
    width: 32px;
    height: 24px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

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

.board-color-option input:checked + .board-color-swatch {
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px currentColor;
}

.board-menu-item-danger {
    color: var(--danger-color);
}

.board-menu-item-danger svg {
    color: var(--danger-color);
}

.board-menu-item-danger:hover {
    background-color: var(--danger-bg);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label,
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.form-control::placeholder {
    color: var(--text-faint);
}

/* Color Picker */
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.color-option {
    cursor: pointer;
}

.color-option input {
    display: none;
}

.color-swatch {
    display: block;
    width: 48px;
    height: 32px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

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

.color-option input:checked + .color-swatch {
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-color);
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    font-size: 14px;
}

.alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-color);
}

/* Toast / Flash Messages */
.toast,
.flash-message {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    font-size: 0.875rem;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: slideUp 0.3s ease;
}

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

.toast.success,
.flash-success {
    border-color: var(--success);
    background-color: var(--success-bg);
    color: var(--success-text);
}

.toast.error,
.flash-error {
    border-color: var(--danger-color);
    background-color: var(--danger-bg);
    color: var(--danger-text);
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.flash-close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
}

/* ============================================
   Password Page (Login)
   ============================================ */
.password-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-secondary);
    padding: 20px;
}

.password-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 48px 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.password-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.password-container h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.password-section-name {
    color: var(--text-muted);
    margin: 0 0 24px 0;
    font-size: 15px;
}

.password-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

@media (prefers-color-scheme: dark) {
    .password-error {
        background: #450a0a;
        color: #fca5a5;
    }

    .password-container {
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    }
}

.password-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.password-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.password-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.password-submit {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.password-submit:hover {
    background: var(--accent-hover);
}

.password-hint {
    margin: 20px 0 0 0;
    font-size: 13px;
    color: var(--text-faint);
}

/* ============================================
   Error Page
   ============================================ */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-secondary);
}

.error-container {
    text-align: center;
    padding: var(--space-8);
}

.error-code {
    font-size: 120px;
    font-weight: 700;
    color: var(--text-faint);
    line-height: 1;
}

.error-message {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.error-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    font-size: 16px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .board-columns {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    .header-center .btn-text {
        display: none;
    }

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

    #cardModal .modal-body {
        grid-template-columns: 1fr;
    }

    .card-modal-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .card-modal-sidebar .sidebar-title {
        width: 100%;
    }

    .card-modal-sidebar .btn-sidebar {
        width: auto;
        flex: 1;
    }

    .board-menu-dialog {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .modal-dialog {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .board-column {
        width: 85vw;
        max-width: var(--column-width);
    }

    .toast,
    .flash-message {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

/* ============================================
   Utilities
   ============================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    padding: var(--space-4) var(--space-4);
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-6);
}

.footer-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.powered-by {
    font-size: 12px;
    color: var(--text-faint);
}

.powered-by a {
    color: var(--text-muted);
    text-decoration: none;
}

.powered-by a:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

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

.user-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.15s ease;
    z-index: 1000;
}

.user-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-info {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.user-menu-email {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-all;
}

.user-menu-role {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.user-menu-role.role-admin {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.user-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.user-menu-item svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.user-menu-item-danger {
    color: var(--danger-color);
}

.user-menu-item-danger svg {
    color: var(--danger-color);
}

.user-menu-item-danger:hover {
    background: var(--danger-bg);
    color: var(--danger-color);
}

/* ============================================
   Users Page
   ============================================ */
.users-page-view .main-content {
    padding: var(--space-8) var(--space-5);
    max-width: 900px;
    margin: 0 auto;
}

.users-page {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}

.users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.users-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.empty-state {
    padding: 12px 0;
    color: var(--text-muted);
}

.user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease;
}

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

.user-card-info {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.user-card-email {
    font-weight: 500;
    color: var(--text-primary);
}

.user-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 13px;
    color: var(--text-muted);
}

.user-card-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.role-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 500;
}

.role-admin {
    background: #dbeafe;
    color: #1d4ed8;
}

.role-readonly {
    background: #f3f4f6;
    color: #6b7280;
}

@media (prefers-color-scheme: dark) {
    .role-admin {
        background: #1e3a5f;
        color: #60a5fa;
    }

    .role-readonly {
        background: #374151;
        color: #9ca3af;
    }
}

.super-admin-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: #8b5cf6;
    color: white;
    border-radius: 9999px;
    font-weight: 500;
}

/* Modal Overlay Style (for users page) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay .modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    margin: 20px;
    padding: 0;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-modal);
    transform: translateY(20px);
    transition: transform 0.2s ease;
    /* Override base .modal hidden styles */
    opacity: 1;
    visibility: visible;
    inset: auto;
}

.modal-overlay.show .modal {
    transform: translateY(0);
}

.modal-overlay .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    box-sizing: border-box;
}

.modal-overlay .modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-overlay .modal-body {
    width: 100%;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.modal-overlay .modal-close {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.modal-overlay .modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-overlay .form-group {
    margin-bottom: 16px;
}

.modal-overlay .form-group:last-of-type {
    margin-bottom: 0;
}

/* Form styles for users page */
.modal-overlay .form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.modal-overlay .form-input,
.modal-overlay .form-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.modal-overlay .form-input:focus,
.modal-overlay .form-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.modal-overlay .form-help {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .user-menu-email {
        display: none;
    }

    .user-card {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .user-card-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ============================================
   Shared View Banner & Styles
   ============================================ */
.shared-view-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    background: var(--bg-active);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

.shared-view-banner svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.shared-view-login {
    color: var(--accent-color);
    text-decoration: none;
    margin-left: var(--space-3);
}

.shared-view-login:hover {
    text-decoration: underline;
}

/* Shared view: disable editing visual cues */
.board-wrapper.shared-view .board-title {
    cursor: default;
}

.board-wrapper.shared-view .column-title {
    cursor: default;
}

.board-wrapper.shared-view .card {
    cursor: pointer;
}

/* Column emoji display (non-editable in shared view) */
.column-emoji-display {
    font-size: 16px;
    margin-right: var(--space-2);
}

/* ============================================
   Share Modal Styles
   ============================================ */
.share-toggle-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.share-toggle-label {
    font-size: 15px;
    color: var(--text-primary);
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.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(--border-color);
    transition: var(--transition-fast);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

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

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

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* Share link section */
.share-link-section {
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
}

.share-link-input-group {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.share-link-input-group input {
    flex: 1;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: monospace;
}

.share-link-input-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.share-link-input-group .btn {
    white-space: nowrap;
}

#regenerateShareLink {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.share-note {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   Focus States for Accessibility - matches TodoStack
   ============================================ */
.btn:focus-visible,
.form-control:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ============================================
   Scrollbar Styling - matches TodoStack
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Search Modal
   ============================================ */

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 20px 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
}

.search-modal.show {
    opacity: 1;
    visibility: visible;
}

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.search-modal-content {
    position: relative;
    background-color: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 560px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(-10px);
    transition: transform 0.15s ease;
}

.search-modal.show .search-modal-content {
    transform: translateY(0);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.search-icon {
    flex-shrink: 0;
    color: var(--text-muted);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
}

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

.search-shortcut {
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    color: var(--text-muted);
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 100px;
}

.search-result {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.1s;
}

.search-result:hover,
.search-result.selected {
    background-color: var(--bg-tertiary);
}

.search-result-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.search-result-title mark {
    background-color: rgba(59, 130, 246, 0.2);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.search-result-preview {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.search-result-preview mark {
    background-color: rgba(59, 130, 246, 0.2);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.search-result-path {
    font-size: 12px;
    color: var(--text-muted);
}

.search-empty,
.search-loading {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.search-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.search-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.search-hint kbd {
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
}

@media (max-width: 600px) {
    .search-modal {
        padding: 5vh 12px 12px;
    }

    .search-modal-content {
        max-height: 80vh;
    }

    .search-footer {
        display: none;
    }
}

@media (prefers-color-scheme: dark) {
    .search-modal-backdrop {
        background-color: rgba(0, 0, 0, 0.7);
    }

    .search-result-title mark,
    .search-result-preview mark {
        background-color: rgba(59, 130, 246, 0.3);
    }
}

/* ============================================
   Cleanup Modal
   ============================================ */

.cleanup-summary {
    font-size: 14px;
    line-height: 1.6;
}

.cleanup-summary p {
    margin: 0 0 12px 0;
}

.cleanup-summary p:last-child {
    margin-bottom: 0;
}

.cleanup-file-list {
    max-height: 200px;
    overflow-y: auto;
    margin: 12px 0;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    list-style: none;
}

.cleanup-file-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    font-family: monospace;
}

.cleanup-file-list li:last-child {
    border-bottom: none;
}

.cleanup-stats {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}
