:root {
    --bg: #21160f;
    --panel: rgba(46, 31, 18, 0.94);
    --panel2: rgba(59, 40, 24, 0.92);
    --line: #6e5431;
    --text: #f4e8cc;
    --muted: #c7af80;
    --accent: #c89a4a;
    --accent-dark: #3a2611;
    --accent-soft: #e5c27f;
    --money: #d9c47e;
    --success: #9fb86c;
    --success-dark: #22321a;
    --red: #a54b33;
    --red-dark: #4b1f16;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% 10%, rgba(229, 194, 127, 0.16), transparent 28%),
        linear-gradient(180deg, rgba(31, 20, 12, 0.80), rgba(22, 15, 10, 0.94)),
        url('western-bg.jpg');
    background-size: auto, auto, cover;
    background-position: top left, center center, center right;
    background-repeat: no-repeat, no-repeat, no-repeat;
    background-attachment: fixed, fixed, fixed;
}
a { color: var(--accent-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 14px 24px;
    background: rgba(36, 24, 15, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
}
.brand {
    color: #fff8ea;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: .3px;
}
.topbar nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.nav-user { color: var(--muted); font-size: 13px; }
.container { max-width: 1250px; margin: 0 auto; padding: 24px; }
.login-container { max-width: 460px; margin: 70px auto; }
h1, h2, h3 {
    margin-top: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: .2px;
}
h1 { font-size: 32px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; color: #e9d8b1; }
.card {
    background: linear-gradient(180deg, rgba(54, 36, 21, 0.93), rgba(38, 25, 16, 0.95));
    border: 1px solid rgba(110, 84, 49, 0.95);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 12px 30px rgba(0,0,0,.30);
    margin-bottom: 20px;
    backdrop-filter: blur(3px);
}
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1.25fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-admin { grid-template-columns: 1fr 1fr; }
label { display: block; margin-bottom: 7px; font-weight: 700; color: #eadab3; }
input, select, textarea {
    width: 100%;
    padding: 12px;
    border-radius: 11px;
    border: 1px solid #7a5e37;
    background: rgba(20, 13, 8, 0.92);
    color: #fff7ea;
    font-size: 15px;
    margin-bottom: 14px;
}
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: auto; margin-right: 7px; }
button, .btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    width: auto;
    min-height: 42px;
    padding: 11px 15px;
    border: 1px solid rgba(104, 71, 30, 0.85);
    border-radius: 11px;
    background: linear-gradient(180deg, #d7b06e, var(--accent));
    color: var(--accent-dark);
    font-weight: 800;
    cursor: pointer;
    font-size: 15px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
button.full { width: 100%; }
button:hover, .btn:hover { filter: brightness(.97); text-decoration: none; }
.btn-secondary {
    background: linear-gradient(180deg, #5c452d, #45311f);
    color: #f8edd5;
    border-color: #7c5c35;
}
.btn-danger {
    background: linear-gradient(180deg, #bc5b40, var(--red));
    color: white;
    border-color: #7d2916;
}
.btn-small { padding: 8px 10px; min-height: 34px; font-size: 13px; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 15px; border: 1px solid; }
.alert-success { background: rgba(41, 58, 31, .9); border-color: var(--success); color: #e6f0cf; }
.alert-error { background: rgba(75, 31, 22, .92); border-color: var(--red); color: #f6d3c7; }
.alert-info { background: rgba(80, 59, 29, .92); border-color: var(--accent); color: #f6e8cb; }
.total-general { font-size: 25px; margin: 6px 0 18px; color: var(--accent-soft); font-weight: 900; }
.money { font-weight: 900; color: var(--money); }
.muted, .small { color: var(--muted); }
.small { font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; border-bottom: 1px solid rgba(110, 84, 49, 0.75); text-align: left; vertical-align: top; }
th { background: rgba(25, 16, 10, 0.92); color: var(--accent-soft); position: sticky; top: 0; }
tr:hover td { background: rgba(84, 58, 33, .38); }
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.article-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel2);
    padding: 10px;
    cursor: pointer;
    transition: .12s transform ease, .12s border-color ease;
}
.article-card:hover { transform: translateY(-1px); border-color: var(--accent-soft); }
.article-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(200,154,74,.18); }
.article-card img { width: 52px; height: 52px; object-fit: contain; display: block; margin-bottom: 7px; }
.article-card .name { font-weight: 800; }
.article-card .price { color: var(--money); font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat {
    background: rgba(25, 16, 10, 0.82);
    border: 1px solid rgba(110, 84, 49, 0.85);
    border-radius: 14px;
    padding: 14px;
}
.stat .value { font-size: 23px; font-weight: 900; color: var(--accent-soft); }
.stat .label { color: var(--muted); font-size: 13px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.admin-list-row { border: 1px solid var(--line); background: rgba(27, 18, 11, 0.88); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #5a4327; color: #f9edcf; font-size: 12px; font-weight: 700; }
.badge-admin { background: #7c5b1f; }
.badge-user { background: #4f6530; }
.badge-off { background: #6a5b4f; }
.upload-preview { width: 42px; height: 42px; object-fit: contain; vertical-align: middle; margin-right: 8px; border-radius: 6px; }
.danger-zone {
    border: 2px solid var(--red);
    background: linear-gradient(180deg, rgba(89, 33, 23, .78), rgba(40, 23, 16, .96));
}
.danger-zone h2 { color: #ffd5ca; }
.reset-code { font-size: 18px; letter-spacing: 1px; border-color: var(--red); }
.hero-title { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-admin { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .container { padding: 16px; }
}

.dash-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}
.compact-stats { margin-bottom: 20px; }
.top-global-card { align-self: start; }
.locked-character {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(20, 13, 8, 0.88);
    padding: 12px 14px;
    margin-bottom: 14px;
}
.locked-character strong { display: block; font-size: 18px; color: #fff7e7; margin-top: 3px; }
.employee-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.employee-card-admin { display: flex; flex-direction: column; gap: 10px; }
.employee-mini-history {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 4px;
}
.employee-mini-history p { margin: 6px 0; }
.mini-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 1050px) {
    .dash-top-grid, .employee-admin-grid { grid-template-columns: 1fr; }
}

.top-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.top-column .card {
    margin-bottom: 0;
}


.rank {
    font-size: 20px;
    font-weight: 900;
    width: 54px;
    text-align: center;
}

.badge-super {
    background: #b91c1c;
    color: #fff4f0;
}

.admin-tabs > input {
    display: none;
}

.admin-tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 22px;
    padding: 10px;
    border: 1px solid rgba(110, 84, 49, 0.95);
    border-radius: 16px;
    background: rgba(25, 16, 10, 0.86);
}

.admin-tab-nav label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    min-height: 44px;
    padding: 11px 18px;
    border-radius: 12px;
    border: 1px solid rgba(124, 92, 53, .95);
    background: linear-gradient(180deg, #5c452d, #3f2d1d);
    color: #f8edd5;
    font-weight: 900;
    letter-spacing: .8px;
    cursor: pointer;
}

.admin-tab-nav label:hover {
    filter: brightness(1.08);
}

.admin-tab-nav .tab-reset {
    border-color: #ef4444;
    background: linear-gradient(180deg, #b91c1c, #7f1d1d);
    color: #fff;
}

.admin-panel {
    display: none;
}

#tab-employes:checked ~ .admin-tab-nav label[for="tab-employes"],
#tab-payes:checked ~ .admin-tab-nav label[for="tab-payes"],
#tab-articles:checked ~ .admin-tab-nav label[for="tab-articles"] {
    background: linear-gradient(180deg, #e0b96f, #c89a4a);
    color: #3a2611;
    border-color: #f3d191;
}

#tab-reset:checked ~ .admin-tab-nav label[for="tab-reset"] {
    background: linear-gradient(180deg, #ef4444, #991b1b);
    color: #fff;
    border-color: #fecaca;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, .18);
}

#tab-employes:checked ~ .admin-panels #panel-employes,
#tab-payes:checked ~ .admin-panels #panel-payes,
#tab-articles:checked ~ .admin-panels #panel-articles,
#tab-reset:checked ~ .admin-panels #panel-reset {
    display: block;
}

.reset-panel .card {
    border: 2px solid #ef4444;
    background: linear-gradient(180deg, rgba(127, 29, 29, .78), rgba(48, 20, 15, .96));
}

.reset-panel h2 {
    color: #fecaca;
}

.reset-panel table th {
    color: #fecaca;
}
