﻿@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --brand: #E30613;
    --brand-hover: #c0000f;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
    --text: #111827;
    --muted: #6B7280;
    --card: #ffffff;
    --bg: #f6f7fb;
    --border: #e5e7eb;
    --sidebar-bg: #1a1d2e;
    --sidebar-text: #e5e7eb;
    --sidebar-muted: #9ca3af;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(227,6,19,0.15);
    --sidebar-border: rgba(255,255,255,0.1);
    --input-bg: #ffffff;
    --modal-bg: #ffffff;
    --backdrop: rgba(0,0,0,0.3);
}

[data-theme="dark"] {
    --brand: #F04550;
    --brand-hover: #d93540;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --card: #1e1e2e;
    --bg: #121218;
    --border: #2e2e3e;
    --sidebar-bg: #0f111a;
    --sidebar-text: #e5e7eb;
    --sidebar-muted: #9ca3af;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(240,69,80,0.15);
    --sidebar-border: rgba(255,255,255,0.1);
    --input-bg: #1e1e2e;
    --modal-bg: #1e1e2e;
    --backdrop: rgba(0,0,0,0.6);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--brand);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

.page-content {
    padding: 0 24px;
}

/* ---- Page Layout ---- */
.page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow: visible;
}

.sidebar-logo {
    display: block;
    width: 100%;
    height: auto;
}

.brand {
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.2px;
    color: var(--muted);
    text-transform: uppercase;
    text-align: center;
    width: 100%;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 0px;
    flex: 1;
}

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 9px 12px;
        border-radius: 8px;
        font-weight: 600;
        color: var(--sidebar-text);
        text-decoration: none;
        transition: background 0.15s;
    }

    .sidebar-nav svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    .sidebar-nav a:hover {
        background: var(--sidebar-hover);
        text-decoration: none;
    }

    .sidebar-nav a.active {
        background: var(--sidebar-active);
    }

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.nav-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
    padding: 8px 12px 2px;
    user-select: none;
}

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    font-weight: 600;
    color: var(--sidebar-text);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    transition: background 0.15s;
}

    .sidebar-logout svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    .sidebar-logout:hover {
        background: var(--sidebar-hover);
    }

.sidebar-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 16px 0;
}

/* Sidebar header with logo + toggle */
.sidebar-header {
    position: relative;
}

.sidebar-toggle {
    position: absolute;
    bottom: -14px;
    right: -14px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text);
    padding: 4px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    z-index: 101;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

    .sidebar-toggle svg {
        width: 14px;
        height: 14px;
    }

    .sidebar-toggle:hover {
        background: var(--bg);
    }

/* Collapsed sidebar */
.sidebar-collapsed {
    width: 60px;
    padding: 16px 8px;
    align-items: center;
}

    .sidebar-collapsed .sidebar-logo {
        width: 36px;
    }

    .sidebar-collapsed .nav-label,
    .sidebar-collapsed .nav-group-label {
        display: none;
    }

    .sidebar-collapsed .sidebar-nav a,
    .sidebar-collapsed .sidebar-logout {
        justify-content: center;
        padding: 9px;
        gap: 0;
    }

.sidebar-collapsed + .main-content {
    margin-left: 60px;
}

.main-content {
    margin-left: 220px;
    flex: 1;
    min-width: 0;
    transition: margin-left 0.2s;
}

.sidebar {
    transition: width 0.2s, padding 0.2s;
}

@media (max-width: 700px) {
    .page {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: relative;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        padding: 12px 16px;
        bottom: unset;
    }

    .sidebar-logo {
        max-width: 100px;
        margin-bottom: 0;
    }

    .brand {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-evenly;
        margin-top: 0;
        margin-left: 0;
        flex: 1;
    }

    .sidebar-nav a,
    .sidebar-logout {
        flex: 1;
        justify-content: center;
    }

    .sidebar-logout {
        margin-top: 0;
        width: auto;
    }

    .nav-label {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: none;
    }
}

.grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 14px;
}
@media (max-width: 900px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.reports-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 900px) {
    .reports-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
}

/* ---- Page toolbar (search/actions above table card) ---- */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
    margin-bottom: 12px;
}

.page-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.page-toolbar-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: block;
}

    .card h2 {
        margin: 0 0 10px 0;
        font-size: 18px;
    }

.muted {
    color: var(--muted);
    font-size: 13px;
}

.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    background: rgba(227,6,19,0.12);
    color: var(--brand);
    border: 1px solid rgba(227,6,19,0.25);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 0;
}

.btn {
    display: inline-block;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

button.btn {
    cursor: pointer;
    font-family: inherit;
}

button.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn.primary,
.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

ul.clean {
    list-style: none;
    padding: 0;
    margin: 0;
}

    ul.clean li {
        padding: 10px 0;
        border-bottom: 1px solid var(--border);
    }

        ul.clean li:last-child {
            border-bottom: none;
        }

.kv {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px 12px;
}
@media (max-width: 600px) {
    .kv {
        grid-template-columns: 1fr;
    }
}

.k {
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.v {
    font-weight: 600;
}

iframe.map {
    width: 100%;
    height: 280px;
    border: 0;
    border-radius: 12px;
}

/* ---------- Global form styling ---------- */
form p {
    margin: 0 0 12px 0;
}

label {
    display: block;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    outline: none;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

    input:focus,
    select:focus,
    textarea:focus {
        border-color: rgba(227,6,19,0.55);
        box-shadow: 0 0 0 4px rgba(227,6,19,0.12);
    }

.helptext {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.errorlist {
    list-style: none;
    margin: 0 0 10px 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(227,6,19,0.25);
    background: rgba(227,6,19,0.08);
    color: var(--text);
    font-weight: 600;
}

button {
    font: inherit;
}


.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--backdrop);
  z-index: 1000;
}

.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--modal-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  width: 500px;
  max-width: 95vw;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.modal-content {
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
}

.modal-header-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 400;
}

.close {
  background: none;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.close:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-body {
  padding: 20px 28px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.modal-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.modal-section-label:first-child {
  margin-top: 0;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 28px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-radius: 0 0 16px 16px;
  flex-shrink: 0;
}

/* ---- Modal size variants ---- */
.modal-dialog.modal-wide {
    width: 640px;
}

.modal-dialog.modal-narrow {
    width: 420px;
}

/* ---- Live contact-search ---- */
.search-group {
    position: relative;
}

/* Inline results panel — sits in normal flow so scroll containers don't clip it */
.search-results {
    margin-top: 4px;
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.07);
    overflow: hidden;
}

.search-results-list {
    padding: 4px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
    -webkit-user-select: none;
    user-select: none;
}

.search-result-item:hover {
    background: rgba(227,6,19,0.07);
}

.search-result-item:active {
    background: rgba(227,6,19,0.14);
}

.search-result-avatar {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(227,6,19,0.1);
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.search-result-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-result-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-results-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 14px;
    font-size: 13px;
    color: var(--muted);
}

/* ---- Selected-contact chip ---- */
.contact-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 6px 12px 6px 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.contact-chip-avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(227,6,19,0.1);
    color: var(--brand);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.contact-chip-remove {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 2px;
    margin-left: 2px;
    border-radius: 50%;
    line-height: 1;
    transition: color 0.1s, background 0.1s;
}

.contact-chip-remove:hover {
    color: var(--brand);
    background: rgba(227,6,19,0.08);
}

/* ---- Modal form-group spacing (ensures consistent gap between fields) ---- */
.modal-body .form-row {
    margin-bottom: 14px;
}

.modal-body .form-row:last-child {
    margin-bottom: 0;
}

/* ---- Optional field hint ---- */
.field-optional {
    font-size: 11px;
    font-weight: 400;
    color: var(--muted);
    margin-left: 4px;
}

/* ---- Address field block ---- */
.address-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---- Stacked address display ---- */
.address-lines {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.meta-row.meta-row-address {
    align-items: flex-start;
}

/* ---- Login page ---- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 24px;
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 40px 36px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.10);
    width: 100%;
    max-width: 420px;
}

.login-logo {
    display: block;
    width: 160px;
    margin: 0 auto 28px;
}

.login-title {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    margin: 0 0 4px;
    color: var(--text);
}

.login-subtitle {
    font-size: 14px;
    color: var(--muted);
    text-align: center;
    margin: 0 0 28px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.login-form input {
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input:focus {
    border-color: rgba(227,6,19,0.55);
    box-shadow: 0 0 0 4px rgba(227,6,19,0.12);
}

.login-btn {
    margin-top: 6px;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: var(--brand);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
}

.login-btn:hover {
    background: #c0000f;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(227,6,19,0.08);
    border: 1px solid rgba(227,6,19,0.2);
    color: var(--brand);
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
}

/* ---- Modal body scroll variant ---- */
.modal-body.modal-body-scroll {
    max-height: 62vh;
    overflow-y: auto;
}

/* ---- Inline modal error ---- */
.modal-error {
    color: var(--brand);
    font-size: 13px;
    padding: 0 24px 8px;
    flex-shrink: 0;
}

/* ---- Form layout ---- */
.form-row {
    margin-bottom: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Two-column form grid */
.cols-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Helper text beneath an input */
.form-hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* Dimmed, non-interactive form section */
.form-section.disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* Text divider — e.g. "— or —" */
.or-divider {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    margin: 8px 0 16px;
}

h1:focus {
  outline: none;
}

/* ---- Page header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    padding: 20px 28px 18px;
    margin: 0 -24px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--text);
    margin: 0;
}

/* ---- Icon-only button ---- */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
}

    .btn-icon:hover {
        background: var(--bg);
    }

/* ---- Danger button ---- */
.btn.danger {
    border-color: rgba(227,6,19,0.35);
    color: var(--brand);
}

/* ---- Add button with text (page-level, brand red) ---- */
.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--brand);
    border: 1px solid var(--brand);
    color: #fff;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13.5px;
    white-space: nowrap;
    letter-spacing: 0.01em;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 4px rgba(227,6,19,0.25);
}

.btn-add:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    box-shadow: 0 2px 8px rgba(227,6,19,0.3);
}

    .btn.danger:hover {
        background: rgba(227,6,19,0.08);
    }

/* ---- Sortable data table ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

    .data-table thead tr {
        border-bottom: 2px solid var(--border);
        text-align: left;
    }

    .data-table th {
        padding: 9px 14px;
        font-size: 11px;
        font-weight: 700;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        white-space: nowrap;
        background: var(--bg);
    }

    .data-table th.sortable {
        cursor: pointer;
        user-select: none;
    }

        .data-table th.sortable:hover {
            color: var(--brand);
        }

    .data-table td {
        padding: 11px 14px;
        font-size: 13.5px;
    }

    .data-table tbody tr {
        border-bottom: 1px solid var(--border);
    }

    .data-table tbody tr.clickable {
        cursor: pointer;
    }

       .data-table tbody tr.clickable:hover {
           background: var(--bg);
       }

    .data-table .col-actions {
        text-align: right;
        white-space: nowrap;
    }

    .data-table .col-actions-inner {
        display: flex;
        gap: 4px;
        justify-content: flex-end;
    }

    .data-table .col-truncate {
        max-width: 400px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .data-table .col-nowrap {
        white-space: nowrap;
    }

    .data-table .col-bold {
        font-weight: 700;
    }

    .data-table tbody tr.clickable:hover .col-bold {
       /* color: var(--brand);*/
        text-decoration: underline;
    }

/* ---- Soft table variant (for detail-card pages) ---- */
.data-table-soft {
    table-layout: fixed;
}

.data-table-soft thead tr {
    border-bottom: 0.5px solid var(--border);
}

.data-table-soft th {
}

.data-table-soft tbody tr {
    border-bottom: 0.5px solid var(--border);
}

.data-table-soft tbody tr:last-child {
    border-bottom: none;
}

/* ---- Card toolbar & filters ---- */
.card-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.card-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.card-toolbar-count {
    font-size: 0.78rem;
    white-space: nowrap;
}

.btn-icon.active {
    background: var(--bg);
    border-color: var(--muted);
}

.btn-icon {
    position: relative;
}

.filter-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand);
}

.filter-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

    .filter-chip button {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0 2px;
        font-size: 0.8rem;
        color: var(--muted);
        line-height: 1;
    }

        .filter-chip button:hover {
            color: var(--brand);
        }

.filter-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-item-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.filter-input {
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.78rem;
    background: #fff;
    color: var(--text);
    height: 28px;
    box-sizing: border-box;
    width: auto;
}

.filter-search {
    min-width: 180px;
    height: 36px;
}

.filter-clear-btn {
    padding: 3px 10px;
    font-size: 0.75rem;
    height: 28px;
    line-height: 1;
}

/* ---- Toggle switch ---- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

    .toggle-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: background 0.2s;
}

    .toggle-slider::before {
        content: "";
        position: absolute;
        width: 18px;
        height: 18px;
        left: 3px;
        bottom: 3px;
        background: #fff;
        border-radius: 50%;
        transition: transform 0.2s;
    }

.toggle-switch input:checked + .toggle-slider {
    background: var(--brand);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ---- File chip with remove button ---- */
.chip-file {
    display: inline-flex;
    align-items: center;
    background: var(--bg);
    border: 0.5px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.chip-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--muted);
    background: none;
    border: none;
    padding: 4px 6px 4px 9px;
    cursor: pointer;
}

.chip-download-btn:hover {
    color: var(--text);
}

.chip-remove-btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    border-left: 0.5px solid var(--border);
    padding: 4px 6px;
    cursor: pointer;
    color: var(--muted);
}

.chip-remove-btn:hover {
    background: #fdf0ef;
    color: #c0392b;
}

/* ---- Undo toast ---- */
.undo-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1e1e2e;
    color: #e5e7eb;
    font-size: 13px;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 500;
    white-space: nowrap;
}

.undo-toast-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 5px;
    cursor: pointer;
}

.undo-toast-btn:hover {
    background: rgba(255,255,255,0.1);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.breadcrumb-link {
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.breadcrumb-link:hover {
    color: var(--text);
    text-decoration: none;
}

.breadcrumb-sep {
    color: var(--border);
    user-select: none;
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 600;
}

/* ---- Detail page layout ---- */
.detail-wrap {
    padding: 1.25rem 0;
}

.detail-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.detail-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.detail-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
    letter-spacing: -0.3px;
}

.detail-desc {
    font-size: 15px;
    color: var(--muted);
    margin: 0;
    line-height: 1.6;
}

.detail-divider {
    border: none;
    border-top: 0.5px solid var(--border);
    margin: 1rem 0;
}

.detail-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin: 0;
}

.detail-section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.5rem -1.25rem 10px;
    padding: 10px 1.25rem 0;
    border-top: 1px solid var(--border);
}

/* ---- Contact / person row ---- */
.contact-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-row-link {
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    padding: 4px 6px;
    margin: -4px -6px;
    transition: background 0.15s ease;
}

.contact-row-link:hover {
    background: rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

.contact-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.contact-avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 18px;
}

.contact-avatar[data-color="0"] { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.contact-avatar[data-color="1"] { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.contact-avatar[data-color="2"] { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.contact-avatar[data-color="3"] { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.contact-avatar[data-color="4"] { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.contact-avatar[data-color="5"] { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }
.contact-avatar[data-color="6"] { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); color: #555; }
.contact-avatar[data-color="7"] { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); color: #555; }
.contact-avatar[data-color="8"] { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); color: #555; }
.contact-avatar[data-color="9"] { background: linear-gradient(135deg, #ff6e7f 0%, #bfe9ff 100%); }

.contact-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.contact-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

/* ---- Customer + Installation Address side-by-side ---- */
.project-info-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.project-info-col-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 10px 0;
}

@media (max-width: 600px) {
    .project-info-columns {
        grid-template-columns: 1fr;
    }
}

/* ---- Meta info ---- */
.meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

.meta-row i {
    font-size: 15px;
}

.meta-info-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

/* ---- Item cards (designs, etc.) ---- */
.item-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.item-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.item-card-link:hover {
    background: rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

.item-card-clickable {
    cursor: pointer;
}

.item-card-clickable:hover {
    background: var(--bg);
    border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
}

.item-card-selected {
    border: 2px solid #7F77DD;
}

/* ---- Status Badges ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.status-badge-lead,
.status-badge-draft {
    background: #F1EFE8;
    color: #444441;
}

.status-badge-surveybooked {
    background: #EEF3FD;
    color: #2C4F8A;
}

.status-badge-proposal {
    background: #FAEEDA;
    color: #633806;
}

.status-badge-accepted {
    background: #EAF3DE;
    color: #27500A;
}

.status-badge-inproduction {
    background: #E8F0FD;
    color: #1A4585;
}

.status-badge-awaitinginstallation {
    background: #F0EAFD;
    color: #4A1A85;
}

.status-badge-completed {
    background: #D6EFE0;
    color: #145C38;
}

.status-badge-rejected {
    background: #FDE8E8;
    color: #7C0C0C;
}

.status-badge-stale {
    background: #FEF3C7;
    color: #92400E;
}

.details-menu-group-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 4px 12px 2px;
}

.selected-ribbon {
    position: absolute;
    top: -1px;
    right: 14px;
    background: #EEEDFE;
    color: #3C3489;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px 4px;
    border-radius: 0 0 8px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.item-card-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 4px;
}

.item-card-desc {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}

.item-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.item-card-buttons {
    display: flex;
    gap: 4px;
}

.item-card-cost {
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

/* ---- Roofwright panel (inside design cards) ---- */
.item-card-body {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.rw-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
    width: 130px;
    border-right: 1px solid var(--border);
    padding-right: 16px;
    margin-right: 16px;
}

.rw-panel-content {
    flex: 1;
    min-width: 0;
}

.rw-thumbnail {
    width: 88px;
    height: 68px;
    border-radius: 8px;
    background: var(--bg);
    border: 0.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.rw-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.rw-action-link {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    line-height: 1.35;
    padding: 5px 8px;
    border-radius: 6px;
    background: #EEEDFE;
    color: #3C3489;
    text-decoration: none;
    display: block;
    transition: background 0.15s;
}

.rw-action-link:hover {
    background: #dddcfc;
    color: #3C3489;
    text-decoration: none;
}

.rw-action-link[type="button"], button.rw-action-link {
    border: none;
    cursor: pointer;
    width: 100%;
}

.rw-app-picker {
    position: relative;
    width: 100%;
}

.rw-app-picker-dropdown {
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 140px;
}

/* ---- File chips ---- */
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--muted);
    background: var(--bg);
    border: 0.5px solid var(--border);
    border-radius: 6px;
    padding: 4px 9px;
}

.chip i {
    font-size: 14px;
}

.chip-btn {
    cursor: pointer;
    border: 0.5px solid var(--border);
    background: var(--bg);
}

/* ---- Details / dropdown menu ---- */
.details-menu {
    position: relative;
    flex-shrink: 0;
}

.details-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 199;
}

.details-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}

.details-menu-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.details-menu-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 170px;
    z-index: 200;
    padding: 4px;
}

.details-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    text-align: left;
    white-space: nowrap;
}

.details-menu-item:hover {
    background: var(--bg);
}

.details-menu-item.danger {
    color: #c0392b;
}

.details-menu-item.danger:hover {
    background: #fdf0ef;
}

.details-menu-separator {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

/* ---- Dashboard ---- */
.dash-stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 1rem;
}

.dash-stat-card {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    transition: box-shadow 0.15s, transform 0.15s;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

a.dash-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border);
}

a.dash-stat-card.dash-stat-primary::before { background: #3498db; }
a.dash-stat-card.dash-stat-success::before { background: #2ecc71; }
a.dash-stat-card.dash-stat-warning::before { background: #f39c12; }
a.dash-stat-card.dash-stat-danger::before  { background: #e74c3c; }

a.dash-stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
}

.dash-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.dash-stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin-top: 2px;
}

.dash-stat-primary .dash-stat-value { color: #2980b9; }
.dash-stat-success .dash-stat-value { color: #27ae60; }
.dash-stat-warning .dash-stat-value { color: #e67e22; }
.dash-stat-danger  .dash-stat-value  { color: #c0392b; }

/* Stat card icon wrapper */
.dash-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-stat-primary .dash-stat-icon { background: rgba(52,152,219,0.12); color: #2980b9; }
.dash-stat-success .dash-stat-icon { background: rgba(46,204,113,0.12); color: #27ae60; }
.dash-stat-warning .dash-stat-icon { background: rgba(243,156,18,0.12); color: #e67e22; }
.dash-stat-danger  .dash-stat-icon { background: rgba(231,76,60,0.12);  color: #c0392b; }

.dash-stat-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* Legacy dash-grid kept for compatibility */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ── Dashboard sections container ── */
.dash-panels {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Projects + Contacts side-by-side, equal height ── */
.dash-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: stretch;   /* both columns share the same height */
}

/* Each panel card — flex column, fixed height sized for 8 rows */
.dash-panel-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 460px;
    overflow: hidden;
}

/* Top-row (Projects + Contacts): auto-height, body sized for exactly 8 rows, no scroll */
.dash-top-row .dash-panel-card {
    height: auto;
}

.dash-top-row .dash-panel-body {
    overflow: hidden;
    height: 448px;  /* 8 × ~56px contact rows */
}

/* Tasks panel is full-width below the top row */
.dash-panel-tasks {
    height: 380px;    /* header ~44px + tabs ~37px + ~5 task rows ~60px each */
}

/* Panel header — flush to top of card, no extra margin */
.dash-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.dash-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Scrollable body — fills remaining height */
.dash-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    min-height: 0;
}

/* Scrollbar styling */
.dash-panel-body::-webkit-scrollbar {
    width: 4px;
}
.dash-panel-body::-webkit-scrollbar-track {
    background: transparent;
}
.dash-panel-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* Panel task footer tabs sit at the bottom, never scroll away */
.dash-panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.dash-panel-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    letter-spacing: 0.01em;
}

.dash-panel-tab:hover { color: var(--text); }

.dash-panel-tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.dash-panel-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: var(--bg);
    color: var(--muted);
}

.dash-panel-tab.active .dash-panel-tab-badge {
    background: rgba(227,6,19,0.1);
    color: var(--brand);
}

/* Compact list items inside panels */
.dash-panel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    min-width: 0;
}

.dash-panel-item:last-child {
    border-bottom: none;
}

.dash-panel-item:hover {
    background: var(--bg);
}

.dash-panel-item-body {
    flex: 1;
    min-width: 0;
}

.dash-panel-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-panel-item-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-panel-item-side {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

/* Task row middle column: project name centred between body and right group */
.dash-task-project {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 2px;
}

/* Task row right group: priority badge + done button */
.dash-task-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Task check button inside panel */
.dash-task-done-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: none;
    cursor: pointer;
    color: var(--muted);
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.dash-task-done-btn:hover {
    border-color: #27ae60;
    background: rgba(39,174,96,0.08);
    color: #27ae60;
}

/* Panel empty state (compact) */
.dash-panel-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: var(--muted);
    text-align: center;
    padding: 20px;
}

.dash-panel-empty svg {
    opacity: 0.3;
}

.dash-panel-empty-text {
    font-size: 13px;
    font-weight: 500;
}

@media (max-width: 800px) {
    .dash-stats-row {
        flex-wrap: wrap;
    }
    .dash-stat-card {
        min-width: calc(50% - 6px);
    }
    .dash-grid {
        grid-template-columns: 1fr;
    }
    .dash-top-row {
        grid-template-columns: 1fr;
    }
    .dash-panel-card {
        height: 360px;
    }
    .dash-panel-tasks {
        height: 300px;
    }
}

.dash-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    margin: 0 -10px;
    border-bottom: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
}

.dash-list-item:last-of-type {
    border-bottom: none;
}

.dash-list-item:hover {
    background: var(--bg);
}

.dash-project-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 1px;
}

.dash-card-heading {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.1px;
}

.dash-view-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.dash-view-all:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    text-decoration: none;
}

.dash-pill {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.dash-pill-danger {
    background: rgba(227,6,19,0.1);
    color: #c0392b;
    border: 1px solid rgba(227,6,19,0.25);
}

.dash-pill-warning {
    background: rgba(255,165,0,0.1);
    color: #b8860b;
    border: 1px solid rgba(255,165,0,0.3);
}

.dash-pill-success {
    background: rgba(39,128,10,0.1);
    color: #27500a;
    border: 1px solid rgba(39,128,10,0.25);
}

.detail-section-link {
    text-decoration: none;
    color: inherit;
}

.detail-section-link:hover {
    text-decoration: none;
}

.detail-section-link:hover .detail-section-label {
    color: var(--text);
}

/* ---- Task section pills ---- */
.task-section-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1.5px solid transparent;
}

.task-section-pill-danger {
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
    border-color: rgba(220, 38, 38, 0.25);
}

.task-section-pill-warning {
    background: rgba(217, 119, 6, 0.08);
    color: #b45309;
    border-color: rgba(217, 119, 6, 0.25);
}

.task-section-pill-success {
    background: rgba(22, 101, 52, 0.08);
    color: #15803d;
    border-color: rgba(22, 101, 52, 0.2);
}

.task-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.task-count-badge-danger {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.task-count-badge-warning {
    background: rgba(217, 119, 6, 0.12);
    color: #b45309;
}

.task-count-badge-success {
    background: rgba(22, 101, 52, 0.1);
    color: #166534;
}

/* ---- Task section heading (sits above card) ---- */
.task-section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

/* ---- Priority badges ---- */
.task-priority-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}
.task-priority-high   { background: rgba(239,68,68,0.12);  color: #dc2626; }
.task-priority-medium { background: rgba(234,179,8,0.14);  color: #b45309; }
.task-priority-low    { background: rgba(34,197,94,0.12);  color: #15803d; }

[data-theme="dark"] .task-priority-high   { background: rgba(239,68,68,0.2);   color: #f87171; }
[data-theme="dark"] .task-priority-medium { background: rgba(234,179,8,0.18);  color: #fbbf24; }
[data-theme="dark"] .task-priority-low    { background: rgba(34,197,94,0.18);  color: #4ade80; }

/* ---- Task status badges ---- */
.task-status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}
.task-status-overdue  { background: rgba(239,68,68,0.12);  color: #dc2626; }
.task-status-today    { background: rgba(234,179,8,0.14);  color: #b45309; }
.task-status-upcoming { background: rgba(34,197,94,0.12);  color: #15803d; }
.task-status-done     { background: rgba(107,114,128,0.12); color: #6b7280; }

[data-theme="dark"] .task-status-overdue  { background: rgba(239,68,68,0.2);   color: #f87171; }
[data-theme="dark"] .task-status-today    { background: rgba(234,179,8,0.18);  color: #fbbf24; }
[data-theme="dark"] .task-status-upcoming { background: rgba(34,197,94,0.18);  color: #4ade80; }
[data-theme="dark"] .task-status-done     { background: rgba(107,114,128,0.18); color: #9ca3af; }

/* ---- Completed tasks section ---- */
.task-completed-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 6px 2px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
}
.task-completed-toggle:hover { color: var(--text); }

.task-completed-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.task-completed-chevron.chevron-open { transform: rotate(180deg); }

.task-done-row { opacity: 0.65; }
.task-done-text { text-decoration: line-through; }

/* ---- Flush card: full-width table dividers ---- */
.detail-card-flush {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.detail-card-flush .data-table {
    margin-top: 0;
}

.detail-card-flush .data-table th,
.detail-card-flush .data-table td {
    padding: 10px 16px;
}

.detail-card-flush .data-table tbody tr:last-child {
    border-bottom: none;
}

/* ---- Page-level table card: full-width count divider + thead divider ---- */
.page-table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.page-table-card-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.page-table-card .data-table {
    margin-top: 0;
}

.page-table-card .data-table th,
.page-table-card .data-table td {
    padding: 10px 14px;
}

.page-table-card .data-table thead tr {
    border-bottom: 2px solid var(--border);
}

.page-table-card .data-table tbody tr:last-child {
    border-bottom: none;
}

/* ---- Team contacts section ---- */
.team-contacts-card {
    border-top: 3px solid var(--brand);
}

.team-contacts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
}

.team-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    min-width: 200px;
    flex: 1 1 200px;
    max-width: 300px;
    transition: background 0.15s;
    position: relative;
}

    .team-contact-item:hover {
        background: var(--card);
    }

.team-contact-info {
    flex: 1;
    min-width: 0;
}

.team-contact-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-contact-email {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Dashboard task tabs ---- */
.dash-tab-bar {
    display: flex;
    margin: -10px -1.25rem 4px;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border);
}

.dash-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dash-tab:hover {
    color: var(--text);
}

.dash-tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.dash-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--bg);
    color: var(--muted);
}

.dash-tab.active .dash-tab-badge {
    background: rgba(227,6,19,0.1);
    color: var(--brand);
}

/* ── Reports chart placeholder / loading skeleton ── */
@keyframes chart-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.chart-placeholder {
    height: 280px;
    border-radius: 8px;
    background: linear-gradient(
        90deg,
        var(--border) 25%,
        var(--bg)     50%,
        var(--border) 75%
    );
    background-size: 1200px 100%;
    animation: chart-shimmer 1.4s ease-in-out infinite;
}

/* ── Reports drag-and-drop ── */
.chart-card {
    position: relative;
    cursor: default;
    transition: box-shadow 0.15s, opacity 0.15s, transform 0.15s;
    user-select: none;
}

.chart-drag-handle {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--muted);
    cursor: grab;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 0;
}

.chart-card:hover .chart-drag-handle {
    opacity: 1;
}

.chart-card.dragging {
    opacity: 0.4;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    transform: scale(0.98);
}

.chart-card.drag-over {
    box-shadow: 0 0 0 2px var(--brand), 0 4px 16px rgba(227,6,19,0.12);
}

/* ── Calendar page ── */
.cal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 16px;
}

.cal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    min-width: 160px;
    text-align: center;
}

.cal-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0.5px solid var(--border);
    background: var(--card);
    border-radius: 7px;
    cursor: pointer;
    color: var(--muted);
    transition: background 0.15s, color 0.15s;
}

.cal-nav-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.cal-today-btn {
    padding: 5px 14px;
    border: 0.5px solid var(--border);
    background: var(--card);
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}

.cal-today-btn:hover {
    background: var(--bg);
}

.cal-toggles {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.cal-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 0.5px solid var(--border);
    background: var(--card);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    opacity: 0.6;
}

.cal-toggle-btn:hover {
    background: var(--bg);
    color: var(--text);
    opacity: 0.85;
}

.cal-toggle-btn.active {
    background: rgba(51, 65, 85, 0.08);
    border-color: rgba(51, 65, 85, 0.3);
    color: #334155;
    opacity: 1;
}

.cal-toggle-btn.active.notes {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    color: #4338ca;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--border);
    gap: 1px;
    box-shadow: var(--shadow-sm);
}

.cal-day-name {
    background: var(--card);
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    padding: 8px 0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cal-cell {
    background: var(--card);
    min-height: 110px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    transition: background 0.12s;
}

.cal-cell:hover {
    background: var(--bg);
}

.cal-cell.is-selected {
    background: rgba(227, 6, 19, 0.04);
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.cal-cell.other-month {
    background: var(--bg);
}

.cal-cell.other-month .cal-day-num {
    color: var(--border);
}

.cal-cell.is-today .cal-day-num {
    background: var(--brand);
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-day-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    flex-shrink: 0;
}

.cal-task-chip {
    display: block;
    width: 100%;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border: none;
    text-align: left;
    line-height: 1.6;
    transition: opacity 0.12s;
}

.cal-task-chip:hover {
    opacity: 0.8;
}

.cal-task-chip.chip-overdue {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

.cal-task-chip.chip-today {
    background: rgba(217, 119, 6, 0.1);
    color: #b45309;
}

.cal-task-chip.chip-upcoming {
    background: rgba(22, 101, 52, 0.08);
    color: #166534;
}

.cal-overflow {
    font-size: 10px;
    color: var(--muted);
    padding: 1px 4px;
    cursor: default;
}

/* ── Calendar day schedule panel ── */
.cal-schedule-panel {
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.cal-schedule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.cal-schedule-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.cal-schedule-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--muted);
    transition: background 0.12s, color 0.12s;
}

.cal-schedule-close:hover {
    background: var(--border);
    color: var(--text);
}

.cal-schedule-body {
    display: flex;
    flex-direction: column;
    max-height: 384px; /* 8 rows × 48px */
    overflow-y: auto;
}

.cal-hour-row {
    display: flex;
    align-items: flex-start;
    min-height: 48px;
    border-bottom: 1px solid var(--border);
}

.cal-hour-row:last-child {
    border-bottom: none;
}

.cal-hour-label {
    width: 64px;
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-align: right;
    border-right: 1px solid var(--border);
    line-height: 1.4;
}

.cal-hour-tasks {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    align-items: flex-start;
}

.cal-hour-empty {
    flex: 1;
    min-height: 48px;
}

.cal-schedule-task-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-align: left;
    line-height: 1.4;
    transition: opacity 0.12s;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-schedule-task-btn:hover {
    opacity: 0.8;
}

.cal-schedule-task-btn.chip-overdue {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

.cal-schedule-task-btn.chip-today {
    background: rgba(217, 119, 6, 0.1);
    color: #b45309;
}

.cal-schedule-task-btn.chip-upcoming {
    background: rgba(22, 101, 52, 0.08);
    color: #166534;
}

.cal-schedule-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ── Notes & Timeline ───────────────────────────────────────────────── */

.note-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-date-row input[type="datetime-local"] {
    flex: 1;
}

.chip-note {
    background: rgba(99, 102, 241, 0.1) !important;
    color: #4338ca !important;
    border-color: rgba(99, 102, 241, 0.2) !important;
}

.cal-schedule-task-btn.chip-note {
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
}

.cal-owner-avatar {
    width: 16px !important;
    height: 16px !important;
    font-size: 8px !important;
    font-weight: 700;
    vertical-align: middle;
    flex-shrink: 0;
    letter-spacing: 0;
    margin-right: 3px;
}

.cal-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.cal-task-chip.has-owner {
    display: flex;
    align-items: center;
}

/* Timeline */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px 16px;
    position: relative;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 26px;
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: var(--border, #e5e7eb);
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    position: relative;
}

.timeline-item-link {
    cursor: pointer;
    border-radius: 6px;
    padding: 10px 6px;
    margin: 0 -6px;
}

.timeline-item-link:hover .timeline-title {
    text-decoration: underline;
}

.timeline-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
    z-index: 1;
    border: 2px solid var(--border, #e5e7eb);
    background: var(--card-bg, #fff);
}

.timeline-marker-note {
    background: #6366f1;
    border-color: #6366f1;
}

.timeline-marker-task {
    background: #f59e0b;
    border-color: #f59e0b;
}

.timeline-marker-project {
    background: #10b981;
    border-color: #10b981;
}

.timeline-marker-created {
    background: #6b7280;
    border-color: #6b7280;
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.timeline-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.timeline-badge-note {
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
}

.timeline-badge-task {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
}

.timeline-badge-project {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
}

.timeline-badge-created {
    background: rgba(107, 114, 128, 0.1);
    color: #374151;
}

/* Project activity events — blue */
.timeline-marker-statuschanged,
.timeline-marker-contactchanged {
    background: #3b82f6;
    border-color: #3b82f6;
}

.timeline-badge-statuschanged,
.timeline-badge-contactchanged {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

/* Design events — violet */
.timeline-marker-designadded,
.timeline-marker-designstatuschanged {
    background: #7c3aed;
    border-color: #7c3aed;
}

.timeline-badge-designadded,
.timeline-badge-designstatuschanged {
    background: rgba(124, 58, 237, 0.1);
    color: #5b21b6;
}

/* Design removed — rose */
.timeline-marker-designremoved {
    background: #f43f5e;
    border-color: #f43f5e;
}

.timeline-badge-designremoved {
    background: rgba(244, 63, 94, 0.1);
    color: #9f1239;
}

/* Contact / company association events — teal */
.timeline-marker-contactassociated,
.timeline-marker-contactdissociated,
.timeline-marker-primarycontactchanged {
    background: #14b8a6;
    border-color: #14b8a6;
}

.timeline-badge-contactassociated,
.timeline-badge-contactdissociated,
.timeline-badge-primarycontactchanged {
    background: rgba(20, 184, 166, 0.1);
    color: #0f766e;
}

/* Task lifecycle events — amber (same family as task) */
.timeline-marker-taskcreated,
.timeline-marker-taskstatuschanged,
.timeline-marker-taskassigned {
    background: #f59e0b;
    border-color: #f59e0b;
}

.timeline-badge-taskcreated,
.timeline-badge-taskstatuschanged,
.timeline-badge-taskassigned {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
}

/* Task completed — emerald green */
.timeline-marker-taskcompleted {
    background: #22c55e;
    border-color: #22c55e;
}

.timeline-badge-taskcompleted {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

/* Task reopened — orange */
.timeline-marker-taskreopened {
    background: #f97316;
    border-color: #f97316;
}

.timeline-badge-taskreopened {
    background: rgba(249, 115, 22, 0.1);
    color: #c2410c;
}

/* Visibility changed — violet */
.timeline-marker-visibilitychanged {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.timeline-badge-visibilitychanged {
    background: rgba(139, 92, 246, 0.1);
    color: #6d28d9;
}

/* Quote events — sky blue */
.timeline-marker-quotestatuschanged,
.timeline-marker-quotevalueupdated {
    background: #0ea5e9;
    border-color: #0ea5e9;
}

.timeline-badge-quotestatuschanged,
.timeline-badge-quotevalueupdated {
    background: rgba(14, 165, 233, 0.1);
    color: #0369a1;
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--muted, #6b7280);
}

.timeline-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    color: var(--text, #111827);
}

.timeline-desc {
    font-size: 0.8rem;
    color: var(--muted, #6b7280);
    margin: 2px 0 0;
    line-height: 1.4;
}

/* ---- Global Search (Dashboard) ---- */
.global-search-wrapper {
    position: relative;
    margin-left: auto;
}

.global-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
    min-width: 280px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.global-search-box:focus-within {
    border-color: rgba(227,6,19,0.55);
    box-shadow: 0 0 0 3px rgba(227,6,19,0.08);
}

.global-search-icon {
    flex-shrink: 0;
    color: var(--muted);
}

.global-search-input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    outline: none !important;
    font: inherit;
    color: var(--text);
    width: 100%;
    min-width: 0;
    border-radius: 0 !important;
}

.global-search-input::placeholder {
    color: var(--muted);
}

.global-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--muted);
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.global-search-clear:hover {
    color: var(--text);
    background: var(--bg);
}

.global-search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 380px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1000;
    padding: 6px;
}

.global-search-empty {
    padding: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.global-search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.global-search-result-item:hover {
    background: var(--bg);
}

.global-search-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.global-search-badge-project {
    background: rgba(52, 152, 219, 0.12);
    color: #2980b9;
}

.global-search-badge-contact {
    background: rgba(46, 204, 113, 0.12);
    color: #27ae60;
}

.global-search-badge-task {
    background: rgba(243, 156, 18, 0.12);
    color: #e67e22;
}

.global-search-badge-note {
    background: rgba(155, 89, 182, 0.12);
    color: #8e44ad;
}

.global-search-badge-design {
    background: rgba(227, 6, 19, 0.1);
    color: #c0000f;
}

.global-search-result-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-result-subtitle {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── View toggle buttons (List / Kanban) ── */
.view-toggle-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1.25rem;
    margin-bottom: 12px;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 8px;
    cursor: pointer;
    color: var(--muted);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.view-toggle-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.view-toggle-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* ── Business card grid ── */
.business-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.business-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.business-card:hover {
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.business-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.business-card-info {
    flex: 1;
    min-width: 0;
}

.business-card-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.business-card-location {
    font-size: 12px;
    margin-top: 2px;
}

.business-card-website {
    font-size: 12px;
    color: var(--brand);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.business-card-website:hover {
    text-decoration: underline;
}

.business-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.business-card-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.business-card-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Contact card grid ── */
.contact-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.contact-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 12px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    position: relative;
}

.contact-card:hover {
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.contact-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-top: 4px;
}

.contact-card-detail {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.contact-card-menu {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* ── Kanban board ── */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    align-items: flex-start;
}

.kanban-column {
    flex: 1 1 0;
    min-width: 220px;
    max-width: 340px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.kanban-column.drag-over {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(227, 6, 19, 0.15);
}

/* While any card is being dragged, suppress pointer events on all column
   descendants so drag-enter/leave only fire at the column boundary itself,
   preventing the red-outline flicker caused by child elements stealing events. */
.kanban-board.is-dragging .kanban-column * {
    pointer-events: none;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.kanban-column-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--border);
    color: var(--muted);
}

.kanban-column-revenue {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 14px 10px;
}

.kanban-revenue-tag {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: var(--border);
    color: var(--muted);
}

.kanban-revenue-actual {
    color: var(--text);
}

.kanban-column-body {
    flex: 1;
    padding: 4px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.kanban-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: grab;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s, transform 0.15s, opacity 0.15s;
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.4;
    transform: scale(0.97);
}

.kanban-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    word-break: break-word;
    line-height: 1.3;
}

.kanban-card-customer {
    font-size: 11px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 8px;
}

.kanban-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: -0.5px;
    line-height: 1;
    margin-top: 6px;
    margin-bottom: 10px;
}

.kanban-card-value--actual {
    color: var(--text);
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.kanban-card-date {
    font-size: 11px;
    color: var(--muted);
}

.kanban-card-meta {
    font-size: 11px;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.kanban-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kanban-card-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.kanban-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: var(--border);
    color: var(--muted);
}

.kanban-drop-placeholder {
    border: 2px dashed var(--border);
    border-radius: 10px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--muted);
    opacity: 0.6;
}

[data-theme="dark"] .kanban-column {
    background: #161622;
}

[data-theme="dark"] .kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .status-badge-lead,
[data-theme="dark"] .status-badge-draft               { background: #2a2a2e; color: #9ca3af; }
[data-theme="dark"] .status-badge-surveybooked       { background: #101830; color: #93c5fd; }
[data-theme="dark"] .status-badge-proposal           { background: #3a2a10; color: #fbbf24; }
[data-theme="dark"] .status-badge-accepted           { background: #1a3a10; color: #4ade80; }
[data-theme="dark"] .status-badge-inproduction       { background: #102040; color: #60a5fa; }
[data-theme="dark"] .status-badge-awaitinginstallation { background: #1e1030; color: #c4b5fd; }
[data-theme="dark"] .status-badge-completed          { background: #0a3020; color: #34d399; }
[data-theme="dark"] .status-badge-rejected           { background: #3a1010; color: #f87171; }
[data-theme="dark"] .status-badge-stale             { background: #3a2800; color: #fcd34d; }

/* ---- Dropdown upward flip for last rows ---- */
.data-table tbody tr:nth-last-child(-n+3) .details-menu-dropdown {
    top: auto;
    bottom: calc(100% + 4px);
}

/* ---- Primary entity name column (tables) ---- */
.col-primary {
    font-weight: 600;
    color: var(--text);
}

.data-table tbody tr.clickable:hover .col-primary {
    color: var(--brand);
}

/* ---- Actions cell inner flex wrapper ---- */
.col-actions-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

/* ---- Empty state inside a card ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 10px;
    color: var(--muted);
    text-align: center;
}

.empty-state-icon {
    opacity: 0.35;
}

.empty-state-text {
    font-size: 14px;
    font-weight: 500;
}

/* ---- project-info-col-label refinement ---- */
.project-info-col-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin: 0 0 10px 0;
}

/* ---- KPI cards for reports dashboard ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
@media (max-width: 1100px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

/* ---- 6-column KPI grid (Analytics / Performance page) ---- */
.kpi-grid-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}
@media (max-width: 1400px) {
    .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .kpi-grid-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .kpi-grid-6 { grid-template-columns: 1fr; }
}

/* ---- Activity KPI card delta lines ---- */
.kpi-delta {
    font-size: 12px;
    font-weight: 600;
    margin-top: 5px;
    line-height: 1.3;
}
.kpi-prev {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* ---- Section label (Sales Movement, Revenue Breakdown) ---- */
.reports-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

/* ---- Performance filter bar ---- */
.perf-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    padding: 16px 20px;
    flex-wrap: wrap;
    margin-bottom: 0;
}
.perf-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.perf-filter-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.perf-period-btns {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.perf-period-btn {
    padding: 7px 14px;
    border: none;
    border-right: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    transition: background 0.12s, color 0.12s;
    line-height: 1;
}
.perf-period-btn:last-child { border-right: none; }
.perf-period-btn:hover { background: var(--hover); }
.perf-period-btn.active {
    background: var(--brand);
    color: #fff;
}

/* ---- Secondary outline button (small) ---- */
.btn-outline-sm {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    transition: background 0.12s;
}
.btn-outline-sm:hover { background: var(--hover); }
.btn-outline-sm:disabled { opacity: 0.5; cursor: default; }

/* ---- Reports page tab bar ---- */
.reports-tab-card {
    padding: 0;
    overflow: hidden;
}
.reports-tab-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: 0 8px;
    gap: 4px;
    flex-wrap: wrap;
}
.reports-tab {
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.12s, border-color 0.12s;
    white-space: nowrap;
}
.reports-tab:hover { color: var(--text); }
.reports-tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}
.reports-tab-spacer { flex: 1; }
.reports-period-text {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    padding: 0 8px;
}
.reports-period-btns {
    display: flex;
    gap: 0;
}
.reports-period-btn {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-right: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.reports-period-btn:first-child { border-radius: 8px 0 0 8px; }
.reports-period-btn:last-child  { border-right: 1px solid var(--border); border-radius: 0 8px 8px 0; }
.reports-period-btn:hover { background: var(--hover); }
.reports-period-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.reports-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    flex-wrap: wrap;
}

/* ---- Win rate analysis card ---- */
.win-rate-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 8px;
}
.win-rate-box {
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.win-rate-box-won  { background: rgba(34,197,94,0.08);  border: 1px solid rgba(34,197,94,0.2); }
.win-rate-box-lost { background: rgba(227,6,19,0.06);   border: 1px solid rgba(227,6,19,0.15); }
.win-rate-box-rate { background: rgba(34,197,94,0.08);  border: 1px solid rgba(34,197,94,0.2); }
.win-rate-box-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin-bottom: 6px;
}
.win-rate-box-val {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}
.win-rate-bar-track {
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    overflow: hidden;
    margin: 12px 0 6px;
}
.win-rate-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: #22C55E;
    transition: width 0.4s ease;
    max-width: 100%;
}

/* Scrollable wrapper for report tables — overridden to fully expand on print */
.table-scroll-wrap {
    overflow-x: auto;
}

/* ---- Print / PDF export ---- */
@media print {
    @page {
        margin: 15mm;
    }

    /* Hide navigation and interactive controls */
    .sidebar,
    .reports-tab-card {
        display: none !important;
    }

    /* Remove the sidebar offset so report content fills the page */
    .main-content {
        margin-left: 0 !important;
    }

    /* Expand tables fully — no scroll bars, no height cap */
    .table-scroll-wrap {
        overflow: visible !important;
        max-height: none !important;
    }

    /* Prevent cards from being split across pages */
    .card,
    .kpi-card,
    .chart-card {
        break-inside: avoid;
    }
}


/* ── Contact card selected state ── */
.contact-card-selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(227, 6, 19, 0.15);
}
