/* Yooneek CRM — dark UI */

:root {
    --bg: #0e1116;
    --bg-2: #151a21;
    --bg-3: #1c232d;
    --border: #262f3b;
    --text: #e6ebf2;
    --muted: #8b97a7;
    --accent: #4f8cff;
    --accent-2: #7c5cff;
    --green: #34c98e;
    --red: #ef5f6b;
    --amber: #f0b53d;
    --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg-3); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 210px; flex-shrink: 0; padding: 20px 12px;
    background: var(--bg-2); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 18px; font-weight: 700; padding: 0 10px 18px; letter-spacing: .3px; }
.brand span { color: var(--accent); }
.sidebar-search { padding: 0 4px 14px; }
.sidebar-search input { width: 100%; font-size: 13.5px; padding: 7px 11px; }
.search-results { list-style: none; }
.search-results li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.search-results li:last-child { border-bottom: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.sidebar nav a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--bg-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-icon { width: 18px; text-align: center; opacity: .9; }
.logout { color: var(--muted); font-size: 13px; padding: 8px 10px; }
.main { flex: 1; padding: 26px 30px; max-width: 1500px; min-width: 0; }

/* Page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Cards */
.card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin-bottom: 12px; color: var(--text); }
.card.narrow { max-width: 460px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h2 { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.muted { color: var(--muted); font-size: 14px; }

/* Stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
    background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; color: var(--text);
}
.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat-num { font-size: 24px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Buttons */
.btn {
    display: inline-block; background: var(--bg-3); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 7px 14px; font-size: 14px; font-weight: 500; cursor: pointer;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.link-btn {
    background: none; border: none; color: var(--accent); cursor: pointer;
    font-size: 12.5px; padding: 2px 4px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }

/* Badges */
.badge {
    display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px;
    border-radius: 20px; background: var(--bg-3); color: var(--muted); vertical-align: middle;
}
.stage-new       { background: #1d3050; color: #7fb0ff; }
.stage-contacted { background: #202c46; color: #9aa8ff; }
.stage-qualified { background: #2b2450; color: #b49aff; }
.stage-proposal  { background: #3d3018; color: var(--amber); }
.stage-won       { background: #16382b; color: var(--green); }
.stage-lost      { background: #3c2126; color: var(--red); }
.status-planned     { background: #1d3050; color: #7fb0ff; }
.status-in_progress { background: #3d3018; color: var(--amber); }
.status-review      { background: #2b2450; color: #b49aff; }
.status-live        { background: #16382b; color: var(--green); }
.status-on_hold     { background: #33281c; color: #c09a6a; }
.status-done        { background: #223028; color: #7fbf9a; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--bg-3); }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.kanban-col { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); min-width: 190px; }
.kanban-head {
    padding: 10px 12px; font-size: 13px; font-weight: 700;
    border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center;
}
.kanban-head .count { color: var(--muted); font-weight: 500; font-size: 12px; }
.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 70px; }
.kanban-cards.drag-over { background: rgba(79, 140, 255, .07); border-radius: 0 0 var(--radius) var(--radius); }
.lead-card {
    background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 12px; cursor: grab;
}
.lead-card.dragging { opacity: .45; }
.lc-name { font-weight: 600; font-size: 14px; }
.lc-company { color: var(--muted); font-size: 12.5px; }
.lc-meta { display: flex; gap: 8px; margin-top: 6px; font-size: 12px; }
.lc-value { color: var(--green); font-weight: 600; }
.lc-source { color: var(--muted); }
.lc-actions { margin-top: 6px; display: flex; gap: 6px; }

.lead-view p { margin: 8px 0; font-size: 13.5px; }
.lead-view-notes { margin-top: 12px; }
.lead-view-notes pre { white-space: pre-wrap; font-family: inherit; color: var(--muted); background: var(--card); padding: 10px; border-radius: 6px; margin-top: 6px; }

/* Tasks */
.task-list { list-style: none; }
.task-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.task-list li:last-child { border-bottom: none; }
.task-list li.done span { text-decoration: line-through; color: var(--muted); }
.task-check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.task-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.task-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.task-meta.overdue { color: var(--red); font-weight: 600; }
.task-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.task-form input[type=text] { flex: 1; min-width: 180px; }

/* Activity / notes */
.activity-list, .notes-list { list-style: none; }
.activity-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.activity-list li:last-child { border-bottom: none; }
.act-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.notes-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.notes-list li:last-child { border-bottom: none; }
.note-body { font-size: 14px; }
.note-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.note-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; }
.note-form textarea { flex: 1; }

/* Progress */
.progress { height: 8px; background: var(--bg-3); border-radius: 6px; overflow: hidden; margin: 8px 0 4px; }
.progress.slim { height: 5px; margin: 4px 0 2px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; }
.progress-cell { min-width: 130px; }
.progress-cell span { font-size: 12px; color: var(--muted); }
.progress-slider { width: 100%; accent-color: var(--accent); margin: 6px 0 10px; }
.proj-desc { color: var(--muted); font-size: 14px; margin-top: 8px; }

/* Project tiles */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.project-tile { display: block; background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; color: var(--text); }
.project-tile:hover { border-color: var(--accent); text-decoration: none; }
.pt-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pt-client { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pt-meta { color: var(--muted); font-size: 12px; }
.mini-projects { list-style: none; }
.mini-projects li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.mini-projects li:last-child { border-bottom: none; }

/* Details */
.detail-list { display: grid; grid-template-columns: 90px 1fr; gap: 6px 14px; font-size: 14px; }
.detail-list dt { color: var(--muted); }
.client-notes { margin-top: 12px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); padding-top: 12px; }

/* Forms & inputs */
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number],
input[type=date], input[type=password], select, textarea {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); padding: 8px 12px; font: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; width: 100%; }
.settings-form { display: flex; flex-direction: column; gap: 10px; }

/* Notes sharing + portal access + invoices (admin side) */
.note-form-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.share-check { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.share-check input { width: 15px; height: 15px; accent-color: var(--accent); }
.badge.shared { background: #16382b; color: var(--green); }
.tiny { font-size: 11.5px; }
.portal-user { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.portal-user:last-of-type { border-bottom: none; }
.invite-form { display: flex; gap: 8px; margin-top: 12px; }
.invite-form input { flex: 1; }
.invoice-list { list-style: none; }
.invoice-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.invoice-list li:last-child { border-bottom: none; }
.invoice-list li.paid { opacity: .7; }
.invoice-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(5, 8, 12, .7);
    display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 100;
}
.modal {
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
    width: 100%; max-width: 480px; padding: 22px 24px;
    max-height: calc(100vh - 100px); overflow-y: auto;
}
.modal h2 { font-size: 17px; margin-bottom: 16px; }
.modal form { display: flex; flex-direction: column; gap: 10px; }
.modal .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal label { font-size: 12.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.modal input, .modal select, .modal textarea { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Toast */
.toast {
    position: fixed; bottom: 22px; right: 22px; z-index: 200;
    background: var(--bg-3); border: 1px solid var(--border); border-left: 3px solid var(--green);
    color: var(--text); padding: 12px 18px; border-radius: 8px; font-size: 14px;
    animation: toast-in .2s ease;
}
.toast.error { border-left-color: var(--red); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px;
    padding: 34px 36px; width: 100%; max-width: 360px;
}
.login-logo { font-size: 22px; font-weight: 700; text-align: center; }
.login-logo span { color: var(--accent); }
.login-sub { color: var(--muted); text-align: center; font-size: 13.5px; margin: 6px 0 20px; }
.login-error { background: #3c2126; color: var(--red); border-radius: 8px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card button {
    background: var(--accent); color: #fff; border: none; border-radius: 8px;
    padding: 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.login-card button:hover { filter: brightness(1.1); }

/* Responsive */
@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 12px; overflow-x: auto; }
    .brand { padding: 0 12px 0 4px; white-space: nowrap; }
    .sidebar nav { flex-direction: row; }
    .sidebar nav a { padding: 7px 10px; white-space: nowrap; }
    .logout { margin-left: auto; white-space: nowrap; }
    .main { padding: 18px 14px; }
    .grid-2 { grid-template-columns: 1fr; }
    .kanban { grid-template-columns: repeat(6, 230px); }
}
