:root {
    --primary: #f5a623;
    --primary-dark: #d68c10;
    --dark: #1f2933;
    --gray: #6b7280;
    --light-bg: #f4f6f8;
    --border: #e2e5e9;
    --white: #ffffff;
    --green: #1d9a5b;
    --red: #d94f4f;
    --blue: #2f6fed;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--light-bg);
    color: var(--dark);
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    background: var(--dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
}
.topbar .brand { font-weight: 700; font-size: 18px; color: #fff; }
.topbar .brand span { color: var(--primary); }
.topbar nav a {
    color: #d1d5db;
    margin-left: 20px;
    font-size: 14px;
}
.topbar nav a.active, .topbar nav a:hover { color: #fff; }
.topbar .user-info { font-size: 13px; color: #9ca3af; margin-left: 20px; }

.container {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 20px;
}

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-header h1 { font-size: 22px; margin: 0; }

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--gray); }
.btn-secondary:hover { background: #4b5563; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b83c3c; }
.btn-small { padding: 6px 12px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
th { background: #f9fafb; font-weight: 600; color: var(--gray); }
tr:hover td { background: #fafbfc; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--dark); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-gray { background: #e5e7eb; color: #374151; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-overdue { background: #fee2e2; color: #991b1b; font-weight: 700; }

/* Kanban board */
.kanban-scroll { overflow-x: auto; padding-bottom: 10px; }
.kanban-board { display: flex; gap: 14px; min-width: 1600px; }
.kanban-col { background: #f4f6f8; border-radius: 10px; width: 190px; flex-shrink: 0; padding: 10px; }
.kanban-col-header { font-size: 13px; font-weight: 700; color: var(--dark); margin-bottom: 10px; padding: 4px 6px; display: flex; justify-content: space-between; align-items: center; }
.kanban-col-header .count { background: #e2e5e9; color: var(--gray); border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.kanban-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; font-size: 13px; }
.kanban-card a { color: var(--dark); font-weight: 600; }
.kanban-card .kc-customer { color: var(--gray); font-size: 12px; margin: 2px 0 6px; }
.kanban-card select { width: 100%; font-size: 12px; padding: 4px; border: 1px solid var(--border); border-radius: 4px; margin-top: 6px; }
.kanban-card .kc-tasks { font-size: 11px; margin-top: 6px; color: var(--gray); }
.kanban-card .kc-tasks.due { color: var(--red); font-weight: 600; }

/* Reminders widget */
.reminder-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.reminder-item:last-child { border-bottom: none; }
.reminder-item .r-meta { color: var(--gray); font-size: 12px; }

/* Deal view */
.deal-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.deal-stage-form { display: flex; gap: 8px; align-items: center; }
.timeline-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.task-row:last-child { border-bottom: none; }
.task-row.done { opacity: 0.5; text-decoration: line-through; }
.task-row .t-due { margin-left: auto; font-size: 12px; color: var(--gray); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 10px 16px; font-size: 14px; color: var(--gray); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.nav-badge { background: var(--red); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-box { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.stat-box .stat-value { font-size: 26px; font-weight: 700; }
.stat-box .stat-label { font-size: 13px; color: var(--gray); }

.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--dark); }
.login-box { background: #fff; padding: 36px; border-radius: 12px; width: 340px; }
.login-box h1 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.login-box p.sub { text-align: center; color: var(--gray); font-size: 13px; margin-bottom: 20px; }

.actions-cell a, .actions-cell button { margin-right: 8px; }

@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .container { max-width: 100%; margin: 0; padding: 0; }
}
