:root {
    --bg: #f5f7fb;
    --ink: #1f2d3d;
    --navy: #1c2b42;
    --blue: #215baa;
    --blue-dark: #1a4a8a;
    --green: #127a52;
    --red: #b9482c;
    --line: #e4e9f1;
    --muted: #6b7891;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
}

h1, h2, h3 { margin: 0; }

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; }

.topbar { background: var(--navy); color: #fff; }
.topbar-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 24px;
    height: 56px; display: flex; align-items: center; gap: 24px;
}
.brand { color: #fff; font-size: 20px; font-weight: 700; text-decoration: none; }
.topnav { display: flex; gap: 6px; flex: 1; }
.topnav-link {
    color: #c8d4e6; text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 600;
}
.topnav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.topnav-link.active { background: var(--blue); color: #fff; }
.logout-form { display: flex; align-items: center; gap: 12px; }
.topbar-user { color: #c8d4e6; }
.logout-btn {
    background: transparent; border: 1px solid #44567a; color: #fff;
    padding: 6px 14px; border-radius: 8px; cursor: pointer;
}
.logout-btn:hover { background: rgba(255,255,255,.1); }

.content { max-width: 1280px; margin: 0 auto; padding: 24px; }

.dash-header { margin-bottom: 20px; }
.dash-header h1 { font-size: 24px; }
.dash-header p { color: var(--muted); margin: 4px 0 0; }

/* ---------- Cards ---------- */
.dash-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px;
}
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }

.card {
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    padding: 20px; box-shadow: 0 1px 3px rgba(20,40,80,.04);
}
.card-wide { margin-top: 0; }
.card-title { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }

/* ---------- Form ---------- */
label { display: block; font-weight: 600; margin: 10px 0 4px; font-size: 13px; }
.inp {
    width: 100%; padding: 8px 10px; border: 1px solid #cfd8e6; border-radius: 8px;
    background: #f8fafc; color: var(--ink); font: inherit;
}
.inp:focus { outline: none; border-color: var(--blue); background: #fff; }
textarea.inp { resize: vertical; }
.form-row { display: flex; gap: 12px; }
.form-col { flex: 1; }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.form-error { color: var(--red); font-size: 13px; margin-top: 8px; }

/* ---------- Buttons ---------- */
.btn {
    border: none; border-radius: 8px; padding: 9px 16px; font-weight: 600;
    cursor: pointer; font: inherit; font-weight: 600;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { background: #9bb3d6; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid #c4cdda; }
.btn-secondary:hover { background: #f0f4f9; }
.btn-block { width: 100%; margin-top: 14px; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }

/* ---------- Summary ---------- */
.summary-row { display: flex; gap: 12px; margin: 8px 0 14px; flex-wrap: wrap; }
.summary-row .summary-box { flex: 1; }
.summary-box {
    display: flex; flex-direction: column; gap: 4px;
    background: #f7f9fc; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
}
.summary-box span { color: var(--muted); font-size: 13px; }
.summary-box strong { font-size: 18px; }
.summary-green strong { color: var(--green); }
.summary-red strong { color: var(--red); }
.summary-blue strong { color: var(--navy); }

/* ---------- Customers ---------- */
.customer-list { list-style: none; margin: 12px 0; padding: 0; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.customer-list li {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f0f3f8;
}
.customer-list li:last-child { border-bottom: none; }
.customer-list li:hover { background: #f3f7fc; }
.customer-list li.selected { background: #dde8fa; }
.customer-list li.empty { color: var(--muted); cursor: default; justify-content: center; }
.row-del { background: transparent; border: none; color: #b0baca; cursor: pointer; font-size: 14px; }
.row-del:hover { color: var(--red); }
.add-customer { margin-top: 10px; }

/* ---------- Grid / table ---------- */
.filter-tag { background: #dde8fa; color: var(--navy); border-radius: 20px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.filter-tag button { background: transparent; border: none; cursor: pointer; color: var(--navy); }
.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; }
.grid th {
    text-align: left; background: #eff3f8; color: var(--navy); padding: 10px 12px;
    font-size: 13px; border-bottom: 1px solid var(--line);
}
.grid td { padding: 10px 12px; border-bottom: 1px solid #f0f3f8; }
.grid tr:hover td { background: #fafbfe; }
.grid .empty { text-align: center; color: var(--muted); padding: 24px; }
.badge { padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green { background: #e3f3ec; color: var(--green); }
.badge-red { background: #fae6e0; color: var(--red); }
.row-actions { white-space: nowrap; }
.link-btn { background: transparent; border: none; color: var(--blue); cursor: pointer; font: inherit; padding: 2px 6px; }
.link-btn:hover { text-decoration: underline; }
.link-danger { color: var(--red); }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(20,30,50,.45);
    display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
    background: #fff; border-radius: 14px; padding: 24px; width: 420px; max-width: 92vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal h3 { margin-bottom: 12px; }

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1c2b42, #2a4570);
}
.login-card {
    background: #fff; border-radius: 16px; padding: 32px; width: 360px; max-width: 92vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-title { font-size: 28px; color: var(--navy); text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin: 4px 0 20px; }
.login-label { font-weight: 600; font-size: 13px; margin-top: 12px; }
.login-input {
    width: 100%; padding: 10px 12px; border: 1px solid #cfd8e6; border-radius: 8px;
    background: #f8fafc; font: inherit; margin-top: 4px;
}
.login-input:focus { outline: none; border-color: var(--blue); background: #fff; }
.login-btn {
    width: 100%; margin-top: 20px; background: var(--blue); color: #fff; border: none;
    padding: 11px; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 15px;
}
.login-btn:hover { background: var(--blue-dark); }
.login-error {
    background: #fae6e0; color: var(--red); padding: 10px 12px; border-radius: 8px;
    font-size: 13px; margin-bottom: 12px;
}

/* ---------- Blazor error UI ---------- */
#blazor-error-ui {
    background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: 0.6rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
