/* ═══════════════════════════════════════════════════════
   HORIZONTAL KANBAN — Design System
   Inspired by nordwestlab.ru — Clean, Lab-Style
   ═══════════════════════════════════════════════════════ */

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

[hidden] {
    display: none !important;
}

:root {
    /* Colors */
    --color-bg: #FFFFFF;
    --color-bg-secondary: #F5F7FA;
    --color-bg-tertiary: #EDF0F5;
    --color-accent: #1B2A4A;
    --color-accent-light: #2D4A7A;
    --color-accent-hover: #3A5F9A;
    --color-accent-subtle: rgba(27, 42, 74, 0.06);
    --color-text: #1A1D23;
    --color-text-secondary: #64748B;
    --color-text-muted: #94A3B8;
    --color-border: #E2E8F0;
    --color-border-light: #F1F5F9;

    /* Status Colors */
    --color-approved-bg: #E8F5E9;
    --color-approved: #2E7D32;
    --color-approved-border: #A5D6A7;
    --color-rejected-bg: #FFEBEE;
    --color-rejected: #C62828;
    --color-rejected-border: #EF9A9A;
    --color-review-bg: #FFF8E1;
    --color-review: #E65100;
    --color-review-border: #FFE082;
    --color-new-bg: #E3F2FD;
    --color-new: #1565C0;
    --color-new-border: #90CAF9;

    /* Fonts */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --gap-xs: 4px;
    --gap-sm: 8px;
    --gap-md: 16px;
    --gap-lg: 24px;
    --gap-xl: 32px;

    /* Shapes */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(27, 42, 74, 0.06);
    --shadow: 0 2px 8px rgba(27, 42, 74, 0.08);
    --shadow-md: 0 4px 16px rgba(27, 42, 74, 0.10);
    --shadow-lg: 0 8px 32px rgba(27, 42, 74, 0.12);
    --shadow-card: 0 2px 8px rgba(27, 42, 74, 0.06), 0 0 0 1px rgba(27, 42, 74, 0.04);

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --header-height: 56px;
    --sidebar-width: 240px;
}

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

body {
    font-family: var(--font-family);
    background: var(--color-bg-secondary);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    overflow: hidden;
}

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    outline: none;
    text-decoration: none;
    white-space: nowrap;
}
.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.2);
}
.btn-primary {
    background: var(--color-accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--color-accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.btn-accent {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
}
.btn-accent:hover {
    background: rgba(27, 42, 74, 0.12);
}
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}
.btn-ghost:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text);
}
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1.25rem;
}
.btn-icon:hover {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
}
.btn-icon--text {
    width: auto;
    min-width: 34px;
    padding: 0 7px;
    font-size: 0.68rem;
    font-weight: 700;
}

.btn-status {
    width: 32px;
    height: 32px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-bg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all var(--transition);
    padding: 0;
}
.btn-status:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow);
}
.btn-status--approve {
    border-color: var(--color-approved-border);
    color: var(--color-approved);
}
.btn-status--approve:hover {
    background: var(--color-approved-bg);
    border-color: var(--color-approved);
}
.btn-status--reject {
    border-color: var(--color-rejected-border);
    color: var(--color-rejected);
}
.btn-status--reject:hover {
    background: var(--color-rejected-bg);
    border-color: var(--color-rejected);
}
.btn-status--review {
    border-color: var(--color-review-border);
    color: var(--color-review);
}
.btn-status--review:hover {
    background: var(--color-review-bg);
    border-color: var(--color-review);
}

/* ── Forms ── */
.form-group {
    margin-bottom: var(--gap-md);
}
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.label-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-text-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.925rem;
    color: var(--color-text);
    background: var(--color-bg);
    transition: all var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.08);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--color-text-muted);
}
.form-error {
    color: var(--color-rejected);
    font-size: 0.85rem;
    margin-bottom: var(--gap-sm);
    padding: 8px 12px;
    background: var(--color-rejected-bg);
    border-radius: var(--radius-sm);
}

/* ── Login Screen ── */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F1923 0%, #1B2A4A 40%, #2D4A7A 100%);
    position: relative;
    overflow: hidden;
}
.login-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 70%, rgba(45, 74, 122, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(27, 42, 74, 0.4) 0%, transparent 50%);
    animation: login-bg-shift 15s ease-in-out infinite alternate;
}
@keyframes login-bg-shift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-3%, -3%) rotate(2deg); }
}
.login-card {
    position: relative;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    animation: login-card-in 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes login-card-in {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
    text-align: center;
    margin-bottom: var(--gap-xl);
}
.login-logo-icon {
    margin-bottom: var(--gap-md);
    display: inline-block;
}
.login-logo h1 {
    color: var(--color-accent);
    margin-bottom: 4px;
}
.login-subtitle {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* ── App Screen ── */
.app-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ── Header ── */
.app-header {
    height: var(--header-height);
    background: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--gap-lg);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.header-left {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
}
.header-logo {
    display: flex;
    align-items: center;
}
.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.header-nav {
    display: flex;
    gap: 4px;
}
.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.nav-tab:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
}
.nav-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}
.header-right {
    display: flex;
    align-items: center;
    gap: var(--gap-md);
}
.header-user {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
}
.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
}
.user-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
}
#btn-logout {
    color: rgba(255, 255, 255, 0.7);
}
#btn-logout:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

/* ── View Container ── */
.view-container {
    flex: 1;
    overflow: hidden;
}

#view-board {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.board-tools {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: var(--gap-sm) var(--gap-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-md);
    flex-wrap: wrap;
}
.stats-row {
    display: flex;
    gap: var(--gap-sm);
    flex-wrap: wrap;
}
.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    font-size: 0.78rem;
}
.stat-chip strong {
    color: var(--color-accent);
}
.board-filters {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    flex-wrap: wrap;
}
.board-filters input,
.board-filters select {
    min-height: 34px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font: inherit;
    font-size: 0.82rem;
    background: var(--color-bg);
}
.inline-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

/* ── Board Layout ── */
.board-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: var(--gap-md) 0;
    min-height: 0;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--gap-md) var(--gap-sm);
    border-bottom: 1px solid var(--color-border-light);
    margin-bottom: var(--gap-sm);
}
.sidebar-header h2 {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.category-list {
    list-style: none;
}
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px var(--gap-md);
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    gap: var(--gap-xs);
}
.category-item:hover {
    background: var(--color-bg-secondary);
}
.category-item.active {
    background: var(--color-accent-subtle);
    border-left-color: var(--color-accent);
}
.category-item .cat-name {
    font-weight: 500;
    font-size: 0.82rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.category-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.category-item .cat-count {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: var(--color-bg-tertiary);
    padding: 2px 8px;
    border-radius: 50px;
    min-width: 22px;
    text-align: center;
}
.category-item .cat-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition);
}
.category-item:hover .cat-actions {
    opacity: 1;
}
.cat-actions .btn-icon {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
}
.category-item--all {
    font-weight: 600;
    color: var(--color-accent);
}

/* ── Swimlanes Area (now Kanban Board) ── */
.swimlanes-area {
    overflow: auto;
    padding: var(--gap-md);
    min-height: 0;
}

/* ── Kanban Columns (Trello-style) ── */
.kanban-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap-md);
    height: 100%;
    align-items: start;
}

.kanban-column {
    background: var(--color-bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--header-height) - 40px);
    animation: swimlane-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes swimlane-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--gap-sm) var(--gap-md);
    border-bottom: 2px solid var(--col-color, var(--color-border));
    background: var(--color-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    flex-shrink: 0;
}
.kanban-column-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--col-color, var(--color-accent));
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.kanban-column-header .count-badge {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg-tertiary);
    padding: 2px 7px;
    border-radius: 50px;
}

.kanban-column-body {
    padding: var(--gap-sm);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--gap-sm);
    overflow-y: auto;
    flex: 1;
    min-height: 60px;
}
.kanban-column-body--drop {
    outline: 2px dashed var(--color-accent);
    outline-offset: -4px;
    background: rgba(27, 42, 74, 0.05);
}

.kanban-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    min-height: 40px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    font-family: var(--font-family);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
    flex-shrink: 0;
}
.kanban-add-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-accent-subtle);
}

.swimlane-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gap-md);
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* ── Proposal Card ("Notepad Sheet") ── */
.card {
    background: #FFFEF5;
    border: 1px solid #E8E4D4;
    border-left: 3px solid var(--color-new-border);
    border-radius: 2px 6px 6px 2px;
    padding: 10px 12px;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.02);
    transition: all var(--transition);
    margin-left: 0;
    position: relative;
    animation: card-in 0.3s ease;
    width: auto;
    min-width: 0;
    max-width: 100%;
}
.card[draggable="true"] {
    cursor: grab;
}
.card--archived {
    filter: grayscale(0.35);
    opacity: 0.76;
}
@keyframes card-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.card:hover {
    box-shadow: 2px 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* Notepad lines effect */
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 3px;
    width: calc(100% - 6px);
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 21px,
        rgba(100, 130, 180, 0.07) 21px,
        rgba(100, 130, 180, 0.07) 22px
    );
    pointer-events: none;
}

/* Red margin line — classic notepad */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 26px;
    width: 1px;
    height: 100%;
    background: rgba(220, 80, 80, 0.18);
    pointer-events: none;
}

/* Status-based styles */
.card--new {
    border-left-color: var(--color-new-border);
    background: #FFFEF5;
}
.card--review {
    border-left-color: var(--color-review-border);
    background: #FFFBEE;
}
.card--approved {
    border-left-color: var(--color-approved);
    background: #F5FFF5;
}
.card--rejected {
    border-left-color: var(--color-rejected);
    background: #FFF5F5;
    opacity: 0.65;
}
.card--rejected:hover {
    opacity: 1;
}

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--gap-sm);
    margin-bottom: 4px;
}
.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
    line-height: 1.3;
}
.card h3.card-title {
    margin: 0 0 4px;
}
.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--cat-color) 12%, white);
    color: var(--cat-color);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
}
.card-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin: 6px 0;
}
.priority-badge,
.due-badge,
.soft-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}
.priority-badge--low { background: #E8F5E9; color: #2E7D32; }
.priority-badge--normal { background: #E3F2FD; color: #1565C0; }
.priority-badge--high { background: #FFF8E1; color: #E65100; }
.priority-badge--urgent { background: #FFEBEE; color: #C62828; }
.due-badge--overdue {
    background: #FFEBEE;
    color: #C62828;
}
.priority--urgent {
    box-shadow: 0 0 0 1px rgba(198, 40, 40, 0.15), 1px 2px 4px rgba(0,0,0,0.06);
}
.card-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 50px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}
.badge--new {
    background: var(--color-new-bg);
    color: var(--color-new);
}
.badge--review {
    background: var(--color-review-bg);
    color: var(--color-review);
}
.badge--approved {
    background: var(--color-approved-bg);
    color: var(--color-approved);
}
.badge--rejected {
    background: var(--color-rejected-bg);
    color: var(--color-rejected);
}

.card-desc {
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    line-height: 1.5;
    margin-bottom: var(--gap-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    padding-top: 4px;
    border-top: 1px dashed rgba(0,0,0,0.08);
}
.card-author {
    display: flex;
    align-items: center;
    gap: 4px;
}
.card-author-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
}

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

/* ── Poll Inside Card ── */
.card-poll {
    margin: var(--gap-sm) 0;
    padding: var(--gap-sm);
    background: rgba(0,0,0,0.02);
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.05);
}
.poll-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.poll-option {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    padding: 6px 0;
    cursor: pointer;
    transition: all var(--transition);
}
.poll-option:hover {
    color: var(--color-accent);
}
.poll-option input[type="radio"] {
    accent-color: var(--color-accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.poll-option-label {
    flex: 1;
    font-size: 0.875rem;
}
.poll-option-count {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
}
.poll-bar-wrap {
    height: 4px;
    background: var(--color-border-light);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}
.poll-bar {
    height: 100%;
    background: var(--color-accent);
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.poll-vote-btn {
    margin-top: var(--gap-sm);
}

/* ── Attachments Inside Card ── */
.card-attachments {
    margin: var(--gap-sm) 0;
    padding: var(--gap-sm);
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 4px;
    position: relative;
    z-index: 1;
}
.attachments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-sm);
    margin-bottom: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.attachment-add-btn {
    padding: 3px 6px;
    font-size: 0.68rem;
    text-transform: none;
    letter-spacing: 0;
}
.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.attachments-empty {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-style: italic;
}
.attachment-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 26px;
    align-items: center;
    gap: 4px;
}
.attachment-link {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    background: rgba(255,255,255,0.65);
    transition: all var(--transition);
}
.attachment-thumb {
    width: 34px;
    height: 26px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--color-border);
}
.attachment-link:hover {
    color: var(--color-accent);
    background: var(--color-accent-subtle);
}
.attachment-icon {
    padding: 2px 4px;
    border-radius: 3px;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    text-align: center;
}
.attachment-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.76rem;
}
.attachment-size {
    color: var(--color-text-muted);
    font-size: 0.68rem;
    white-space: nowrap;
}
.attachment-delete-btn {
    width: 26px;
    height: 26px;
    color: var(--color-text-muted);
    font-size: 1rem;
}
.attachment-delete-btn:hover {
    color: var(--color-rejected);
    background: var(--color-rejected-bg);
}

/* ── Poll Options Editor (in modal) ── */
.poll-options-editor {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}
.poll-option-row {
    display: flex;
    gap: var(--gap-sm);
    align-items: center;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-md);
}
.poll-option-row input {
    flex: 1;
}
.poll-option-row .btn-icon {
    flex-shrink: 0;
}

/* ── Admin Panel ── */
.admin-panel {
    padding: var(--gap-xl);
    max-width: 900px;
    margin: 0 auto;
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
}
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--gap-lg);
}
.admin-header h2 {
    color: var(--color-accent);
}
.admin-table-wrap {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow-x: auto;
    border: 1px solid var(--color-border-light);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th {
    text-align: left;
    padding: 14px var(--gap-lg);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
}
.admin-table td {
    padding: 12px var(--gap-lg);
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.9rem;
}
.admin-table tr:last-child td {
    border-bottom: none;
}
.admin-table tr:hover td {
    background: var(--color-bg-secondary);
}
.admin-table .role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.role-badge--admin {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
}
.role-badge--editor {
    background: var(--color-review-bg);
    color: var(--color-review);
}
.role-badge--moderator {
    background: var(--color-new-bg);
    color: var(--color-new);
}
.role-badge--user {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}
.role-badge--viewer {
    background: var(--color-border-light);
    color: var(--color-text-muted);
}
.user-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}
.admin-table .btn-icon {
    color: var(--color-text-muted);
}
.admin-table .btn-icon:hover {
    color: var(--color-accent);
    background: var(--color-accent-subtle);
}
.admin-table .btn-icon--danger {
    color: var(--color-text-muted);
}
.admin-table .btn-icon--danger:hover {
    color: var(--color-rejected);
    background: var(--color-rejected-bg);
}

/* ── Modals ── */
.modal {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 0;
    max-width: 480px;
    width: 90%;
    animation: modal-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal:has(.modal-content--wide) {
    max-width: 580px;
}
.modal-detail {
    max-width: 980px;
}
.modal-content--detail {
    max-height: min(82vh, 760px);
    overflow-y: auto;
}
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: var(--gap-lg);
}
.detail-main,
.detail-section {
    min-width: 0;
}
.detail-meta,
.detail-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--gap-sm);
    margin-bottom: var(--gap-md);
}
.detail-description {
    color: var(--color-text-secondary);
    margin-bottom: var(--gap-md);
    white-space: pre-wrap;
}
.detail-section {
    padding: var(--gap-md);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    background: var(--color-bg-secondary);
    margin-bottom: var(--gap-md);
}
.detail-section h4 {
    margin-bottom: var(--gap-sm);
    color: var(--color-accent);
}
.comments-list,
.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}
.comment-item,
.activity-item {
    padding: var(--gap-sm);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
}
.comment-item div,
.activity-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.comment-item small,
.activity-item small,
.muted {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}
.comment-item p {
    margin: 6px 0;
    color: var(--color-text-secondary);
    white-space: pre-wrap;
}
.comment-form {
    margin-top: var(--gap-md);
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}
.comment-form textarea {
    width: 100%;
    resize: vertical;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font: inherit;
}
.modal::backdrop {
    background: rgba(15, 25, 35, 0.5);
    backdrop-filter: blur(4px);
    animation: backdrop-in 0.2s ease;
}
@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal-content {
    padding: var(--gap-xl);
}
.modal-content--wide {
    min-width: 0;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--gap-lg);
}
.modal-header h3 {
    color: var(--color-accent);
}
.modal-close {
    font-size: 1.5rem;
    line-height: 1;
}
.modal-actions {
    display: flex;
    gap: var(--gap-sm);
    justify-content: flex-end;
    padding-top: var(--gap-md);
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    bottom: var(--gap-lg);
    right: var(--gap-lg);
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--gap-sm);
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-md);
    animation: toast-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    max-width: 360px;
}
.toast--success {
    background: var(--color-approved);
}
.toast--error {
    background: var(--color-rejected);
}
.toast--info {
    background: var(--color-accent);
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}
.toast-out {
    animation: toast-out 0.25s ease forwards;
}
@keyframes toast-out {
    to { opacity: 0; transform: translateX(40px) scale(0.9); }
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    max-height: 420px;
    overflow-y: auto;
}
.notification-item {
    display: grid;
    gap: 3px;
    padding: var(--gap-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
    background: var(--color-bg-secondary);
}
.notification-item strong {
    color: var(--color-accent);
}
.notification-item--error strong {
    color: var(--color-rejected);
}
.notification-item--success strong {
    color: var(--color-approved);
}
.notification-item small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* ── Utility ── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Responsive ── */

/* Tablet landscape */
@media (max-width: 1024px) {
    .kanban-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet portrait / small landscape */
@media (max-width: 768px) {
    /* Header: wrap nav below logo */
    .app-header {
        height: auto;
        min-height: var(--header-height);
        flex-wrap: wrap;
        padding: var(--gap-sm) var(--gap-md);
        gap: var(--gap-xs);
    }
    .header-left {
        order: 1;
    }
    .header-left .header-title {
        font-size: 0.95rem;
    }
    .header-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 2px;
    }
    .nav-tab {
        padding: 5px 10px;
        font-size: 0.78rem;
    }
    .header-right {
        order: 2;
        gap: var(--gap-sm);
    }
    .user-name {
        display: none;
    }
    .user-badge {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    /* Board: vertical stack */
    .app-header {
        flex-shrink: 0;
    }
    .view-container {
        min-height: 0;
    }
    .board-tools {
        align-items: stretch;
    }
    .board-filters,
    .stats-row {
        width: 100%;
    }
    .board-filters input,
    .board-filters select {
        flex: 1 1 150px;
    }
    .board-layout {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    /* Sidebar: horizontal scrollable strip */
    .sidebar {
        flex-shrink: 0;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: var(--gap-xs) 0;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .sidebar-header {
        padding: 0 var(--gap-sm);
        margin-bottom: var(--gap-xs);
    }
    .sidebar-header h2 {
        font-size: 0.65rem;
    }
    .category-list {
        display: flex;
        flex-direction: row;
        gap: 0;
        white-space: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
    }
    .category-item {
        flex-shrink: 0;
        padding: 5px var(--gap-sm);
        border-left: none;
        border-bottom: 2px solid transparent;
        font-size: 0.75rem;
    }
    .category-item.active {
        border-left-color: transparent;
        border-bottom-color: var(--color-accent);
        background: var(--color-accent-subtle);
    }
    .cat-actions {
        display: none; /* hide edit/delete on tiny strip */
    }

    /* Kanban columns: single column, compact */
    .swimlanes-area {
        flex: 1;
        min-height: 0;
        padding: var(--gap-sm);
    }
    .kanban-columns {
        grid-template-columns: 1fr;
        gap: var(--gap-sm);
        height: auto;
    }
    .kanban-column {
        max-height: 45vh;
    }
    .kanban-column-header {
        padding: 6px var(--gap-sm);
    }
    .kanban-column-title {
        font-size: 0.72rem;
    }
    .kanban-column-body {
        padding: var(--gap-xs);
        gap: var(--gap-xs);
    }

    /* Cards: even more compact */
    .card {
        padding: 8px 10px;
    }
    .card::before {
        left: 18px;
    }
    .card-title {
        font-size: 0.8rem;
    }
    .card-desc {
        font-size: 0.72rem;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }
    .card-status-badge {
        padding: 1px 5px;
        font-size: 0.55rem;
    }
    .card-meta {
        font-size: 0.65rem;
    }
    .card-author-avatar {
        width: 16px;
        height: 16px;
        font-size: 0.5rem;
    }
    .btn-status {
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
    }

    /* Admin panel */
    .admin-panel {
        padding: var(--gap-sm);
    }
    .admin-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .admin-table th,
    .admin-table td {
        padding: 8px var(--gap-sm);
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* Modals: full-width */
    .modal {
        width: 95%;
        max-width: none;
    }
    .modal:has(.modal-content--wide) {
        max-width: none;
    }
    .modal-content {
        padding: var(--gap-md);
    }
    .form-row,
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .modal-content--detail {
        max-height: 86vh;
    }

    /* Login */
    .login-card {
        padding: 32px 24px;
        margin: var(--gap-md);
        max-width: none;
    }
    .login-logo h1 {
        font-size: 1.3rem;
    }
}

/* Phone */
@media (max-width: 480px) {
    .app-header {
        padding: var(--gap-xs) var(--gap-sm);
    }
    .header-left .header-logo svg {
        width: 22px;
        height: 22px;
    }
    .header-left .header-title {
        font-size: 0.85rem;
    }
    .nav-tab span {
        display: none;
    }
    .nav-tab {
        padding: 6px 10px;
    }

    .board-layout {
        height: 100%;
    }

    .sidebar-header h2 {
        font-size: 0.6rem;
    }

    .kanban-column {
        max-height: 40vh;
    }

    .card {
        padding: 6px 8px;
    }
    .card::after {
        display: none; /* remove notepad lines on tiny screens for clarity */
    }
    .card::before {
        display: none;
    }
    .card-top {
        flex-wrap: wrap;
        gap: 2px;
    }
    .card-poll {
        padding: var(--gap-xs);
    }
    .card-attachments {
        padding: var(--gap-xs);
    }
    .attachments-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .attachment-link {
        grid-template-columns: 30px minmax(0, 1fr);
    }
    .attachment-size {
        grid-column: 2;
    }
    .poll-option-label {
        font-size: 0.7rem;
    }

    .modal-content {
        padding: var(--gap-sm) var(--gap-md);
    }
    .modal-header h3 {
        font-size: 0.95rem;
    }

    .login-card {
        padding: 24px 18px;
        border-radius: var(--radius-lg);
    }
    .login-logo-icon svg {
        width: 32px;
        height: 32px;
    }
    .login-logo h1 {
        font-size: 1.1rem;
    }
    .login-subtitle {
        font-size: 0.78rem;
    }

    .toast-container {
        right: var(--gap-sm);
        top: var(--gap-sm);
        left: var(--gap-sm);
    }
    .toast {
        font-size: 0.78rem;
        padding: 10px 14px;
    }
}
