/* TaskFlow CRM — Brand Theme «Руслан Ботис» */
:root {
    /* Brand palette */
    --pine:        #2D6A4F;
    --pine-light:  #3D8B6A;
    --pine-dark:   #1E4D38;
    --amber:       #E9962A;
    --amber-light: #F0AD4E;
    --navy:        #1B4F72;
    --navy-light:  #2471A3;
    --ochre:       #D95F02;
    --milk:        #F5EFE6;
    --milk-dark:   #EDE5D8;
    --coal:        #1C1C1E;
    --coal-light:  #3A3A3C;

    /* Semantic tokens */
    --bg:          #FAF7F2;
    --bg-card:     #FFFFFF;
    --bg-col:      #F5EFE6;
    --bg-input:    #FFFFFF;
    --bg-modal:    #FFFFFF;
    --border:      #DDD5C8;
    --border-light:#EAE3D6;
    --text:        #1C1C1E;
    --text-muted:  #6B6560;
    --accent:      #2D6A4F;
    --accent-hover:#3D8B6A;
    --red:         #C0392B;
    --yellow:      #E9962A;
    --green:       #2D6A4F;
    --blue:        #1B4F72;
    --orange:      #D95F02;
    --purple:      #7D3C98;

    --shadow-sm:   0 1px 3px rgba(28,28,30,.06);
    --shadow-md:   0 4px 12px rgba(28,28,30,.08);
    --shadow-lg:   0 8px 24px rgba(28,28,30,.12);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--navy);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

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

h1 {
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -.3px;
}

h1 span {
    color: var(--amber);
}

.view-toggle {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,.12);
    border-radius: 6px;
    padding: 2px;
}

.view-toggle button {
    padding: 5px 14px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,.65);
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
}

.view-toggle button.active {
    background: var(--amber);
    color: #fff;
}

.view-toggle button:hover:not(.active) {
    color: #fff;
    background: rgba(255,255,255,.08);
}

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

#search {
    padding: 7px 14px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 8px;
    background: rgba(255,255,255,.1);
    color: #fff;
    font-size: 13px;
    width: 220px;
    outline: none;
    transition: all .2s;
}

#search::placeholder {
    color: rgba(255,255,255,.5);
}

#search:focus {
    border-color: var(--amber);
    background: rgba(255,255,255,.15);
}

.stats-badge {
    font-size: 12px;
    color: rgba(255,255,255,.7);
}

/* ── Kanban ──────────────────────────────────────────────── */

.kanban-board {
    display: flex;
    gap: 10px;
    padding: 20px;
    overflow-x: auto;
    min-height: calc(100vh - 56px);
}

.kanban-col {
    flex: 0 0 230px;
    display: flex;
    flex-direction: column;
    background: var(--bg-col);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    max-height: calc(100vh - 80px);
    box-shadow: var(--shadow-sm);
}

.col-header {
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .3px;
    font-size: 11px;
}

.col-count {
    margin-left: auto;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.col-cards {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.dot.incoming   { background: var(--text-muted); }
.dot.brief      { background: var(--amber); }
.dot.assigned   { background: var(--navy); }
.dot.in-progress{ background: var(--pine); }
.dot.review     { background: var(--ochre); }
.dot.delivery   { background: var(--purple); }
.dot.closed     { background: var(--pine-dark); }

/* ── Task Card ──────────────────────────────────────────── */

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all .2s;
    font-size: 13px;
    box-shadow: var(--shadow-sm);
}

.task-card:hover {
    border-color: var(--pine-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.task-card .card-title {
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.35;
    color: var(--coal);
}

.task-card .card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.task-card .card-deadline.overdue {
    color: var(--red);
    font-weight: 700;
}

.task-card .card-deadline.today {
    color: var(--ochre);
    font-weight: 600;
}

.task-card .card-deadline.soon {
    color: var(--amber);
}

/* ── Table View ─────────────────────────────────────────── */

.table-view {
    padding: 20px;
}

.table-view table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-view th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border);
    color: var(--navy);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--bg-col);
}

.table-view td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}

.table-view tr:hover td {
    background: var(--milk);
}

.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-pill.INCOMING     { background: #E8E5E0; color: var(--text-muted); }
.status-pill.BRIEF        { background: #FDF0DB; color: #B8760C; }
.status-pill.ASSIGNED     { background: #D6EAF8; color: var(--navy); }
.status-pill.IN_PROGRESS  { background: #D5F5E3; color: var(--pine-dark); }
.status-pill.REVIEW       { background: #FDEBD0; color: var(--ochre); }
.status-pill.DELIVERY     { background: #E8DAEF; color: var(--purple); }
.status-pill.CLOSED        { background: #C8E6C9; color: #1E4D38; }

/* ── Modal ───────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(28,28,30,.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    overflow-y: auto;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 680px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-col);
    border-radius: 14px 14px 0 0;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}

.modal-close:hover {
    color: var(--coal);
    background: var(--border-light);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.modal-body .field {
    margin-bottom: 16px;
}

.modal-body .field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.modal-body .field-value {
    color: var(--text);
}

.modal-body .field-value input,
.modal-body .field-value textarea,
.modal-body .field-value select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all .2s;
}

.modal-body .field-value textarea {
    min-height: 60px;
    resize: vertical;
}

.modal-body .field-value input:focus,
.modal-body .field-value textarea:focus {
    border-color: var(--pine);
    box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn {
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
}

.btn:hover {
    border-color: var(--pine);
    background: var(--milk);
}

.btn-primary {
    background: var(--pine);
    border-color: var(--pine);
    color: #fff;
}

.btn-primary:hover {
    background: var(--pine-light);
    border-color: var(--pine-light);
}

.btn-accent {
    background: var(--amber);
    border-color: var(--amber);
    color: #fff;
}

.btn-accent:hover {
    background: var(--amber-light);
}

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

/* Status action buttons in modal */
.status-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.status-actions .btn {
    font-size: 12px;
    padding: 5px 12px;
}

/* History / comments section */
.history-section {
    margin-top: 20px;
    border-top: 2px solid var(--border-light);
    padding-top: 16px;
}

.history-section h3 {
    font-size: 12px;
    color: var(--navy);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .4px;
    font-weight: 700;
}

.history-entry {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
}

.history-entry .hist-time {
    color: var(--text-muted);
    margin-right: 8px;
}

.history-entry .hist-action {
    color: var(--pine);
    font-weight: 500;
}

/* Checkpoints section */
.checkpoints-section {
    margin-top: 16px;
}

.checkpoints-section h3 {
    font-size: 12px;
    color: var(--navy);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .4px;
    font-weight: 700;
}

.checkpoint-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
}

.checkpoint-item.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checkpoint-item input[type="checkbox"] {
    accent-color: var(--pine);
    width: 16px;
    height: 16px;
}

/* Comment input */
.comment-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.comment-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: all .2s;
}

.comment-form input:focus {
    border-color: var(--pine);
    box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}

/* ── Login page ─────────────────────────────────────────── */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-box {
    text-align: center;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

/* ── Utility ─────────────────────────────────────────────── */

.hidden { display: none !important; }

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

/* Responsive */
@media (max-width: 768px) {
    header { padding: 10px 14px; }
    .kanban-col { flex: 0 0 190px; }
    .kanban-board { padding: 12px; gap: 8px; }
    .modal { width: 95vw; }
    #search { width: 140px; }
    .modal-body { padding: 16px; }
    .modal-header { padding: 14px 16px; }
}
