:root{
  --p:#2b2d7a;
  --a:#8f4bd8;

  /* Dark modern background */
  --bg0:#070a17;
  --bg1:#0a0f25;
  --bg2:#101a3a;

  /* Glass cards */
  --card: rgba(18, 26, 54, .55);
  --card2: rgba(18, 26, 54, .40);
  --line: rgba(255,255,255,.10);
  --line2: rgba(255,255,255,.06);

  --text:#eaf0ff;
  --muted: rgba(234,240,255,.75);

  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --shadow2: 0 10px 30px rgba(0,0,0,.35);

  --r:18px;
  --r2:14px;

  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  background:
    radial-gradient(1100px 600px at 18% 20%, rgba(143,75,216,.25), transparent 60%),
    radial-gradient(900px 550px at 78% 18%, rgba(43,45,122,.35), transparent 55%),
    radial-gradient(900px 650px at 50% 85%, rgba(34,162,220,.10), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 40%, var(--bg2));
}

/* layout */
.container{max-width:1200px;margin:26px auto;padding:0 18px}
a{text-decoration:none;color:inherit}
.muted{color:var(--muted);font-size:14px}

/* Topbar */
.topbar{
  position:sticky;top:0;z-index:10;
  margin:18px auto 0;
  max-width:1200px;
  padding:14px 18px;
  border-radius:22px;
  background: linear-gradient(90deg, rgba(35,42,82,.65), rgba(75,40,140,.35));
  border:1px solid var(--line);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(14px);
  display:flex;align-items:center;justify-content:space-between;
}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.brand-name strong{font-size:18px;letter-spacing:.2px}
.brand-logo{
  width:46px;height:46px;border-radius:16px;
  display:grid;place-items:center;
  background: linear-gradient(135deg, rgba(143,75,216,.45), rgba(43,45,122,.55));
  border:1px solid rgba(255,255,255,.14);
  overflow:hidden;
}
.brand-logo img{max-width:150px;max-height:40px;object-fit:contain}
.brand-logo.noimg .logo-fallback{display:block}
.logo-fallback{display:none;color:#fff;font-weight:900;letter-spacing:.8px}

/* Page title */
.page-title{margin:22px 0 18px;font-size:34px}

/* grid cards */
.grid4{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:16px;
  align-items:start;
}
@media (max-width: 1100px){ .grid4{grid-template-columns: repeat(2, 1fr);} }
@media (max-width: 640px){ .grid4{grid-template-columns: 1fr;} }

.card{
  border-radius:22px;
  background: linear-gradient(180deg, var(--card), var(--card2));
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card-head{padding:18px 18px 0}
.card h3{margin:0 0 10px;font-size:20px}
.section{padding:12px 18px}
.subhead{margin:10px 0 10px;font-size:16px;color:rgba(234,240,255,.92)}
.divider{height:1px;background:var(--line2);margin:10px 0}

/* fields */
.field-label{display:block;font-size:13px;color:var(--muted);margin:0 0 8px}
input, select{
  width:100%;
  border:1px solid var(--line2);
  border-radius:14px;
  padding:11px 12px;
  outline:none;
  background: rgba(255,255,255,.06);
  color:var(--text);
}
select option{color:#111}
input:focus, select:focus{
  border-color: rgba(143,75,216,.45);
  box-shadow:0 0 0 4px rgba(143,75,216,.16);
}

.row{display:flex;gap:10px;align-items:center}
.row > * {flex:1}
.row .btn{flex:0 0 auto}

/* buttons */
.btn{
  background: linear-gradient(90deg, rgba(143,75,216,.95), rgba(43,45,122,.95));
  color:#fff;border:0;border-radius:14px;
  padding:10px 14px;font-weight:800;cursor:pointer;
  box-shadow:0 10px 22px rgba(0,0,0,.25);
}
.btn:hover{filter:brightness(1.06)}
.btn.ghost{
  background: rgba(255,255,255,.06);
  color:var(--text);
  border:1px solid rgba(255,255,255,.14);
  box-shadow:none;
}

/* tip */
.tip{
  margin:12px 18px 0;
  padding:10px 12px;
  border-radius:16px;
  border:1px dashed rgba(143,75,216,.35);
  background:rgba(143,75,216,.08);
  color:rgba(234,240,255,.86);
  font-size:13px;
}

/* lists */
.list{list-style:none;margin:0;padding:0}
.list-item,.file-item{
  border:1px solid rgba(255,255,255,.12);
  border-radius:18px;
  padding:12px 12px;
  margin:10px 0;
  background: rgba(10,14,30,.35);
}
.list-item{display:flex;align-items:center;justify-content:space-between;gap:12px}
.li-left{min-width:0}
.li-right{flex:0 0 auto}

.file-title{font-size:14px;word-break:break-word;color:rgba(234,240,255,.92);margin-bottom:50px;line-height: 1.35;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;overflow: hidden;word-break: break-word;}
.file-actions{display:flex;gap:8px;flex-wrap:nowrap;align-items:center;margin-top: 40px;justify-content: flex-end;}
@media (max-width: 520px){
  .file-actions{flex-wrap:wrap} /* على الموبايل ممكن يلف */
}

/* small action buttons (View/Download/Delete) */
.link, .linkbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:34px;                 /* ✅ أصغر */
  padding:0 10px;
  border-radius:12px;
  font-weight:800;
  font-size:13px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color:rgba(234,240,255,.92);
  white-space:nowrap;
}
.link:hover,.linkbtn:hover{filter:brightness(1.06)}
.link.danger,.linkbtn.danger{
  border-color: rgba(255,80,80,.35);
  background: rgba(255,80,80,.10);
  color: #ffd0d0;
}
.inline{display:inline}

/* menu (3 dots) */
.menu{position:relative}
.icon-btn{
  width:34px;height:34px;border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color:rgba(234,240,255,.9);
  cursor:pointer;font-size:18px;line-height:0;
}
.menu-pop{
  position:absolute;right:0;top:38px;
  min-width:140px;
  background: rgba(10,14,30,.85);
  border:1px solid rgba(255,255,255,.14);
  border-radius:16px;
  box-shadow: var(--shadow2);
  padding:8px;
  display:none;
  backdrop-filter: blur(12px);
}
.menu-pop.open{display:block}
.menu-item{
  width:100%;
  text-align:left;
  border:0;background:transparent;
  padding:10px 10px;border-radius:12px;
  cursor:pointer;font-weight:900;
  color:rgba(234,240,255,.92);
}
.menu-item:hover{background:rgba(255,255,255,.06)}
.menu-item.danger{color:#ffd0d0}

/* Company selector cards */
.cards-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:16px;
  align-items:start;
}
@media (max-width: 1100px){ .cards-grid{grid-template-columns: repeat(2, 1fr);} }
@media (max-width: 640px){ .cards-grid{grid-template-columns: 1fr;} }

.company-card{
  display:flex;gap:14px;
  padding:16px;
  border-radius:22px;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(18, 26, 54, .55), rgba(18, 26, 54, .40));
  box-shadow: var(--shadow2);
  height:auto;
}
.company-logo{
  width:74px;height:50px;border-radius:16px;
  background: linear-gradient(135deg, rgba(143,75,216,.60), rgba(43,45,122,.55));
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;flex:0 0 auto;
  border:1px solid rgba(255,255,255,.14);
}
.company-logo img{max-height:32px;max-width:62px;object-fit:contain}
.company-logo .logo-fallback{display:none;color:#fff;font-weight:900;letter-spacing:.6px}
.company-logo.noimg .logo-fallback{display:block}
.company-meta h3{margin:0 0 6px;font-size:18px;color:rgba(234,240,255,.95)}

/* Login page */
.login-wrap{
  min-height:100%;
  display:grid;
  place-items:center;
  padding:28px 16px;
}
.login-card{
  width:min(520px, 100%);
  border-radius:26px;
  padding:18px;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(18, 26, 54, .62), rgba(18, 26, 54, .40));
  box-shadow: var(--shadow);
}
.login-head{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 10px 2px;
}
.login-title{
  margin:8px 10px 14px;
  font-size:26px;
  letter-spacing:.2px;
}
.login-form{
  padding:0 10px 12px;
  display:grid;
  gap:12px;
}
.alert{
  margin:0 10px 12px;
  padding:10px 12px;
  border-radius:16px;
  border:1px solid rgba(255,80,80,.35);
  background: rgba(255,80,80,.10);
  color:#ffd0d0;
  font-weight:800;
}
.backlink{
  margin:12px 10px 6px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  color:rgba(234,240,255,.88);
  font-weight:900;
  opacity:.92;
}
.backlink:hover{opacity:1}

/* --- Fix: company cards width + long domain wrap --- */

/* على الشاشات العادية خليها 3 أعمدة بدل 4 */
.cards-grid{
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* على الشاشات الصغيرة 2 ثم 1 */
@media (max-width: 1100px){
  .cards-grid{grid-template-columns: repeat(2, minmax(0, 1fr));}
}
@media (max-width: 640px){
  .cards-grid{grid-template-columns: 1fr;}
}

/* امنع خروج النص خارج الكرت */
.company-card{min-width:0}
.company-meta{min-width:0}

/* خلي الدومين يلف بدل ما يطلع برا */
.company-meta .muted{
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* =========================
   VIEWER PAGE (View Only)
   ========================= */
.viewer-page{
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* خلفية نفس ستايل الداشبورد (Glow + Gradient) */
.viewer-page::before{
  content:"";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(143,75,216,.35), transparent 60%),
    radial-gradient(900px 520px at 80% 20%, rgba(43,45,122,.35), transparent 62%),
    radial-gradient(900px 520px at 50% 90%, rgba(20,40,120,.30), transparent 60%),
    linear-gradient(180deg, rgba(7,10,35,.90), rgba(7,10,35,.78));
  pointer-events: none;
  z-index: -2;
}

.viewer-page .container{max-width: 1320px; padding: 0 22px;}
.viewer-page .page-hero{padding: 14px 0 12px;}
.viewer-page .page-title{margin: 10px 0 6px; font-size: 44px; letter-spacing: -0.6px;}
.viewer-page .muted{color: rgba(255,255,255,.75);}
.viewer-page .muted.small{font-size: 12.5px;}

.viewer-page .topbar{
  background: rgba(255,255,255,.07);
  border-bottom: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 14px 40px rgba(0,0,0,.25);
}

.viewer-page .brand-name{display:flex; align-items:center; gap:10px; color: rgba(255,255,255,.92);}
.viewer-page .pill{
  display:inline-flex; align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
}

/* Grid أكبر شوي + مسافات */
.viewer-grid{
  gap: 22px;
  align-items: start;
}

/* Glass cards */
.viewer-page .card.glass{
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 18px 60px rgba(0,0,0,.30);
  backdrop-filter: blur(14px);
}

.viewer-page .card-head{padding: 18px 18px 10px;}
.viewer-page .card h3{
  color: rgba(255,255,255,.95);
  font-size: 22px;
  margin: 0 0 6px;
}
.viewer-page .subhead{
  color: rgba(255,255,255,.88);
}

.viewer-page .divider{
  background: rgba(255,255,255,.10);
}

.viewer-page input, .viewer-page select{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.92);
}
.viewer-page select option{color:#111;}

.viewer-page .btn{
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
}
.viewer-page .btn.ghost{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.92);
}

/* Lists / Items */
.viewer-page .list.compact .list-item.compact,
.viewer-page .list.compact .file-item.compact{
  margin: 10px 0;
  padding: 12px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}

.viewer-page .file-title{
  color: rgba(255,255,255,.90);
}
.viewer-page .file-title .dot{margin:0 8px; opacity:.6;}
.viewer-page .file-title .name{opacity:.95;}
.viewer-page .empty{
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(255,255,255,.18);
  color: rgba(255,255,255,.72);
  background: rgba(255,255,255,.05);
}

/* buttons smaller + in one row */
.viewer-page .file-actions{
  display:flex;
  gap: 10px;
  margin-top: 8px;
}
.viewer-page .file-actions.nowrap{
  flex-wrap: nowrap;
}
.viewer-page .btn-sm{
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1;
}
.viewer-page .link{
  color: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.10);
}
.viewer-page .link:hover{filter: brightness(1.06);}

.viewer-page .tag{
  display:inline-flex;
  margin-right: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,.86);
}

/* Responsive تحسين */
@media (max-width: 1100px){
  .viewer-page .page-title{font-size: 36px;}
}
@media (max-width: 640px){
  .viewer-page .page-title{font-size: 30px;}
  .viewer-page .file-actions{gap:8px;}
  .viewer-page .btn-sm{padding: 6px 9px;}
}




/* =========================
   DASHBOARD LAYOUT IMPROVE (SAFE OVERRIDES)
   ========================= */

/* 1) Center container + make it wider */
.container{
  max-width: 1320px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* 2) Make the cards grid more spacious and responsive */
.grid4{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 22px;
  align-items: start;
}

/* 3) Cards: slightly bigger + less cramped */
.card{
  border-radius: 18px;
  padding: 16px 16px 14px;
}

/* 4) Section spacing */
.card .section{
  margin-top: 12px;
}
.card .divider{
  margin: 14px 0;
  opacity: .35;
}

/* 5) Make inputs/buttons comfortable */
input, select{
  width: 100%;
}
.row{
  gap: 10px;
}
.btn{
  padding: 10px 14px;
  border-radius: 12px;
}

/* 6) LIST ITEMS: fix the "vertical letters" issue */
.list, .list.compact{
  padding-left: 0;
  margin: 0;
  list-style: none;
}
.file-item, .list-item{
  width: 100%;
}

/* Force file row to have enough room for title */
.file-item{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* This is the key: prevent the title block from shrinking to 1 character */
.file-title{
  flex: 1 1 auto;
  min-width: 240px;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

/* Keep actions on the right without crushing the title */
.file-actions{
  flex: 0 0 auto;
  min-width: 180px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

/* 7) Make long file lists usable (scroll inside list area, NOT whole page) */
.section .subhead + .list{
  max-height: 320px;
  overflow: auto;
  padding-right: 6px;
}
.section .subhead + .list.compact{
  max-height: 360px;
  overflow: auto;
  padding-right: 6px;
}

/* 8) Better readability for headings */
.page-title{
  margin: 18px 0 14px;
}
.card-head h3{
  font-size: 18px;
}

/* 9) Mobile adjustments */
@media (max-width: 520px){
  .container{ padding-left: 14px; padding-right: 14px; }
  .grid4{ grid-template-columns: 1fr; }
  .file-actions{ min-width: 140px; }
  .file-title{ min-width: 0; }
}

/* ===== Inline Section Files Panel (no page height growth) ===== */
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.files-panel{
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(10,14,30,.25);
  padding: 10px;
  max-height: 340px;  /* ثابت */
  overflow: auto;     /* scroll داخل الكرت */
}

/* smaller buttons */
.btn-sm{
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
}

/* clickable section name */
.section-link{
  color: inherit;
  text-decoration: none;
  display: inline-block;
}
.section-link:hover{
  text-decoration: underline;
  opacity: .95;
}

/* =========================
   VIEW PAGE (Public Catalog)
   Scoped to .view-page only
   ========================= */

.view-page { min-height: 100vh; }
.view-page .view-wrap{
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 22px 40px;
}

.view-page .view-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 16px;
  border-radius:18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(10px);
}

.view-page .brand{ display:flex; align-items:center; gap:12px; }
.view-page .brand-logo{
  width:44px; height:44px; border-radius:14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
}
.view-page .brand-logo img{ width:70%; height:auto; display:block; }
.view-page .brand-title{ font-weight:700; font-size:16px; line-height:1; }
.view-page .brand-sub{ opacity:.8; font-size:12px; margin-top:6px; }

.view-page .badge{
  padding:8px 10px;
  border-radius:999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-size:12px;
}

.view-page .view-hero{ padding:22px 6px 8px; }
.view-page .view-hero h1{ margin:0; font-size:44px; letter-spacing:-0.02em; }
.view-page .view-hero p{ margin:10px 0 0; opacity:.85; max-width: 680px; }

.view-page .view-grid{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:18px;
  margin-top:18px;
}

.view-page .panel{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius:18px;
  padding:16px;
}

.view-page .panel-head{ margin-bottom:12px; }
.view-page .panel-head h2{ margin:0; font-size:18px; }
.view-page .muted{ opacity:.75; font-size:12px; margin-top:6px; }

.view-page .panel-head.row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.view-page .year-form{
  display:flex;
  align-items:center;
  gap:10px;
}

.view-page .select{
  min-width: 190px;
  padding:10px 12px;
  border-radius:12px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.12);
  color: inherit;
  outline: none;
}

.view-page .section-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding-top: 6px;
}

.view-page .section-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 12px;
  border-radius:14px;
  text-decoration:none;
  color: inherit;
  background: rgba(0,0,0,0.16);
  border: 1px solid rgba(255,255,255,0.10);
  transition: transform .12s ease, background .12s ease;
}
.view-page .section-item:hover{ transform: translateY(-1px); background: rgba(0,0,0,0.22); }
.view-page .section-item.is-active{
  background: rgba(124,58,237,0.18);
  border-color: rgba(124,58,237,0.45);
}

.view-page .sec-name{ font-weight:700; }
.view-page .sec-pill{
  font-size:12px;
  opacity:.9;
  min-width: 22px;
  text-align:center;
}

.view-page .panel-foot{ margin-top:12px; }
.view-page .link-btn{
  display:inline-block;
  padding:10px 12px;
  border-radius:12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  text-decoration:none;
  color: inherit;
  font-size: 13px;
}

.view-page .files-block{ margin-top: 6px; }

.view-page .empty{
  padding:14px;
  border-radius:14px;
  background: rgba(0,0,0,0.14);
  border: 1px dashed rgba(255,255,255,0.16);
  opacity:.9;
}

.view-page .files-grid{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.view-page .file-card{
  display:flex;
  align-items:center;
  gap:14px;
  padding:14px 14px;
  border-radius:16px;
  background: rgba(0,0,0,0.16);
  border: 1px solid rgba(255,255,255,0.10);
}

.view-page .file-info{ min-width: 0; }
.view-page .file-title{
  font-weight:700;
  line-height:1.25;
  word-break: break-word;
}
.view-page .file-section{ opacity:.95; }
.view-page .sep{ opacity:.55; margin: 0 6px; }
.view-page .file-meta{
  display:flex;
  gap:8px;
  margin-top:8px;
  flex-wrap:wrap;
}
.view-page .meta-chip{
  font-size:12px;
  opacity:.9;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

.view-page .file-actions{
  margin-left:auto;               /* ✅ دائما يمين */
  display:flex;
  align-items:center;
  gap:10px;
  flex-shrink:0;
}

.view-page .files-scroll{
  max-height: 520px;              /* ✅ يمنع طول الصفحة */
  overflow:auto;
  padding-right: 6px;
}

.view-page .view-footer{
  margin-top: 16px;
  padding: 10px 6px 0;
}

/* responsive */
@media (max-width: 980px){
  .view-page .view-grid{ grid-template-columns: 1fr; }
  .view-page .files-scroll{ max-height: 460px; }
}

/* ===== Viewer layout v2 ===== */
.view-grid.view-grid-v2{
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.view-grid.view-grid-v2 .panel-small{ min-height: 320px; }
.view-grid.view-grid-v2 .panel-big{ min-height: 320px; }

@media (max-width: 1100px){
  .view-grid.view-grid-v2{
    grid-template-columns: 1fr;
  }
}

/* Big scroll area to prevent page getting too long */
.big-scroll{
  max-height: 430px;
  overflow: auto;
  padding-right: 6px;
}

/* Make file actions always on the right */
.file-card{
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.file-info{
  flex: 1;
  min-width: 0;
}
.file-actions{
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

/* Stat box */
.stat{
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.10);
}
.stat-num{
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}
.stat-label{
  margin-top: 6px;
  opacity: .8;
}

/* buttons ghost */
.btn.btn-ghost{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}
.btn.btn-ghost:hover{
  background: rgba(255,255,255,0.10);
}


/* ==== LOGO SIZE OVERRIDE (bigger, clearer) ==== */
.brand-logo{
  width: 80px !important;
  height: 80px !important;
  flex: 0 0 80px !important;
}
.brand-logo img{
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

/* If view page has a header/logo block, this helps too */
.header-logo, .logo, .site-logo{
  width: 80px !important;
  height: 80px !important;
}
.header-logo img, .logo img, .site-logo img{
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display:block !important;
}

/* ==== LOGO FIX: remove frame + allow bigger logo ==== */

/* kill the framed square behind logo (common classes) */
.brand-logo,
.header-logo,
.logo,
.site-logo,
.topbar .brand-logo,
.brand .brand-logo{
  width: 80px !important;
  height: 80px !important;
  flex: 0 0 80px !important;

  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;

  padding: 0 !important;
  margin: 0 !important;

  overflow: visible !important; /* important: don't crop logo */
  border-radius: 0 !important;  /* remove rounded frame */
}

/* make the image fill its box cleanly */
.brand-logo img,
.header-logo img,
.logo img,
.site-logo img,
.topbar .brand-logo img{
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

/* ==== FORCE REMOVE ANY LOGO FRAME (more aggressive) ==== */
.brand,
.brand * ,
.topbar .brand,
.topbar .brand *{
  box-shadow: none !important;
}

/* likely wrapper around logo */
.brand-logo,
.brand-logo *{
  border: 0 !important;
  background: transparent !important;
  outline: 0 !important;
}

/* if there is a square around logo, it's often the img container */
.brand-logo{
  border-radius: 0 !important;
  overflow: visible !important;
  padding: 0 !important;
}

/* if logo is inside "brand" and framed by a child */
.brand .brand-logo{
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* ==== DASHBOARD: Bigger logo like /view (keep purple header as-is) ==== */
.topbar .brand-logo,
.topbar .logo,
.topbar .site-logo{
  width: 120px !important;
  height: 60px !important;
  flex: 0 0 120px !important;
  padding: 0 !important;
  margin: 0 !important;

  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  border-radius: 0 !important;
}

.topbar .brand-logo img,
.topbar .logo img,
.topbar .site-logo img{
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  padding: 0 !important;
}

/* mobile */
@media (max-width: 680px){
  .topbar .brand-logo,
  .topbar .logo,
  .topbar .site-logo{
    width: 110px !important;
    height: 54px !important;
    flex-basis: 110px !important;
  }
}


/* ==== DASHBOARD HEADER: make logo bigger (only dashboard topbar) ==== */
.topbar .brand{
  display:flex;
  align-items:center;
  gap:14px;
}

/* enlarge logo box */
.topbar .brand-logo{
  width: 120px !important;
  height: 64px !important;
  flex: 0 0 120px !important;

  padding: 0 !important;
  margin: 0 !important;

  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;

  overflow: visible !important;
  border-radius: 0 !important;
}

/* image fits cleanly */
.topbar .brand-logo img{
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  padding: 0 !important;
}

/* mobile */
@media (max-width: 680px){
  .topbar .brand-logo{
    width: 110px !important;
    height: 56px !important;
    flex-basis: 110px !important;
  }
}


/* --- REP view cards layout --- */
.rep-cards{
  display:flex;
  gap:18px;
  align-items:stretch;
  flex-wrap:nowrap;
}
.rep-card{
  flex:1 1 0;
  min-width:0;
}
@media (max-width: 1100px){
  .rep-cards{ flex-wrap:wrap; }
}

/* REP card styling */
.rep-card{
  border-radius:22px;
  background: linear-gradient(180deg, var(--card), var(--card2));
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.rep-card-head{padding:16px 16px 10px}
.rep-card-title{font-size:18px;font-weight:900;margin-bottom:6px}
.rep-card-sub{font-size:13px;color:var(--muted)}
.files-panel{padding:12px 16px 16px}
.file-row{display:flex;justify-content:space-between;gap:10px;padding:10px 0;border-top:1px solid var(--line2)}
.file-row:first-child{border-top:0}
.file-link{font-weight:800}
.file-meta{font-size:12px;color:var(--muted);white-space:nowrap}


/* ===== DASHBOARD: force 3 cards in one row (like sections cards) ===== */
.dashboard-page .grid4{
  display:grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap:16px !important;
  align-items:start;
}
@media (max-width: 1100px){
  .dashboard-page .grid4{ grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 640px){
  .dashboard-page .grid4{ grid-template-columns: 1fr !important; }
}

/* --- DASHBOARD: Representatives buttons grid --- */
.reps-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
}
@media (max-width: 1100px){
  .reps-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  .reps-grid{ grid-template-columns: 1fr; }
}
/* ensure links/buttons fill cell */
.reps-grid a,
.reps-grid button{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
}

