* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #fff6eb;
    color: #222;
}
.topbar {
    background: #fff6eb;
    color: #222;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid #f0dfc4;
}
.topbar .brand { font-weight: 700; font-size: 18px; color: #222; }
.topbar nav a {
    color: #6b5c47;
    text-decoration: none;
    margin-left: 22px;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
}
.topbar nav a:hover { color: #222; }
.topbar nav a.active { background: #ee8442; color: #fff; }

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

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: #e3f7e9; color: #1a7a3d; border: 1px solid #b7e6c4; }
.flash.error { background: #fdecec; color: #b3261e; border: 1px solid #f5c2c0; }

h1 { font-size: 22px; margin-bottom: 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.btn {
    display: inline-block;
    background: #ee8442;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover { background: #d96f2e; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.secondary { background: #6b7280; }
.btn.secondary:hover { background: #545a63; }
.btn.danger { background: #d9463f; }
.btn.danger:hover { background: #b83a34; }

/* To-Do list */
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo-item {
    background: #fff;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.todo-item.done { opacity: 0.6; }
.todo-item.done .todo-task { text-decoration: line-through; }
.todo-check { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; }
.todo-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ee8442;
    cursor: pointer;
}
.todo-task { font-size: 14px; }
.todo-meta { display: flex; align-items: center; gap: 8px; }
.todo-tag {
    background: #fdece0;
    color: #b85a1f;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
}
.todo-due { font-size: 12px; color: #888; }
.todo-due.overdue { color: #b3261e; font-weight: 600; }

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.filter-field label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.filter-field input {
    padding: 7px 9px;
    border: 1px solid #d5d8de;
    border-radius: 6px;
    font-size: 13px;
}

/* Pipeline overview cards */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.overview-card {
    background: #fff;
    border-radius: 8px;
    padding: 14px 16px;
    border-left: 3px solid #9aa2b5;
}
.overview-card.type-won { border-left-color: #1a7a3d; }
.overview-card.type-lost { border-left-color: #b3261e; }
.overview-label { font-size: 12px; color: #666; text-transform: uppercase; letter-spacing: .02em; margin-bottom: 6px; }
.overview-amount { font-size: 20px; font-weight: 700; }
.overview-count { font-size: 12px; color: #888; margin-top: 2px; }

/* Pipeline board */
.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    overflow-x: auto;
}
.column {
    background: #eef0f4;
    border-radius: 8px;
    padding: 12px;
    min-height: 200px;
}
.column h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #444;
    margin: 0 0 12px;
    display: flex;
    justify-content: space-between;
}
.card {
    background: #fff;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.card .title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.card .contact { font-size: 12px; color: #666; margin-bottom: 6px; }
.card .value { font-size: 13px; color: #1a7a3d; font-weight: 600; margin-bottom: 8px; }
.card .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.card form { display: inline; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
table th, table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 14px; }
table th { background: #f0f1f5; font-size: 12px; text-transform: uppercase; color: #555; }
table tr:last-child td { border-bottom: none; }

/* Forms */
.form-box { background: #fff; padding: 20px; border-radius: 8px; max-width: 560px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d5d8de;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-row textarea { resize: vertical; min-height: 70px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.unpaid { background: #fdecec; color: #b3261e; }
.badge.paid { background: #e3f7e9; color: #1a7a3d; }
.badge.cancelled { background: #eee; color: #666; }

.items-table input { padding: 6px 8px; font-size: 13px; }
.items-table td { vertical-align: middle; }

/* Invoice print view */
.invoice-box { background: #fff; padding: 32px; border-radius: 8px; max-width: 800px; margin: 0 auto; }
.invoice-head { display: flex; justify-content: space-between; margin-bottom: 24px; }
.invoice-total { text-align: right; font-size: 16px; font-weight: 700; margin-top: 12px; }
@media print {
    .topbar, .no-print { display: none !important; }
    body { background: #fff; }
    .container { padding: 0; }
}

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