/* Trip Labs CRM — minimal CSS */

:root {
    --bg: #f5f5f5;
    --card: #fff;
    --border: #e0e0e0;
    --text: #1a1a1a;
    --text-muted: #888;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #ccc;
    --sidebar-active: #fff;
    --radius: 6px;
}

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

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

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg);
}
.login-card {
    background: var(--card);
    padding: 40px;
    border-radius: var(--radius);
    width: 360px;
}
.login-card h1 {
    margin-bottom: 24px;
    font-size: 24px;
    text-align: center;
}
.login-card label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
}
.login-card input {
    width: 100%;
    padding: 10px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}
.login-card button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    cursor: pointer;
}
.login-card button:hover { background: var(--primary-hover); }

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    padding: 10px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

/* Sidebar */
.sidebar {
    width: 200px;
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
}
.sidebar-logo {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    padding: 0 16px 24px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}
.sidebar-link:hover { background: rgba(255,255,255,0.08); }
.sidebar-link.active { color: var(--sidebar-active); background: rgba(255,255,255,0.12); }
.sidebar-spacer { flex: 1; }
.sidebar-user {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--sidebar-text);
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 8px;
}

/* Content */
.content {
    margin-left: 200px;
    padding: 24px;
    flex: 1;
    width: calc(100% - 200px);
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 24px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d0d0d0; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.card h2 {
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Forms */
.form-card { max-width: 800px; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: span 2; }
.form-group label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-muted);
}
.form-group input, .form-group select, .form-group textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.form-hint {
    font-size: 12px;
    color: var(--primary);
    margin-top: 4px;
}
.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.data-table th, .data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.data-table th {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    background: #fafafa;
}
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f0f4ff; }

/* Stage badges */
.stage-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.stage-audit_done { background: #dbeafe; color: #1e40af; }
.stage-negotiation { background: #fef3c7; color: #92400e; }
.stage-proposal { background: #e0e7ff; color: #3730a3; }
.stage-contract { background: #fce7f3; color: #9d174d; }
.stage-prepaid { background: #d1fae5; color: #065f46; }
.stage-in_progress { background: #cffafe; color: #155e75; }
.stage-delivered { background: #f0fdf4; color: #166534; }
.stage-paid { background: #dcfce7; color: #15803d; }
.stage-lost { background: #fee2e2; color: #991b1b; }
.stage-frozen { background: #f3f4f6; color: #4b5563; }

/* Kanban */
.kanban {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
}
.kanban-column {
    min-width: 220px;
    max-width: 260px;
    flex-shrink: 0;
    background: #eef2f7;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
}
.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
}
.stage-count {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}
.kanban-cards {
    padding: 4px 8px 8px;
    flex: 1;
    min-height: 60px;
}
.kanban-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 6px;
    cursor: grab;
    transition: box-shadow 0.15s;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.kanban-card.sortable-ghost {
    opacity: 0.4;
    background: #dbeafe;
}
.kanban-card-title {
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
    display: block;
    margin-bottom: 6px;
}
.kanban-card-title:hover { color: var(--primary); }
.kanban-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}
.kanban-card-assignee {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}
.kanban-column-closed { opacity: 0.7; }
.kanban-card-closed { opacity: 0.8; }
.kanban-closed { margin-top: 8px; }

.closed-section {
    margin-top: 24px;
}
.closed-section h2 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

/* Deal layout */
.deal-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}
.deal-sidebar .card { margin-bottom: 12px; }

/* Finance */
.finance-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

/* Events */
.comment-form {
    margin-bottom: 16px;
}
.comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 8px;
}
.events-list { display: flex; flex-direction: column; gap: 8px; }
.event {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.event:last-child { border-bottom: none; }
.event-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 4px;
}
.event-time { color: var(--text-muted); }
.event-content { font-size: 14px; }
.event-stage-change { color: var(--primary); font-style: italic; }

/* Files */
.file-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.file-form select, .file-form input[type="file"] {
    padding: 6px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.files-list { display: flex; flex-direction: column; gap: 6px; }
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
}
.file-item a { color: var(--primary); text-decoration: none; }
.file-meta { color: var(--text-muted); font-size: 12px; }

/* Search */
.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.search-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

/* Helpers */
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-link span, .sidebar-user { display: none; }
    .sidebar-logo { font-size: 16px; padding-bottom: 16px; }
    .content { margin-left: 60px; width: calc(100% - 60px); padding: 16px; }
    .deal-layout { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: span 1; }
}
