/* ===========================================================================
   Chamkila — light & airy hospitality theme.
   Design tokens + Bootstrap overrides + reusable UI components.
   =========================================================================== */
:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #fbfcfe;
    --text: #14181f;
    --muted: #6b7280;
    --border: #eceef3;
    --border-strong: #e2e6ee;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef0ff;

    --teal: #0d9488;   --teal-soft: #e6f7f4;
    --amber: #b45309;  --amber-soft: #fff5e6;
    --green: #15803d;  --green-soft: #e9f8ef;
    --rose: #be123c;   --rose-soft: #fdebef;
    --blue: #1d4ed8;   --blue-soft: #e8eeff;
    --violet: #6d28d9; --violet-soft: #f1eaff;
    --slate: #475569;  --slate-soft: #eef1f6;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(20, 24, 31, .04), 0 6px 20px rgba(20, 24, 31, .05);
    --shadow-hover: 0 2px 4px rgba(20, 24, 31, .06), 0 12px 28px rgba(20, 24, 31, .09);
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
h5, h6 { font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
.text-muted { color: var(--muted) !important; }

h1:focus { outline: none; }

/* --- Cards --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body { padding: 1.25rem; }
.border-dashed { border-style: dashed !important; border-color: var(--border-strong) !important; box-shadow: none; }

/* --- Buttons --- */
.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline-secondary { border-color: var(--border-strong); color: var(--slate); }
.btn-outline-secondary:hover { background: var(--slate-soft); color: var(--text); border-color: var(--border-strong); }
.btn-sm { border-radius: 8px; }
.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 .2rem var(--primary-soft);
    border-color: var(--primary);
}

/* --- Forms --- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-strong);
    background: var(--surface);
    color: var(--text);
}
.form-label { font-weight: 600; font-size: .85rem; color: var(--slate); }

/* --- Tables --- */
.table { --bs-table-bg: transparent; }
.table > thead th {
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.table > tbody td { border-color: var(--border); vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background: var(--surface-2); }

/* --- Badges / chips --- */
.badge { font-weight: 600; border-radius: 999px; padding: .35em .7em; }
.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .75rem; font-weight: 600; border-radius: 999px; padding: .25rem .6rem;
    background: var(--slate-soft); color: var(--slate);
}
.chip--teal{background:var(--teal-soft);color:var(--teal)} .chip--amber{background:var(--amber-soft);color:var(--amber)}
.chip--green{background:var(--green-soft);color:var(--green)} .chip--rose{background:var(--rose-soft);color:var(--rose)}
.chip--blue{background:var(--blue-soft);color:var(--blue)} .chip--violet{background:var(--violet-soft);color:var(--violet)}
.chip--slate{background:var(--slate-soft);color:var(--slate)} .chip--primary{background:var(--primary-soft);color:var(--primary)}

/* --- KPI cards --- */
.kpi {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.1rem 1.25rem; box-shadow: var(--shadow); height: 100%;
    transition: box-shadow .15s ease, transform .15s ease;
}
.kpi:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.kpi .kpi-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi .kpi-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-top: .25rem; }
.kpi .kpi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 1.05rem; }

/* --- Panels (dashboard sections) --- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); height: 100%; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.panel-head h6 { margin: 0; font-weight: 700; }
.panel-body { padding: .75rem 1.25rem 1.1rem; }
.list-row { display: flex; align-items: center; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }

/* --- Pipeline columns --- */
.pipe-col { width: 250px; flex: 0 0 auto; }
.pipe-col-head { display:flex; align-items:center; justify-content:space-between; font-weight:700; font-size:.8rem; text-transform:uppercase; letter-spacing:.03em; padding: .25rem .25rem .5rem; }
.pipe-col-body { background: var(--surface-2); border:1px solid var(--border); border-radius: var(--radius); padding:.6rem; min-height: 140px; }
.lead-card { background: var(--surface); border:1px solid var(--border); border-radius: 12px; padding:.7rem .8rem; box-shadow: var(--shadow); cursor:pointer; transition: box-shadow .15s ease, transform .15s ease; }
.lead-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }

/* --- Top-bar entity switcher (JS-free dropdown) + logout --- */
details.entsw { position: relative; }
details.entsw > summary { list-style: none; cursor: pointer; user-select: none; }
details.entsw > summary::-webkit-details-marker { display: none; }
details.entsw .menu {
    position: absolute; right: 0; top: 120%;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow-hover);
    padding: .4rem; min-width: 240px; z-index: 60;
}
details.entsw .menu-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .3rem .6rem; }
details.entsw .menu a { display: block; padding: .45rem .6rem; border-radius: 8px; color: var(--text); font-size: .85rem; }
details.entsw .menu a:hover { background: var(--primary-soft); color: var(--primary); }

.logout-top {
    background: var(--surface); border: 1px solid var(--border-strong);
    color: var(--slate); font-weight: 600; font-size: .82rem;
    border-radius: 999px; padding: .35rem .8rem; cursor: pointer;
}
.logout-top:hover { background: var(--rose-soft); color: var(--rose); border-color: var(--rose-soft); }

.validation-message { color: var(--rose); }
.valid.modified:not([type=checkbox]) { outline: none; }
.invalid { outline: 1px solid var(--rose); }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; border-radius: var(--radius-sm); }
.blazor-error-boundary::after { content: "An error has occurred." }
