:root {
    --bg: #f3f3f3;
    --panel: #ffffff;
    --border: #c8c8c8;
    --text: #222;
    --muted: #666;
    --accent: #2b579a;
    --header: #ededed;
    --ok-bg: #90ee90;      /* Color.LightGreen */
    --ok-fg: #006400;      /* Color.DarkGreen */
    --bad-bg: #f08080;     /* Color.LightCoral */
    --bad-fg: #8b0000;     /* Color.DarkRed */
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 14px;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ---- Import group (groupControl1) ---- */
.group {
    position: relative;
    margin: 0;
    padding: 12px 20px 16px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.group legend {
    float: left;
    width: 100%;
    margin: -12px -20px 12px;
    padding: 6px 20px;
    width: calc(100% + 40px);
    background: var(--header);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.import-grid {
    clear: both;
    display: grid;
    grid-template-columns: 170px minmax(200px, 540px) 112px;
    gap: 12px 20px;
    align-items: center;
}

.lbl { white-space: nowrap; }

.txt {
    height: 30px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: #fafafa;
    font: inherit;
    width: 100%;
}

.actions { display: flex; gap: 12px; }

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 112px;
    height: 34px;
    border: 1px solid #adadad;
    border-radius: 2px;
    background: linear-gradient(#fdfdfd, #e9e9e9);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    user-select: none;
}
.btn:hover { border-color: var(--accent); background: linear-gradient(#f4f8fd, #dce8f7); }
.btn:active { background: #d0e0f4; }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-within, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.hidden-file {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
}

.version {
    position: absolute;
    right: 12px;
    bottom: 6px;
    color: var(--muted);
}

/* ---- Grid (gridControl1 / gridView1) ---- */
.grid-wrap {
    flex: 1;
    overflow: auto;
    background: var(--panel);
}

.grid {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.grid th, .grid td {
    border: 1px solid #dcdcdc;
    padding: 4px 8px;
    text-align: left;
}

.grid thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--header);
    font-weight: 600;
    cursor: pointer;
}
.grid thead th:hover { background: #e2e2e2; }
.grid .sort { font-size: 10px; margin-left: 4px; color: var(--muted); }

.grid .filter-row td {
    position: sticky;
    top: 29px;
    z-index: 1;
    padding: 2px;
    background: #fff;
}
.grid .filter-row input {
    width: 100%;
    min-width: 60px;
    padding: 3px 6px;
    border: 1px solid #e0e0e0;
    font: inherit;
}

.grid tbody tr:nth-child(even) td { background: #fafafa; }
.grid tbody tr:hover td { background: #e8f0fb; }

.grid td.num { text-align: right; }
.grid .center { text-align: center; }
.grid tbody td.status-ok { background: var(--ok-bg) !important; color: var(--ok-fg); }
.grid tbody td.status-mismatch { background: var(--bad-bg) !important; color: var(--bad-fg); }

.grid .empty { text-align: center; color: var(--muted); padding: 40px; }

.grid tfoot td {
    position: sticky;
    bottom: 0;
    background: var(--header);
    color: var(--muted);
    height: 28px;
}

/* ---- Message box ---- */
.mb-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.mb-dialog {
    min-width: 340px;
    max-width: 520px;
    background: #fff;
    border: 1px solid #999;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.mb-title { padding: 8px 14px; background: var(--header); border-bottom: 1px solid var(--border); font-weight: 600; }
.mb-body { display: flex; gap: 14px; padding: 18px 16px; align-items: flex-start; }
.mb-text { white-space: pre-line; padding-top: 6px; }
.mb-icon {
    flex: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff;
}
.mb-icon-warning { background: #e8a800; border-radius: 4px; }
.mb-icon-error { background: #d32f2f; }
.mb-buttons { display: flex; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid #eee; }

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

/* ================= Login & user pages ================= */
.shell { display: flex; flex-direction: column; height: 100vh; }
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.main > .app { flex: 1; min-height: 0; height: auto; }

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 20px;
    height: 44px;
    flex: none;
    background: var(--accent);
    color: #fff;
}
.topbar a { color: #fff; text-decoration: none; opacity: .9; }
.topbar a:hover { opacity: 1; text-decoration: underline; }
.topbar .brand { font-weight: 600; opacity: 1; }
.topbar nav { display: flex; gap: 18px; flex: 1; }
.topbar .who { display: flex; align-items: center; gap: 14px; }
.topbar form { margin: 0; }
.link-btn {
    background: none; border: 1px solid rgba(255,255,255,.6); color: #fff;
    padding: 4px 10px; border-radius: 2px; font: inherit; cursor: pointer;
}
.link-btn:hover { background: rgba(255,255,255,.15); }

.account-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.account-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 6px 24px rgba(0,0,0,.08);
    padding: 28px;
}
.account-title { color: var(--accent); font-weight: 600; margin-bottom: 18px; }
.account-h { font-size: 20px; margin: 0 0 14px; }
.account-hint { color: var(--muted); margin: 0 0 16px; }
.account-version { color: var(--muted); margin-top: 10px; font-size: 12px; }
.account-form, .form-card { display: flex; flex-direction: column; gap: 6px; }
.account-form input, .form-card input, .form-row input:not([type=checkbox]), .row-actions input {
    height: 34px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 2px; font: inherit;
}
.account-form label, .form-card label { margin-top: 8px; }
.account-form .btn, .form-card .btn { margin-top: 16px; width: 100%; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #1f4580; border-color: #1f4580; }
.btn-danger { color: var(--bad-fg); }
.btn-small { width: auto; height: 28px; padding: 0 10px; }
a.btn { text-decoration: none; }

.alert { padding: 8px 12px; margin-bottom: 12px; border: 1px solid; border-radius: 2px; }
.alert-error { background: #fdecea; border-color: #f5c2c0; color: var(--bad-fg); }
.alert-ok { background: #e9f7ec; border-color: #b9e2c1; color: var(--ok-fg); }

.page { padding: 20px 24px; max-width: 1000px; }
.page h1 { font-size: 20px; margin: 0 0 16px; }
.page h2 { font-size: 15px; margin: 24px 0 10px; }
.page .form-card { max-width: 380px; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.form-row .btn { width: auto; padding: 0 16px; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.grid.users td { white-space: nowrap; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.hint { color: var(--muted); margin-top: 16px; }
.page-msg { padding: 40px; text-align: center; color: var(--muted); }
