* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #1a1a1a;
    color: #e5e5e5;
    line-height: 1.4;
    margin: 0;
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #2a2a2a;
    border-right: 1px solid #404040;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #404040;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-section {
    margin-bottom: 16px;
}

.nav-section-title {
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: #b5b5b5;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: #3a3a3a;
    color: #ffffff;
}

.nav-item-active {
    background: #3a3a3a;
    color: #ffffff;
    border-right: 3px solid #8b5cf6;
}

.nav-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.main-content {
    flex: 1;
    overflow-x: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
}

.header {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: 1px solid #404040;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 12px;
}

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

.dropdown {
    padding: 8px 12px;
    border: 1px solid #555555;
    border-radius: 6px;
    background: #3a3a3a;
    color: #e5e5e5;
    font-size: 14px;
    min-width: 120px;
}

.btn {
    padding: 8px 16px;
    border: 1px solid #555555;
    border-radius: 6px;
    background: #3a3a3a;
    color: #e5e5e5;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn:hover {
    background: #4a4a4a;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #555555;
    border-radius: 6px;
    background: #3a3a3a;
    color: #e5e5e5;
    font-size: 14px;
    min-width: 200px;
}

.stats-section {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #404040;
}

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

.stats-title {
    font-size: 14px;
    font-weight: 600;
    color: #b5b5b5;
}

.total-rows {
    font-size: 14px;
    color: #9ca3af;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.stat-card {
    background: #3a3a3a;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 70px;
    border: 1px solid #555555;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: #e5e5e5;
}

.stat-percentage {
    font-size: 16px;
    font-weight: bold;
}

.stat-percentage.success {
    color: #059669;
}

.stat-percentage.warning {
    color: #d97706;
}

.stat-percentage.error {
    color: #dc2626;
}

.stat-description {
    font-size: 12px;
    color: #9ca3af;
}

.matrix-container {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: 1px solid #404040;
}

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

.showing-info {
    font-size: 14px;
    color: #9ca3af;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #9ca3af;
}

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

.matrix-table th {
    background: #3a3a3a;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #e5e5e5;
    border-bottom: 2px solid #555555;
}

.matrix-table td {
    padding: 0;
    vertical-align: top;
    border-bottom: 1px solid #555555;
}

.cell-content {
    padding: 12px;
    min-height: 100px;
}

.test-case {
    background: #2b2b2b;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 6px;
    border-left: 3px solid #8b5cf6;
    border: 1px solid #6666666f;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.test-case:last-child {
    margin-bottom: 0;
}

.test-case:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.test-case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
}

.test-case-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.test-case-badge {
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-rq {
    background: #003877;
}

.badge-tc {
    background: #4b0e9e;
}

.test-case-id {
    color: #3b82f6;
    font-size: 12px;
    font-weight: 600;
}

.test-case-title {
    font-size: 13px;
    font-weight: 600;
    color: #e5e5e5;
    margin-bottom: 6px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    width: 100%;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: nowrap;
}

.status-row .status-badge {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
}

.status-row .suggest-controls {
    margin-left: auto;
}

.suggest-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.suggest-decision {
    display: none;
    align-items: center;
    gap: 4px;
}

.suggest-controls.active .suggest-decision {
    display: inline-flex;
}

.suggest-controls.active .suggest-btn {
    display: none;
}

.suggest-controls.suggesting .suggest-btn {
    position: relative;
    color: rgba(226, 232, 240, 0.8);
    background: rgba(79, 70, 229, 0.25);
    border-color: rgba(79, 70, 229, 0.35);
    pointer-events: none;
}

.suggest-controls.suggesting .suggest-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    border: 2px solid rgba(79, 70, 229, 0.4);
    border-top-color: rgba(79, 70, 229, 0.95);
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.status-missing {
    background: #740238;
    color: #e9d5ff;
}

.status-approved {
    background: #594500;
    color: #fed7aa;
}

.status-manual {
    background: #6b7280;
    color: #e5e7eb;
}

.suggest-btn {
    padding: 4px 10px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, #2196f3, #64b5f6);
    color: #e3f2fd;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.suggest-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.suggest-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.btn-reset {
    background: linear-gradient(135deg, #4b4b4b5c, #6b6b6b71);
    border-color: rgba(90, 90, 90, 0.5);
    color: #fff0f0;
    font-weight: 600;
}

.btn-reset:hover {
    background: linear-gradient(135deg, #f97316, #fb923c);
}

.suggest-action-btn {
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(17, 24, 39, 0.6);
    color: #f9fafb;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.suggest-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(17, 24, 39, 0.35);
}

.suggest-accept {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}

.suggest-accept:hover {
    background: rgba(34, 197, 94, 0.3);
}

.suggest-reject {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.4);
    color: #fecaca;
}

.suggest-reject:hover {
    background: rgba(248, 113, 113, 0.3);
}

.suggest-diff {
    position: relative;
}

.suggest-diff::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    border-radius: 6px;
    opacity: 0.85;
    pointer-events: none;
}

.suggest-diff-added::before {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.9), rgba(16, 185, 129, 0.8));
}

.suggest-diff-removed::before {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.9), rgba(248, 113, 113, 0.8));
}

.suggest-ghost-card {
    opacity: 0.35;
    filter: saturate(0.6) brightness(0.9);
    border: 1px dashed rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.25);
    pointer-events: none;
}

.alert-row {
    background: #740238;
    color: #e9d5ff;
}

.alert-content {
    padding: 2px 2px 2px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-text {
    font-size: 14px;
    font-weight: 600;
}

.empty-cell {
    background: #2a2a2a;
}

.design-input-cell {
    background: #383838;
}

.validation-cell {
    background: #2a2a3a;
}

.trello-board {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.board-header-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1px;
    background: #555555;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.column-header {
    background: #3a3a3a;
    padding: 12px;
    text-align: center;
}

.column-title {
    font-size: 13px;
    font-weight: 600;
    color: #e5e5e5;
    margin: 0;
}

.trello-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1px;
    background: #555555;
    min-height: 120px;
    border-bottom: 2px solid #666666;
}

.trello-row:first-child {
    border-top: 2px solid #666666;
    padding-top: 0;
}

.trello-cell {
    background: #2a2a2a;
    padding: 12px;
    min-height: 100px;
    position: relative;
}

.trello-cell.design-input {
    background: #383838;
}

.trello-cell.validation {
    background: #2a2a3a;
}

.cards-container {
    min-height: 80px;
    position: relative;
}

.trello-card {
    background: #2b2b2b;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 6px;
    border: 1px solid #6666666f;
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
}

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

.trello-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(3deg);
    z-index: 1000;
}

.drop-zone {
    min-height: 0;
    height: 0;
    border: 2px dashed transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin: 0;
    overflow: hidden;
}

.dragging-active .drop-zone {
    min-height: 50px;
    height: auto;
    margin: 4px 0;
}

.origin-cell .drop-zone {
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
}

.drop-zone.drag-over {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

.trello-cell.valid-drop-target .drop-zone {
    border-color: #6b7280;
    background: rgba(107, 114, 128, 0.08);
}

.trello-cell.valid-drop-target .drop-zone:hover {
    background: rgba(107, 114, 128, 0.12);
}

.relationship-indicator {
    position: absolute;
    top: 50%;
    right: -14px;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4f46e5;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 3px 6px rgba(31, 41, 55, 0.6);
}

.relationship-indicator.hidden {
    display: none;
}

.connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.connections-layer path {
    fill: none;
    stroke: rgba(99, 102, 241, 0.35);
    stroke-width: 2;
    stroke-linecap: round;
}

.connections-layer circle {
    fill: rgba(99, 102, 241, 0.55);
}

@media (max-width: 768px) {
    .trello-board {
        flex-direction: column;
        gap: 12px;
    }

    .trello-column {
        width: 100%;
        min-width: auto;
    }

    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .container {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .matrix-table {
        font-size: 12px;
    }
}
