:root {
    --ink: #1a1a1a;
    --parchment: #f4f1ea;
    --oxblood: #660000;
    --gold: #c5a059;
    --forest: #1b3022;
    --global-font: 'Courier New', Courier, monospace;
}

/* --- 1. Base Setup --- */
body {
    background-color: var(--forest);
    background-image: url('https://www.transparenttextures.com/patterns/dark-leather.png');
    font-family: var(--global-font);
    color: var(--ink);
    margin: 0; padding: 0;
    display: flex; justify-content: center; align-items: center;
    height: 100vh; 
    width: 100vw;
    overflow: hidden; /* Prevents double scrollbars */
}

.container {
    background-color: var(--parchment);
    width: 100%; 
    max-width: 1400px; 
    height: 100vh; /* Changed from 95vh to 100vh */
    padding: 20px 35px;
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
    border-left: 6px solid var(--gold); 
    border-right: 6px solid var(--gold);
    box-sizing: border-box;
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
}

/* --- 2. Navigation & Headers --- */
header { flex-shrink: 0; text-align: center; margin-bottom: 10px; }
h1, h2 {
    font-family: var(--global-font);
    text-transform: uppercase; letter-spacing: 2px;
    border-bottom: 1px solid var(--gold); color: var(--oxblood);
    margin: 0 0 10px 0;
    font-weight: bold;
}
h1 { font-size: 1.6em; }
h2 { font-size: 1.1em; padding-bottom: 5px; }

nav { 
    margin: 5px 0 10px 0; border-bottom: 1px solid var(--gold); padding-bottom: 10px; 
    display: flex; justify-content: center; gap: 25px; flex-shrink: 0;
}
.nav-btn { 
    text-decoration: none; color: var(--ink); 
    text-transform: uppercase; font-size: 0.9em;
    font-weight: bold;
}
.nav-btn.active { color: var(--oxblood); border-bottom: 2px solid var(--oxblood); }

/* --- 3. DASHBOARD MODE --- */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 2fr; 
    gap: 30px;
    flex: 1;
    min-height: 0;
    margin-bottom: 10px;
}

.profile-grid > section {
    display: flex; flex-direction: column; height: 100%; min-height: 0;
}

.dossier-layout {
    display: flex; flex-direction: column; height: 100%; gap: 15px;
}

/* --- 4. ADMIN & COMPOSE MODE --- */
.admin-main-wrapper {
    display: flex; flex-direction: column;
    flex: 1; min-height: 0; gap: 20px;
}

.admin-top-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 25px; height: 30%; flex-shrink: 0;
}

.admin-bottom-row {
    display: flex; flex-direction: column;
    height: 70%; min-height: 0;
}

.admin-bottom-row textarea {
    flex: 1; min-height: 0; resize: none;
    font-family: var(--global-font); font-size: 1.1em;
    line-height: 1.5; padding: 15px;
    background: #ffffff; border: 1px solid var(--gold);
}

/* --- 5. Mail List Formatting --- */
.mail-bin {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--gold);
    flex: 1; overflow-y: scroll; min-height: 0;
    overflow-x: hidden; 
}

.mail-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px; border-bottom: 1px solid rgba(0,0,0,0.1);
    cursor: pointer; transition: background 0.2s;
    text-decoration: none; color: inherit;
}
.mail-item:hover { background: rgba(0, 0, 0, 0.03); }

.mail-sender { width: 25%; color: var(--oxblood); font-size: 0.95em; }
.mail-subject { width: 55%; font-size: 0.95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 15px; }
.mail-date { width: 20%; text-align: right; font-size: 0.85em; opacity: 0.7; }

.mail-item.unread {
    background: rgba(102, 0, 0, 0.05); 
    border-left: 4px solid var(--oxblood);
}

/* --- 6. Content Boxes & Form Elements --- */
.profile-box, .admin-box {
    background: rgba(255, 255, 255, 0.6); 
    border: 1px solid #d3cfc5; padding: 18px;
    flex: 1; display: flex; flex-direction: column;
    overflow-y: auto; min-height: 0;
    overflow-x: hidden; 
}

.input-group { margin-bottom: 8px; display: flex; flex-direction: column; flex: 1; }
label { 
    text-transform: uppercase; font-size: 0.8em; color: var(--oxblood); 
    margin-bottom: 4px; font-weight: bold; 
}

textarea, input[type="text"], input[type="password"], select {
    width: 100%; background: #ffffff; border: 1px solid var(--gold);
    font-family: var(--global-font); padding: 12px; box-sizing: border-box;
    font-size: 1em; color: var(--ink);
}

.dossier-layout textarea { flex: 1; min-height: 0; resize: none; }

.discreet-save {
    background: none; border: none; color: var(--gold);
    font-size: 0.85em; text-transform: uppercase; cursor: pointer; 
    text-decoration: underline; font-family: var(--global-font);
    font-weight: bold; 
}

/* --- Admin Table Stepper Tweaks --- */
.admin-stat-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.small-stepper {
    height: 30px; /* Slightly shorter for table rows */
}

.small-stepper input {
    width: 40px !important;
    font-size: 0.9em !important;
}

th {
    text-align: center;
}

td {
    vertical-align: middle;
    text-align: center;
}

td:first-child {
    text-align: left; /* Keep names left-aligned */
}

/* --- NEW: TACTILE ARROW STEPPERS --- */
.stat-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--gold);
    background: #fff;
    width: fit-content;
    height: 40px;
    margin-top: 5px;
}

.stat-stepper input {
    width: 50px !important;
    border: none !important;
    text-align: center;
    font-size: 1.1em !important;
    padding: 0 !important;
    height: 100% !important;
}

.stepper-btns {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--gold);
    height: 100%;
}

.step-btn {
    background: var(--parchment);
    border: none;
    color: var(--oxblood);
    cursor: pointer;
    font-size: 0.6em;
    padding: 0 8px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-btn:hover { background: var(--gold); color: #fff; }
.step-btn:first-child { border-bottom: 1px solid var(--gold); }

/* Remove default number arrows */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; margin: 0; 
}

/* --- 7. Exhibit & Mail Reader --- */
#mail-reader { height: 100%; overflow-y: auto; background: #ffffff; }
#read-body { padding-bottom: 50px; line-height: 1.6; white-space: pre-wrap; font-size: 1.05em; color: var(--ink); }
#read-meta p { margin: 5px 0; font-size: 0.9em; text-transform: uppercase; color: var(--oxblood); }

#read-exhibit-container {
    background: var(--parchment); padding: 20px; border: 1px solid var(--gold);
    margin-bottom: 20px; text-align: center;
}

#read-exhibit-img {
    max-width: 100%; max-height: 450px; width: auto; height: auto;
    display: block; margin: 0 auto; border: 1px solid #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* --- 8. Tables & Scrollbars --- */
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; background: #e8e4d9; padding: 12px; text-align: left; border-bottom: 1px solid var(--gold); color: var(--oxblood); font-size: 0.85em; font-weight: bold; }
td { padding: 10px; border-bottom: 1px solid rgba(0,0,0,0.05); font-size: 0.9em; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); }
::-webkit-scrollbar-thumb { background: var(--gold); border: 1px solid var(--parchment); }

footer { flex-shrink: 0; padding: 10px 0; text-align: center; }
.logout-footer-btn {
    text-decoration: none; color: var(--oxblood); border: 1px solid var(--oxblood);
    padding: 8px 25px; text-transform: uppercase; font-size: 0.85em; font-weight: bold;
}