/* ==========================================================================
   LuminoCRM — application stylesheet
   Light theme, warm orange accent, generous whitespace.
   Layout: light fixed sidebar + fluid content.
   ========================================================================== */

:root {
    /* Surfaces */
    --bg:            #f7f7f9;
    --surface:       #ffffff;
    --surface-alt:   #fafafb;
    --surface-warm:  #fff8f3;

    /* Lines + type */
    --border:        #ececf0;
    --border-strong: #dcdce3;
    --text:          #14161c;
    --text-soft:     #5b6070;
    --text-muted:    #8e94a3;

    /* Brand */
    --brand:         #f26522;
    --brand-hover:   #db5417;
    --brand-soft:    #fff0e7;
    --brand-line:    #ffd9c4;

    /* Status */
    --good:          #17a55f;
    --good-soft:     #e7f8ef;
    --bad:           #e2493d;
    --bad-soft:      #fdecea;
    --warn:          #eea008;
    --warn-soft:     #fef6e6;
    --info:          #3b82f6;
    --info-soft:     #eaf1fe;
    --violet:        #7c5cff;
    --violet-soft:   #f1edff;

    /* Shape */
    --radius:        14px;
    --radius-sm:     10px;
    --radius-xs:     8px;
    --shadow:        0 1px 2px rgba(20, 22, 28, .04), 0 1px 3px rgba(20, 22, 28, .03);
    --shadow-md:     0 4px 14px rgba(20, 22, 28, .07);
    --shadow-lg:     0 18px 40px rgba(20, 22, 28, .13);

    --sidebar-w:     252px;
    --font:          "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    --font-serif:    "Didot", "Bodoni MT", "Playfair Display", "Times New Roman", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 640; letter-spacing: -.015em; }

hr.rule { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

.muted       { color: var(--text-muted); font-weight: 400; }
.text-danger { color: var(--bad); }
.num         { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap      { white-space: nowrap; }
.d-block     { display: block; }
.is-hidden   { display: none; }

::selection { background: var(--brand-soft); color: var(--brand-hover); }

/* ==========================================================================
   Logo
   ========================================================================== */

.logo { display: inline-flex; align-items: baseline; gap: .1em; line-height: 1; }
.logo__word {
    font-family: var(--font-serif);
    font-weight: 500;
    letter-spacing: .06em;
    color: var(--text);
}
.logo__star { color: var(--brand); font-size: .5em; transform: translateY(-.55em); }
.logo__sub {
    display: block;
    font-family: var(--font-serif);
    letter-spacing: .42em;
    text-indent: .42em;
    color: var(--text-muted);
    text-transform: uppercase;
}
.logo--lg .logo__word { font-size: 40px; }
.logo--lg .logo__sub  { font-size: 11px; margin-top: 5px; }
.logo--sm .logo__word { font-size: 23px; }
.logo--sm .logo__sub  { font-size: 7.5px; margin-top: 2px; }

/* ==========================================================================
   Auth screen
   ========================================================================== */

body.auth {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 32px 20px;
    background:
        radial-gradient(1100px 520px at 50% -10%, var(--brand-soft) 0%, transparent 62%),
        var(--bg);
}

.auth__panel {
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.auth__brand { text-align: center; margin-bottom: 30px; }
.auth__brand h1 { margin: 0 0 10px; }
.auth__brand p  { margin: 0; color: var(--text-muted); font-size: 14px; }
.auth__form  { display: grid; gap: 6px; }
.auth__foot  { margin: 22px 0 0; text-align: center; font-size: 12.5px; color: var(--text-muted); }

/* ==========================================================================
   App shell
   ========================================================================== */

body.app { display: flex; min-height: 100vh; }

.app__main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
}

.app__content { padding: 24px 28px 72px; flex: 1; max-width: 1560px; width: 100%; }

/* Sidebar ---------------------------------------------------------------- */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 40;
}

.sidebar__brand { padding: 20px 20px 16px; }

/* Brand (company) switcher ---------------------------------------------- */

.brand-switch { position: relative; padding: 0 14px 14px; }

.brand-switch__current {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    text-align: left;
    cursor: pointer;
    color: var(--text);
}
.brand-switch__current:hover { border-color: var(--brand-line); background: var(--brand-soft); }
/* Brand marks — logo when the brand has one, initials otherwise */
.brand-mark {
    display: grid;
    place-items: center;
    flex: none;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    overflow: hidden;
}
.brand-mark--image { background: #fff; border: 1px solid var(--border); padding: 3px; }
.brand-mark--image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-mark--sm { width: 26px; height: 26px; font-size: 10px; border-radius: 8px; }
.brand-mark--md { width: 32px; height: 32px; font-size: 11.5px; }
.brand-mark--lg { width: 52px; height: 52px; font-size: 17px; border-radius: 13px; padding: 6px; }
.brand-switch__meta { min-width: 0; flex: 1; line-height: 1.25; }
.brand-switch__meta strong {
    display: block;
    font-size: 13px;
    font-weight: 620;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-switch__meta small { font-size: 10.5px; color: var(--text-muted); }
.brand-switch__caret { color: var(--text-muted); font-size: 10px; flex: none; }

.brand-switch__menu {
    position: absolute;
    left: 14px; right: 14px; top: calc(100% - 6px);
    z-index: 60;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}
.brand-switch__menu[hidden] { display: none; }
.brand-switch__label {
    padding: 6px 8px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.brand-switch__option {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: var(--radius-xs);
    background: none;
    font: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--text);
    cursor: pointer;
}
.brand-switch__option:hover { background: var(--surface-alt); }
.brand-switch__option.is-current { background: var(--brand-soft); color: var(--brand-hover); font-weight: 600; }
.brand-switch__option small { display: block; font-size: 10.5px; color: var(--text-muted); font-weight: 400; }
.brand-switch__add {
    display: block;
    margin-top: 4px;
    padding: 8px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--brand);
}

/* Navigation ------------------------------------------------------------- */

.sidebar__nav { flex: 1; padding: 4px 14px 14px; overflow-y: auto; }

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 13.5px;
    font-weight: 520;
}
.sidebar__link:hover { background: var(--surface-alt); color: var(--text); }
.sidebar__link.is-active { background: var(--brand-soft); color: var(--brand-hover); font-weight: 620; }
.sidebar__link.is-active .sidebar__icon { color: var(--brand); }
.sidebar__icon { width: 17px; text-align: center; font-size: 14px; color: var(--text-muted); flex: none; }
.sidebar__badge {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--bad);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
}

.sidebar__divider {
    margin: 18px 11px 7px;
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.sidebar__foot { padding: 12px 14px 14px; border-top: 1px solid var(--border); }

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px;
    border-radius: var(--radius-sm);
    color: var(--text);
}
.sidebar__user:hover { background: var(--surface-alt); color: var(--text); }
.sidebar__user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sidebar__user-meta strong { font-size: 13px; font-weight: 620; }
.sidebar__user-meta small  { font-size: 11px; color: var(--text-muted); }

.sidebar__logout {
    width: 100%;
    margin-top: 6px;
    padding: 7px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}
.sidebar__logout:hover { color: var(--bad); border-color: var(--bad-soft); background: var(--bad-soft); }

/* Topbar ----------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 28px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar__title   { font-size: 16px; font-weight: 640; }
.topbar__context { flex: 1; min-width: 0; }
.topbar__crumb   { font-size: 11.5px; color: var(--text-muted); }
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.topbar__toggle  { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--text); }

.topbar__search { position: relative; }
.topbar__search input {
    width: 230px;
    padding: 7px 12px 7px 31px;
    border-radius: 999px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    font-size: 13px;
}
.topbar__search input:focus { width: 290px; background: var(--surface); }
.topbar__search::before {
    content: "⌕";
    position: absolute;
    left: 11px; top: 50%;
    transform: translateY(-52%);
    color: var(--text-muted);
    font-size: 15px;
    pointer-events: none;
}

/* Notification bell ------------------------------------------------------ */

.bell { position: relative; }

.bell__button {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
}
.bell__button:hover { background: var(--surface-alt); border-color: var(--border-strong); }

.bell__count {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--bad);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
}

.bell__menu {
    position: absolute;
    top: calc(100% + 8px); right: 0;
    z-index: 60;
    width: 340px;
    max-width: calc(100vw - 24px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.bell__menu[hidden] { display: none; }

.bell__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.bell__mark {
    background: none; border: 0; cursor: pointer;
    color: var(--brand); font: inherit; font-size: 12px;
}
.bell__empty { margin: 0; padding: 22px 16px; font-size: 13px; color: var(--text-muted); text-align: center; }

.bell__list { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow-y: auto; }
.bell__item { border-bottom: 1px solid var(--border); }
.bell__item:last-child { border-bottom: 0; }
.bell__item.is-unread { background: var(--brand-soft); }

.bell__link {
    display: flex;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    background: none;
    border: 0;
    text-align: left;
    font: inherit;
    cursor: pointer;
    color: var(--text);
}
.bell__link:hover { background: var(--surface-alt); }
.bell__icon {
    display: grid; place-items: center;
    width: 26px; height: 26px; flex: none;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--brand);
}
.bell__body { min-width: 0; }
.bell__body strong { display: block; font-size: 13px; font-weight: 620; }
.bell__body small { display: block; font-size: 11.5px; color: var(--text-soft); }
.bell__meta { color: var(--text-muted) !important; margin-top: 2px; }

.bell__all {
    display: block;
    padding: 11px;
    text-align: center;
    font-size: 12.5px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.notif-list__item:last-child { border-bottom: 0; }
.notif-list__item.is-unread { background: var(--brand-soft); }
.notif-list__body { flex: 1; min-width: 0; }
.notif-list__body strong { display: block; font-size: 14px; }
.notif-list__body p { margin: 3px 0 0; font-size: 13px; color: var(--text-soft); }
.notif-list__body small { display: block; margin-top: 4px; font-size: 11.5px; color: var(--text-muted); }

/* ==========================================================================
   Page furniture
   ========================================================================== */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-head__title   { font-size: 23px; letter-spacing: -.02em; }
.page-head__sub     { margin: 6px 0 0; color: var(--text-muted); font-size: 13.5px; max-width: 70ch; }
.page-head__eyebrow { margin: 0 0 5px; font-size: 12px; color: var(--text-muted); }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}
.card--flush { padding: 0; }
.card--flush > .card__head { padding: 18px 20px 0; }
.card--warm { background: var(--surface-warm); border-color: var(--brand-line); }

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.card__head h3 { font-size: 15px; }
.card__head-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); font-weight: 400; }

.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid--sidebar { grid-template-columns: 1.55fr 1fr; }

.empty { margin: 0; padding: 16px 0; color: var(--text-muted); font-size: 13.5px; }
.empty--lg {
    padding: 52px 20px;
    text-align: center;
    font-size: 14px;
    line-height: 1.7;
}
.empty__icon { display: block; font-size: 30px; margin-bottom: 10px; opacity: .5; }

/* ==========================================================================
   Buttons, chips, badges
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    font-weight: 570;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-alt); border-color: var(--border-strong); color: var(--text); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(242, 101, 34, .28); }
.btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn--ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn--danger-ghost { background: transparent; border-color: transparent; color: var(--bad); box-shadow: none; }
.btn--danger-ghost:hover { background: var(--bad-soft); border-color: var(--bad-soft); color: var(--bad); }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--block { width: 100%; padding: 12px; }

.icon-btn {
    background: none;
    border: 0;
    color: var(--text-muted);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 6px;
}
.icon-btn:hover { color: var(--bad); background: var(--bad-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.chips__item {
    padding: 6px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 520;
}
.chips__item span { color: var(--text-muted); font-weight: 700; margin-left: 4px; }
.chips__item:hover { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-hover); }
.chips__item.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips__item.is-active span { color: rgba(255, 255, 255, .82); }

.chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.chip--high   { background: var(--bad-soft);  color: #c0392e; }
.chip--medium { background: var(--warn-soft); color: #a8730a; }
.chip--low    { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 620;
    background: var(--surface-alt);
    color: var(--text-soft);
    white-space: nowrap;
    border: 1px solid var(--border);
}
.badge--new_lead  { background: var(--surface-alt); color: var(--text-soft); }
.badge--attempted { background: var(--info-soft);   color: #1d5fd0; border-color: transparent; }
.badge--qualified,
.badge--prospect  { background: var(--violet-soft); color: #5b3fd8; border-color: transparent; }
.badge--customer,
.badge--won,
.badge--created   { background: var(--good-soft);   color: #0f8b4e; border-color: transparent; }
.badge--lost,
.badge--deleted   { background: var(--bad-soft);    color: #c0392e; border-color: transparent; }
.badge--open,
.badge--updated   { background: var(--brand-soft);  color: var(--brand-hover); border-color: transparent; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--tag-colour, #64748b);
    background: color-mix(in srgb, var(--tag-colour, #64748b) 12%, white);
    border: 1px solid color-mix(in srgb, var(--tag-colour, #64748b) 28%, white);
}
.tag--removable form { display: inline; }
.tag--removable button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 0 0 3px; opacity: .65; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 34px; height: 34px;
    flex: none;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-hover);
    font-size: 12px;
    font-weight: 700;
}
.avatar--sm { width: 26px; height: 26px; font-size: 10px; }
.avatar--xs { width: 22px; height: 22px; font-size: 9px; }
.avatar--lg { width: 58px; height: 58px; font-size: 19px; }

/* ==========================================================================
   Forms
   ========================================================================== */

.form--narrow { max-width: 800px; }

.field { display: block; margin-bottom: 16px; }
.field__label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 620; color: var(--text-soft); }
.field__error { display: block; margin-top: 5px; color: var(--bad); font-size: 12px; }
.field__hint  { display: block; margin-top: 5px; color: var(--text-muted); font-size: 11.5px; }

.field--inline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 14px 0 0;
    font-size: 13px;
    color: var(--text-soft);
}
.field--inline input { width: auto; accent-color: var(--brand); }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="datetime-local"], input[type="url"],
input[type="search"], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
input.has-error, select.has-error, textarea.has-error { border-color: var(--bad); }
input.has-error:focus { box-shadow: 0 0 0 3px var(--bad-soft); }
input[type="color"] { padding: 2px; height: 36px; cursor: pointer; }
input[type="file"]  { border: 0; padding: 0; font-size: 12.5px; }
input[type="checkbox"] { accent-color: var(--brand); }
textarea { resize: vertical; min-height: 76px; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238e94a3' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}

.form__row { display: grid; gap: 14px; }
.form__row--2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form__row--3 { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
.form__row--4 { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }

.form__actions { display: flex; gap: 10px; padding-top: 4px; margin-bottom: 28px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filters input[type="search"] { flex: 1 1 250px; min-width: 190px; border-radius: 999px; }
.filters select { flex: 0 1 170px; border-radius: 999px; }
.filters--inline { margin: 0; }

.inline-form { display: inline-flex; gap: 6px; }
.inline-form--stack { display: block; margin-top: 14px; }
.inline-form select { border-radius: 999px; }

.log-form { display: block; }
.log-form--inline { display: flex; gap: 8px; align-items: flex-start; }
.log-form--inline input[type="text"] { flex: 1; }
.log-form__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.upload {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
    padding: 12px;
    background: var(--surface-alt);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
}

/* Logo upload ------------------------------------------------------------ */

.logo-upload { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }

.logo-upload__preview {
    display: grid;
    place-items: center;
    width: 92px; height: 92px;
    flex: none;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.logo-upload__preview img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.logo-upload__empty { font-size: 11px; color: var(--text-muted); text-align: center; }

.logo-upload__controls { flex: 1 1 260px; min-width: 0; }
.logo-upload__controls input[type="file"] { margin-bottom: 4px; }

.logo-upload__advanced { margin-top: 12px; }
.logo-upload__advanced summary {
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 4px 0;
}
.logo-upload__advanced summary:hover { color: var(--brand); }
.logo-upload__advanced input[type="text"] { margin-top: 8px; }

.tag-picker { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; }
.tag-picker__item { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    padding: 11px 18px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table--hover tbody tr { cursor: pointer; transition: background .12s; }
.table--hover tbody tr:hover { background: var(--brand-soft); }
.table--settings td { padding: 8px 12px; }
.table--settings input[type="text"], .table--settings input[type="number"] { padding: 6px 9px; font-size: 13px; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.cell-person { display: flex; align-items: center; gap: 11px; }
.cell-person strong { display: block; line-height: 1.3; font-weight: 600; }
.cell-person small  { color: var(--text-muted); font-size: 12px; }
.cell-person--stack { margin-bottom: 14px; }

.audit-diff { font-size: 12px; }
.audit-diff code { background: var(--surface-alt); padding: 1px 5px; border-radius: 4px; }
.audit-diff del  { color: var(--bad); text-decoration: line-through; opacity: .75; }
.audit-diff ins  { color: var(--good); text-decoration: none; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.pagination__summary { margin: 0; padding: 14px 18px; font-size: 12.5px; color: var(--text-muted); }
.pagination .pagination__summary { padding: 0; }
.pagination__links { display: flex; gap: 4px; align-items: center; }
.pagination__link {
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 13px;
    color: var(--text-soft);
}
.pagination__link:hover { background: var(--surface-alt); color: var(--text); }
.pagination__link.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination__gap { color: var(--text-muted); padding: 0 2px; }

/* ==========================================================================
   Dashboard
   ========================================================================== */

.segmented {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}
.segmented__item { padding: 6px 13px; border-radius: 999px; font-size: 12.5px; color: var(--text-soft); font-weight: 520; }
.segmented__item:hover { background: var(--surface-alt); color: var(--text); }
.segmented__item.is-active { background: var(--brand); color: #fff; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tiles--compact { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }

.tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.tile:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); transform: translateY(-1px); color: inherit; }
.tile__icon {
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 15px;
}
.tile__icon--good { background: var(--good-soft); color: var(--good); }
.tile__icon--bad  { background: var(--bad-soft);  color: var(--bad); }
.tile__icon--warn { background: var(--warn-soft); color: var(--warn); }
.tile__icon--info { background: var(--info-soft); color: var(--info); }
.tile__label { font-size: 11.5px; font-weight: 640; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.tile__value { font-size: 27px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; }
.tile__value--sm { font-size: 16px; }
.tile__foot  { font-size: 11.5px; color: var(--text-muted); }

.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.funnel__row { display: grid; grid-template-columns: 140px 1fr 34px 62px; align-items: center; gap: 12px; font-size: 13px; }
.funnel__name  { color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel__bar   { height: 10px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.funnel__fill  { display: block; height: 100%; border-radius: 999px; transition: width .35s ease; }
.funnel__count { text-align: right; font-weight: 680; }
.funnel__value { text-align: right; color: var(--text-muted); font-size: 12px; }

.bars { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding-top: 12px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars__bar {
    width: 100%;
    max-width: 44px;
    background: linear-gradient(180deg, var(--brand) 0%, #ffa06b 100%);
    border-radius: 7px 7px 3px 3px;
    min-height: 5px;
    transition: height .35s ease;
}
.bars__label { font-size: 11.5px; color: var(--text-muted); }
.bars__value { font-size: 11px; font-weight: 660; color: var(--text-soft); }

/* Conversion gauge ------------------------------------------------------- */

.gauge { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.gauge__ring {
    position: relative;
    width: 150px; height: 150px;
    flex: none;
    border-radius: 50%;
    background: conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--surface-alt) 0);
    display: grid;
    place-items: center;
}
.gauge__ring::after {
    content: "";
    position: absolute;
    inset: 15px;
    border-radius: 50%;
    background: var(--surface);
}
.gauge__inner { position: relative; z-index: 1; text-align: center; }
.gauge__pct   { display: block; font-size: 27px; font-weight: 720; letter-spacing: -.03em; }
.gauge__cap   { display: block; font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.gauge__legend { display: grid; gap: 11px; font-size: 13px; }
.gauge__legend div { display: flex; align-items: baseline; gap: 8px; }
.gauge__legend strong { font-size: 17px; font-weight: 680; }
.gauge__legend span { color: var(--text-muted); font-size: 12.5px; }

.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
    display: flex;
    flex-direction: column;
    min-width: 118px;
    padding: 12px 16px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: inherit;
}
.pill:hover { border-color: var(--brand-line); background: var(--brand-soft); color: inherit; }
.pill strong { font-size: 20px; font-weight: 700; }
.pill span   { font-size: 11.5px; color: var(--text-muted); }

/* ==========================================================================
   Lists: tasks, feed, timeline, notes, emails
   ========================================================================== */

.tasklist { list-style: none; margin: 0; padding: 0; }
.tasklist--full .tasklist__item { padding: 14px 18px; }

.tasklist__item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.tasklist__item:last-child { border-bottom: 0; }
.tasklist__item.is-done .tasklist__body strong { text-decoration: line-through; color: var(--text-muted); }
.tasklist__item.is-overdue-row { background: var(--bad-soft); }

.tasklist__check {
    width: 20px; height: 20px;
    flex: none;
    display: grid;
    place-items: center;
    background: none;
    border: 1.6px solid var(--border-strong);
    border-radius: 50%;
    font-size: 11px;
    color: transparent;
    cursor: pointer;
    padding: 0;
    transition: background .15s, border-color .15s, color .15s;
}
.tasklist__check:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.is-done .tasklist__check { background: var(--good); border-color: var(--good); color: #fff; }
.tasklist__body { flex: 1; min-width: 0; }
.tasklist__body strong { display: block; font-size: 13.5px; font-weight: 600; }
.tasklist__body small  { display: block; margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.tasklist__desc { margin: 4px 0 0; font-size: 12.5px; color: var(--text-soft); }
.tasklist__due  { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.tasklist__due.is-overdue { color: var(--bad); font-weight: 660; }

.feed, .timeline { list-style: none; margin: 0; padding: 0; }
.feed__item, .timeline__item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.feed__item:last-child, .timeline__item:last-child { border-bottom: 0; }

.feed__icon, .timeline__icon {
    display: grid;
    place-items: center;
    width: 30px; height: 30px;
    flex: none;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 13px;
}
.feed__body p, .timeline__body p { margin: 0; font-size: 13.5px; }
.feed__body small, .timeline__body small { font-size: 11.5px; color: var(--text-muted); }

.notes { list-style: none; margin: 0; padding: 0; }
.notes__item { padding: 13px 0; border-bottom: 1px solid var(--border); }
.notes__item:last-child { border-bottom: 0; }
.notes__item.is-pinned {
    background: var(--warn-soft);
    padding: 13px 14px;
    margin-bottom: 8px;
    border-left: 3px solid var(--warn);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    border-bottom: 0;
}
.notes__head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; font-size: 12.5px; }
.notes__head small { color: var(--text-muted); }
.notes__delete { margin-left: auto; }
.notes__item p { margin: 0; font-size: 13.5px; color: var(--text-soft); }
.pin { font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--warn); font-weight: 700; }

.emails { list-style: none; margin: 0; padding: 0; }
.emails__item { padding: 13px 15px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); }
.emails__item--incoming { border-left: 3px solid var(--info); }
.emails__item--outgoing { border-left: 3px solid var(--brand); }
.emails__head { display: flex; justify-content: space-between; gap: 10px; }
.emails__item p { margin: 7px 0 0; font-size: 13px; color: var(--text-soft); }

.minilist { list-style: none; margin: 0; padding: 0; }
.minilist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.minilist li:last-child { border-bottom: 0; }
.minilist a, .minilist > span { display: block; min-width: 0; }
.minilist strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.minilist a:hover strong { color: var(--brand); }
.minilist small  { display: block; font-size: 11.5px; color: var(--text-muted); }

.deflist { display: grid; grid-template-columns: 112px 1fr; gap: 8px 12px; margin: 0; font-size: 13px; }
.deflist dt { color: var(--text-muted); }
.deflist dd { margin: 0; color: var(--text); }

.note-block { margin: 14px 0 0; padding: 12px 14px; background: var(--surface-alt); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-soft); }

/* ==========================================================================
   Lead workspace
   ========================================================================== */

.workspace-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 22px;
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.workspace-head__identity { display: flex; gap: 16px; align-items: flex-start; }
.workspace-head__identity h2 { font-size: 22px; }
.workspace-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 7px 0 0; font-size: 13px; color: var(--text-muted); }
.workspace-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.workspace { display: grid; grid-template-columns: 350px 1fr; gap: 18px; align-items: start; }
.workspace__side, .workspace__main { min-width: 0; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; width: fit-content; }
.tabs__btn {
    padding: 8px 17px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    font-size: 13.5px;
    font-weight: 560;
    cursor: pointer;
}
.tabs__btn:hover { background: var(--surface-alt); color: var(--text); }
.tabs__btn.is-active { background: var(--brand); color: #fff; }
.tabs__count { display: inline-block; margin-left: 5px; padding: 0 6px; border-radius: 999px; background: var(--surface-alt); font-size: 11px; }
.tabs__btn.is-active .tabs__count { background: rgba(255, 255, 255, .26); }
.tabs__panel { display: none; }
.tabs__panel.is-active { display: block; }

/* ==========================================================================
   Pipeline board
   ========================================================================== */

.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 20px; min-height: 60vh; }

.board__column {
    flex: 0 0 286px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

.board__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 13px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-top: 3px solid var(--stage-colour, var(--brand));
    border-radius: var(--radius) var(--radius) 0 0;
}
.board__head h3 { font-size: 13px; }
.board__head small { font-size: 11.5px; color: var(--text-muted); }
.board__prob { font-size: 10.5px; font-weight: 700; color: var(--text-muted); background: var(--surface-alt); padding: 3px 7px; border-radius: 999px; }

.board__list { flex: 1; overflow-y: auto; padding: 11px; display: grid; gap: 10px; align-content: start; }
.board__list.is-over { background: var(--brand-soft); outline: 2px dashed var(--brand); outline-offset: -7px; border-radius: var(--radius-sm); }

.board__card {
    position: relative;
    padding: 13px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    cursor: grab;
    transition: box-shadow .15s, border-color .15s;
}
.board__card:hover { box-shadow: var(--shadow-md); border-color: var(--brand-line); }
.board__card:active { cursor: grabbing; }
.board__card.is-dragging { opacity: .4; }
.board__card-title { display: block; font-size: 13.5px; font-weight: 620; color: var(--text); padding-right: 28px; }
.board__card-title:hover { color: var(--brand); }
.board__card-person { margin: 4px 0 0; font-size: 12px; }
.board__card-book   { margin: 4px 0 0; font-size: 11.5px; color: var(--text-muted); }
.board__card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); font-size: 12.5px; }
.board__card-date { font-size: 11.5px; color: var(--text-muted); }
.board__card-date.is-overdue { color: var(--bad); font-weight: 660; }
.board__card-owner { position: absolute; top: 12px; right: 12px; }
.board__empty { margin: 0; padding: 22px 8px; text-align: center; font-size: 12px; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }

/* ==========================================================================
   Settings cards, flash, errors
   ========================================================================== */

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 15px; }

.settings-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.settings-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); transform: translateY(-1px); color: inherit; }
.settings-card__icon {
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    margin-bottom: 8px;
    border-radius: 11px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 17px;
}
.settings-card strong { font-size: 14.5px; font-weight: 640; }
.settings-card small { color: var(--text-muted); font-size: 12px; }

.flash-stack { position: sticky; top: 10px; z-index: 25; display: grid; gap: 8px; margin-bottom: 16px; }

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: 13.5px;
    box-shadow: var(--shadow);
    background: var(--surface);
}
.flash--success { border-color: #b9ead1; background: var(--good-soft); color: #0f7a46; }
.flash--error   { border-color: #f6c3bd; background: var(--bad-soft);  color: #b8352a; }
.flash--warning { border-color: #f6dfae; background: var(--warn-soft); color: #97690a; }
.flash--info    { border-color: #c3d8fb; background: var(--info-soft); color: #1d5fd0; }
.flash__close   { background: none; border: 0; font-size: 17px; line-height: 1; cursor: pointer; color: inherit; opacity: .55; }
.flash__close:hover { opacity: 1; }

.error-page { text-align: center; padding: 80px 20px; }
.error-page__code { font-size: 60px; font-weight: 800; color: var(--brand); margin: 0; letter-spacing: -.04em; }
.error-page h2 { font-size: 22px; margin: 8px 0 10px; }
.error-page p  { color: var(--text-muted); margin: 0 0 22px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

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

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

@media (max-width: 880px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .app__main { margin-left: 0; }
    .topbar__toggle { display: block; }
    .app__content { padding: 16px 15px 56px; }
    .topbar { padding: 11px 15px; }
    .topbar__search { display: none; }
    .funnel__row { grid-template-columns: 96px 1fr 30px 54px; }
    .page-head__title { font-size: 20px; }
}

@media print {
    .sidebar, .topbar, .form__actions, .filters, .flash-stack, .tabs { display: none; }
    .app__main { margin-left: 0; }
    .card { box-shadow: none; border-color: #ddd; }
}
