/* Inglis admin console.
   Palette and type are taken from the public site so the two read as one product:
   red #c8102e, navy #0b1f33, Inter, and square corners throughout. */

:root {
    --red: #c8102e;
    --red-dark: #a50d25;
    --red-soft: #fdf2f4;
    --navy: #0b1f33;
    --navy-mid: #16324f;
    --ink: #0f172a;
    --muted: #5b6b7c;
    --soft: #f4f6f8;
    --line: #e6ebf0;
    --white: #ffffff;

    --ok: #0f7b4f;
    --ok-soft: #ecfdf3;
    --warn: #a15c07;
    --warn-soft: #fffaeb;
    --danger: #b42318;
    --danger-soft: #fef3f2;

    --sidebar-width: 236px;
    --topbar-height: 60px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--soft);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Operators scan this interface all day; a visible focus ring is not optional. */
:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------- layout */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--navy);
    color: rgba(255, 255, 255, 0.72);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand img {
    height: 26px;
    width: auto;
    display: block;
    /* The wordmark is dark; the rail is navy. */
    filter: brightness(0) invert(1);
}

.sidebar-brand span {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-group-label {
    padding: 14px 20px 6px;
    font-size: 10px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 20px;
    background: none;
    border: 0;
    border-left: 3px solid transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--white);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.09);
    border-left-color: var(--red);
    color: var(--white);
    font-weight: 600;
}

.nav-count {
    min-width: 20px;
    padding: 1px 6px;
    background: var(--red);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.nav-count:empty,
.nav-count[data-count="0"] {
    display: none;
}

.sidebar-user {
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
}

.sidebar-user .who {
    color: var(--white);
    font-weight: 600;
    word-break: break-all;
}

.role-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.14);
    color: var(--white);
}

.role-badge.manager {
    background: var(--red);
}

.link-button {
    margin-top: 10px;
    padding: 0;
    background: none;
    border: 0;
    color: rgba(255, 255, 255, 0.66);
    font: inherit;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}

.link-button:hover {
    color: var(--white);
}

/* ---------------------------------------------------------------- topbar */

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.topbar .spacer {
    flex: 1;
}

.session-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
}

.session-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
}

.session-pill.idle .session-dot {
    background: var(--warn);
}

.content {
    padding: 24px;
    max-width: 1400px;
    width: 100%;
}

/* ---------------------------------------------------------------- pieces */

.panel {
    background: var(--white);
    border: 1px solid var(--line);
    margin-bottom: 20px;
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.panel-head .spacer {
    flex: 1;
}

.panel-body {
    padding: 18px;
}

.panel-body.flush {
    padding: 0;
}

.hint {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

/* buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid var(--navy);
    background: var(--navy);
    color: var(--white);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    background: var(--navy-mid);
    border-color: var(--navy-mid);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn.primary {
    background: var(--red);
    border-color: var(--red);
}

.btn.primary:hover:not(:disabled) {
    background: var(--red-dark);
    border-color: var(--red-dark);
}

.btn.ghost {
    background: var(--white);
    border-color: var(--line);
    color: var(--ink);
}

.btn.ghost:hover:not(:disabled) {
    background: var(--soft);
    border-color: var(--muted);
}

.btn.danger {
    background: var(--white);
    border-color: var(--danger);
    color: var(--danger);
}

.btn.danger:hover:not(:disabled) {
    background: var(--danger);
    color: var(--white);
}

.btn.small {
    padding: 6px 11px;
    font-size: 12px;
}

/* forms */

label.field {
    display: block;
    margin-bottom: 14px;
}

label.field > span {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--navy);
    outline: none;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar input[type="text"],
.toolbar input[type="email"] {
    max-width: 340px;
}

/* tables */

table.grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.grid th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    background: var(--soft);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.grid td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.grid tbody tr:hover {
    background: var(--soft);
}

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

code,
.mono {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 12.5px;
    background: var(--soft);
    padding: 1px 5px;
}

/* status chips */

.chip {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    background: var(--soft);
    color: var(--muted);
    border: 1px solid var(--line);
}

.chip.ok {
    background: var(--ok-soft);
    color: var(--ok);
    border-color: transparent;
}

.chip.warn {
    background: var(--warn-soft);
    color: var(--warn);
    border-color: transparent;
}

.chip.danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

/* empty and error states: an operator must never confuse "nothing" with "broken" */

.state {
    padding: 34px 18px;
    text-align: center;
    color: var(--muted);
}

.state strong {
    display: block;
    margin-bottom: 5px;
    color: var(--ink);
    font-size: 14px;
}

.state.error {
    background: var(--danger-soft);
    color: var(--danger);
    text-align: left;
    padding: 14px 18px;
    border-left: 3px solid var(--danger);
}

.state.error strong {
    color: var(--danger);
}

/* skeleton shimmer while data loads */

.skeleton-row {
    height: 14px;
    margin: 12px 18px;
    background: linear-gradient(90deg, var(--soft) 25%, #eef1f4 37%, var(--soft) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-row {
        animation: none;
    }
}

/* case cards (dispute queue) */

.case {
    border: 1px solid var(--line);
    border-left: 3px solid var(--muted);
    margin-bottom: 12px;
    background: var(--white);
}

.case.mine {
    border-left-color: var(--ok);
}

.case.taken {
    border-left-color: var(--warn);
}

.case-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.case-amount {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.case-meta {
    color: var(--muted);
    font-size: 12.5px;
}

.case-body {
    padding: 0 16px 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.case-side {
    border: 1px solid var(--line);
    padding: 11px 13px;
    background: var(--soft);
}

.case-side h4 {
    margin: 0 0 5px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
}

.case-statement {
    margin: 0;
    font-size: 13px;
    color: var(--ink);
}

.case-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 14px;
    flex-wrap: wrap;
}

.claim-flag {
    font-size: 12px;
    font-weight: 600;
    color: var(--warn);
}

/* actions catalogue */

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.action-card {
    border: 1px solid var(--line);
    padding: 13px 15px;
    background: var(--white);
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.action-card:hover {
    border-color: var(--navy);
}

.action-card h4 {
    margin: 0 0 4px;
    font-size: 13.5px;
    font-weight: 600;
}

.action-card p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.action-card .row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
}

/* An action with no implementation is shown as such rather than hidden: the
   operator needs to know it exists and is not yet available. */
.action-card.unavailable {
    background: var(--soft);
    cursor: not-allowed;
    opacity: 0.72;
}

.action-card.unavailable:hover {
    border-color: var(--line);
}

.action-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

/* modal */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 31, 51, 0.55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    z-index: 60;
}

.modal {
    background: var(--white);
    border: 1px solid var(--line);
    width: 100%;
    max-width: 620px;
}

.modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--line);
}

.modal-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.modal-body {
    padding: 20px;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    background: var(--soft);
}

.icon-button {
    background: none;
    border: 0;
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
}

.icon-button:hover {
    color: var(--ink);
}

/* toasts replace the alert() calls the console used to fire */

.toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 90;
    max-width: 380px;
}

.toast {
    padding: 12px 15px;
    background: var(--navy);
    color: var(--white);
    font-size: 13px;
    border-left: 3px solid var(--muted);
    box-shadow: 0 8px 24px rgba(11, 31, 51, 0.2);
}

.toast.ok {
    border-left-color: #34d399;
}

.toast.error {
    border-left-color: var(--red);
}

.toast.warn {
    border-left-color: #fbbf24;
}

/* stats */

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat {
    background: var(--white);
    border: 1px solid var(--line);
    padding: 15px 17px;
}

.stat .value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stat .label {
    margin-top: 3px;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
}

/* audit feed */

.feed-item {
    display: flex;
    gap: 12px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.feed-when {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    min-width: 116px;
}

.feed-actor {
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* ---------------------------------------------------------------- login */

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}

.login-hero {
    background: var(--navy);
    color: var(--white);
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-hero img {
    height: 30px;
    width: auto;
    filter: brightness(0) invert(1);
}

.login-hero h2 {
    font-size: 30px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 12px;
    max-width: 420px;
}

.login-hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    max-width: 420px;
}

.login-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--white);
}

.login-card {
    width: 100%;
    max-width: 340px;
}

.login-card h1 {
    font-size: 21px;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}

.login-card > p {
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 13.5px;
}

.form-error {
    margin-bottom: 16px;
    padding: 10px 13px;
    background: var(--danger-soft);
    border-left: 3px solid var(--danger);
    color: var(--danger);
    font-size: 13px;
}

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

    .sidebar {
        position: static;
        height: auto;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        display: none;
    }
}
