:root{
  --gu-black:#0b0b0b;
  --gu-ink:#141414;
  --gu-gold:#d4af37;
  --gu-gold-2:#c49a2a;
  --gu-gold-soft:rgba(212,175,55,.14);
  --gu-bg:#f4f1ea;
  --gu-card:#ffffff;
  --gu-muted:#6f6a60;
  --gu-line:#e6e0d4;
  --gu-green:#1f9d6a;
  --gu-red:#d64545;
  --gu-blue:#2f6fed;
  --gu-purple:#7a5af8;
  --sidebar-w:280px;
  --shadow:0 10px 30px rgba(20,16,8,.08);
  --radius:1rem;
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body.app-body{
  margin:0;
  font-family:"Cairo",Tahoma,sans-serif;
  background:
    radial-gradient(circle at top left, rgba(212,175,55,.12), transparent 28%),
    linear-gradient(180deg,#f7f4ee 0%, var(--gu-bg) 40%, #efe9dd 100%);
  color:#1d1a15;
  min-height:100vh;
  min-height:100dvh;
}

.app-shell{min-height:100vh;min-height:100dvh}
.min-w-0{min-width:0}

/* Sidebar */
.app-sidebar{
  width:var(--sidebar-w);
  background:linear-gradient(180deg,#111 0%, #000 100%);
  color:#f5f5f5;
  position:fixed;
  inset:0 0 0 auto;
  z-index:1040;
  overflow-y:auto;
  border-left:1px solid rgba(212,175,55,.2);
  transition:transform .28s ease;
}
.sidebar-brand{background:rgba(255,255,255,.02)}
.brand-logo{
  width:100%;
  max-width:220px;
  display:block;
  margin-inline:auto;
  filter:drop-shadow(0 8px 18px rgba(212,175,55,.18));
}
.brand-meta{text-align:center}
.brand-title{
  color:var(--gu-gold);
  font-weight:800;
  font-size:1.15rem;
  letter-spacing:.02em;
}
.brand-sub{color:rgba(255,255,255,.62);font-size:.78rem}

.app-nav-link{
  display:flex;align-items:center;gap:.75rem;
  color:rgba(255,255,255,.72)!important;
  border-radius:.85rem;
  padding:.85rem 1rem;
  font-weight:600;
  transition:.2s ease;
}
.app-nav-link i{font-size:1.15rem;color:var(--gu-gold);width:1.25rem;text-align:center}
.app-nav-link:hover,
.app-nav-link.active{
  background:linear-gradient(90deg, rgba(212,175,55,.18), rgba(212,175,55,.05));
  color:#fff!important;
  box-shadow:inset -3px 0 0 var(--gu-gold);
}
.logout-link{border:1px solid rgba(212,175,55,.25)!important;justify-content:center}

.sidebar-backdrop{
  display:none;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:1035;
  backdrop-filter:blur(2px);
}
.sidebar-backdrop.show{display:block}

.app-main{margin-right:var(--sidebar-w);width:100%}
.app-topbar{
  min-height:78px;
  background:rgba(255,255,255,.82);
  border-bottom:1px solid var(--gu-line);
  backdrop-filter:blur(12px);
  position:sticky;top:0;z-index:1020;
}
.eyebrow{color:var(--gu-muted);font-size:.75rem;font-weight:600}
.page-title h1,.page-title .h4{font-weight:800;color:var(--gu-ink)}
.avatar{
  width:42px;height:42px;border-radius:50%;
  display:grid;place-items:center;font-weight:800;
  background:linear-gradient(135deg,var(--gu-gold),#f0d889);
  color:#111;border:2px solid #fff;
  box-shadow:0 6px 16px rgba(212,175,55,.35);
}
.user-chip{
  background:#fff;
  border:1px solid var(--gu-line);
  border-radius:999px;
  padding:.35rem .7rem .35rem .35rem;
  box-shadow:var(--shadow);
}

/* Page blocks */
.toolbar{
  display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;flex-wrap:wrap;
  margin-bottom:1rem;
}
/* Compact date/month/datetime/select fields system-wide */
input[type="date"],
input[type="month"],
input[type="datetime-local"],
.month-input,
.form-control[type="date"],
.form-control[type="month"],
.form-control[type="datetime-local"],
select,
.form-select,
.form-select-sm{
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  padding:0 .65rem!important;
  font-size:.85rem!important;
  line-height:1.2!important;
  border:1px solid #e2d8c4;
  border-radius:.65rem;
  background-color:#fff;
  box-sizing:border-box;
  width:auto;
  max-width:100%;
}
select,
.form-select,
.form-select-sm{
  padding-left:1.85rem!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23655e52' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:left .55rem center;
  background-size:12px 12px;
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.month-input::-webkit-calendar-picker-indicator{
  margin:0;
  padding:0;
  height:16px;
  width:16px;
  cursor:pointer;
}
.filter-form,
.inline-form{
  align-items:center!important;
}
.filter-form > input[type="text"],
.filter-form > input[type="search"],
.filter-form > input:not([type]),
.filter-form > input[name="q"],
.inline-form > input[type="text"],
.filter-form > select,
.inline-form > select{
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  padding:0 .75rem!important;
  font-size:.85rem!important;
  line-height:1.2!important;
  box-sizing:border-box;
}
.filter-form > select,
.inline-form > select{
  padding-left:1.85rem!important;
}
.filter-form label,
.inline-form label{
  margin:0;
}
.filter-form label:has(> input[type="date"]),
.filter-form label:has(> input[type="month"]),
.filter-form label:has(> select),
.inline-form label:has(> input[type="date"]),
.inline-form label:has(> input[type="month"]),
.inline-form label:has(> select){
  flex-direction:row!important;
  align-items:center;
  gap:.45rem;
  width:auto;
  flex:0 0 auto;
  white-space:nowrap;
}
.filter-form label:has(> input[type="date"]) input,
.filter-form label:has(> input[type="month"]) input,
.filter-form label:has(> select) select,
.inline-form label:has(> input[type="date"]) input,
.inline-form label:has(> input[type="month"]) input,
.inline-form label:has(> select) select{
  flex:0 0 auto;
  width:auto!important;
  min-width:148px;
}
.filter-form > input[type="date"],
.filter-form > input[type="month"],
.inline-form > input[type="date"],
.inline-form > input[type="month"]{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:148px;
  max-width:180px;
}
.filter-form .btn,
.inline-form .btn,
.filter-form .btn.secondary,
.inline-form .btn.secondary,
.filter-form .btn.ghost,
.inline-form .btn.ghost,
.filter-form a.btn{
  height:34px!important;
  min-height:34px!important;
  padding:0 .85rem!important;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.form-grid input[type="date"],
.form-grid input[type="month"],
.form-grid input[type="datetime-local"]{
  width:100%!important;
  max-width:100%;
}

.month-filter{
  align-items:center!important;
  background:transparent;
  border:0;
  box-shadow:none;
  padding:0!important;
  gap:.5rem!important;
  flex-wrap:nowrap!important;
  margin:0;
}
.month-filter-label{
  margin:0!important;
  display:inline-flex!important;
  flex-direction:row!important;
  align-items:center;
  color:var(--gu-muted);
  font-size:.8rem;
  font-weight:700;
  white-space:nowrap;
  width:auto!important;
  flex:0 0 auto!important;
  line-height:1;
}
.month-filter .month-input{
  min-width:148px!important;
  max-width:170px;
  margin:0;
  flex:0 0 auto!important;
}
.month-filter .btn{
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  padding:0 .85rem!important;
  line-height:1!important;
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
}
.toolbar h2{margin:0 0 .35rem;font-weight:800;font-size:clamp(1.15rem,2.2vw,1.5rem)}
.toolbar .muted,.muted{color:var(--gu-muted)!important;margin:0}
.toolbar-actions{display:flex;gap:.5rem;flex-wrap:wrap}

.btn{
  border-radius:.8rem;
  font-weight:700;
  padding:.65rem 1rem;
}
.btn.primary,.btn-primary,
.btn.primary:focus,.btn-primary:focus{
  background:linear-gradient(135deg,var(--gu-gold),var(--gu-gold-2));
  border-color:var(--gu-gold-2);
  color:#111;
  box-shadow:0 8px 18px rgba(212,175,55,.28);
}
.btn.primary:hover,.btn-primary:hover{
  background:linear-gradient(135deg,#e0c04a,var(--gu-gold));
  border-color:var(--gu-gold);
  color:#000;
}
.btn.secondary,.btn-secondary{
  background:#fff7df;
  border-color:#ead79a;
  color:#7a5d10;
}
.btn.ghost,.btn-light{
  background:#fff;
  border:1px solid var(--gu-line);
  color:#4d463a;
}
.btn.wide{width:100%}

.summary-hero,.stats-grid,.dashboard-grid,.report-columns,.import-grid,.summary-strip,.filter-bar{
  margin-bottom:1rem;
}
.summary-hero{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:1rem;
}
.summary-hero-card,.panel,.stat-card,.report-header,.summary-strip>div,.import-card{
  background:var(--gu-card);
  border:1px solid var(--gu-line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.summary-hero-card{
  padding:1.15rem 1.25rem;
  position:relative;overflow:hidden;
}
.summary-hero-card:before{
  content:"";position:absolute;inset:0 auto 0 0;width:5px;
  background:var(--gu-gold);
}
.summary-hero-card.fund:before{background:var(--gu-green)}
.summary-hero-card.spend:before{background:var(--gu-red)}
.summary-hero-card.safe:before{background:var(--gu-blue)}
.summary-kicker{display:block;color:var(--gu-muted);font-size:.78rem;margin-bottom:.55rem}
.summary-label{font-weight:800;margin-bottom:.35rem}
.summary-value{font-size:clamp(1.35rem,2.8vw,1.9rem);font-weight:800;margin-bottom:.55rem;word-break:break-word}
.summary-hero-card.fund .summary-value{color:var(--gu-green)}
.summary-hero-card.spend .summary-value{color:var(--gu-red)}
.summary-hero-card.safe .summary-value{color:var(--gu-blue)}
.summary-formula{font-size:.78rem;color:#8a8376;border-top:1px dashed var(--gu-line);padding-top:.65rem}

.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem}
.compact-stats .stat-value{font-size:clamp(.95rem,1.8vw,1.15rem)}
.stat-card{
  display:flex;gap:.9rem;align-items:center;
  padding:1rem 1.1rem;position:relative;overflow:hidden;
}
.stat-card:after{
  content:"";position:absolute;right:0;left:0;bottom:0;height:3px;background:var(--gu-gold);
}
.stat-card.tone-green:after,.stat-card.green:after{background:var(--gu-green)}
.stat-card.tone-red:after,.stat-card.red:after{background:var(--gu-red)}
.stat-card.tone-blue:after,.stat-card.blue:after{background:var(--gu-blue)}
.stat-card.tone-purple:after,.stat-card.purple:after{background:var(--gu-purple)}
.stat-icon{
  width:46px;height:46px;border-radius:14px;display:grid;place-items:center;flex-shrink:0;
  background:var(--gu-gold-soft);color:var(--gu-gold-2);font-size:1.25rem;
}
.tone-green .stat-icon,.green .stat-icon{background:rgba(31,157,106,.12);color:var(--gu-green)}
.tone-red .stat-icon,.red .stat-icon{background:rgba(214,69,69,.12);color:var(--gu-red)}
.tone-purple .stat-icon,.purple .stat-icon{background:rgba(122,90,248,.12);color:var(--gu-purple)}
.stat-label{font-size:.8rem;color:var(--gu-muted);margin-bottom:.2rem;font-weight:600}
.stat-value{font-size:clamp(1rem,2vw,1.25rem);font-weight:800;overflow-wrap:anywhere}
.stat-hint{font-size:.72rem;color:#958d80;margin-top:.25rem}

.dashboard-grid,.report-columns,.import-grid{
  display:grid;grid-template-columns:1.3fr 1fr;gap:1rem;
}
.import-grid{grid-template-columns:1fr 1fr}
.panel{overflow:hidden;margin-bottom:1rem}
.dashboard-grid .panel,.report-columns .panel,.import-grid .panel{margin-bottom:0}
.panel-head{
  display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-wrap:wrap;
  padding:1rem 1.1rem;border-bottom:1px solid var(--gu-line);background:#fffcf6;
}
.panel-head h3{margin:0;font-size:1rem;font-weight:800}
.tag,.source-pill,.status{
  display:inline-flex;align-items:center;border-radius:999px;
  padding:.28rem .65rem;font-size:.75rem;font-weight:700;
  background:#f3eee3;color:#6d634f;
}
.link{color:var(--gu-gold-2);font-weight:700;text-decoration:none}
.link:hover{color:#9a7414}

.origin-list,.mini-list,.report-list{padding:.5rem 1rem 1rem}
.origin-row,.mini-row,.report-line{
  display:flex;align-items:flex-start;justify-content:space-between;gap:.75rem;
  padding:.85rem 0;border-bottom:1px solid #f0ebe1;
}
.origin-row:last-child,.mini-row:last-child,.report-line:last-child{border-bottom:0}
.origin-row strong,.mini-row strong,.report-line span{font-size:.9rem;font-weight:700}
.origin-row small,.mini-row small,.report-line small,.block-muted{
  display:block;color:var(--gu-muted);font-size:.75rem;margin-top:.2rem;
}
.origin-total{
  display:flex;justify-content:space-between;gap:.75rem;flex-wrap:wrap;
  margin-top:.75rem;padding:.9rem 1rem;border-radius:.85rem;
  background:linear-gradient(135deg,#fff8e5,#fff);
  border:1px solid #ead79a;font-weight:800;
}
.origin-total.safe-total{background:#eef4ff;border-color:#c9d8ff}
.positive{color:var(--gu-green)!important}
.negative{color:var(--gu-red)!important}
.empty{text-align:center!important;color:#9a9285;padding:2rem!important}

.bars{
  height:190px;display:flex;align-items:end;justify-content:space-around;
  gap:.5rem;padding:1rem 1rem 0;
}
.bar-group{flex:1;display:flex;flex-direction:column;align-items:center;gap:.45rem;min-width:0}
.bar-pair{height:150px;display:flex;align-items:end;gap:4px}
.bar{width:12px;border-radius:8px 8px 0 0;min-height:4px;display:block}
.bar.revenue{background:linear-gradient(180deg,#34c98a,var(--gu-green))}
.bar.expense{background:linear-gradient(180deg,#f07171,var(--gu-red))}
.legend{display:flex;gap:1rem;flex-wrap:wrap;padding:0 1rem 1rem;color:var(--gu-muted);font-size:.8rem}
.dot{width:8px;height:8px;border-radius:50%;display:inline-block;margin-left:.35rem}
.dot.green{background:var(--gu-green)}
.dot.red{background:var(--gu-red)}

/* Dashboard KPIs + flow + timeline */
.kpi-strip{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:.75rem;
  margin-bottom:1rem;
}
.kpi-card{
  background:var(--gu-card);
  border:1px solid var(--gu-line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:.9rem 1rem;
  display:flex;flex-direction:column;gap:.2rem;
  position:relative;overflow:hidden;
}
.kpi-card:before{
  content:"";position:absolute;inset:0 auto 0 0;width:4px;background:var(--gu-gold);
}
.kpi-card span{font-size:.75rem;color:var(--gu-muted);font-weight:700}
.kpi-card b{font-size:clamp(.95rem,1.6vw,1.15rem);font-weight:800;overflow-wrap:anywhere}
.kpi-card small{font-size:.7rem;color:#958d80}

.flow-panel{margin-bottom:1rem}
.money-flow{
  display:flex;align-items:stretch;justify-content:space-between;gap:.55rem;
  flex-wrap:wrap;padding:1.1rem 1.1rem .35rem;
}
.flow-node{
  flex:1 1 120px;min-width:110px;
  background:linear-gradient(180deg,#fffef9,#fff8e8);
  border:1px solid #ead79a;border-radius:1rem;
  padding:.85rem .9rem;position:relative;overflow:hidden;
}
.flow-node span{display:block;font-size:.72rem;color:var(--gu-muted);font-weight:700;margin-bottom:.35rem}
.flow-node strong{display:block;font-size:clamp(.9rem,1.5vw,1.1rem);font-weight:800;overflow-wrap:anywhere}
.flow-node i{
  display:block;height:4px;border-radius:999px;margin-top:.7rem;
  background:#efe4c5;position:relative;overflow:hidden;
}
.flow-node i:after{
  content:"";position:absolute;inset:0 auto 0 0;width:var(--p,20%);
  background:var(--gu-gold);border-radius:inherit;
}
.flow-node.open i:after{background:#6b7280}
.flow-node.in{border-color:#b7e4cb;background:linear-gradient(180deg,#f4fff8,#eafaf1)}
.flow-node.in i:after,.flow-node.in strong{color:var(--gu-green)}
.flow-node.in i:after{background:var(--gu-green)}
.flow-node.fund{border-color:#ead79a}
.flow-node.out{border-color:#f0c2c2;background:linear-gradient(180deg,#fff7f7,#ffeeee)}
.flow-node.out i:after,.flow-node.out strong{color:var(--gu-red)}
.flow-node.out i:after{background:var(--gu-red)}
.flow-node.safe{border-color:#c9d8ff;background:linear-gradient(180deg,#f5f8ff,#eef3ff)}
.flow-node.safe i:after{background:var(--gu-blue)}
.flow-arrow{
  align-self:center;flex:0 0 auto;
  width:28px;height:28px;border-radius:50%;
  display:grid;place-items:center;
  background:#fff;border:1px solid var(--gu-line);
  color:#8a7a4d;font-weight:800;font-size:.85rem;
}
.flow-caption{
  margin:0;padding:.35rem 1.1rem 1rem;
  color:var(--gu-muted);font-size:.78rem;
}

.timeline-chart{
  display:flex;align-items:end;gap:3px;
  overflow-x:auto;padding:1rem 1rem 0;
  min-height:160px;
}
.timeline-col{
  flex:1 0 14px;min-width:14px;max-width:28px;
  display:flex;flex-direction:column;align-items:center;gap:.35rem;
  opacity:.45;
}
.timeline-col.has-data{opacity:1}
.timeline-bars{
  height:120px;display:flex;align-items:end;gap:2px;
}
.t-bar{
  width:5px;border-radius:5px 5px 0 0;display:block;min-height:2px;
}
.t-bar.rev{background:linear-gradient(180deg,#34c98a,var(--gu-green))}
.t-bar.exp{background:linear-gradient(180deg,#f07171,var(--gu-red))}
.timeline-col small{font-size:.62rem;color:#9a9285}

.hbar-list{padding:.75rem 1.1rem 1.1rem}
.hbar-row{margin-bottom:.85rem}
.hbar-row:last-child{margin-bottom:0}
.hbar-meta{
  display:flex;justify-content:space-between;gap:.75rem;flex-wrap:wrap;
  margin-bottom:.35rem;
}
.hbar-meta strong{font-size:.88rem}
.hbar-meta span{font-size:.75rem;color:var(--gu-muted)}
.hbar-track{
  height:8px;border-radius:999px;background:#f1ebe0;overflow:hidden;
}
.hbar-track span{
  display:block;height:100%;border-radius:inherit;
  background:linear-gradient(90deg,var(--gu-gold),#c9a227);
}

.search-input{
  min-width:min(260px,100%);
  height:34px;padding:.35rem .75rem;
  border:1px solid var(--gu-line);border-radius:.65rem;
  background:#fff;font-family:inherit;font-size:.88rem;
}
.payroll-search-form{flex-wrap:wrap;gap:.5rem;align-items:center}

.sheets-panel{margin-bottom:1rem}
.sheets-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(180px,1fr));
  gap:.75rem;
  padding:1rem 1.1rem 1.1rem;
}
.sheet-card{
  background:linear-gradient(180deg,#fffef9,#fff8ea);
  border:1px solid var(--gu-line);
  border-radius:1rem;
  overflow:hidden;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.sheet-card:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 24px rgba(40,30,10,.08);
  border-color:#e0c56a;
}
.sheet-main{
  display:flex;flex-direction:column;gap:.35rem;
  padding:.95rem 1rem .75rem;
  text-decoration:none;color:inherit;min-height:110px;
}
.sheet-main i{
  width:36px;height:36px;border-radius:10px;
  display:grid;place-items:center;
  background:var(--gu-gold-soft);color:var(--gu-gold-2);
  font-size:1.05rem;margin-bottom:.15rem;
}
.sheet-main strong{font-size:.92rem;font-weight:800;line-height:1.45}
.sheet-main small{color:var(--gu-muted);font-size:.72rem}
.sheet-extra{
  display:block;text-align:center;
  padding:.45rem .75rem;border-top:1px dashed var(--gu-line);
  font-size:.75rem;font-weight:700;color:var(--gu-gold-2);text-decoration:none;
  background:#fffdf7;
}
.sheet-extra:hover{background:#fff6dc;color:#9a7414}
.sheet-card.kind-revenue .sheet-main i{background:rgba(31,157,106,.12);color:var(--gu-green)}
.sheet-card.kind-expense .sheet-main i{background:rgba(214,69,69,.12);color:var(--gu-red)}
.sheet-card.kind-cadre .sheet-main i{background:rgba(122,90,248,.12);color:var(--gu-purple)}
.sheet-card.kind-summary .sheet-main i{background:rgba(59,110,214,.12);color:var(--gu-blue)}
.mini-icon{
  width:34px;height:34px;border-radius:.7rem;display:grid;place-items:center;flex-shrink:0;
}
.green-bg{background:rgba(31,157,106,.12);color:var(--gu-green)}

.table-wrap{overflow:auto;-webkit-overflow-scrolling:touch}
table{width:100%;border-collapse:collapse;min-width:640px;margin:0}
th,td{padding:.85rem 1rem;border-bottom:1px solid #efe9de;text-align:right;white-space:nowrap;vertical-align:middle}
th{
  font-size:.78rem;color:var(--gu-muted);font-weight:700;background:#fffcf6;
  position:sticky;top:0;z-index:1;
}
td{font-size:.9rem;background:#fff}
td strong,.emp-name{white-space:normal;color:#1d1a15;font-weight:800}
.emp-name{display:block;font-size:.95rem}
tbody tr:hover td{background:#fffaf0}
.icon-btn{
  border:0;background:transparent;color:#b1a793;font-size:1.2rem;
  width:2rem;height:2rem;border-radius:.55rem;
}
.icon-btn:hover{background:#ffe8e8;color:var(--gu-red)}

.filter-form,.inline-form{display:flex;flex-wrap:wrap;gap:.6rem;align-items:end}
.filter-form input,.inline-form input,.filter-form select,.inline-form select,
input,select,textarea{
  border:1px solid #ddd4c3;
  border-radius:.8rem;
  padding:.7rem .85rem;
  background-color:#fff;
  color:#1d1a15;
  font-family:inherit;
  font-size:16px;
  outline:none;
  width:100%;
}
select,
.form-select,
.form-select-sm,
.filter-form select,
.inline-form select,
.form-grid select,
.modal-card select,
.panel select{
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  padding-top:0!important;
  padding-bottom:0!important;
  padding-right:.65rem!important;
  padding-left:1.85rem!important;
  font-size:.85rem!important;
  line-height:1.2!important;
  border-radius:.65rem!important;
  background-color:#fff!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23655e52' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E")!important;
  background-repeat:no-repeat!important;
  background-position:left .55rem center!important;
  background-size:12px 12px!important;
  appearance:none!important;
  -webkit-appearance:none!important;
  -moz-appearance:none!important;
}
.form-grid select,
.modal-card select,
.panel select{
  width:100%!important;
  max-width:100%;
}
@media(min-width:768px){
  input,select,textarea,.filter-form input,.inline-form input,.filter-form select,.inline-form select{font-size:.92rem}
}
input:focus,select:focus,textarea:focus{
  border-color:var(--gu-gold);
  box-shadow:0 0 0 .2rem rgba(212,175,55,.18);
}
.filter-form label,.inline-form label,.form-grid label{
  display:flex;flex-direction:column;gap:.35rem;
  color:var(--gu-muted);font-size:.8rem;font-weight:600;min-width:0;
}
.filter-form input,.inline-form input,.filter-form select,.inline-form select{min-width:140px;flex:1 1 140px;width:auto}
.filter-form input[name=q]{flex:1 1 220px}
.summary-strip{display:flex;flex-wrap:wrap;gap:.75rem}
.summary-strip>div{padding:.85rem 1rem;flex:1 1 140px;min-width:0}
.summary-strip span{display:block;color:var(--gu-muted);font-size:.78rem;margin-bottom:.25rem;font-weight:600}
.summary-strip b{font-size:1rem;font-weight:800;overflow-wrap:anywhere}

.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.9rem}
.form-grid .full{grid-column:1/-1}

.modal{
  display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:1080;
  align-items:flex-end;justify-content:center;padding:0;
}
.modal.show{display:flex}
.modal-card{
  background:#fff;width:min(640px,100%);max-height:92vh;overflow:auto;
  border-radius:1.1rem 1.1rem 0 0;padding:1.2rem;
}
.wide-modal{width:min(780px,100%)}
.modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem}
.modal-head h3{margin:0;font-weight:800}
.close-modal{
  border:0;width:2.2rem;height:2.2rem;border-radius:.7rem;
  background:#f3eee3;color:#6d634f;font-size:1.2rem;
}

.status.draft{background:#fff3d6;color:#9a6b00}
.status.approved{background:#e7f8ef;color:#147653}
.status.paid{background:#eaf1ff;color:#2f6fed}

.report-header{padding:1.1rem 1.2rem}
.report-header h3{margin:0 0 .3rem;font-weight:800}
.report-header p{margin:0;color:var(--gu-muted);font-size:.8rem}
.payroll-summary{display:flex;gap:2rem;flex-wrap:wrap;padding:1.1rem}
.payroll-summary b{font-size:1.15rem;font-weight:800}

.reports-stack{display:flex;flex-direction:column;gap:1.15rem;margin-bottom:1.25rem}
.report-card-bar{
  display:flex;justify-content:space-between;align-items:center;gap:.85rem;flex-wrap:wrap;
  margin-bottom:1rem;padding-bottom:.85rem;border-bottom:1px solid var(--gu-line);
}
.report-card-bar h3{margin:0;font-size:1.05rem;font-weight:800}
.report-card-bar .muted{margin:.2rem 0 0;font-size:.82rem}
.print-report{
  background:#fff;
  border:1px solid var(--gu-line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:1.25rem;
}
.print-report-head{
  display:flex;justify-content:space-between;gap:1rem;flex-wrap:wrap;
  border-bottom:2px solid var(--gu-gold);padding-bottom:1rem;margin-bottom:1rem;
}
.print-brand{display:flex;align-items:center;gap:.85rem}
.print-logo{
  width:120px;background:#000;border-radius:.7rem;padding:.45rem .6rem;
}
.print-brand h2{margin:0;font-size:1.15rem;font-weight:800}
.print-brand p,.print-meta p{margin:.2rem 0;color:var(--gu-muted);font-size:.85rem}
.print-meta{text-align:left}
.print-meta h3{margin:0 0 .4rem;font-size:1.05rem;font-weight:800}
.report-tables-grid{
  display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin:1rem 0;
}
.report-table{
  width:100%;min-width:0!important;border-collapse:collapse;
  margin:0 0 1rem;background:#fff;
}
.report-table th,.report-table td{
  border:1px solid #d9d0bf;padding:.55rem .7rem;text-align:right;
  white-space:normal;font-size:.88rem;background:#fff;
}
.report-table thead th{
  background:#fff8e8;color:#1d1a15;font-weight:800;position:static;
}
.report-table .num{text-align:left;font-variant-numeric:tabular-nums;white-space:nowrap}
.report-table .total-row td{background:#fff4d4;font-weight:800}
.report-table.summary-table td:first-child{width:65%}
.print-signatures{
  display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;
  margin-top:1.5rem;padding-top:1rem;border-top:1px dashed #d9d0bf;
}
.print-signatures div{display:flex;flex-direction:column;gap:.55rem;font-size:.85rem}
.print-signatures strong{font-size:.95rem}
@media(max-width:900px){
  .report-tables-grid,.print-signatures{grid-template-columns:1fr}
  .print-meta{text-align:right}
}

.import-grid .panel{padding:1.25rem}
.import-card{text-align:center;padding:1.5rem!important}
.import-icon{
  width:64px;height:64px;border-radius:18px;margin:0 auto 1rem;
  display:grid;place-items:center;font-size:1.8rem;
  background:var(--gu-gold-soft);color:var(--gu-gold-2);
}
.file-drop{
  display:block;border:2px dashed #dfd2ad;border-radius:1rem;
  padding:1.1rem;margin-top:1rem;color:var(--gu-gold-2);background:#fffdf7;
}
.file-drop input{margin-top:.7rem;border:0;padding:0}
.check-list{color:#655e52;line-height:2;font-size:.9rem}
.notice{
  background:#fff5d8;color:#7a5d10;border-radius:.8rem;
  padding:.85rem 1rem;font-size:.82rem;margin-top:1rem;
}
.error-panel{padding:1.25rem}

/* Auth */
.login-page{
  min-height:100vh;min-height:100dvh;
  display:grid;place-items:center;
  background:
    radial-gradient(circle at top, rgba(212,175,55,.22), transparent 35%),
    linear-gradient(160deg,#000 0%, #17150f 45%, #2a2314 100%);
  padding:1.25rem;
}
.login-card,.install-card{
  width:min(440px,100%);
  background:rgba(255,255,255,.97);
  border:1px solid rgba(212,175,55,.35);
  border-radius:1.35rem;
  padding:1.6rem;
  box-shadow:0 25px 60px rgba(0,0,0,.35);
}
.install-card{width:min(500px,100%)}
.login-brand{text-align:center;margin-bottom:1.25rem}
.login-brand img{
  width:min(280px,100%);
  margin:0 auto 1rem;
  display:block;
  background:#000;
  border-radius:1rem;
  padding:.75rem 1rem;
}
.login-brand h1{margin:0 0 .35rem;font-weight:800;color:#111;font-size:1.55rem}
.login-brand p{margin:0;color:var(--gu-muted);font-size:.9rem}
.login-card form label{
  display:flex;flex-direction:column;gap:.4rem;
  color:#655e52;font-size:.85rem;font-weight:600;margin-bottom:.9rem;
}
.login-note{color:#8a8376;font-size:.8rem;text-align:center;margin-top:1rem;line-height:1.7}
.login-page .alert{margin:0 0 1rem}

/* Permissions matrix */
.permissions-matrix{min-width:720px}
.permissions-matrix th,.permissions-matrix td{vertical-align:middle}
.perm-icon{
  width:38px;height:38px;border-radius:12px;display:grid;place-items:center;flex-shrink:0;
  background:var(--gu-gold-soft);color:var(--gu-gold-2);font-size:1.1rem;
}
.perm-check{
  width:1.25rem;height:1.25rem;border-radius:.35rem;border-color:#d6c79a;
  cursor:pointer;
}
.perm-check:checked{
  background-color:var(--gu-gold-2);border-color:var(--gu-gold-2);
}
.tiny-note{font-size:.68rem;color:#9a9285;margin-top:.25rem}
.user-actions{display:flex;flex-wrap:wrap;gap:.35rem;align-items:center}
.user-actions form{margin:0}
.edit-active-row span{font-weight:700;color:#1d1a15}

.pwa-install-fab{
  position:fixed;
  z-index:1090;
  left:1rem;
  bottom:calc(1rem + env(safe-area-inset-bottom,0px));
  display:inline-flex;
  align-items:center;
  gap:.55rem;
  border:0;
  border-radius:999px;
  padding:.75rem 1.05rem;
  background:linear-gradient(135deg,var(--gu-gold),var(--gu-gold-2));
  color:#111;
  font-weight:800;
  font-size:.88rem;
  box-shadow:0 14px 30px rgba(0,0,0,.28),0 0 0 1px rgba(212,175,55,.35);
  cursor:pointer;
}
.pwa-install-fab[hidden]{display:none!important}
.pwa-install-fab i{font-size:1.15rem}
.pwa-install-fab:hover{filter:brightness(1.05);transform:translateY(-1px)}
.pwa-hint p{margin:0 0 .85rem;color:#655e52;line-height:1.8}
.pwa-steps{margin:0;padding-right:1.1rem;color:#655e52;line-height:2}
@media(max-width:575.98px){
  .pwa-install-fab span{display:none}
  .pwa-install-fab{
    width:3.25rem;height:3.25rem;padding:0;justify-content:center;border-radius:50%;
  }
}

/* Bootstrap alert polish */
.alert{border-radius:.9rem;border:0;font-weight:600}
.alert-success{background:#e8f8f0;color:#146c43}
.alert-danger{background:#fdecec;color:#a33b3b}

@media(min-width:768px){
  .modal{align-items:center;padding:1.25rem}
  .modal-card,.wide-modal{border-radius:1.1rem}
}

@media(max-width:1199.98px){
  .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .kpi-strip{grid-template-columns:repeat(3,minmax(0,1fr))}
}

@media(max-width:991.98px){
  .app-sidebar{transform:translateX(110%);width:min(300px,88vw)}
  .app-sidebar.open{transform:translateX(0)}
  .app-main{margin-right:0}
  .summary-hero,.dashboard-grid,.report-columns,.import-grid{grid-template-columns:1fr}
  .flow-arrow{display:none}
}

@media(max-width:767.98px){
  .toolbar-actions,.toolbar-actions .btn,.toolbar-actions form{width:100%}
  .toolbar-actions form .btn{width:100%}
  .stats-grid{grid-template-columns:1fr}
  .kpi-strip{grid-template-columns:repeat(2,minmax(0,1fr))}
  .search-input{flex:1 1 100%!important;width:100%!important;min-width:0}
  .form-grid{grid-template-columns:1fr}
  .form-grid .full{grid-column:auto}
  .filter-form label,.inline-form label,
  .filter-form input,.inline-form input,
  .filter-form select,.inline-form select,
  .filter-form .btn,.inline-form .btn{flex:1 1 100%;width:100%}
  .filter-form > input[type="date"],
  .filter-form > input[type="month"],
  .inline-form > input[type="date"],
  .inline-form > input[type="month"],
  .filter-form label:has(> select),
  .inline-form label:has(> select),
  .filter-form > select,
  .inline-form > select,
  .month-filter-label,
  .month-filter .month-input,
  .month-filter .btn,
  .filter-form .btn,
  .inline-form .btn,
  .filter-form a.btn{
    flex:0 0 auto!important;
    width:auto!important;
    height:34px!important;
    min-height:34px!important;
  }
  .filter-form label:has(> select),
  .inline-form label:has(> select){
    height:auto!important;
    min-height:0!important;
    display:inline-flex!important;
  }
  .filter-form label:has(> select) select,
  .inline-form label:has(> select) select{
    flex:1 1 140px!important;
    min-width:140px!important;
    width:auto!important;
    height:34px!important;
    min-height:34px!important;
    max-height:34px!important;
  }
  .month-filter{width:100%;justify-content:flex-start;flex-wrap:wrap!important}
  .month-filter .month-input,
  .filter-form > input[type="date"],
  .filter-form > input[type="month"]{flex:1 1 140px!important;min-width:140px!important;max-width:none}
  .filter-form > input[name="q"]{flex:1 1 100%!important;width:100%!important;height:34px!important;min-height:34px!important}
  .summary-strip>div{flex:1 1 calc(50% - .75rem)}
  table{min-width:540px}
}

@media(max-width:480px){
  .summary-strip>div{flex:1 1 100%}
  .origin-row,.report-line{flex-direction:column}
  .kpi-strip{grid-template-columns:1fr}
}

@media print{
  @page{size:A4;margin:12mm}
  body.app-body{
    background:#fff!important;
    color:#000!important;
    padding:0!important;
  }
  .app-sidebar,.sidebar-backdrop,.app-topbar,.toolbar,.toolbar-actions,.filter-bar,
  .menu-btn,.btn,.no-print,.alert,.pwa-install-fab{display:none!important}
  .app-main,.app-content{margin:0!important;padding:0!important;width:100%!important}
  .reports-stack{gap:0;margin:0}
  .print-report{
    border:0!important;box-shadow:none!important;border-radius:0!important;
    padding:0!important;margin:0!important;
  }
  body.printing-single .print-report{display:none!important}
  body.printing-single .print-report.print-target{display:block!important}
  body:not(.printing-single) .print-report + .print-report{
    page-break-before:always;break-before:page;padding-top:4mm!important;
  }
  .print-report-head{border-bottom:2px solid #000!important}
  .print-logo{print-color-adjust:exact;-webkit-print-color-adjust:exact}
  .report-tables-grid{grid-template-columns:1fr 1fr;gap:8mm;break-inside:avoid}
  .report-table{page-break-inside:avoid;margin-bottom:6mm}
  .report-table th,.report-table td{border-color:#000!important;font-size:11pt}
  .report-table thead th,.report-table .total-row td{
    background:#eee!important;print-color-adjust:exact;-webkit-print-color-adjust:exact;
  }
  .positive,.negative{color:#000!important}
  .print-signatures{page-break-inside:avoid;margin-top:10mm}
  .panel,.summary-hero-card,.stat-card{box-shadow:none}
}
