/* SpareSwing Sales - internal tool, brand guide light identity
   (emerald #054F28, charcoal navy #182428, antique gold #A07C2A, white). */
:root {
    --emerald: #054F28;
    --emerald-hover: #0A6B38;
    --navy: #182428;
    --gold: #A07C2A;
    --paper: #FAFAF7;
    --white: #FFFFFF;
    --line: rgba(24, 36, 40, .14);
    --muted: #5b6a60;
    --danger: #b4423a;
    --green-soft: rgba(5, 79, 40, .1);
    --gold-soft: rgba(160, 124, 42, .14);
    --coral-soft: rgba(180, 66, 58, .12);
    --gray-soft: rgba(24, 36, 40, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Montserrat', 'Avenir Next', 'Segoe UI', sans-serif;
    background: var(--paper);
    color: var(--navy);
    font-size: 15px;
    line-height: 1.55;
}

h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: .6rem; }
a { color: var(--emerald); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--gray-soft); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.muted { color: var(--muted); font-size: .9rem; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; }
.brand-tile {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--emerald); font-size: 1.05rem;
}
.brand-name { font-weight: 700; font-size: 1.15rem; color: var(--emerald); }
.brand-name span { color: var(--navy); }
.brand-badge {
    font-size: .66rem; font-weight: 600; letter-spacing: .16em;
    color: var(--gold); border: 1px solid var(--gold);
    padding: 2px 7px; border-radius: 4px;
}

.topnav { display: flex; align-items: center; gap: 22px; font-weight: 500; font-size: .9rem; }
.topnav a.active { color: var(--navy); }
.linklike { background: none; border: none; color: var(--emerald); font: inherit; font-weight: 500; cursor: pointer; }
.linklike:hover { text-decoration: underline; }

.content { flex: 1; max-width: 1120px; width: 100%; margin: 0 auto; padding: 30px 28px 60px; }

/* ---------- Page head / toolbar ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head-actions { display: flex; gap: 10px; }
.backlink { display: inline-block; margin-bottom: 6px; font-size: .85rem; }

.toolbar { display: flex; align-items: center; gap: 14px; margin: 14px 0; }
.search {
    flex: 0 1 340px;
    padding: .55rem .8rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--white);
    font: inherit;
}
.search:focus { outline: none; border-color: var(--emerald); }

/* ---------- Buttons ---------- */
.btn {
    font: inherit; font-weight: 600; font-size: .85rem;
    padding: .55rem 1.1rem;
    border-radius: 6px;
    border: 1px solid var(--emerald);
    background: var(--emerald);
    color: var(--white);
    cursor: pointer;
}
.btn:hover { background: var(--emerald-hover); border-color: var(--emerald-hover); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-outline { background: transparent; color: var(--emerald); }
.btn-outline:hover { background: var(--green-soft); }

.mini {
    font: inherit; font-size: .78rem; font-weight: 600;
    padding: .25rem .6rem;
    border-radius: 5px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--navy);
    cursor: pointer;
}
.mini:hover { border-color: var(--emerald); color: var(--emerald); }
.mini.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- Table ---------- */
.grid {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.grid th, .grid td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); }
.grid th { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--paper); }
.grid tr:last-child td { border-bottom: none; }
.grid tr:hover td { background: rgba(5, 79, 40, .03); }
.grid .num { text-align: right; }
.rowlink { font-weight: 600; }
.rowactions { text-align: right; white-space: nowrap; }
.rowactions .mini { margin-left: 6px; }
.ext { margin-left: 6px; font-size: .8rem; }

/* ---------- Pills / notes ---------- */
.pill { display: inline-block; font-size: .74rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.pill.green { background: var(--green-soft); color: var(--emerald); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.coral { background: var(--coral-soft); color: var(--danger); }
.pill.gray { background: var(--gray-soft); color: var(--muted); }

.note {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .7rem 1rem;
    margin: 10px 0;
    font-size: .9rem;
}
.note.ok { border-color: var(--emerald); background: var(--green-soft); color: var(--emerald); }
.note.warn { border-color: var(--danger); background: var(--coral-soft); color: var(--danger); }

/* ---------- Modal ---------- */
.overlay {
    position: fixed; inset: 0;
    background: rgba(24, 36, 40, .45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.panel {
    background: var(--white);
    border-radius: 10px;
    padding: 26px 26px 22px;
    width: min(560px, 100%);
    max-height: 90vh;
    overflow-y: auto;
}
.panel-actions { display: flex; gap: 10px; margin-top: 18px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 10px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.form-grid input, .form-grid select {
    font: inherit; font-size: .92rem;
    padding: .5rem .7rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--white);
    color: var(--navy);
}
.form-grid input:focus, .form-grid select:focus { outline: none; border-color: var(--emerald); }
.form-grid .span2 { grid-column: span 2; }

/* ---------- Wait / denied ---------- */
.wait { min-height: 50vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.wait-brand { font-weight: 700; font-size: 1.15rem; color: var(--emerald); display: flex; align-items: center; gap: 8px; }
.wait-tile { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; background: var(--emerald); font-size: 1rem; }
.wait-sub { font-size: .66rem; font-weight: 600; letter-spacing: .16em; color: var(--gold); }
.wait-spinner {
    width: 30px; height: 30px; border-radius: 50%;
    border: 3px solid var(--line); border-top-color: var(--emerald);
    animation: sw-spin .8s linear infinite;
}
.wait-msg { color: var(--muted); font-size: .9rem; }
@keyframes sw-spin { to { transform: rotate(360deg); } }

.ops-denied { max-width: 26rem; margin: 16vh auto 0; text-align: center; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 2rem; }
.ops-denied p { margin: .6rem 0 1rem; color: var(--muted); }

/* ---------- Blazor error bar ---------- */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: lightyellow; color: #333;
    padding: .6rem 1.25rem .7rem;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    z-index: 3000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
