/* MPY — Banker Design System
 * Warm parchment aesthetic. Light only — no dark mode in the Banker design system.
 * Fonts: Abril Fatface · IM Fell English · Work Sans · Special Elite · JetBrains Mono
 * Loaded from Google Fonts in fragments/head.html */

/* ─── Custom Properties ──────────────────────────────────────────────────── */

:root {
    /* Surfaces — parchment hierarchy */
    --bg:       #F3E6C7;  /* parchment — app background */
    --s1:       #FBF5E1;  /* paper — cards, modal, topbar */
    --s2:       #F5ECCE;  /* paperAlt — sidebar, table header */
    --s3:       #ECDCB4;  /* hover fill */
    --s4:       #E3D0A0;  /* active / deep fill */

    /* Borders */
    --border:   #C9B583;  /* rule — dashed internal dividers */
    --border2:  #2B1D0E;  /* ink — solid surface borders */

    /* Semantic — mapped to preserve existing HTML class references */
    --blue:     #A9301F;   /* stamp red — primary action */
    --blue-bg:  rgba(169,48,31,.09);
    --green:    #16512F;   /* deed green — success / confirm */
    --green-bg: rgba(22,81,47,.09);
    --yellow:   #C99A2E;   /* coin gold — warning / highlight */
    --yellow-bg:rgba(201,154,46,.10);
    --red:      #A9301F;   /* stamp red — danger / error */
    --red-bg:   rgba(169,48,31,.09);
    --orange:   #C07830;

    /* Text */
    --text:     #2B1D0E;  /* ink */
    --t2:       #6F5A3A;  /* ink2 — secondary */
    --t3:       #A08B60;  /* ink3 — muted / labels */

    /* Typography */
    --display: 'Abril Fatface', serif;
    --serif:   'IM Fell English', Georgia, serif;
    --ui:      'Work Sans', system-ui, sans-serif;
    --stampf:  'Special Elite', monospace;
    --mono:    'JetBrains Mono', monospace;
    --sans:    var(--ui);  /* alias for backwards compat */
}

/* ─── Reset / Base ───────────────────────────────────────────────────────── */

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

body {
    font-family: var(--serif);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    background-image: radial-gradient(ellipse at 20% 10%, rgba(255,255,255,0.45) 0%, transparent 50%);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ─── App Shell ──────────────────────────────────────────────────────────── */

.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── Stamp Logo ─────────────────────────────────────────────────────────── */
/* Used in sidebar and login page. Mimics a rubber-stamp impression. */

.stamp-logo {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px double var(--blue);
    border-radius: 8px;
    color: var(--blue);
    font-family: var(--stampf);
    padding: 7px 18px;
    transform: rotate(-3deg);
}

.stamp-logo .top {
    font-size: 7px;
    letter-spacing: 3px;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.85;
}

.stamp-logo .wm {
    font-size: 28px;
    letter-spacing: 8px;
    font-weight: 700;
    line-height: 1;
}

.stamp-logo .bot {
    font-size: 7px;
    letter-spacing: 2px;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.85;
}

.stamp-logo.sm .wm { font-size: 20px; letter-spacing: 5px; }

.stamp-logo.lg .top,
.stamp-logo.lg .bot { font-size: 9px; }
.stamp-logo.lg .wm  { font-size: 48px; letter-spacing: 12px; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar {
    width: 210px;
    min-width: 210px;
    background: var(--s2);
    border-right: 1.5px solid var(--border2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 18px 14px 16px;
    border-bottom: 1.5px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 8px;
}

.sidebar-nav .nav-section-label {
    font-family: var(--ui);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--t3);
    padding: 10px 10px 4px;
}

.sidebar-nav .nav-item {
    display: block;
    padding: 7px 10px;
    margin: 3px 0;
    border-radius: 4px;
    border: 1.5px solid transparent;
    font-family: var(--ui);
    font-size: 13px;
    font-weight: 500;
    color: var(--t2);
    transition: all .12s;
    text-decoration: none;
}

.sidebar-nav .nav-item:hover {
    background: var(--s3);
    color: var(--text);
    text-decoration: none;
}

.sidebar-nav .nav-item.active {
    background: var(--blue-bg);
    color: var(--blue);
    border-color: rgba(169,48,31,.25);
}

.sidebar-user {
    padding: 12px 14px;
    border-top: 1.5px solid var(--border2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--blue-bg);
    border: 1.5px solid var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--stampf);
    font-size: 14px;
    font-weight: 700;
    color: var(--blue);
}

.sidebar-user .user-info .name {
    font-family: var(--ui);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.sidebar-user .user-info .role {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--t3);
}

/* ─── Main Content ───────────────────────────────────────────────────────── */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 52px;
    min-height: 52px;
    background: var(--s1);
    border-bottom: 1.5px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.topbar .page-title {
    font-family: var(--display);
    font-size: 18px;
    color: var(--text);
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

.content-area::-webkit-scrollbar {
    width: 5px;
}

.content-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 6px;
    font-family: var(--ui);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border: 1.5px solid var(--border2);
    background: var(--s1);
    color: var(--t2);
    box-shadow: 1.5px 2px 0 var(--border2);
    cursor: pointer;
    transition: all .12s;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    text-decoration: none;
}

.btn:hover {
    background: var(--s3);
    color: var(--text);
    text-decoration: none;
}

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

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

.btn-primary:hover {
    background: #8B2518;
    border-color: #8B2518;
    color: var(--s1);
}

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

.btn-danger:hover {
    background: var(--blue);
    color: var(--s1);
}

.btn-success {
    background: var(--green);
    border-color: var(--green);
    color: var(--s1);
}

.btn-success:hover {
    background: #0E3D20;
    border-color: #0E3D20;
    color: var(--s1);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 10px;
    letter-spacing: 1px;
    min-height: 32px;
    min-width: 32px;
    box-shadow: 1px 1.5px 0 var(--border2);
}

.btn-xs {
    padding: 3px 7px;
    font-size: 10px;
    letter-spacing: 0.8px;
    min-height: 28px;
    min-width: 28px;
    box-shadow: 1px 1px 0 var(--border2);
}

/* ─── Status Badges ──────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

.badge::before {
    content: '\25CF';
    font-size: 7px;
}

.b-gr { background: var(--green-bg); color: var(--green); }
.b-yw { background: var(--yellow-bg); color: var(--yellow); }
.b-rd { background: var(--red-bg); color: var(--red); }
.b-bl { background: var(--blue-bg); color: var(--blue); }
.b-gy { background: var(--s3); color: var(--t2); }

/* ─── Tables ─────────────────────────────────────────────────────────────── */

.table-wrapper {
    background: var(--s1);
    border: 1.5px solid var(--border2);
    border-radius: 6px;
    box-shadow: 2px 3px 0 var(--border2);
    overflow: hidden;
}

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
}

.table-wrapper thead th {
    background: var(--s2);
    font-family: var(--ui);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--t3);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1.5px solid var(--border2);
}

.table-wrapper tbody td {
    padding: 10px 14px;
    border-bottom: 1px dashed var(--border);
    font-family: var(--serif);
    font-size: 13px;
    color: var(--t2);
}

.table-wrapper tbody tr:last-child td {
    border-bottom: none;
}

.table-wrapper tbody tr:hover {
    background: var(--s3);
}

.table-wrapper .mn {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--t2);
}

.table-wrapper .pr {
    font-family: var(--ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

/* ─── Form Inputs ────────────────────────────────────────────────────────── */

.finp {
    background: var(--s1);
    border: 1.5px solid var(--border);
    border-radius: 4px;
    padding: 8px 10px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--serif);
    min-height: 44px;
    width: 100%;
}

.finp:focus {
    outline: none;
    border-color: var(--border2);
}

.finp::placeholder {
    color: var(--t3);
    font-style: italic;
}

.form-label {
    display: block;
    font-family: var(--ui);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--t3);
    margin-bottom: 4px;
}

.form-group {
    margin-bottom: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */

.card {
    background: var(--s1);
    border: 1.5px solid var(--border2);
    border-radius: 6px;
    box-shadow: 2px 3px 0 var(--border2);
    padding: 18px 20px;
}

.card-title {
    font-family: var(--ui);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--t3);
    margin-bottom: 14px;
}

/* ─── Modal ──────────────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(43,29,14,.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    width: 420px;
    max-width: 90vw;
    background: var(--s1);
    border: 1.5px solid var(--border2);
    border-radius: 6px;
    box-shadow: 4px 6px 0 var(--border2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px dashed var(--border);
}

.modal-header .modal-title {
    font-family: var(--ui);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    color: var(--t3);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 18px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px dashed var(--border);
}

/* ─── Alerts ─────────────────────────────────────────────────────────────── */

.alert {
    padding: 10px 14px;
    border-radius: 4px;
    font-family: var(--serif);
    font-size: 13px;
    font-style: italic;
    margin-bottom: 14px;
    border: 1.5px solid;
}

.alert-error {
    background: var(--red-bg);
    border-color: var(--red);
    color: var(--red);
}

.alert-success {
    background: var(--green-bg);
    border-color: var(--green);
    color: var(--green);
}

.alert-warning {
    background: var(--yellow-bg);
    border-color: var(--yellow);
    color: var(--yellow);
}

/* ─── Section Divider ────────────────────────────────────────────────────── */

.section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.section-divider span {
    font-family: var(--ui);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--t3);
    white-space: nowrap;
}

/* ─── Login Page ─────────────────────────────────────────────────────────── */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 380px;
    max-width: 100%;
    background: var(--s1);
    border: 1.5px solid var(--border2);
    border-radius: 6px;
    box-shadow: 3px 4px 0 var(--border2);
    padding: 36px 32px;
}

.login-card .login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.login-card .login-logo .subtitle {
    font-family: var(--serif);
    font-size: 14px;
    font-style: italic;
    color: var(--t2);
}

/* ─── Utility ────────────────────────────────────────────────────────────── */

.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.gap-8  { gap: 8px; }
.flex   { display: flex; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.text-right      { text-align: right; }
.hidden          { display: none !important; }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .topbar {
        padding: 0 12px;
    }

    .content-area {
        padding: 12px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

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

    .modal {
        width: 95vw;
    }
}

/* ── Build revision marker ────────────────────────────────────────────────
   Version label shown in the topbar on app-shell pages and beneath the login
   card. Sourced from the pom <version> via the appVersion model attribute
   (GlobalModelAttributes). React-shell pages (lobby, setup, dashboard) render
   their own equivalent marker from the Vite __APP_VERSION__ build constant. */
.topbar-version {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--t2);
    white-space: nowrap;
    user-select: none;
}

.login-version {
    margin-top: 14px;
    text-align: center;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .05em;
    color: var(--t3);
    user-select: none;
}
