@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@600;700&display=swap');

:root {
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol", sans-serif;
    --font-heading: "Poppins", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --sidebar-bg: #775922;
    --sidebar-fg: #ffffff;
    --sidebar-accent: #BB8D3B;
    --focus-ring: 2px solid #ffd166;
    --line-body: 1.6;
    --line-heading: 1.25;
    --sidebar-w:260px;
    --sidebar-mini:64px;
    --launcher-size-m: 56px;
    --launcher-icon-m: 28px;
    --launcher-top-m: 20px;
    --launcher-left-m: 16px;

    --brand:#5B4424;
    --paper:#F6EFE5;
    --beige:#E9D8BF;
    --text:#2B2B2B;
    --muted:#6B5E52;
    --card:#FFFFFF;
    --ink:#2B2B2B;
    --line:#E8E0D6;
    --focus:#C9AE7A;
    --sb-bg-active: #B98C3E;
    --sb-fg-dim: rgba(255,255,255,.85);
    --sb-hover: rgba(255,255,255,.12);
}
html {
    font-size: 12px;
    height: 100%
}

body {
    font-family: var(--font-body);
    line-height: var(--line-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2B2B2B;
    background:var(--paper);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6,
.heading, .sidebar__brand, .navbar-brand {
    font-family: var(--font-heading);
    line-height: var(--line-heading);
    letter-spacing: 0.2px;
}
h1 { font-weight: 700; font-size: clamp(2rem, 1.6rem + 1.2vw, 2.5rem); }
h2 { font-weight: 700; font-size: clamp(1.5rem, 1.3rem + 0.6vw, 2rem); }
h3 { font-weight: 600; font-size: 1.25rem; }
strong, b { font-weight: 600; }

button, input, select, textarea, .sidebar__link, .btn {
    font-family: var(--font-body);
    font-weight: 500;
}

.sidebar__launcher{ z-index: 3050; }
.sidebar__launcher,
.sidebar__toggle{
    background:transparent;border:0;box-shadow:none;border-radius:0;
    padding:0;margin:0;-webkit-appearance:none;appearance:none;
    display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;cursor:pointer;color:#fff!important;
}
.sidebar__launcher i,.sidebar__toggle i{color:#fff;font-size:22px;line-height:1}
.sidebar__launcher:focus-visible,.sidebar__toggle:focus-visible{outline:var(--focus-ring);outline-offset:2px}
.sidebar__launcher:hover,.sidebar__launcher:active,.sidebar__launcher:focus,
.sidebar__toggle:hover,.sidebar__toggle:active,.sidebar__toggle:focus{
    background:transparent;box-shadow:none;color:#fff;
}

.sidebar{
    position:fixed;top:0;left:0;height:100%;z-index:6000;
    background:var(--sidebar-bg);color:var(--sidebar-fg);
    display:flex;flex-direction:column;overflow-x:visible;overflow-y:auto;
    transition:width .25s ease,left .25s ease;
}
.sidebar__header{display:flex;align-items:center;justify-content:space-between;padding:12px 12px}
.sidebar__brand{font:700 18px/1.1 var(--font-heading);white-space:nowrap}
.sidebar__menu{padding:8px 6px}
.sidebar__list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.sidebar__icon{width:22px;height:22px;object-fit:contain;filter:brightness(0) invert(1)}
.sidebar__link{display:flex;align-items:center;gap:12px;padding:12px 12px;border-radius:10px;color:var(--sidebar-fg);text-decoration:none;font-weight:600;line-height:1}
.sidebar__list .sidebar__link:hover,
.sidebar__list .sidebar__link:focus{
    background: var(--sb-hover);
    color: var(--sidebar-fg);
    border-radius: 10px;
}
.sidebar__link.is-active{
    background: rgba(255,255,255,.15);
    border-radius: 10px;
}
@media (min-width:769px){
    body.sidebar-collapsed .sidebar__list .sidebar__link:hover{
        background: rgba(255,255,255,.18);
    }
}
.sidebar__text{transition:opacity .18s ease,visibility .18s ease}

.main-content{flex:1;padding:1rem;transition:margin-left .25s ease,transform .25s ease;
    z-index: 0;
    position: relative;
    transform: none;  }
.sb-tip{
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: #111827;
    color: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
    font-size: 13px;
    line-height: 1;
    display: none;
    z-index: 6500;
    pointer-events: none;
}
.sb-tip::after{
    content: "";
    position: absolute;
    right: 100%; top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #111827;
}

@media (min-width:769px){
    .sidebar__launcher{display:none!important}
    .sidebar__toggle{display:inline-flex!important}
    .main-content{ margin-left: var(--sidebar-mini, 64px); }

    body.sidebar-collapsed .sidebar{width:var(--sidebar-mini);left:0}
    body.sidebar-collapsed .main-content{margin-left:var(--sidebar-mini)}
    body.sidebar-collapsed .sidebar__header{justify-content:center;padding:8px 0}
    body.sidebar-collapsed .sidebar__brand{display:none}
    body.sidebar-collapsed .sidebar__list{gap:12px}
    body.sidebar-collapsed .sidebar__link{height:48px;padding: 0;justify-content:center;gap:0; position: relative; }
    body.sidebar-collapsed .sidebar__link:hover .sb-tip{ display: inline-block; }
    body.sidebar-collapsed .sidebar__text{display:none}
    body.sidebar-collapsed .sidebar__link.is-active{background:rgba(255,255,255,.15);border-radius:10px}

    body.sidebar-expanded .sidebar{width:var(--sidebar-w);left:0}
    body.sidebar-expanded .main-content{ margin-left: var(--sidebar-w, 260px);}
        body.sidebar-expanded .sidebar__brand,
    body.sidebar-expanded .sidebar__text{display:inline;}
}



@media (max-width:768px){
    .sidebar{width:var(--sidebar-w);left:calc(-1 * var(--sidebar-w))}
    .sidebar[data-open="true"]{left:0}
    .sidebar__toggle{display:inline-flex;align-items:center}
    .main-content{margin-left:0}
    .sidebar__launcher{
        background: none;
        box-shadow: none;
        top: calc(var(--launcher-top-m) + env(safe-area-inset-top));
        left: var(--launcher-left-m);
        width: var(--launcher-size-m);
        height: var(--launcher-size-m);
    }
    .sidebar__launcher i{
        font-size: var(--launcher-icon-m);
        color: var(--sidebar-bg);
    }
    .sidebar-open .sidebar__launcher{
        color: var(--sidebar-bg)!important;
    }
        .sidebar__launcher:hover,
        .sidebar__launcher:active,
        .sidebar__launcher:focus{
            background: transparent;
        }
}

.sidebar__scrim{position:fixed;inset:0;z-index:900;background:rgba(0,0,0,.35);display:none;border:0}
.sidebar-open .sidebar__scrim{display:block}

.skip-link{position:absolute;left:-9999px}
.skip-link:focus{position:static;background:#fff;color:#000;padding:.5rem}
@media (min-width:769px){
    .sidebar{ width: var(--sidebar-mini, 64px); }
}

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

/** Login Page **/
.login-shell{
    display:grid;
    grid-template-columns: minmax(320px, 45%) 1fr;
    min-height:100vh;
}

.login-hero{
    position:relative;
    background:#523e19;
    color:#fff;
    padding:56px;
    display:flex;
    flex-direction:column;
    justify-content: center;
}

.login-hero__brand{
    position: absolute;
    top: 24px;
    left: 56px;
}
.login-hero__brand .brand{height:28px}
.login-hero__copy{ max-width: 520px; }

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrapper input {
    flex: 1;
    padding-right: 40px; /* space for eye icon */
}
.toggle-password {
    position: absolute;
    right: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.toggle-password img {
    width: 20px;
    height: 20px;
    opacity: 0.6;
}
.toggle-password img:hover {
    opacity: 1;
}


.hero-title{
    color: #ffffff;
    font-family:"Poppins", system-ui, sans-serif;
    font-weight:700; font-size:40px; margin:0 0 8px;
}
.hero-sub{font: 400 20px/1.5 "Inter", system-ui, sans-serif; margin:0}
.hero-bg{position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:.08;}

.login-panel{
    background: var(--paper);
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.panel-title{
    font:700 36px/1.2 "Poppins", system-ui, sans-serif;
    color:var(--brand); letter-spacing:.5px; margin:0 0 8px;
}

.login-form{width:min(560px, 100%); display:flex; flex-direction:column; gap:18px}
.field{display:flex; flex-direction:column; gap:8px}
.field__label{
    display:flex; align-items:center; gap:10px;
    color:var(--brand); font:600 16px/1 "Poppins", system-ui, sans-serif;
}
.field__icon img{width:20px; height:20px; display:block}

.input{
    width:100%;
    border:2px solid var(--brand);
    background:#fff; color:var(--text);
    border-radius:14px; padding:14px 16px;
    font:500 16px/1.2 "Inter", system-ui, sans-serif;
}
.input::placeholder{color:#A3927D}
.input:focus{outline:3px solid var(--focus); outline-offset:2px}

.row-between{display:flex; align-items:center; justify-content:space-between}
.link{color:var(--brand); text-decoration:none; font-weight:600}
.link:hover{text-decoration:underline}

.check{display:inline-flex; align-items:center; gap:10px; cursor:pointer; user-select:none}
.check__input{appearance:none; width:0; height:0; position:absolute; opacity:0}
.check__box{
    width:24px; height:24px; border:2px solid var(--brand); border-radius:8px; background:#fff;
    display:inline-block; position:relative;
}
.check__input:checked + .check__box{
    background:var(--beige); border-color:var(--brand);
}
.check__input:checked + .check__box::after{
    content:""; position:absolute; left:6px; top:1px; width:8px; height:14px;
    border:3px solid var(--brand); border-top:0; border-left:0; transform:rotate(45deg);
}
.check__label{font:500 16px "Inter", system-ui, sans-serif; color:var(--text)}

.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:0;
    cursor:pointer;
    border-radius:28px;
    padding:14px 28px;
    font:700 16px/1 var(--font-body);
    text-align:center;
    min-height:48px;
    box-sizing:border-box;
    max-width:100%;
}

.btn-primary{
    background:var(--brand);
    color:#fff;
    box-shadow:0 8px 0 rgba(0,0,0,.12);
}
.btn-primary:hover{filter:brightness(1.05)}

.btn-sm { padding:10px 20px; border-radius:22px; font-size:14px; }
.btn-md { padding:14px 28px; }
.btn-lg { padding:16px 36px; border-radius:32px; }

.btn-auto  { width:auto; }
.btn-block { width:100%; }

.login-form .btn { align-self:center; }

.g-recaptcha{margin-top:8px}

@media (max-width: 960px){
    .login-shell{grid-template-columns: 1fr}
    .login-hero{min-height:220px; padding:28px 24px}
    .login-panel{padding:40px 24px}
    .panel-title{font-size:28px}
}

.topbar{
    position: sticky;
    top: 0;
    z-index: 900;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--paper, #F6EFE5);
    border: 0;
    display:grid;
    grid-template-columns: auto minmax(0,1fr) auto; /* burger | title | user */
    gap: 10px;
    flex-wrap: nowrap;
}
.topbar__left{ padding-left: 40px; min-width:0; }
.topbar__title{
    margin:0; font: 800 2rem/1.2 var(--font-heading, "Poppins", system-ui);
    color: #57441e; letter-spacing:.05em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__burger{ display:none; }
@media (min-width: 769px){
    .topbar{ padding-left: var(--sidebar-mini, 64px); }
    .main-content{ margin-left: var(--sidebar-mini, 64px); }
    .topbar__burger { display: none !important; }
    body.sidebar-expanded .topbar{ padding-left: var(--sidebar-w, 260px); }
    body.sidebar-expanded .main-content{ margin-left: var(--sidebar-w, 260px); }
}

@media (max-width: 768px){
    .topbar__title{ font-size:20px; }
    .topbar{ padding-left: 12px; grid-template-columns: auto minmax(0,1fr) auto; }
    .topbar__left{ padding-left: 0; gap: 8px; }
    .sidebar__launcher{ display:none; }
    .topbar__burger{
        display: inline-flex;
        transform: translateY(6px);
        background: transparent;
        border: 0;
        box-shadow: none;
        filter: none;
        -webkit-tap-highlight-color: transparent;
        transition: border-color .15s ease, color .15s ease, transform .05s ease;
        color: var(--sidebar-bg);
    }

    .topbar__burger i{
        color: currentColor;
        font-size: 20px;
    }

    .topbar__burger:hover,
    .topbar__burger:focus{
        background: transparent;
        color: var(--sidebar-bg);
        border-color: var(--sidebar-bg);
    }

    .topbar__burger:focus-visible{
        outline: var(--focus-ring);
        outline-offset: 2px;
        border-color: var(--sidebar-bg) !important;
    }

    /* Tiny press feedback */
    .topbar__burger:active{ transform: scale(0.98); }
}

.topbar__left{ display:flex; align-items:center; gap:16px; }
.topbar__right{ margin-left: auto; display:flex; align-items:center; gap:12px;
}

.topbar__brand{ display:none; }

.icon-btn{
    display:inline-flex; align-items:center; justify-content:center;
    width:38px; height:38px; border-radius:999px;
    border:0; background:transparent; cursor:pointer;
}
.icon-btn:hover{ filter:brightness(.98); }

.userchip{
    position:relative;
    padding:0;
    background:transparent;
    border:0;
}

.userchip__frame{
    display:flex;
    align-items:center;
    gap:10px;
    padding:6px 10px;
    border:2px solid var(--brand);
    border-radius:999px;
    background:transparent;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.userchip__avatar{
    width:32px; height:32px; border-radius:999px;
    border: 2px solid var(--brand);
    background:#E9D8BF; color:#5B4424; display:grid; place-items:center; font-weight:700;
}

.userchip__meta{ line-height:1.1; }
.userchip__name{ font-weight:600; color:#2B2B2B; }
.userchip__role{ font-size:.85rem; color:#6B5E52; }

.userpanel{
    position:absolute; right:0; top:calc(100% + 8px);
    min-width:220px; background:#fff; border:1px solid var(--line,#E8E0D6);
    border-radius:14px; box-shadow:0 10px 24px rgba(0,0,0,.08);
    padding:10px; display:none; z-index:1200;
}
.userchip.is-open .userpanel{ display:block; }

.userpanel__row{
    display:flex; align-items:center; gap:10px;
    padding:6px 6px 10px; border-bottom:1px solid #eee; margin-bottom:8px;
}
.userpanel__avatar{
    width:36px; height:36px; border-radius:999px;
    background:#E9D8BF; color:#5B4424; display:grid; place-items:center; font-weight:700;
}
.userpanel__name{ font-weight:700; color:#2B2B2B; }
.userpanel__role{ font-size:.9rem; color:#6B5E52; }

.userpanel__logout{
    display:block; text-decoration:none; color:#7f1d1d;
    font-weight:600; padding:8px 6px; border-radius:10px;
}
.userpanel__logout:hover{ background:#fff4f4; }
.userchip__menu{ display:none !important; }
