/* ============================================================
   Codeefi Portal — design layer
   Loaded AFTER the website's assets/css/style.css and reuses its
   palette: navy-950 #04101f · navy-900 #071c33 · gold-500 #c9a227
   cream #faf7ee · sand #f0ebdd
   ============================================================ */
:root {
  --p-navy-950: #04101f;
  --p-navy-900: #071c33;
  --p-navy-800: #0f2c4e;
  --p-gold-200: #f6e7b2;
  --p-gold-300: #eed58a;
  --p-gold-400: #e3bd5e;
  --p-gold-500: #c9a227;
  --p-gold-600: #a9852a;
  --p-gold-700: #8a6a1f;
  --p-cream: #faf7ee;
  --p-sand: #f0ebdd;
  --p-side-w: 262px;
}

/* ---------- shell: sidebar + content ---------- */
.p-shell { display: flex; min-height: 100vh; }

.p-side {
  width: var(--p-side-w);
  position: fixed; inset: 0 auto 0 0; z-index: 46;
  background: linear-gradient(180deg, #04101f 0%, #071c33 70%, #0a2340 100%);
  color: var(--p-cream);
  display: flex; flex-direction: column;
  border-right: 1px solid #c9a22726;
  transition: transform .35s cubic-bezier(.22,1,.36,1);
}
.p-brand { display: flex; align-items: center; gap: .65rem; padding: 1.05rem 1.1rem; border-bottom: 1px solid #c9a22726; text-decoration: none; }
.p-brand .t1 { font-family: var(--font-display, 'Poppins', serif); font-size: 1.15rem; letter-spacing: .08em; color: var(--p-cream); }
.p-brand .t1 b { color: var(--p-gold-400); font-weight: 800; }
.p-brand .t2 { display: block; font-size: .56rem; letter-spacing: .16em; text-transform: uppercase; color: #eed58ae6; font-weight: 600; }
.p-role-tag { margin: .9rem 1.1rem 0; font-size: .6rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: #04101f; background: linear-gradient(135deg, #f2d98c, #c9a227); padding: .35rem .7rem; border-radius: 999px; align-self: flex-start; }

.p-nav { padding: 1rem .8rem 1rem; overflow-y: auto; flex: 1; }
.p-nav .lbl { font-size: .6rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: #eed58a66; margin: 1rem .7rem .45rem; }
.p-nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: .85rem; color: #faf7eeb3; font-size: .86rem; font-weight: 600; letter-spacing: .02em; text-decoration: none; border: 1px solid transparent; transition: all .25s; }
.p-nav a i, .p-nav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.p-nav a:hover { background: #ffffff0d; color: var(--p-gold-300); }
.p-nav a.on { background: linear-gradient(135deg, #c9a2272e, #eed58a1a); border-color: #eed58a38; color: var(--p-gold-300); }
.p-nav .count { margin-left: auto; background: var(--p-gold-500); color: #231a05; font-size: .62rem; font-weight: 800; border-radius: 999px; padding: .12rem .45rem; }
.p-side .foot { padding: .9rem 1.1rem; border-top: 1px solid #c9a22726; font-size: .66rem; color: #faf7ee59; letter-spacing: .06em; }

.p-main { flex: 1; margin-left: var(--p-side-w); min-width: 0; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.p-top {
  position: sticky; top: 0; z-index: 40;
  background: #faf7eeeb; backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--p-sand);
  display: flex; align-items: center; gap: 1rem;
  padding: .8rem 1.4rem;
}
.p-top h1 { font-family: var(--font-display, 'Poppins', serif); font-weight: 800; color: var(--p-navy-900); font-size: 1.28rem; line-height: 1.2; }
.p-top .sub { font-size: .72rem; color: #64748b; letter-spacing: .04em; margin-top: .1rem; }
.p-top .spacer { flex: 1; }
.p-burger { display: none; border: 1.5px solid var(--p-sand); background: #fff; border-radius: .7rem; padding: .45rem .55rem; color: var(--p-navy-900); cursor: pointer; }

.p-iconbtn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 999px; border: 1.5px solid var(--p-sand); background: #fff; color: var(--p-navy-900); cursor: pointer; transition: all .25s; text-decoration: none; }
.p-iconbtn:hover { border-color: var(--p-gold-500); color: var(--p-gold-600); }
.p-iconbtn .dot { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 999px; background: linear-gradient(135deg, #f2d98c, #c9a227); color: #231a05; font-size: .6rem; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px #c9a22766; }

.p-user { position: relative; }
.p-chip { display: flex; align-items: center; gap: .6rem; background: var(--p-navy-950); color: var(--p-cream); border: 1px solid #c9a22740; border-radius: 999px; padding: .35rem .9rem .35rem .4rem; cursor: pointer; font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
.p-chip .avatar { width: 32px; height: 32px; border-radius: 999px; background: linear-gradient(135deg, #f2d98c, #b98c22); color: #231a05; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: .78rem; }
.p-drop { position: absolute; right: 0; top: calc(100% + .6rem); width: 300px; background: #fff; border: 1px solid var(--p-sand); border-radius: 1.1rem; box-shadow: 0 30px 60px -20px #04101f59; overflow: hidden; display: none; }
.p-drop.open { display: block; animation: pUp .25s both; }
.p-drop .pd-head { padding: .9rem 1.1rem; border-bottom: 1px solid var(--p-sand); background: var(--p-cream); }
.p-drop .pd-head b { color: var(--p-navy-900); font-size: .88rem; display: block; }
.p-drop .pd-head span { font-size: .72rem; color: #64748b; }
.p-drop a { display: flex; align-items: center; gap: .6rem; padding: .75rem 1.1rem; font-size: .84rem; font-weight: 600; color: var(--p-navy-800); text-decoration: none; transition: background .2s; }
.p-drop a:hover { background: var(--p-cream); color: var(--p-gold-700); }
.p-drop a.danger { color: #b91c1c; }

/* notifications dropdown (wider card) */
.p-drop.notifs { width: 360px; }
.p-drop.notifs .n-item { display: block; padding: .8rem 1.1rem; border-bottom: 1px solid #f5f1e6; }
.p-drop.notifs .n-item b { font-size: .8rem; color: var(--p-navy-900); display: flex; gap: .4rem; align-items: center; }
.p-drop.notifs .n-item.unread b::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: var(--p-gold-500); flex-shrink: 0; }
.p-drop.notifs .n-item p { font-size: .74rem; color: #64748b; margin: .15rem 0 0; line-height: 1.45; }
.p-drop.notifs .n-item time { font-size: .64rem; color: #a39d8c; letter-spacing: .05em; text-transform: uppercase; }

/* ---------- content ---------- */
.p-wrap { padding: 1.5rem 1.4rem 3rem; max-width: 1180px; width: 100%; margin: 0 auto; }
.p-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.p-pagehead h2 { font-family: var(--font-display, 'Poppins', serif); font-weight: 800; color: var(--p-navy-900); font-size: 1.5rem; }
.p-pagehead .muted { margin-top: .25rem; }

/* stat cards */
.p-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat { background: #fff; border: 1px solid var(--p-sand); border-radius: 1.25rem; padding: 1.05rem 1.15rem; display: flex; align-items: center; gap: .9rem; transition: transform .3s, box-shadow .3s; }
.stat:hover { transform: translateY(-3px); box-shadow: 0 24px 44px -22px #04101f40; }
.stat .ic { width: 44px; height: 44px; border-radius: .95rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: linear-gradient(135deg, #c9a22724, #eed58a36); color: var(--p-gold-700); }
.stat .ic.green { background: #0596691f; color: #047857; }
.stat .ic.red { background: #dc26261a; color: #b91c1c; }
.stat .ic.blue { background: #0284c71a; color: #075985; }
.stat .num { font-family: var(--font-display, 'Poppins', serif); font-size: 1.45rem; font-weight: 800; color: var(--p-navy-900); line-height: 1.1; }
.stat .lb { font-size: .64rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #a9852a; margin-top: .15rem; }
.stat .x { font-size: .72rem; color: #94a3b8; margin-top: .15rem; }

/* cards & tables */
.p-card { background: #fff; border: 1px solid var(--p-sand); border-radius: 1.4rem; padding: 1.35rem; margin-bottom: 1.3rem; box-shadow: 0 1px 3px #04101f0d; }
.p-card > .p-card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.p-card h3 { font-family: var(--font-display, 'Poppins', serif); font-weight: 700; color: var(--p-navy-900); font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.p-card h3 i, .p-card h3 svg { width: 17px; height: 17px; color: var(--p-gold-600); }

.p-tblwrap { overflow-x: auto; margin: 0 -1.35rem; padding: 0 1.35rem; }
table.p-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.p-table th { text-align: left; font-size: .63rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: #94a3b8; padding: .6rem .7rem; border-bottom: 2px solid var(--p-sand); white-space: nowrap; }
.p-table td { padding: .78rem .7rem; border-bottom: 1px solid #f5f1e6; font-size: .85rem; color: #33415c; vertical-align: middle; }
.p-table tr:last-child td { border-bottom: 0; }
.p-table tbody tr { transition: background .2s; }
.p-table tbody tr:hover { background: #faf7ee; }
.p-table b { color: var(--p-navy-900); }
.p-table .actions { display: flex; gap: .35rem; flex-wrap: wrap; }

/* mini icon buttons in tables */
.mb { display: inline-flex; align-items: center; gap: .3rem; padding: .38rem .7rem; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1.5px solid var(--p-sand); background: #fff; color: var(--p-navy-800); cursor: pointer; text-decoration: none; transition: all .2s; white-space: nowrap; }
.mb:hover { border-color: var(--p-gold-500); color: var(--p-gold-700); }
.mb i, .mb svg { width: 13px; height: 13px; }
.mb.gold { background: linear-gradient(135deg, #f2d98c, #d9b455); border-color: transparent; color: #231a05; }
.mb.gold:hover { filter: brightness(1.06); color: #231a05; }
.mb.navy { background: var(--p-navy-900); border-color: var(--p-navy-900); color: var(--p-cream); }
.mb.red { color: #b91c1c; }
.mb.red:hover { border-color: #dc2626; color: #b91c1c; background: #dc26260d; }
.mb.green { color: #047857; }
.mb.green:hover { border-color: #059669; color: #047857; background: #0596690d; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: .32rem; padding: .3rem .68rem; border-radius: 999px; font-size: .66rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.badge i, .badge svg { width: 11px; height: 11px; }
.b-verified { background: #0596691a; color: #047857; }
.b-pending  { background: #d9770617; color: #b45309; }
.b-rejected { background: #dc262614; color: #b91c1c; }
.b-missing  { background: #64748b14; color: #64748b; }
.b-info     { background: #0284c714; color: #075985; }
.b-gold     { background: linear-gradient(135deg, #f2d98c, #d9b455); color: #231a05; }
.b-navy     { background: var(--p-navy-900); color: var(--p-gold-300); }

/* forms */
.f-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .9rem; }
.f-grid .full { grid-column: 1 / -1; }
.f-label { display: block; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #94a3b8; margin: 0 0 .35rem .15rem; }
.f-help { font-size: .72rem; color: #94a3b8; margin-top: .3rem; }
textarea.field { min-height: 92px; resize: vertical; }

/* flash alerts */
.p-alert { display: flex; gap: .7rem; align-items: flex-start; border-radius: 1rem; padding: .9rem 1.1rem; font-size: .86rem; font-weight: 600; margin-bottom: 1rem; border: 1px solid; }
.p-alert i, .p-alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: .1rem; }
.p-alert.ok  { background: #05966912; border-color: #05966945; color: #065f46; }
.p-alert.err { background: #dc26260f; border-color: #dc262645; color: #991b1b; }

/* key-value detail grid */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem 1.4rem; }
.kv .k { font-size: .63rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: #94a3b8; }
.kv .v { font-size: .9rem; font-weight: 600; color: var(--p-navy-900); margin-top: .15rem; overflow-wrap: anywhere; }

/* progress bar */
.pbar { height: 8px; border-radius: 99px; background: var(--p-sand); overflow: hidden; min-width: 90px; }
.pbar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #c9a227, #eed58a); }

/* case-stage stepper */
.steps { display: flex; flex-wrap: wrap; gap: .45rem; }
.step { display: inline-flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 700; padding: .42rem .75rem; border-radius: 999px; background: var(--p-sand); color: #94a3b8; letter-spacing: .02em; }
.step.done { background: #05966918; color: #047857; }
.step.now  { background: linear-gradient(135deg, #f2d98c, #d9b455); color: #231a05; box-shadow: 0 8px 18px -6px #c9a22780; }
.step i, .step svg { width: 12px; height: 12px; }

/* document rows */
.doc { display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; border: 1.5px solid var(--p-sand); border-radius: 1rem; margin-bottom: .7rem; background: #fff; flex-wrap: wrap; transition: border-color .25s; }
.doc:hover { border-color: #e3bd5e80; }
.doc.req  { border-style: dashed; border-color: var(--p-gold-500); background: #c9a22708; }
.doc .fi { width: 40px; height: 40px; border-radius: .8rem; background: var(--p-cream); border: 1px solid var(--p-sand); display: flex; align-items: center; justify-content: center; color: var(--p-gold-600); flex-shrink: 0; }
.doc .grow { flex: 1; min-width: 170px; }
.doc .dn { font-weight: 700; color: var(--p-navy-900); font-size: .88rem; }
.doc .dm { font-size: .72rem; color: #94a3b8; margin-top: .1rem; }
.doc .note { width: 100%; font-size: .76rem; background: #d9770610; border-left: 3px solid #d97706; color: #92400e; padding: .5rem .7rem; border-radius: 0 .6rem .6rem 0; }
.doc .note.ok { background: #05966910; border-color: #059669; color: #065f46; }

/* empty state */
.empty { text-align: center; padding: 2.6rem 1rem; color: #94a3b8; }
.empty i, .empty svg { width: 34px; height: 34px; margin: 0 auto .6rem; color: #cbbf9b; display: block; }
.empty b { color: var(--p-navy-800); display: block; font-size: .95rem; margin-bottom: .15rem; }
.empty p { font-size: .8rem; margin: 0; }

/* filter bar */
.p-filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.1rem; }
.p-filters .field { width: auto; min-width: 190px; }

/* misc */
.muted { color: #64748b; font-size: .8rem; }
.small { font-size: .74rem; }
.gold-num { font-family: var(--font-display, 'Poppins', serif); font-weight: 800; background: linear-gradient(120deg, #8a6a1f, #c9a227 45%, #e3bd5e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mt { margin-top: 1rem; } .mt2 { margin-top: 1.6rem; }
.flexrow { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.right { margin-left: auto; }
.backlink { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 700; color: var(--p-gold-700); text-decoration: none; margin-bottom: .9rem; }
.backlink:hover { color: var(--p-gold-500); }
.p-sb-overlay { display: none; }

@keyframes pUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.anim-up { animation: pUp .45s both; }

/* ---------- auth (login / install) ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2.2rem 1rem;
  background: radial-gradient(1100px 500px at 85% -10%, #c9a22738, transparent 60%),
              radial-gradient(800px 420px at -10% 30%, #1f4a7580, transparent 55%), #04101f; }
.auth-card { width: 100%; max-width: 430px; background: var(--p-cream); border-radius: 1.6rem; padding: 2.1rem 2rem; box-shadow: 0 40px 90px -30px rgba(0,0,0,.7); border: 1px solid #eed58a3d; }
.auth-card .logo { display: flex; align-items: center; gap: .65rem; justify-content: center; margin-bottom: 1.1rem; }
.auth-card h1 { font-family: var(--font-display, 'Poppins', serif); text-align: center; color: var(--p-navy-900); font-weight: 800; font-size: 1.35rem; }
.auth-card .sub { text-align: center; color: #64748b; font-size: .8rem; margin: .3rem 0 1.4rem; }
.auth-card .field { margin-bottom: .85rem; }
.auth-foot { text-align: center; margin-top: 1.2rem; font-size: .74rem; color: #94a3b8; }
.auth-foot a { color: var(--p-gold-700); font-weight: 700; text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .p-side { transform: translateX(-100%); box-shadow: 40px 0 90px rgba(0,0,0,.5); }
  body.sb-open .p-side { transform: none; }
  body.sb-open .p-sb-overlay { display: block; position: fixed; inset: 0; background: #04101fa6; z-index: 45; }
  .p-main { margin-left: 0; }
  .p-burger { display: inline-flex; }
  .p-user .who { display: none; }
}
@media (max-width: 560px) {
  .p-top { padding: .7rem .9rem; }
  .p-wrap { padding: 1.1rem .9rem 2.4rem; }
  .p-drop.notifs { width: 86vw; }
}
