/* =====================================================================
   Journal Portal - theme
   ===================================================================== */
:root {
    /* Brand */
    --burgundy: #6D1A36;
    --burgundy-dark: #4E1226;
    --burgundy-light: #8A2B4B;
    --caramel: #C68E4E;
    --caramel-dark: #A87238;
    --caramel-light: #E3BE91;
    --cream: #FAF3E8;
    --cream-dark: #F0E4D0;

    /* Neutrals */
    --ink: #2B1B20;
    --muted: #7A6A66;
    --line: #E6D8C3;
    --white: #FFFFFF;

    /* Status */
    --success: #2F7D4F;
    --success-bg: #E6F3EA;
    --danger: #B3261E;
    --danger-bg: #FBE9E7;
    --warning: #9A6A12;
    --warning-bg: #FFF4D9;
    --info: #28587B;
    --info-bg: #E5EFF7;

    /* Shape */
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 6px 24px rgba(109, 26, 54, 0.10);
    --shadow-sm: 0 1px 3px rgba(43, 27, 32, 0.10);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--cream);
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; color: var(--burgundy); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
a { color: var(--burgundy); }
a:hover { color: var(--burgundy-light); }
.muted { color: var(--muted); }

:focus-visible { outline: 3px solid var(--caramel); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem 1.1rem;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--burgundy); color: var(--cream); }
.btn-primary:hover { background: var(--burgundy-dark); color: var(--cream); }
.btn-accent { background: var(--caramel); color: var(--burgundy-dark); }
.btn-accent:hover { background: var(--caramel-dark); color: var(--white); }
.btn-outline { background: transparent; color: var(--cream); border-color: var(--caramel); }
.btn-outline:hover { background: var(--caramel); color: var(--burgundy-dark); }
.btn-sm { padding: .4rem .8rem; font-size: .875rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; margin-bottom: .35rem; font-weight: 600; font-size: .95rem; }
.input {
    display: block;
    width: 100%;
    padding: .7rem .85rem;
    font: inherit;
    color: var(--ink);
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(198, 142, 78, .25); }
.pw-field { position: relative; }
.pw-field .input { padding-right: 4.5rem; }
.pw-toggle {
    position: absolute; top: 50%; right: .5rem; transform: translateY(-50%);
    padding: .3rem .55rem;
    font: inherit; font-size: .8rem; font-weight: 600;
    color: var(--burgundy); background: var(--cream-dark);
    border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.pw-toggle:hover { background: var(--caramel-light); }
.inline-form { display: inline; margin: 0; }

/* ---------- Alerts ---------- */
.alert {
    margin: 0 0 1rem;
    padding: .75rem 1rem;
    border: 1px solid transparent;
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    font-size: .95rem;
}
.alert-success { color: var(--success); background: var(--success-bg); border-color: var(--success); }
.alert-danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger); }
.alert-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--caramel); }
.alert-info    { color: var(--info);    background: var(--info-bg);    border-color: var(--info); }

/* ---------- Brand ---------- */
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 1.2rem;
    color: var(--burgundy-dark); background: var(--caramel);
    border-radius: 50%;
}
.brand-mark-lg { width: 56px; height: 56px; font-size: 1.9rem; margin-bottom: .6rem; }

/* ---------- Auth pages ---------- */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 15% 10%, rgba(198, 142, 78, .22), transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(109, 26, 54, .18), transparent 45%),
        var(--cream);
}
.auth-card {
    width: 100%; max-width: 410px;
    padding: 2rem 1.75rem;
    background: var(--white);
    border-top: 5px solid var(--burgundy);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand h1 { margin-bottom: .15rem; }
.auth-brand p { margin: 0; }

/* ---------- App shell ---------- */
.topbar { background: var(--burgundy); color: var(--cream); border-bottom: 4px solid var(--caramel); }
.topbar-inner {
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
    max-width: 1200px; margin: 0 auto; padding: .7rem 1.25rem;
}
.brand-link { display: inline-flex; align-items: center; gap: .6rem; color: var(--cream); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand-link:hover { color: var(--caramel-light); }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav-link { padding: .45rem .8rem; color: var(--cream); text-decoration: none; border-radius: var(--radius-sm); font-weight: 500; }
.nav-link:hover { background: var(--burgundy-light); color: var(--white); }
.nav-link.is-active { background: var(--burgundy-dark); color: var(--caramel-light); }
.topbar-user { display: flex; align-items: center; gap: .7rem; }
.user-name { font-weight: 600; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.page-head { margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.site-footer { padding: 1rem 0 2rem; color: var(--muted); font-size: .875rem; text-align: center; }
.site-footer .container { padding-top: 0; padding-bottom: 0; }

/* ---------- Cards, stats, tables ---------- */
.card {
    margin-bottom: 1.5rem; padding: 1.25rem;
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    padding: 1rem 1.1rem;
    background: var(--white);
    border: 1px solid var(--line); border-left: 5px solid var(--caramel);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--burgundy); line-height: 1.1; }
.stat-label { margin-top: .25rem; color: var(--muted); font-size: .9rem; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--burgundy); background: var(--cream); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr:hover { background: var(--cream); }

.badge {
    display: inline-block; padding: .15rem .55rem;
    font-size: .75rem; font-weight: 700; text-transform: capitalize;
    border-radius: 999px; background: var(--cream-dark); color: var(--burgundy);
}
.badge-role { background: var(--caramel); color: var(--burgundy-dark); }
.badge-pending, .badge-queued { background: var(--warning-bg); color: var(--warning); }
.badge-in_progress, .badge-active { background: var(--info-bg); color: var(--info); }
.badge-completed, .badge-approved, .badge-used { background: var(--success-bg); color: var(--success); }
.badge-cancelled, .badge-rejected, .badge-archived { background: var(--danger-bg); color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .topbar-inner { gap: .6rem; }
    .nav { order: 3; flex-basis: 100%; }
    .topbar-user { margin-left: auto; }
    .user-name { display: none; }
    .auth-card { padding: 1.5rem 1.25rem; }
}
