/* ==========================================================================
   US Business Database — modern design system (.NET 8 Blazor)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --primary-rgb: 79, 70, 229;
    --accent: #0ea5e9;

    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;

    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;

    --text: #0f172a;
    --text-muted: #64748b;
    --text-faint: #94a3b8;

    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
    --shadow: 0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
    --shadow-lg: 0 20px 45px -15px rgba(15, 23, 42, .25);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    font-family: var(--font);
    color: var(--text);
    background-color: var(--bg);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    letter-spacing: -0.011em;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.25;
}

a, .btn-link { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--primary-dark); }
h1:focus { outline: none; }

code {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: .15em .4em;
    border-radius: 6px;
    font-size: .9em;
}

/* --------------------------------------------------------------------------
   App shell — top navigation layout
   -------------------------------------------------------------------------- */
.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1280px;
    margin: 0 auto;
    padding: .65rem 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    font-weight: 700;
    font-size: 1.12rem;
    color: var(--text);
    white-space: nowrap;
}

.brand:hover { color: var(--text); }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    font-weight: 800;
    font-size: .95rem;
    box-shadow: 0 4px 10px -2px rgba(var(--primary-rgb), .5);
}

.brand-text strong { color: var(--primary); }

.nav-links {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-left: 1rem;
}

.nav-links a.nav-item {
    color: var(--text-muted);
    font-weight: 500;
    font-size: .95rem;
    padding: .5rem .85rem;
    border-radius: 8px;
    transition: color .15s ease, background-color .15s ease;
}

.nav-links a.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.nav-item.active { color: var(--primary); background: var(--primary-light); }

.nav-spacer { flex: 1; }

.nav-right { display: flex; align-items: center; gap: .5rem; }

/* Account chip + dropdown */
.account { position: relative; }

.account-toggle {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem .65rem .3rem .35rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
}

.account-toggle:hover { border-color: var(--border-strong); background: var(--surface-2); }
.account-toggle { list-style: none; }
.account-toggle::-webkit-details-marker { display: none; }
details.account[open] .account-toggle { border-color: var(--primary); }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: .85rem;
    text-transform: uppercase;
}

.account-menu {
    position: absolute;
    right: 0;
    top: calc(100% + .5rem);
    min-width: 230px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: .4rem;
    z-index: 1040;
}

.account-menu a, .account-menu button {
    display: block;
    width: 100%;
    text-align: left;
    color: var(--text);
    font-size: .92rem;
    font-weight: 500;
    padding: .55rem .75rem;
    border-radius: 8px;
    border: none;
    background: none;
    cursor: pointer;
}

.account-menu a:hover, .account-menu button:hover { background: var(--surface-2); }
.account-menu .logout { color: var(--danger); font-weight: 600; }
.account-menu .menu-divider { border-top: 1px solid var(--border); margin: .35rem 0; }
.account-menu .menu-label {
    padding: .5rem .75rem .25rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-faint);
}

.app-main { flex: 1; }

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem;
}

.app-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: .9rem;
}

.app-footer .footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: space-between;
    align-items: center;
}

.app-footer a { font-weight: 600; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    font-weight: 600;
    font-size: .92rem;
    border-radius: var(--radius-sm);
    padding: .5rem 1.1rem;
    border: 1px solid transparent;
    transition: all .15s ease;
    box-shadow: none;
    letter-spacing: -0.01em;
    cursor: pointer;
}

.btn:focus, .btn:active:focus, .form-control:focus {
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .25);
}

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-faint); color: var(--text); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); color: #fff; }

.btn-outline { color: var(--primary); border-color: var(--border-strong); background: var(--surface); }
.btn-outline:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }

.btn-sm { padding: .3rem .7rem; font-size: .82rem; border-radius: 7px; }
.btn-lg { padding: .8rem 1.7rem; font-size: 1.05rem; border-radius: var(--radius); }

/* --------------------------------------------------------------------------
   Surfaces, headers
   -------------------------------------------------------------------------- */
.surface {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
}

.page-header { margin-bottom: 1.5rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.page-header h1 { font-size: 1.6rem; margin: 0; }
.page-header .lead { color: var(--text-muted); margin: .35rem 0 0; font-size: 1rem; }

.section-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.25rem;
    margin: 0 0 1rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--border);
}
.section-title::before { content: ""; width: 4px; height: 1.1em; background: var(--primary); border-radius: 4px; }

.alert-success { background: var(--success-light); border: 1px solid #bbf7d0; color: #166534; padding: .8rem 1rem; border-radius: var(--radius-sm); }
.alert-danger { background: var(--danger-light); border: 1px solid #fecaca; color: var(--danger-dark); padding: .8rem 1rem; border-radius: var(--radius-sm); }

.badge-pill {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.badge-role { background: var(--primary-light); border-color: transparent; color: var(--primary-dark); }

/* --------------------------------------------------------------------------
   Hero + feature grid (home)
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #0ea5e9 100%);
    color: #fff;
    padding: 3.5rem 2.5rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-lg);
}
.hero::after {
    content: "";
    position: absolute; inset: 0;
    background-image: radial-gradient(circle at 80% 20%, rgba(255,255,255,.18), transparent 40%),
                      radial-gradient(circle at 10% 90%, rgba(255,255,255,.12), transparent 35%);
    pointer-events: none;
}
.hero-content { position: relative; max-width: 760px; }
.hero .eyebrow {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
    background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
    padding: .35rem .8rem; border-radius: 999px; margin-bottom: 1.1rem;
}
.hero h1 { color: #fff; font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 800; margin: 0 0 .85rem; line-height: 1.1; }
.hero p { font-size: 1.15rem; color: rgba(255,255,255,.9); margin: 0 0 1.6rem; max-width: 620px; }
.hero .stat-strong { font-weight: 800; color: #fff; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero .btn-light { background: #fff; color: var(--primary-dark); border: none; font-weight: 700; }
.hero .btn-light:hover { background: #f1f5f9; transform: translateY(-1px); box-shadow: var(--shadow); }
.hero .btn-ghost { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255,255,255,.2); color: #fff; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.feature {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem 1.3rem; box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.feature .feature-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--primary-light); color: var(--primary); margin-bottom: .85rem;
}
.feature .feature-icon svg { width: 22px; height: 22px; }
.feature h3 { font-size: 1.02rem; margin: 0 0 .35rem; }
.feature p { color: var(--text-muted); font-size: .92rem; margin: 0; }

.contact-band {
    text-align: center; margin-top: 2.5rem; padding: 1.75rem;
    border-radius: var(--radius-lg); background: var(--surface);
    border: 1px solid var(--border); color: var(--text-muted);
}
.contact-band a { font-weight: 600; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-control, .form-select, select,
input:not([type]), input[type=text], input[type=email], input[type=password],
input[type=number], input[type=search], input[type=tel], input[type=url], input[type=date],
textarea {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: .55rem .8rem;
    font-size: .95rem;
    color: var(--text);
    background-color: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease;
    width: 100%;
    font-family: inherit;
}
.form-control:focus, .form-select:focus, select:focus,
input:not([type]):focus, input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=number]:focus, input[type=search]:focus, input[type=tel]:focus, input[type=url]:focus, input[type=date]:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18);
    outline: none;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
label, .control-label { font-weight: 600; font-size: .88rem; color: var(--text); margin-bottom: .35rem; }
.form-group { margin-bottom: 1rem; }
.form-floating > label { font-weight: 500; }
.field-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.field-row > .form-group { flex: 1; min-width: 200px; }
.validation-message, .text-danger { color: var(--danger); font-size: .85rem; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }

/* --------------------------------------------------------------------------
   Generic tables (admin)
   -------------------------------------------------------------------------- */
.table {
    width: 100%;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-collapse: separate;
    border-spacing: 0;
    font-size: .92rem;
}
.table thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
    padding: .7rem .85rem; text-align: left; vertical-align: middle;
}
.table td { padding: .65rem .85rem; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }

/* --------------------------------------------------------------------------
   Data grid — custom server-side table
   -------------------------------------------------------------------------- */
.db-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.db-search { position: relative; flex: 1; min-width: 260px; max-width: 540px; display: flex; align-items: center; }
.db-search > svg { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-faint); pointer-events: none; }
.db-search input { width: 100%; padding: .65rem 2.4rem .65rem 2.75rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); font-size: .92rem; box-shadow: var(--shadow-sm); }
.db-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18); outline: none; }
.db-search-clear { position: absolute; right: .65rem; border: none; background: none; font-size: 1.25rem; color: var(--text-faint); cursor: pointer; line-height: 1; }
.db-search-clear:hover { color: var(--danger); }

.btn-chip { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: .5rem .95rem; font-weight: 600; font-size: .88rem; cursor: pointer; transition: all .15s ease; }
.btn-chip:hover, .btn-chip.active { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-light); }
.btn-chip.ghost { border-color: transparent; color: var(--text-muted); }
.btn-chip.ghost:hover { color: var(--danger); background: var(--danger-light); }

.db-filters {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .9rem 1rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.2rem 1.35rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm);
    animation: fadeSlide .16s ease;
}
@media (max-width: 1100px) { .db-filters { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .db-filters { grid-template-columns: 1fr; } }

/* Filter builder */
.filter-builder {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.1rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); animation: fadeSlide .16s ease;
}
.filter-empty { color: var(--text-muted); font-size: .9rem; margin: 0 0 .85rem; }
.filter-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.filter-row .f-col { flex: 0 0 190px; }
.filter-row .f-op { flex: 0 0 140px; }
.filter-row .f-val { flex: 1 1 200px; min-width: 140px; }
.filter-row select, .filter-row input { padding: .45rem .6rem; font-size: .9rem; border-radius: 8px; width: auto; }
.f-unary { color: var(--text-faint); font-style: italic; font-size: .85rem; padding: .45rem 0; }
.f-fast, .f-slow { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .15rem .4rem; border-radius: 5px; }
.f-fast { background: var(--success-light); color: #166534; }
.f-slow { background: var(--warning-light); color: #92400e; }
.f-remove { border: none; background: none; color: var(--text-faint); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 .25rem; }
.f-remove:hover { color: var(--danger); }
.filter-actions { display: flex; align-items: center; gap: .6rem; margin-top: .25rem; padding-top: .85rem; border-top: 1px solid var(--border); }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.fld { display: flex; flex-direction: column; gap: .3rem; }
.fld label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; margin: 0; }
.fld input, .fld select, .fld textarea { width: 100%; padding: .5rem .7rem; font-size: .9rem; border-radius: 8px; }

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.table-card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.result-count { font-size: .95rem; color: var(--text-muted); display: flex; align-items: center; gap: .5rem; }
.result-count strong { color: var(--text); font-size: 1.05rem; }
.page-size { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-muted); }
.page-size select { width: auto; padding: .35rem 1.7rem .35rem .6rem; border-radius: 8px; font-weight: 600; }

.table-scroll { position: relative; overflow: auto; max-height: 60vh; }

.biz-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .85rem; white-space: nowrap; }
.biz-table thead th {
    position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-muted);
    font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
    text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--border); user-select: none;
}
.biz-table thead th.sortable { cursor: pointer; transition: color .15s ease, background .15s ease; }
.biz-table thead th.sortable:hover { color: var(--primary); background: #e9edf5; }
.biz-table thead th.sorted { color: var(--primary); }
.biz-table thead th .sort-arrow { font-weight: 700; }
.biz-table thead th.th-actions { width: 1%; }

.biz-table tbody td { padding: .62rem .85rem; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.biz-table tbody tr:last-child td { border-bottom: none; }
.biz-table tbody tr { transition: background .12s ease; }
.biz-table tbody tr:hover td { background: var(--primary-light); }
.cell-strong { font-weight: 600; color: var(--text); }
.cell-muted { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.cell-num { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.state-tag { display: inline-block; min-width: 34px; text-align: center; padding: .1rem .45rem; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; font-size: .75rem; color: var(--text-muted); }
.row-actions { text-align: center; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; transition: all .15s ease; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Freeze the actions column to the right edge during horizontal scroll */
.biz-table th.th-actions, .biz-table td.row-actions {
    position: sticky;
    right: 0;
    background: var(--surface);
    box-shadow: -8px 0 8px -8px rgba(15, 23, 42, .18);
}
.biz-table thead th.th-actions { top: 0; z-index: 5; background: var(--surface-2); }
.biz-table td.row-actions { z-index: 1; }
.biz-table tbody tr:hover td.row-actions { background: var(--primary-light); }

.table-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.25rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-info { color: var(--text-muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.pager { display: inline-flex; align-items: center; gap: .35rem; }
.pager .pg { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: .35rem .7rem; cursor: pointer; font-weight: 600; font-size: .85rem; transition: all .15s ease; }
.pager .pg:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.pager .pg:disabled { opacity: .4; cursor: default; }
.pager .pg-current { padding: 0 .5rem; font-size: .85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state svg { color: var(--text-faint); margin-bottom: .5rem; }
.empty-state h3 { margin: .25rem 0; font-size: 1.1rem; color: var(--text); }
.empty-state p { margin: 0 0 1rem; }
.dot-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); display: inline-block; animation: dotpulse 1s ease-in-out infinite; }
@keyframes dotpulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* Toolbar export actions + column menu */
.toolbar-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-left: auto; }

.group-by { display: flex; align-items: center; gap: .45rem; }
.group-by label { margin: 0; font-size: .85rem; color: var(--text-muted); font-weight: 600; }
.group-by select { width: auto; padding: .45rem 1.7rem .45rem .75rem; border-radius: 999px; font-weight: 600; font-size: .85rem; }

.share-row { display: flex; align-items: center; gap: .6rem; }
.share-bar { flex: 1; height: 8px; max-width: 280px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.share-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; }
.share-pct { font-size: .78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 44px; }

.btn-chip.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn-chip.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
a.btn-chip { text-decoration: none; }

.cols-menu { position: relative; }
.cols-menu > summary { list-style: none; }
.cols-menu > summary::-webkit-details-marker { display: none; }
.cols-panel { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 1045; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .5rem; min-width: 210px; max-height: 340px; overflow: auto; }
.col-check { display: flex; align-items: center; gap: .55rem; padding: .4rem .55rem; border-radius: 8px; font-size: .9rem; font-weight: 500; cursor: pointer; margin: 0; }
.col-check:hover { background: var(--surface-2); }
.col-check input { width: auto; }

/* Column resize handles */
.biz-table thead th { position: relative; }
.col-resizer { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; user-select: none; }
.col-resizer:hover { background: linear-gradient(to right, transparent, rgba(var(--primary-rgb), .4)); }
body.col-resizing { cursor: col-resize !important; user-select: none !important; }

/* Print: show only the table */
@media print {
    .app-header, .app-footer, .db-toolbar, .db-filters, .table-card-head, .table-card-foot,
    .page-header .btn, #blazor-error-ui, .row-actions, .th-actions { display: none !important; }
    body { background: #fff; }
    .app-main .container { max-width: none; padding: 0; }
    .table-card { border: none; box-shadow: none; }
    .table-scroll { max-height: none; overflow: visible; }
    .biz-table thead th { position: static; }
}

.status-pill {
    display: inline-block; padding: .15rem .55rem; border-radius: 999px;
    font-size: .72rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.status-Completed { background: var(--success-light); color: #166534; }
.status-In-Progress { background: var(--primary-light); color: var(--primary-dark); }
.status-Pending, .status-On-Hold { background: var(--warning-light); color: #92400e; }
.status-Cancelled { background: var(--danger-light); color: var(--danger-dark); }
.status-Not-Started { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* --------------------------------------------------------------------------
   Modal / dialog
   -------------------------------------------------------------------------- */
.modal-backdrop-custom {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; z-index: 1050; padding: 1rem;
    animation: fadeSlide .15s ease;
}
.modal-card {
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 720px; max-height: 92vh; overflow: auto;
    animation: modalPop .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes modalPop { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-card.edit-modal { max-width: 760px; }
.modal-card .modal-head { padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--surface-2); }
.modal-card .modal-head h3 { margin: 0; font-size: 1.15rem; }
.modal-title-wrap { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.modal-title-wrap h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 460px; }
.modal-avatar { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 800; font-size: 1.1rem; }
.modal-sub { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.modal-card .modal-body { padding: 1.4rem; }
.modal-card .modal-foot { padding: 1rem 1.4rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; background: var(--surface-2); }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-faint); cursor: pointer; line-height: 1; padding: 0 .25rem; }
.modal-close:hover { color: var(--text); }

.form-section { margin-bottom: 1.4rem; }
.form-section:last-child { margin-bottom: 0; }
.form-section-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); font-weight: 700; margin: 0 0 .8rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem 1.1rem; }
.form-grid .span-2, .form-grid .span-3 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Blazor framework bits
   -------------------------------------------------------------------------- */
#blazor-error-ui {
    color-scheme: light only;
    background: #fff8e1;
    border-top: 1px solid #f0d68a;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.9rem 1.4rem 0.9rem 1.4rem;
    position: fixed;
    width: 100%;
    z-index: 1060;
    font-weight: 500;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .75rem; }

.blazor-error-boundary {
    background: var(--danger); padding: 1rem 1rem 1rem 1rem; color: white; border-radius: var(--radius-sm);
}
.blazor-error-boundary::after { content: "An error has occurred." }

.darker-border-checkbox.form-check-input { border-color: #929292; }

.loading-overlay {
    position: absolute; inset: 0; background: rgba(255,255,255,.6);
    display: flex; align-items: center; justify-content: center; z-index: 5;
}
.spinner {
    width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
    .nav-links { display: none; }
    .app-nav { padding: .65rem 1rem; }
}

/* --------------------------------------------------------------------------
   Auth pages (login / register / account)
   -------------------------------------------------------------------------- */
.auth-wrap { display: flex; justify-content: center; padding: 1rem 0 2rem; }
.auth-card { width: 100%; max-width: 430px; }
.auth-card h1 { font-size: 1.5rem; margin: 0 0 1.25rem; }
.auth-card .form-floating > label { color: var(--text-muted); }

.auth-divider { display: flex; align-items: center; gap: .75rem; color: var(--text-faint); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin: 1.25rem 0; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }

.external-login { margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.btn-provider {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    width: 100%; padding: .65rem 1rem; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); background: #fff; color: var(--text);
    font-weight: 600; font-size: .95rem; cursor: pointer; transition: all .15s ease;
}
.btn-provider:hover { background: var(--surface-2); border-color: var(--text-faint); box-shadow: var(--shadow-sm); }
.btn-provider svg { width: 18px; height: 18px; flex: 0 0 auto; }

.auth-links { margin-top: 1.25rem; display: flex; flex-direction: column; gap: .45rem; font-size: .9rem; }
