:root {
    --bg-primary: #f7f3ec;
    --bg-secondary: #ede8df;
    --bg-card: #faf8f4;
    --bg-white: #ffffff;

    --text-primary: #2c2416;
    --text-secondary: #6b5d4e;
    --text-muted: #a08d7c;

    --accent-amber: #c8873a;
    --accent-amber-light: #f0d4a8;
    --accent-amber-dark: #9d6428;

    --status-todo: #6b5d4e;
    --status-todo-bg: #ede8df;
    --status-progress: #c8873a;
    --status-progress-bg: #faecd8;
    --status-done: #4e7a5f;
    --status-done-bg: #dff0e7;
    --status-hold: #a08d7c;
    --status-hold-bg: #eee8e2;

    --priority-high: #c0392b;
    --priority-high-bg: #fce8e6;
    --priority-medium: #c8873a;
    --priority-medium-bg: #faecd8;
    --priority-low: #7f8c8d;
    --priority-low-bg: #eaecec;

    --type-bug: #c0392b;
    --type-feature: #2980b9;
    --type-ux: #8e44ad;
    --type-perf: #27ae60;
    --type-other: #7f8c8d;

    --border: #d9d0c3;
    --border-strong: #b5a898;
    --shadow-sm: 0 1px 3px rgba(44, 36, 22, 0.06), 0 1px 2px rgba(44, 36, 22, 0.04);
    --shadow-md: 0 4px 12px rgba(44, 36, 22, 0.1), 0 2px 4px rgba(44, 36, 22, 0.06);
    --shadow-lg: 0 12px 40px rgba(44, 36, 22, 0.14), 0 4px 12px rgba(44, 36, 22, 0.08);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 200ms ease;
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(200, 135, 58, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(200, 135, 58, 0.04) 0%, transparent 50%);
}

/* Header */
.app-header {
    background: var(--bg-white);
    border-bottom: 1.5px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 28px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-title {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    flex: 1;
}

.app-title span {
    color: var(--accent-amber);
}

/* View Switcher */
.view-switcher {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    transition: all var(--transition);
}

.view-btn.active {
    background: var(--bg-white);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.view-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* Primary Button */
.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--accent-amber-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Main */
.app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px;
}

/* View containers */
.view-container {
    display: none;
}

.view-container.active {
    display: block;
    animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =====================
   BOARD VIEW
   ===================== */
.board-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    align-items: start;
}

.board-column {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.column-header h3 {
    font-family: 'Crimson Pro', serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.column-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px 9px;
    min-width: 26px;
    text-align: center;
}

.column-cards {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
}

/* Cards */
.improvement-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.improvement-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-amber);
    opacity: 0;
    transition: opacity var(--transition);
}

.improvement-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.improvement-card:hover::before {
    opacity: 1;
}

.card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.card-module {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* Tags/Badges */
.badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.badge-priority-high {
    background: var(--priority-high-bg);
    color: var(--priority-high);
}

.badge-priority-medium {
    background: var(--priority-medium-bg);
    color: var(--priority-medium);
}

.badge-priority-low {
    background: var(--priority-low-bg);
    color: var(--priority-low);
}

.badge-type-bug { background: #fce8e6; color: var(--type-bug); }
.badge-type-feature { background: #d6eaf8; color: var(--type-feature); }
.badge-type-ux { background: #f4e9f9; color: var(--type-ux); }
.badge-type-perf { background: #d5f5e3; color: var(--type-perf); }
.badge-type-other { background: #eaecec; color: var(--type-other); }

.badge-status-todo { background: var(--status-todo-bg); color: var(--status-todo); }
.badge-status-progress { background: var(--status-progress-bg); color: var(--status-progress); }
.badge-status-done { background: var(--status-done-bg); color: var(--status-done); }
.badge-status-hold { background: var(--status-hold-bg); color: var(--status-hold); }

.card-date {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 8px;
}

.card-actions {
    display: none;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.improvement-card:hover .card-actions {
    display: flex;
}

.card-btn {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

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

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-muted);
    font-size: 11px;
}

/* =====================
   TABLE VIEW
   ===================== */
.table-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 7px 12px;
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: border-color var(--transition);
    appearance: none;
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b5d4e' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-amber);
}

.table-container {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.data-table thead {
    background: var(--bg-secondary);
    border-bottom: 1.5px solid var(--border);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--bg-secondary);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: background var(--transition);
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: var(--bg-primary);
}

.cell-title {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    max-width: 300px;
}

.cell-module {
    font-size: 11px;
    color: var(--text-muted);
    max-width: 120px;
}

.table-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity var(--transition);
}

.data-table tbody tr:hover .table-actions {
    opacity: 1;
}

/* =====================
   MODAL
   ===================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.modal.open {
    opacity: 1;
    pointer-events: all;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(44, 36, 22, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96) translateY(10px);
    transition: transform 200ms ease;
}

.modal.open .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1.5px solid var(--border);
}

.modal-header h2 {
    font-family: 'Crimson Pro', serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

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

.modal-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.form-group label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 9px 12px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: border-color var(--transition);
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-amber);
    background: var(--bg-white);
}

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

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

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    opacity: 0;
    transform: translateY(8px);
    transition: all 250ms ease;
    z-index: 2000;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 900px) {
    .board-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .form-row {
        flex-direction: column;
    }

    .header-content {
        padding: 0 16px;
    }

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