/* Meganest CRM — brand styling */
:root {
    --red: #D81E2A;
    --red-dark: #B01622;
    --red-light: #FDECEE;
    --ink: #1c1c1e;
    --muted: #6b7280;
    --bg: #f6f7f9;
    --card: #ffffff;
    --border: #e5e7eb;
    --green: #16a34a;
    --amber: #d97706;
    --radius: 10px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* topbar */
.topbar {
    display: flex; align-items: center; gap: 24px;
    background: #fff; border-bottom: 3px solid var(--red);
    padding: 10px 22px; position: sticky; top: 0; z-index: 50;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); }
.brand img { height: 26px; }
.brand span { color: var(--red); }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a {
    padding: 8px 14px; border-radius: 8px; color: var(--ink); font-weight: 600;
}
.mainnav a:hover { background: var(--red-light); text-decoration: none; }
.mainnav a.active { background: var(--red); color: #fff; }
.userbox { display: flex; align-items: center; gap: 10px; }
.uname { font-weight: 600; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }
.footer { text-align: center; color: var(--muted); padding: 24px; font-size: 0.85rem; }

/* cards & grids */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat { text-align: left; }
.stat .num { font-size: 1.7rem; font-weight: 800; }
.stat .num.red { color: var(--red); }
.stat .num.green { color: var(--green); }
.stat .lbl { color: var(--muted); font-size: 0.85rem; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr:hover td { background: #fafafa; }

/* forms */
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 0.9rem; }
input, select, textarea {
    width: 100%; padding: 9px 11px; margin-top: 5px;
    border: 1px solid var(--border); border-radius: 8px;
    font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red-light); border-color: var(--red); }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form label { flex: 1; min-width: 140px; margin-bottom: 0; }

/* buttons */
.btn {
    display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
    font-weight: 700; font-size: 0.9rem; cursor: pointer; text-decoration: none !important;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 11px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-light); }

/* badges / stages */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 700;
}
.badge-admin { background: var(--ink); color: #fff; font-size: 0.65rem; vertical-align: middle; }
.stage-lead        { background: #e0e7ff; color: #3730a3; }
.stage-contacted   { background: #dbeafe; color: #1d4ed8; }
.stage-quoted      { background: #fef3c7; color: #b45309; }
.stage-negotiation { background: #fde8cd; color: #c2410c; }
.stage-won         { background: #dcfce7; color: #15803d; }
.stage-lost        { background: #f3f4f6; color: #6b7280; }
.due-overdue { color: var(--red); font-weight: 700; }
.due-today   { color: var(--amber); font-weight: 700; }

/* alerts */
.alert { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; }
.alert-success { background: #dcfce7; color: #15803d; }
.alert-error   { background: var(--red-light); color: var(--red-dark); }

/* auth pages */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(160deg, #fff 0%, var(--red-light) 100%);
}
.auth-card {
    background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--red);
    border-radius: 14px; padding: 34px; width: 100%; max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.auth-logo { height: 34px; margin-bottom: 14px; }

/* pipeline board */
.board { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; }
.board-col { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.board-col h3 { margin: 2px 4px 10px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.board-col .colval { font-weight: 400; color: var(--muted); display: block; font-size: 0.75rem; text-transform: none; }
.board-card {
    background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--red);
    border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; font-size: 0.85rem;
}
.board-card .cname { font-weight: 700; }
@media (max-width: 900px) { .board { grid-template-columns: repeat(2, 1fr); } }

/* activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: none; }
.feed .meta { color: var(--muted); font-size: 0.8rem; }
.feed .note { margin-top: 3px; white-space: pre-wrap; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; margin-top: 0; }
