:root{
  --ink:#14213D;
  --ink-soft:#3B4664;
  --ink-faint:#8891A3;
  --stone:#EFEDE4;
  --stone-deep:#E4E1D4;
  --paper:#FBFAF6;
  --brass:#B08D57;
  --brass-deep:#8C6E3F;
  --oxblood:#A63D40;
  --sage:#5C7A5E;
  --rule: rgba(20,33,61,0.12);
}
*{box-sizing:border-box;}
body{
  margin:0;
  background:var(--stone);
  font-family:'IBM Plex Sans', sans-serif;
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
}
.display{ font-family:'Fraunces', serif; }
.mono{ font-family:'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
a{ color:inherit; }

/* ---------- auth screens (login / join) ---------- */
.auth-wrap{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:
    linear-gradient(var(--rule) 1px, transparent 1px) 0 0/100% 42px,
    var(--stone);
  padding:60px 20px;
}
.auth-card{
  position:relative; width:100%; max-width:440px;
  background:var(--paper); border:1px solid var(--rule); border-radius:6px;
  padding:44px 40px 36px; box-shadow:0 24px 60px -20px rgba(20,33,61,0.25);
}
.auth-card.wide{ max-width:560px; }
.ribbon{
  position:absolute; top:-2px; right:44px; width:26px; height:64px;
  background:linear-gradient(180deg, var(--brass), var(--brass-deep));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  box-shadow: 0 6px 14px rgba(139,110,63,0.35);
}
.auth-logo{ display:block; height:32px; margin:0 auto 26px; }
.auth-eyebrow{
  text-align:center; font-size:11px; letter-spacing:.14em; text-transform:uppercase;
  color:var(--brass-deep); font-weight:600; margin-bottom:8px;
}
.auth-title{ text-align:center; font-size:26px; font-weight:600; margin:0 0 6px; }
.auth-sub{ text-align:center; font-size:13.5px; color:var(--ink-faint); margin:0 0 28px; line-height:1.5; }

.field{ margin-bottom:16px; }
.field label{ display:block; font-size:12px; font-weight:600; color:var(--ink-soft); margin-bottom:7px; }
.field input, .field select{
  width:100%; padding:12px 14px; border:1px solid var(--rule); border-radius:4px;
  background:var(--stone); font-family:'IBM Plex Sans'; font-size:14.5px; color:var(--ink);
}
.field input:focus, .field select:focus{
  outline:none; border-color:var(--brass); background:var(--paper);
  box-shadow:0 0 0 3px rgba(176,141,87,0.18);
}
.field-row{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }

.btn-primary{
  width:100%; padding:13px; border:none; border-radius:4px; margin-top:4px;
  background:var(--ink); color:var(--paper); font-size:14.5px; font-weight:600;
  letter-spacing:.02em; cursor:pointer;
}
.btn-primary:hover{ background:var(--brass-deep); }
.btn-secondary{
  width:100%; padding:12px; border:1px solid var(--ink); border-radius:4px;
  background:transparent; color:var(--ink); font-size:14px; font-weight:600; cursor:pointer;
}
.auth-foot{ text-align:center; margin-top:20px; font-size:13px; color:var(--ink-faint); }
.auth-foot a{ color:var(--brass-deep); font-weight:600; text-decoration:none; }
.alert{
  padding:12px 14px; border-radius:4px; font-size:13px; margin-bottom:18px; line-height:1.5;
}
.alert.error{ background:rgba(166,61,64,0.1); color:var(--oxblood); }
.alert.success{ background:rgba(92,122,94,0.12); color:var(--sage); }

/* ---------- authenticated shell ---------- */
.shell{ display:flex; }
.sidebar{
  width:236px; min-height:100vh; background:var(--ink); color:var(--stone);
  padding:28px 0; position:sticky; top:0; align-self:flex-start;
}
.side-logo{ padding:0 26px 26px; border-bottom:1px solid rgba(255,255,255,0.1); margin-bottom:18px;}
.side-logo img{ height:26px; }
.nav-item{
  position:relative; display:flex; align-items:center; gap:12px; padding:12px 26px;
  font-size:14px; font-weight:500; color:rgba(239,237,228,0.6); cursor:pointer; text-decoration:none;
}
.nav-item .dot{ width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.5;}
.nav-item:hover{ color:var(--stone); }
.nav-item.active{ color:var(--paper); }
.nav-item.active::before{
  content:""; position:absolute; left:0; top:6px; bottom:6px; width:4px;
  background:var(--brass); border-radius:0 3px 3px 0;
}
.nav-item.active .ribbon-tab{
  position:absolute; right:16px; width:14px; height:20px; background:var(--brass);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 70%, 0 100%);
}
.nav-section-label{
  padding:18px 26px 8px; font-size:10.5px; letter-spacing:.14em; text-transform:uppercase;
  color:rgba(239,237,228,0.35); font-weight:600;
}
.main{ flex:1; padding:40px 48px; max-width:1100px; }
.topline{ display:flex; justify-content:space-between; align-items:flex-end; flex-wrap:wrap; gap:14px; margin-bottom:6px; padding-bottom:20px; border-bottom:1px solid var(--rule); }
.greeting-eyebrow{ font-size:11.5px; letter-spacing:.12em; text-transform:uppercase; color:var(--brass-deep); font-weight:600; margin-bottom:6px;}
.greeting{ font-size:28px; font-weight:600; margin:0; }
.greeting-sub{ font-size:13.5px; color:var(--ink-faint); margin-top:6px; }
.user-chip{ display:flex; align-items:center; gap:10px; }
.user-avatar{ width:38px; height:38px; border-radius:50%; background:var(--brass); color:var(--paper); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; }
.user-meta div:first-child{ font-size:13.5px; font-weight:600; }
.user-meta div:last-child{ font-size:11.5px; color:var(--ink-faint); }

.banner{
  margin:22px 0 0; padding:14px 18px; border-radius:6px; font-size:13.5px; line-height:1.5;
  background:rgba(166,61,64,0.08); border:1px solid rgba(166,61,64,0.25); color:var(--oxblood);
}
.banner a{ font-weight:700; text-decoration:underline; }

.section-head{ display:flex; justify-content:space-between; align-items:baseline; margin:28px 0 14px; }
.section-title{ font-size:17px; font-weight:600; }
.section-link{ font-size:12.5px; color:var(--brass-deep); font-weight:600; cursor:pointer; text-decoration:none; }

.ledger{ background:var(--paper); border:1px solid var(--rule); border-radius:6px; overflow:hidden; }
.ledger-row{ display:grid; grid-template-columns:1fr 140px 120px 100px; align-items:center; gap:12px; padding:16px 22px; border-bottom:1px solid var(--rule); font-size:13.5px; }
.ledger-row:last-child{ border-bottom:none; }
.ledger-row.head{ background:var(--stone); font-size:11px; text-transform:uppercase; letter-spacing:.07em; color:var(--ink-faint); font-weight:600; padding:11px 22px; }
.ledger-title{ font-weight:600; }
.ledger-tag{ font-size:11.5px; color:var(--ink-faint); margin-top:2px; }
.ledger-empty{ padding:40px 22px; text-align:center; color:var(--ink-faint); font-size:13.5px; }

.badge{ display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:20px; font-size:11.5px; font-weight:600; }
.badge.due{ background:rgba(166,61,64,0.1); color:var(--oxblood); }
.badge.pass{ background:rgba(92,122,94,0.12); color:var(--sage); }
.badge.open{ background:rgba(176,141,87,0.14); color:var(--brass-deep); }
.badge.pending{ background:rgba(176,141,87,0.14); color:var(--brass-deep); }

.btn-row{ padding:6px 14px; border:1px solid var(--ink); background:transparent; border-radius:4px; font-size:12px; font-weight:600; cursor:pointer; color:var(--ink); }
.btn-row:hover{ background:var(--ink); color:var(--paper); }
.btn-row.reject{ border-color:var(--oxblood); color:var(--oxblood); }
.btn-row.reject:hover{ background:var(--oxblood); color:var(--paper); }
.btn-row.approve{ border-color:var(--sage); color:var(--sage); }
.btn-row.approve:hover{ background:var(--sage); color:var(--paper); }

.dept-card{ background:var(--paper); border:1px solid var(--rule); border-radius:6px; padding:20px; margin-bottom:14px; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; }
.dept-name{ font-weight:600; font-size:14.5px; }
.dept-role{ font-size:12px; color:var(--brass-deep); font-weight:600; margin-top:3px; }

/* ---------- mobile responsiveness ---------- */
.mobile-menu-btn{
  display:none; position:fixed; top:16px; left:16px; z-index:60;
  background:var(--ink); color:var(--paper); border:none; width:42px; height:42px;
  border-radius:6px; align-items:center; justify-content:center; font-size:20px; cursor:pointer;
  box-shadow:0 6px 16px rgba(20,33,61,0.3);
}
.sidebar-overlay{ display:none; }

@media (max-width: 900px){
  .mobile-menu-btn{ display:flex; }
  .shell{ display:block; }
  .sidebar{
    position:fixed; top:0; left:0; height:100vh; z-index:55;
    transform:translateX(-100%); transition:transform .25s ease;
    box-shadow:0 0 40px rgba(0,0,0,0.35);
  }
  .sidebar.open{ transform:translateX(0); }
  .sidebar-overlay.active{
    display:block; position:fixed; inset:0; background:rgba(15,20,35,0.45); z-index:50;
  }
  .main{ padding:70px 18px 32px; max-width:100%; }
  .topline{ flex-wrap:wrap; gap:14px; }
  .greeting{ font-size:23px; }
  .user-chip{ width:100%; justify-content:flex-start; }
  .ledger-row{ grid-template-columns:1fr !important; gap:6px !important; }
  .ledger-row.head{ display:none; }
  .ledger{ overflow-x:visible; }
  .notif-panel{ right:8px; left:8px; width:auto; top:64px; }
}

/* ---------- toast notifications ---------- */
.toast-container{
  position:fixed; top:20px; right:20px; z-index:9999;
  display:flex; flex-direction:column; gap:10px; max-width:340px;
}
.toast{
  background:var(--paper); border-left:4px solid var(--brass);
  padding:14px 18px; border-radius:6px; font-size:13.5px; line-height:1.5;
  box-shadow:0 14px 34px rgba(20,33,61,0.18);
  animation: toast-in .25s ease-out;
}
.toast.success{ border-left-color:var(--sage); }
.toast.error{ border-left-color:var(--oxblood); }
.toast.toast-out{ opacity:0; transform:translateX(16px); transition:.25s ease-in; }
@keyframes toast-in{
  from{ opacity:0; transform:translateX(16px); }
  to{ opacity:1; transform:translateX(0); }
}

/* ---------- custom confirm/prompt dialogs ---------- */
.dialog-overlay{
  position:fixed; inset:0; background:rgba(20,33,61,0.55); z-index:9998;
  display:flex; align-items:center; justify-content:center; padding:20px;
  animation: dialog-fade-in .15s ease-out;
}
.dialog-overlay.dialog-out{ opacity:0; transition:.15s; }
.dialog-card{
  background:var(--paper); border-radius:8px; padding:28px; width:100%; max-width:380px;
  box-shadow:0 30px 70px rgba(0,0,0,0.3); animation: dialog-pop-in .18s ease-out;
}
.dialog-title{ font-family:'Fraunces', serif; font-size:18px; font-weight:600; margin-bottom:8px; }
.dialog-message{ font-size:13.5px; color:var(--ink-soft); line-height:1.5; margin-bottom:18px; }
.dialog-input{
  width:100%; padding:11px 13px; border:1px solid var(--rule); border-radius:4px;
  background:var(--stone); font-family:'IBM Plex Sans'; font-size:14px; margin-bottom:18px;
}
.dialog-input:focus{ outline:none; border-color:var(--brass); }
.dialog-actions{ display:flex; gap:10px; justify-content:flex-end; }
.dialog-btn{
  padding:9px 18px; border-radius:4px; border:1px solid var(--rule); background:transparent;
  color:var(--ink); font-size:13.5px; font-weight:600; cursor:pointer;
}
.dialog-btn.primary{ background:var(--ink); color:var(--paper); border-color:var(--ink); }
.dialog-btn.primary.danger{ background:var(--oxblood); border-color:var(--oxblood); }
@keyframes dialog-fade-in{ from{ opacity:0; } to{ opacity:1; } }
@keyframes dialog-pop-in{ from{ opacity:0; transform:scale(.96); } to{ opacity:1; transform:scale(1); } }

/* ---------- notification bell ---------- */
.notif-bell-btn{
  position:fixed; top:16px; right:16px; z-index:60;
  background:var(--paper); border:1px solid var(--rule); width:42px; height:42px;
  border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-size:18px; cursor:pointer; box-shadow:0 6px 16px rgba(20,33,61,0.15);
}
.notif-badge{
  position:absolute; top:-4px; right:-4px; background:var(--oxblood); color:#fff;
  font-family:'IBM Plex Mono'; font-size:10px; font-weight:600; min-width:16px; height:16px;
  border-radius:8px; display:flex; align-items:center; justify-content:center; padding:0 4px;
}
.notif-panel{
  position:fixed; top:64px; right:16px; z-index:59; width:340px; max-height:420px; overflow-y:auto;
  background:var(--paper); border:1px solid var(--rule); border-radius:8px;
  box-shadow:0 20px 50px rgba(20,33,61,0.2); display:none;
}
.notif-panel.open{ display:block; }
.notif-panel-head{
  display:flex; justify-content:space-between; align-items:center; padding:14px 16px;
  border-bottom:1px solid var(--rule); font-weight:600; font-size:13.5px;
}
.notif-mark-all{ font-size:11.5px; color:var(--brass-deep); cursor:pointer; font-weight:600; }
.notif-item{
  padding:12px 16px; border-bottom:1px solid var(--rule); cursor:pointer; font-size:12.5px;
}
.notif-item:hover{ background:var(--stone); }
.notif-item.unread{ background:rgba(176,141,87,0.06); }
.notif-item-title{ font-weight:600; color:var(--ink); margin-bottom:2px; }
.notif-item-msg{ color:var(--ink-soft); line-height:1.4; }
.notif-item-time{ color:var(--ink-faint); font-size:10.5px; margin-top:4px; }
.notif-empty{ padding:30px 16px; text-align:center; color:var(--ink-faint); font-size:12.5px; }