/* ═══════════════════════════════════════════════════════════
   NCP Office Portal — Main Stylesheet
   Colors: NCP Green #1B7A3C · NCP Red #CC1F24 · White
   ═══════════════════════════════════════════════════════════ */

/* ─── Custom Fonts ────────────────────────────────────────── */
@font-face {
  font-family: 'July';
  src: url('../fonts/July-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'July';
  src: url('../fonts/July-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'July';
  src: url('../fonts/July-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'July';
  src: url('../fonts/July-Bold-Italic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'AbuSayeed';
  src: url('../fonts/Abu-Sayeed-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ─── CSS Variables ───────────────────────────────────────── */
:root {
  /* Brand colors from NCP logo */
  --primary:        #1B7A3C;   /* NCP forest green */
  --primary-light:  #239150;   /* lighter green */
  --primary-dark:   #145E2E;   /* darker green */
  --primary-bg:     #E8F5EE;   /* very light green tint */
  --accent:         #CC1F24;   /* NCP red */
  --accent-dark:    #A81A1E;   /* darker red */
  --accent-bg:      #FDECEC;   /* light red tint */

  --success:        #2E7D32;
  --danger:         #CC1F24;   /* use NCP red for danger too */
  --warning:        #E65100;

  --bg:             #F0F4F1;   /* slightly green-tinted bg */
  --surface:        #FFFFFF;
  --surface-2:      #F7FAF8;
  --border:         #D6E4DC;   /* green-tinted border */
  --shadow:         0 2px 8px rgba(27,122,60,.10);
  --shadow-lg:      0 8px 32px rgba(27,122,60,.16);

  --text:           #1A2E22;   /* dark green-black */
  --text-2:         #3D5A47;
  --text-3:         #8AAE96;

  --sidebar-w:      240px;
  --topbar-h:       56px;
  --bottom-nav-h:   60px;
  --radius:         10px;
  --radius-sm:      6px;

  --font-main:      'July', 'Hind Siliguri', sans-serif;
  --font-org:       'AbuSayeed', 'Hind Siliguri', sans-serif;
}

/* ─── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; height: auto; }

/* ─── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #A8C9B2; border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */

/* ── Background ─────────────────────────────────────────── */
/*
 * The login background (image + decorative shapes + dot pattern) must stay
 * put while the form/error messages scroll. We use `position: fixed` layers
 * instead of `background-attachment: fixed` because mobile browsers (iOS
 * Safari in particular) ignore background-attachment:fixed with cover sizing.
 */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: #0e3d1e;
  position: relative;
  overflow-x: hidden;   /* clip decorative circles horizontally */
  padding: 1.5rem 0;    /* breathing room so card never touches screen edge */
  /* NB: no overflow-y here — let the html/window scroll naturally so the
     fixed bg layer is anchored to the viewport, not the body. */
}

/* Custom background image (uploaded by dev-admin) — pinned to viewport */
.login-bg-image {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
}

/* Login page decorations (shapes, stripe, dots) removed by user request —
   only the dev-admin uploaded background image (.login-bg-image) shows. */

/* ── Card ───────────────────────────────────────────────── */
.login-wrap { width: 100%; max-width: 420px; padding: 1.25rem; position: relative; z-index: 1; }
.login-card {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 2.5rem 2rem 2rem;
  box-shadow: 0 24px 64px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.1);
}

/* ── Logo ───────────────────────────────────────────────── */
.login-logo-wrap {
  display: flex; justify-content: center;
  margin-bottom: 1rem;
}
.login-logo-img {
  width: 100px; height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(27,122,60,.25));
}
.login-logo-fallback {
  width: 90px; height: 90px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.4rem;
  font-family: var(--font-org);
  box-shadow: 0 4px 16px rgba(27,122,60,.4);
}

/* ── Titles ─────────────────────────────────────────────── */
.login-titles { text-align: center; margin-bottom: 1.75rem; }
.login-main-title {
  font-size: 1.25rem; font-weight: 700; color: var(--text);
  font-family: var(--font-org); line-height: 1.2; margin: 0 0 .3rem;
}
.login-sub-title { font-size: .82rem; color: var(--text-2); margin: 0; }

/* ── Login button ───────────────────────────────────────── */
.login-btn {
  margin-top: .5rem; padding: .75rem;
  font-size: 1rem; letter-spacing: .02em;
  border-radius: 10px;
}

/* ── Misc ───────────────────────────────────────────────── */
.login-hint { margin-top: 1.25rem; text-align: center; font-size: .85rem; color: var(--text-2); }
.input-with-icon { position: relative; }
.input-with-icon .form-control { padding-right: 2.8rem; }
.pw-toggle {
  position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-3);
  padding: .2rem;
}
.pw-toggle:hover { color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════ */
.app-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s ease;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.1rem 1.25rem 1rem;
  border-bottom: 3px solid var(--primary);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.sidebar-brand-logo {
  width: 38px; height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar-brand-icon-fallback {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.15);
  color: #fff;
  align-items: center; justify-content: center;
  border-radius: 8px; font-weight: 700; font-size: .85rem;
  flex-shrink: 0; font-family: var(--font-org);
  border: 1.5px solid rgba(255,255,255,.3);
}
.sidebar-brand-icon {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.15);
  color: #fff;
  border-radius: 8px; font-size: .78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-family: var(--font-org);
  border: 1.5px solid rgba(255,255,255,.3);
}
.sidebar-brand-text { font-weight: 600; font-size: .92rem; color: #fff; }

.sidebar-nav { flex: 1; padding: .75rem .75rem 0; }
.sidebar-nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .62rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .9rem;
  transition: background .15s, color .15s;
  cursor: pointer;
  margin-bottom: 2px;
}
.sidebar-nav-item:hover { background: var(--primary-bg); color: var(--primary); text-decoration: none; }
.sidebar-nav-item.active {
  background: var(--primary-bg); color: var(--primary); font-weight: 700;
  border-left: 3px solid var(--primary); padding-left: calc(.75rem - 3px);
}
.sidebar-nav-item .nav-icon { display: flex; align-items: center; flex-shrink: 0; }
.sidebar-divider { border: none; border-top: 1px solid var(--border); margin: .5rem 0; }

.sidebar-footer {
  padding: 1rem .75rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.sidebar-user { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.sidebar-avatar {
  width: 34px; height: 34px;
  background: var(--primary); color: #fff;
  border-radius: 50%; font-weight: 700; font-size: .9rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-user-name  { font-size: .88rem; font-weight: 700; line-height: 1.2; }
.sidebar-user-role  { font-size: .72rem; color: var(--text-3); }
.sidebar-logout {
  width: 100%; justify-content: center;
  border: 1px solid var(--border);
  color: var(--accent) !important;
}
.sidebar-logout:hover { background: var(--accent-bg); border-color: var(--accent); }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 190;
}

/* ─── Main ─────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-h);
  background: var(--primary);
  border-bottom: 2px solid var(--primary-dark);
  display: flex; align-items: center;
  padding: 0 1.25rem; gap: .75rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(27,122,60,.25);
}
.topbar-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer; color: rgba(255,255,255,.85);
  padding: .35rem; border-radius: var(--radius-sm);
}
.topbar-menu-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar-title { font-size: 1.05rem; font-weight: 700; flex: 1; color: #fff; }
.topbar-actions { display: flex; gap: .5rem; }

.page-content { flex: 1; padding: 1.5rem; overflow-y: auto; }

/* ─── Bottom Nav (mobile only) ────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--surface);
  border-top: 2px solid var(--primary);
  height: var(--bottom-nav-h);
  flex-direction: row; align-items: stretch;
  box-shadow: 0 -2px 12px rgba(27,122,60,.12);
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--text-3); font-size: .66rem; cursor: pointer;
  text-decoration: none; transition: color .15s;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active .bottom-nav-icon { color: var(--primary); }
.bottom-nav-icon { display: flex; }

.more-menu {
  display: none; position: fixed; bottom: calc(var(--bottom-nav-h) + 8px); right: 12px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); z-index: 210; min-width: 180px; overflow: hidden;
}
.more-menu.open { display: block; }
.more-menu-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1.1rem; color: var(--text);
  font-size: .9rem; cursor: pointer; text-decoration: none;
  transition: background .12s;
}
.more-menu-item:hover { background: var(--primary-bg); }
.more-menu-logout { color: var(--accent); }
.more-menu-backdrop {
  display: none; position: fixed; inset: 0; z-index: 205;
}
.more-menu-backdrop.open { display: block; }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .app-main { margin-left: 0; padding-bottom: var(--bottom-nav-h); }
  .topbar-menu-btn { display: flex; }
  .bottom-nav { display: flex; }
  .page-content { padding: 1rem; }
}

/* ═══════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block; font-size: .84rem; font-weight: 700;
  color: var(--text-2); margin-bottom: .35rem;
}
.form-control {
  width: 100%; padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem; color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: var(--font-main);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,122,60,.13);
}
.form-control::placeholder { color: var(--text-3); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-hint { font-size: .78rem; color: var(--text-3); margin-top: .25rem; }

/* Use Different inline row */
.field-with-alt {
  display: flex; align-items: flex-start; gap: .5rem;
}
.field-with-alt .form-control { flex: 1; }
.btn-use-diff {
  white-space: nowrap; flex-shrink: 0;
  margin-top: 0; padding: .5rem .75rem;
  font-size: .78rem;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 700; cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s; line-height: 1;
  font-family: var(--font-main); text-decoration: none !important;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-accent   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--primary-bg); color: var(--primary); }
.btn-danger { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger:hover { background: var(--accent-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-sm { padding: .38rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }

/* FAB */
.fab {
  position: fixed; bottom: calc(var(--bottom-nav-h) + 16px); right: 20px;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(204,31,36,.45);
  cursor: pointer; border: none; z-index: 150;
  transition: transform .15s, box-shadow .15s;
  font-size: 1.5rem;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(204,31,36,.55); }
@media (min-width: 769px) {
  .fab { bottom: 24px; right: 28px; }
}

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  font-size: .9rem; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: .5rem;
}
.alert-error   { background: var(--accent-bg); color: #7B1215; border: 1px solid #F5A0A2; }
.alert-success { background: var(--primary-bg); color: var(--primary-dark); border: 1px solid #9DD3B0; }
.alert-info    { background: var(--primary-bg); color: var(--primary-dark); border: 1px solid #9DD3B0; }
.alert-warning { background: #FFF8E1; color: #6D4C00; border: 1px solid #FFD54F; }

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0;
}
.card-title  { font-size: 1rem; font-weight: 700; color: var(--primary); }
.card-body   { padding: 1.25rem; }
.card-footer { padding: .85rem 1.25rem; border-top: 1px solid var(--border); }

/* ═══════════════════════════════════════════════════════════
   MODAL / SLIDE PANEL
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }
.modal-header {
  padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; background: var(--primary); border-radius: var(--radius) var(--radius) 0 0;
}
.modal-title  { font-size: 1rem; font-weight: 700; color: #fff; }
.modal-close  { background: rgba(255,255,255,.15); border: none; cursor: pointer; color: #fff; padding: .3rem .4rem; border-radius: 4px; }
.modal-close:hover { background: rgba(255,255,255,.25); }
.modal-body   { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: .85rem 1.25rem; border-top: 1px solid var(--border); display:flex; gap:.6rem; justify-content:flex-end; flex-shrink:0; }

/* Slide panel (Add Notice) */
.slide-panel {
  position: fixed; top: 0; right: -100%; bottom: 0; width: 100%; max-width: 700px;
  background: var(--surface); z-index: 350;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(27,122,60,.18);
  transition: right .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.slide-panel.open { right: 0; }
.slide-panel-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 340;
  display: none;
}
.slide-panel-overlay.open { display: block; }
.slide-panel-header {
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem; flex-shrink: 0;
  background: var(--primary);
}
.slide-panel-title { font-size: 1rem; font-weight: 700; flex: 1; color: #fff; }
.slide-panel-header .btn-ghost { color: rgba(255,255,255,.8); }
.slide-panel-header .btn-ghost:hover { background: rgba(255,255,255,.15); color: #fff; }
.slide-panel-header .btn-secondary { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.3); }
.slide-panel-header .btn-secondary:hover { background: rgba(255,255,255,.25); }
.slide-panel-body  { flex: 1; overflow-y: auto; padding: 1.25rem; background: var(--bg); }
.slide-panel-footer {
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; gap: .6rem; justify-content: flex-end; flex-shrink: 0;
  background: var(--surface);
}

/* ═══════════════════════════════════════════════════════════
   NOTICES LIST
   ═══════════════════════════════════════════════════════════ */
.notices-layout {
  display: flex; gap: 1.25rem;
  /* On desktop: fill page-content height (page-content has 1.5rem padding top+bottom = 3rem) */
  height: calc(100vh - var(--topbar-h) - 3rem);
}
.folder-panel {
  width: 240px; flex-shrink: 0;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.folder-panel-header {
  padding: .85rem 1rem; border-bottom: 2px solid var(--primary);
  font-weight: 700; font-size: .88rem; color: var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--primary-bg);
}
.folder-tree { flex: 1; overflow-y: auto; padding: .5rem; }
.folder-node { user-select: none; }
.folder-row {
  display: flex; align-items: center; gap: .4rem;
  padding: .48rem .6rem; border-radius: var(--radius-sm);
  cursor: pointer; font-size: .88rem; color: var(--text-2);
  transition: background .12s, color .12s;
}
.folder-row:hover { background: var(--primary-bg); color: var(--primary); }
.folder-row.active {
  background: var(--primary-bg); color: var(--primary); font-weight: 700;
  border-left: 3px solid var(--primary); padding-left: calc(.6rem - 3px);
}
.folder-row .toggle-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--text-3);
  transition: transform .2s, background .15s, color .15s;
  font-size: .7rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px;
}
.folder-row .toggle-icon.clickable { cursor: pointer; }
.folder-row .toggle-icon.clickable:hover {
  background: rgba(27,122,60,.12); color: var(--primary);
}
.folder-row.open .toggle-icon { transform: rotate(90deg); }
.folder-icon { color: var(--primary); flex-shrink: 0; }
.folder-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-menu-btn {
  opacity: 0; flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 1rem; padding: 0 3px;
  line-height: 1; border-radius: 3px; transition: opacity .15s, background .15s;
}
.folder-row:hover .folder-menu-btn { opacity: 1; }
.folder-menu-btn:hover { background: rgba(0,0,0,.1); color: var(--primary); }
/* Touch devices: always show the ⋮ button — no hover available */
@media (hover: none), (max-width: 768px) {
  .folder-menu-btn {
    opacity: 1;
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    color: var(--text-2);
  }
  /* Slightly bigger arrow target on touch for easier tapping */
  .folder-row .toggle-icon { width: 22px; height: 22px; font-size: .8rem; }
  .folder-row { padding: .55rem .5rem; gap: .35rem; }
}
.folder-children { margin-left: 1.2rem; display: none; }
.folder-children.open { display: block; }

/* Context menu */
.ctx-menu {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 170px; padding: .3rem 0; overflow: hidden;
}
.ctx-menu-item {
  display: flex; align-items: center; gap: .5rem;
  width: 100%; padding: .5rem .85rem; border: none; background: none;
  cursor: pointer; font-size: .875rem; color: var(--text-1);
  text-align: left; transition: background .12s;
}
.ctx-menu-item:hover { background: var(--primary-bg); color: var(--primary); }
.ctx-menu-item.ctx-menu-danger { color: var(--danger); }
.ctx-menu-item.ctx-menu-danger:hover { background: #fff0f0; }
.ctx-menu-sep { height: 1px; background: var(--border); margin: .25rem 0; }

/* Modal folder picker */
.modal-folder-picker {
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .35rem;
}

.notice-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.notice-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .65rem; }
.notice-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 1rem 1.1rem;
  cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .12s;
  display: flex; gap: 1rem; align-items: flex-start;
}
.notice-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.notice-card-icon {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--primary-bg); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.notice-card-body { flex: 1; min-width: 0; }
.notice-card-headline { font-size: .9rem; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice-card-smarak { font-size: .75rem; color: var(--text-3); margin-top: .2rem; }
.notice-card-date { font-size: .75rem; color: var(--accent); margin-top: .15rem; font-weight: 600; }
.notice-card-actions { display: flex; gap: .4rem; align-items: center; }

/* ═══════════════════════════════════════════════════════════
   MEMBER VIEW — flat notice list
   ═══════════════════════════════════════════════════════════ */
.member-notices-wrap {
  display: flex; flex-direction: column;
  height: 100%; gap: .75rem;
}
.member-search-bar {
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: .55rem .9rem;
  transition: border-color .15s;
  flex-shrink: 0;
}
.member-search-bar:focus-within { border-color: var(--primary); }
.member-search-input {
  flex: 1; border: none; background: none; outline: none;
  font-size: .9rem; color: var(--text-1);
  font-family: var(--font-main);
}
.member-notice-list {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem;
}
.member-notice-card {
  display: flex; align-items: center; gap: .85rem;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: .85rem 1rem;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.member-notice-card:hover {
  border-color: var(--primary); box-shadow: 0 2px 8px rgba(27,122,60,.1);
}
.member-notice-card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--primary-bg); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.member-notice-card-body { flex: 1; min-width: 0; }
.member-notice-headline {
  font-size: .95rem; font-weight: 700; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.4;
}
.member-notice-meta {
  display: flex; flex-wrap: wrap; gap: .5rem .9rem;
  margin-top: .3rem; font-size: .75rem; color: var(--text-3);
}
.member-notice-meta span { display: flex; align-items: center; gap: .2rem; }
.member-notice-card-arrow { color: var(--text-3); flex-shrink: 0; }

/* Empty state */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--text-3);
}
.empty-state svg { margin-bottom: 1rem; opacity: .35; color: var(--primary); }
.empty-state-title { font-size: 1rem; font-weight: 700; color: var(--text-2); margin-bottom: .35rem; }
.empty-state-text  { font-size: .88rem; }

/* ── Mobile notice layout — master-detail pattern ─────────── */
/* Back button: hidden on desktop, shown on mobile when in notice view */
.mobile-back-btn {
  display: none;
  align-items: center; gap: .3rem;
  font-size: .85rem; color: var(--primary); font-weight: 600;
  background: none; border: none; cursor: pointer; padding: 0;
}
/* notices-page: zero out page-content padding so notices/member layout fills exactly */
.notices-page {
  padding: 0 !important;
  overflow: hidden !important;
  height: 100% !important;
}
/* member wrap needs a little padding inside the zero-padding page-content */
.notices-page .member-notices-wrap {
  padding: 1rem;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .notices-layout {
    flex-direction: column;
    /* Use 100% of page-content (which has padding zeroed by .notices-page) */
    height: 100%;
    gap: 0;
    overflow: hidden;
  }
  /* Folder panel fills full height by default on mobile */
  .folder-panel {
    width: 100%; flex: 1; max-height: none;
    border-radius: var(--radius);
  }
  /* Notice panel hidden until folder is selected */
  .notice-panel { display: none; }

  /* When a folder is selected: swap views */
  .notices-layout.mobile-notice-view .folder-panel { display: none; }
  .notices-layout.mobile-notice-view .notice-panel {
    display: flex; flex-direction: column; flex: 1;
  }

  /* Show back button only inside the mobile notice view */
  .notices-layout.mobile-notice-view .mobile-back-btn { display: inline-flex; }
}

/* ═══════════════════════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════════════════════ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.1rem;
}
.section-title {
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════
   QUILL EDITOR STYLING
   ═══════════════════════════════════════════════════════════ */
.quill-wrap { border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.quill-wrap .ql-toolbar { border: none; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.quill-wrap .ql-toolbar .ql-stroke { stroke: var(--text-2); }
.quill-wrap .ql-toolbar .ql-fill  { fill: var(--text-2); }
.quill-wrap .ql-toolbar button:hover .ql-stroke { stroke: var(--primary); }
.quill-wrap .ql-toolbar button.ql-active .ql-stroke { stroke: var(--primary); }
.quill-wrap .ql-toolbar button.ql-active { color: var(--primary); }
.quill-wrap .ql-container { border: none; font-family: var(--font-main); font-size: .95rem; }
.quill-wrap .ql-editor { min-height: 200px; padding: .9rem 1rem; }
.quill-wrap .ql-editor.ql-blank::before { font-style: normal; color: var(--text-3); font-family: var(--font-main); }
.quill-wrap.quill-small .ql-editor { min-height: 100px; }
.ql-editor.hyphen-on { hyphens: auto; }

/* ── Custom Quill toolbar: free-form number inputs for font size & line height ─ */
.ql-custom-num {
  width: 3.5rem; height: 24px; padding: 0 .3rem;
  border: 1px solid var(--border); border-radius: 4px;
  font-size: .78rem; background: var(--surface); color: var(--text);
  text-align: center; vertical-align: middle;
  -moz-appearance: textfield;
}
.ql-custom-num::-webkit-outer-spin-button,
.ql-custom-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ql-custom-num:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(21,101,192,.12); }
.ql-custom-label {
  font-size: .75rem; color: var(--text-3); user-select: none;
  vertical-align: middle; margin-left: 2px;
}

/* ═══════════════════════════════════════════════════════════
   NOTICE ADD FORM SECTIONS
   ═══════════════════════════════════════════════════════════ */
.form-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.form-section-title {
  font-size: .76rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--primary); margin-bottom: .85rem;
  display: flex; align-items: center; gap: .4rem;
  padding-bottom: .6rem; border-bottom: 2px solid var(--primary-bg);
}
.smarak-preview {
  background: var(--primary-bg); color: var(--primary-dark);
  padding: .6rem .9rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-family: var(--font-main);
  border: 1px dashed var(--primary);
  margin-top: .5rem; font-weight: 600;
}
.logo-preview {
  width: 90px; height: 90px; border-radius: 8px;
  border: 2px dashed var(--border); object-fit: contain;
  background: var(--surface-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.sig-preview {
  width: 130px; height: 65px; border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm); object-fit: contain; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; color: var(--text-3); cursor: pointer; overflow: hidden;
}
.sig-preview img { width: 100%; height: 100%; object-fit: contain; }

/* ═══════════════════════════════════════════════════════════
   A4 NOTICE PREVIEW
   SVG-derived margins: 24/595.3*210mm ≈ 8.5mm on all sides
   All backgrounds white — no colour fills in the notice itself
   ═══════════════════════════════════════════════════════════ */
.notice-preview-bg {
  background: #f8bbd0;
  padding: 28px;
  min-height: 100%;
  display: flex; justify-content: center;
}
.notice-a4 {
  width: 210mm; min-height: 297mm;
  background: #fff;
  font-family: 'July', 'Hind Siliguri', sans-serif;
  color: #000;
  box-shadow: 0 4px 32px rgba(0,0,0,.2);
  position: relative;
  display: flex; flex-direction: column;
  /* Internal page margins derived from SVG (24/595.3*210mm ≈ 8.46mm) */
  padding: 8.5mm 8.5mm;
  box-sizing: border-box;
}

/* Header — all white, 3pt divider only */
.na-header {
  background: #fff;
  display: flex; align-items: center;
  border-bottom: 3pt solid #000;
  padding-bottom: 3px;
}
/* Logo box — white, no border, proportional width */
.na-logo-box {
  width: 22mm; flex-shrink: 0;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 2px 4px 2px 0;
}
.na-logo-box img { width: 20mm; height: 20mm; object-fit: contain; }
.na-logo-placeholder {
  width: 18mm; height: 18mm; border-radius: 50%;
  background: var(--primary); display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .85rem;
}
/* Org text block — center aligned */
.na-org-details {
  flex: 1; text-align: center;
  display: flex; flex-direction: column; justify-content: center;
  gap: 0; padding: 0 4px;
}
/* Abu-Sayeed Bold — SVG 30.3pt; tighter line-height */
.na-org-name {
  font-family: 'AbuSayeed', 'Hind Siliguri', sans-serif;
  font-size: 30.3pt; font-weight: 700; line-height: 1.0; color: #000;
  margin: 0; padding: 0;
}
/* Committee — SVG 21.4pt July-Bold; tight gap below org name */
.na-committee {
  font-family: 'July', 'Hind Siliguri', sans-serif;
  font-size: 21.4pt; font-weight: 700; color: #000;
  line-height: 1.0; margin: 0; padding: 0;
}
/* Address — SVG 14.6pt July-Bold; slightly more gap above vs committee */
.na-address {
  font-family: 'July', 'Hind Siliguri', sans-serif;
  font-size: 14.6pt; font-weight: 700; color: #000;
  line-height: 1.1; margin: 4pt 0 0; padding: 0;
}

/* স্মারক নং / তারিখ row — SVG 14pt, no border */
.na-smarak-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 4pt 0 2pt; font-size: 14pt;
  font-family: 'July', 'Hind Siliguri', sans-serif;
}

/* Scalable section — wraps body + signature + footer so JS can scale them as one unit */
.na-scalable {
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 0;
}

/* Body — 14pt, reduced line-height */
.na-body {
  flex: 1; padding: 4pt 0 4pt;
  font-family: 'July', 'Hind Siliguri', sans-serif;
  font-size: 14pt; line-height: 1.6; color: #000;
}
.na-body.hyphen-on { hyphens: auto; }

/* Signature — compact */
.na-signature {
  padding: 4pt 0 4pt;
  font-family: 'July', 'Hind Siliguri', sans-serif;
  line-height: 1.3;
}
.na-sig-img { width: 110px; height: 55px; object-fit: contain; display: block; margin-bottom: 2px; }
.na-sig-name { font-size: 14pt; font-weight: 700; color: #000; line-height: 1.3; }
.na-sig-designation { font-size: 14pt; color: #000; line-height: 1.3; word-break: break-word; }
.na-sig-extra { font-size: 10pt; margin-top: 1px; color: #000; line-height: 1.3; word-break: break-word; }

/* Footer — compact */
.na-footer {
  border-top: 1.5pt solid #666;
  padding: 3pt 0 4pt;
  font-family: 'July', 'Hind Siliguri', sans-serif;
  font-size: 10pt; color: #333; line-height: 1.4;
  background: #fff;
}

/* ── Quill output classes re-scoped for notice preview & print ────────────────
   Quill's own CSS scopes these rules to .ql-editor. When the saved HTML is
   placed inside .na-body / .na-footer (not inside .ql-editor), the alignment,
   size, and indent classes have no effect. We re-declare them under .notice-a4
   so they work correctly in both the preview modal and the print stylesheet. */

/* Text alignment */
.notice-a4 .ql-align-center  { text-align: center !important; }
.notice-a4 .ql-align-right   { text-align: right !important; }
.notice-a4 .ql-align-justify { text-align: justify !important; }

/* Font sizes (relative to the 14pt base set on .na-body) */
.notice-a4 .ql-size-small { font-size: 0.75em; }
.notice-a4 .ql-size-large { font-size: 1.5em; }
.notice-a4 .ql-size-huge  { font-size: 2.5em; }

/* Indentation */
.notice-a4 .ql-indent-1:not(.ql-direction-rtl) { padding-left: 3em; }
.notice-a4 .ql-indent-2:not(.ql-direction-rtl) { padding-left: 6em; }
.notice-a4 .ql-indent-3:not(.ql-direction-rtl) { padding-left: 9em; }
.notice-a4 .ql-indent-4:not(.ql-direction-rtl) { padding-left: 12em; }
.notice-a4 .ql-indent-5:not(.ql-direction-rtl) { padding-left: 15em; }
.notice-a4 .ql-indent-6:not(.ql-direction-rtl) { padding-left: 18em; }
.notice-a4 .ql-indent-7:not(.ql-direction-rtl) { padding-left: 21em; }
.notice-a4 .ql-indent-8:not(.ql-direction-rtl) { padding-left: 24em; }

/* Ordered & bullet lists — Quill renders these as <ol>/<ul> with <li> items */
.notice-a4 ol, .notice-a4 ul { padding-left: 2em; margin: 0.25em 0; }
.notice-a4 li { list-style-position: outside; }

/* Inline formatting */
.notice-a4 u { text-decoration: underline; }
.notice-a4 s { text-decoration: line-through; }

/* A4 preview fullscreen modal */
.notice-preview-modal {
  position: fixed; inset: 0; z-index: 400;
  background: #e8e8e8;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.notice-preview-toolbar {
  background: rgba(27,122,60,.9); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem; flex-shrink: 0;
  border-bottom: 2px solid var(--primary-dark);
}
.notice-preview-toolbar-title { color: #fff; font-size: .95rem; font-weight: 700; flex: 1; }
.notice-preview-scroll {
  flex: 1; overflow-y: auto; padding: 2rem;
  display: flex; justify-content: center; align-items: flex-start;
}
/* Mobile preview: keep A4 at true 210mm, JS scales it to fit */
@media (max-width: 768px) {
  .notice-preview-toolbar {
    padding: .5rem .75rem; gap: .4rem; flex-wrap: wrap;
  }
  .notice-preview-toolbar-title {
    order: -1; width: 100%; font-size: .8rem;
  }
  .notice-preview-scroll {
    padding: 8px; overflow-x: hidden; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════
   FOLDER PICKER (in form)
   ═══════════════════════════════════════════════════════════ */
.folder-picker {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); max-height: 200px; overflow-y: auto;
  padding: .4rem;
}
.fp-node {
  padding: .38rem .6rem; border-radius: 4px; cursor: pointer;
  font-size: .88rem; color: var(--text-2);
  display: flex; align-items: center; gap: .5rem;
  transition: background .1s;
}
.fp-node:hover { background: var(--primary-bg); color: var(--primary); }
.fp-node.selected { background: var(--primary-bg); color: var(--primary); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════
   COMING SOON
   ═══════════════════════════════════════════════════════════ */
.coming-soon {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 62vh; text-align: center; padding: 2rem;
}
.coming-soon-badge {
  background: var(--accent-bg); color: var(--accent);
  border-radius: 999px; padding: .35rem 1.2rem; font-size: .78rem; font-weight: 700;
  margin-bottom: 1.25rem; display: inline-block; letter-spacing: .06em;
  border: 1px solid var(--accent);
}
.coming-soon-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.coming-soon h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: .5rem; color: var(--primary); }
.coming-soon p { color: var(--text-2); font-size: .95rem; }

/* ═══════════════════════════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════════════════════════ */
.settings-tabs {
  display: flex; gap: .25rem; margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}
.settings-tab {
  padding: .6rem 1.1rem; font-size: .9rem; font-weight: 700; cursor: pointer;
  border: none; background: none; color: var(--text-2);
  border-bottom: 2.5px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  font-family: var(--font-main);
}
.settings-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.settings-tab:hover  { color: var(--primary); }
.settings-pane { display: none; }
.settings-pane.active { display: block; }

/* ═══════════════════════════════════════════════════════════
   BADGE / TAG
   ═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: .22rem .65rem; border-radius: 999px;
  font-size: .74rem; font-weight: 700;
}
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: #DCFCE7; color: var(--success); }
.badge-warning { background: #FEF9C3; color: #854D0E; }
.badge-danger  { background: var(--accent-bg); color: var(--accent); }
.badge-purple  { background: #EDE9FE; color: #6D28D9; }

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; top: 1rem; right: 1rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  min-width: 260px; max-width: 360px;
  padding: .8rem 1.1rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: .88rem; font-weight: 600;
  display: flex; align-items: center; gap: .6rem;
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateX(40px); } to { opacity:1; transform:none; } }
.toast-success { background: var(--primary-bg); color: var(--primary-dark); border-left: 4px solid var(--primary); }
.toast-error   { background: var(--accent-bg); color: #7B1215; border-left: 4px solid var(--accent); }
.toast-info    { background: var(--primary-bg); color: var(--primary-dark); border-left: 4px solid var(--primary); }

/* ═══════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════ */
@media print {
  /* A4 page — no margins so content fills the paper edge to edge */
  @page { size: A4 portrait; margin: 0; }

  /* Color accuracy for all elements */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body { margin: 0 !important; padding: 0 !important; background: white !important; }

  /* ── Hide everything; reveal only the active notice preview modal ── */
  body > * { display: none !important; }
  #noticePreviewModal { display: flex !important; }

  /* Preview modal fills the full A4 page */
  .notice-preview-modal {
    position: fixed !important; inset: 0 !important;
    background: white !important;
    display: flex !important; flex-direction: column !important;
    overflow: hidden !important;
  }

  /* Toolbar (print/save buttons) hidden on paper */
  .notice-preview-toolbar { display: none !important; }

  /* Scroll wrapper becomes a plain flex container */
  .notice-preview-scroll {
    flex: 1 !important; overflow: hidden !important;
    padding: 0 !important; background: white !important;
    display: flex !important;
    justify-content: flex-start !important; align-items: flex-start !important;
  }

  /* ── The A4 notice: exact page dimensions, flex column so footer
        is always pinned to the page bottom ── */
  .notice-a4 {
    width: 210mm !important;
    height: 297mm !important;    /* fixed height so flex: 1 on body works */
    padding: 8.5mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    background: white !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    font-size: 14pt !important;  /* anchor — prevents browser from rescaling */
    transform: none !important;
  }

  /* Header + smarak: fixed, never shrink */
  .na-header     { flex-shrink: 0 !important; }
  .na-smarak-row { font-size: 14pt !important; flex-shrink: 0 !important; }

  /* Scalable section: JS sets flex:0 0 auto and transform:scale() via inline style.
     We provide display/flex-direction but do NOT use !important on flex so JS wins. */
  .na-scalable {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  /* Body inside scalable: takes remaining space, safety overflow clip */
  .na-body {
    font-size: 14pt !important;
    flex: 1 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  /* Signature + footer: never shrink */
  .na-signature      { flex-shrink: 0 !important; }
  .na-sig-name       { font-size: 14pt !important; }
  .na-sig-designation{ font-size: 14pt !important; }
  .na-sig-extra      { font-size: 10pt !important; }
  .na-footer         { font-size: 10pt !important; flex-shrink: 0 !important; }

  /* All backgrounds white */
  .na-header, .na-logo-box, .na-org-details,
  .na-smarak-row, .na-scalable, .na-body, .na-signature, .na-footer { background: white !important; }

  /* Preserve Quill text-alignment classes in print */
  .notice-a4 .ql-align-center  { text-align: center !important; }
  .notice-a4 .ql-align-right   { text-align: right !important; }
  .notice-a4 .ql-align-justify { text-align: justify !important; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE ENHANCEMENTS — Mobile (≤ 768px)
   Covers: settings tabs, forms, modals, slide-panel, Quill
   toolbar, notice cards, user-list rows, FAB, login.
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Top bar & page padding ─────────────────────────────── */
  .topbar { padding: 0 .85rem; gap: .5rem; }
  .topbar-title { font-size: 1rem; }
  .page-content { padding: .85rem; }

  /* ── Forms: stack two-column rows on mobile ─────────────── */
  .form-row { flex-direction: column; gap: 0; }
  .form-row .form-group { flex: 1 1 auto; width: 100%; }
  .form-group { margin-bottom: .9rem; }
  .form-control { font-size: 1rem; }   /* prevents iOS auto-zoom on focus */

  /* "ভিন্ন ব্যবহার" / "ভিন্ন তারিখ" rows — stack so input
     gets full width, button drops below */
  .field-with-alt { flex-direction: column; align-items: stretch; gap: .4rem; }
  .field-with-alt .btn-use-diff { align-self: flex-start; }

  /* ── Cards ──────────────────────────────────────────────── */
  .card-header { padding: .85rem 1rem; }
  .card-body   { padding: 1rem; }
  .card-footer { padding: .75rem 1rem; }

  /* ── Settings tabs: horizontal scroll strip ─────────────── */
  .settings-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .settings-tabs::-webkit-scrollbar { height: 3px; }
  .settings-tab {
    flex-shrink: 0;
    padding: .55rem .9rem;
    font-size: .85rem;
    white-space: nowrap;
  }

  /* ── Settings: users list row (built inline in JS) ──────── */
  /* Wrap action buttons onto a second line if the row is full */
  #usersList > div { flex-wrap: wrap; row-gap: .5rem; }

  /* ── Settings: inline preview + upload-button rows ──────── */
  /* (logo, signature, login bg, favicon — all use inline styles
     with display:flex;align-items:center;gap:1rem). Make them
     wrap so the upload button drops below the preview. */
  .settings-pane .card-body > .form-group > div[style*="display:flex"],
  .settings-pane .form-group > div[style*="display:flex"] {
    flex-wrap: wrap;
  }

  /* ── Modal ──────────────────────────────────────────────── */
  .modal-overlay { padding: .5rem; }
  .modal { max-height: 95vh; border-radius: var(--radius-sm); }
  .modal-header  { padding: .9rem 1rem; }
  .modal-body    { padding: 1rem; }
  .modal-footer {
    padding: .75rem 1rem;
    flex-wrap: wrap;
    gap: .5rem;
  }
  .modal-footer .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* ── Slide panel (Add / Edit Notice) ────────────────────── */
  .slide-panel { max-width: 100%; }
  .slide-panel-header { padding: .75rem 1rem; }
  .slide-panel-header .slide-panel-title { font-size: .92rem; }
  .slide-panel-body { padding: .85rem; }
  .slide-panel-footer {
    padding: .75rem .85rem;
    flex-wrap: wrap;
    gap: .5rem;
  }
  .slide-panel-footer .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* Form sections inside slide panel */
  .form-section { padding: .85rem; margin-bottom: .9rem; }

  /* Slide-panel inline preview rows (logo / signature uploads) */
  .slide-panel-body .form-section > div[style*="display:flex"],
  .slide-panel-body .form-group > div[style*="display:flex"] {
    flex-wrap: wrap;
  }

  /* ── Quill toolbar: allow wrapping with smaller controls ─ */
  .quill-wrap .ql-toolbar {
    padding: 4px 6px !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 4px;
  }
  .quill-wrap .ql-toolbar .ql-formats {
    margin-right: 8px !important;
    display: inline-flex;
    align-items: center;
  }
  .quill-wrap .ql-toolbar .ql-formats:last-child { margin-right: 0 !important; }
  .ql-custom-num { width: 2.8rem; }
  .quill-wrap .ql-editor { min-height: 160px; padding: .75rem .85rem; }
  .quill-wrap.quill-small .ql-editor { min-height: 90px; }

  /* ── Folder picker inside notice form ──────────────────── */
  .folder-picker { max-height: 160px; }

  /* ── Notice cards: wrap headline & actions to second line ─ */
  .notice-card { gap: .65rem; padding: .85rem .9rem; align-items: center; }
  .notice-card-headline {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.3;
  }
  .notice-card-actions { flex-wrap: wrap; gap: .25rem; justify-content: flex-end; }

  /* ── Member notice cards ────────────────────────────────── */
  .member-notice-card { padding: .75rem .85rem; gap: .65rem; }
  .member-notice-headline { white-space: normal; line-height: 1.35; }

  /* ── Section headers & titles ──────────────────────────── */
  .section-header { margin-bottom: .85rem; flex-wrap: wrap; gap: .4rem; }
  .section-title { font-size: .75rem; }

  /* ── Coming soon ────────────────────────────────────────── */
  .coming-soon { min-height: 55vh; padding: 1.5rem 1rem; }
  .coming-soon-icon { font-size: 2.75rem; }
  .coming-soon h2 { font-size: 1.2rem; }

  /* ── Empty state ────────────────────────────────────────── */
  .empty-state { padding: 2rem 1rem; }

  /* ── FAB: nudge above bottom nav ───────────────────────── */
  .fab {
    width: 50px; height: 50px;
    bottom: calc(var(--bottom-nav-h) + 12px);
    right: 14px;
    font-size: 1.35rem;
  }

  /* ── Bottom nav label readability ──────────────────────── */
  .bottom-nav-item { font-size: .62rem; gap: 1px; }

  /* ── Toast: shrink on tiny screens, stay readable ──────── */
  #toast-container { top: .6rem; right: .6rem; left: .6rem; }
  .toast { min-width: 0; max-width: 100%; font-size: .85rem; }

  /* ── Context menu: avoid being cut off ─────────────────── */
  .ctx-menu { min-width: 150px; }

  /* ── Login page ─────────────────────────────────────────── */
  .login-wrap { padding: 1rem; max-width: 380px; }
  .login-card { padding: 2rem 1.4rem 1.5rem; border-radius: 16px; }
  .login-logo-img { width: 80px; height: 80px; }
  .login-main-title { font-size: 1.15rem; }
}

/* ═══════════════════════════════════════════════════════════
   Very small phones (≤ 420px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 420px) {
  html { font-size: 15px; }

  .topbar-title { font-size: .9rem; }

  .settings-tab { padding: .5rem .7rem; font-size: .8rem; }

  /* Stack all footer buttons full-width */
  .modal-footer .btn,
  .slide-panel-footer .btn { width: 100%; flex: 1 1 100%; }

  /* Quill toolbar inputs slightly tighter */
  .ql-custom-num { width: 2.5rem; height: 22px; font-size: .72rem; }
  .ql-custom-label { font-size: .68rem; }

  /* Notice preview toolbar */
  .notice-preview-toolbar .btn { padding: .35rem .55rem; font-size: .75rem; }

  /* Card padding */
  .card-body { padding: .85rem; }
  .form-section { padding: .75rem; }

  /* Notice cards — give the icon less space, headline more room */
  .notice-card-icon { width: 36px; height: 36px; }
  .member-notice-card-icon { width: 36px; height: 36px; }

  /* Login page tighter */
  .login-card { padding: 1.6rem 1.1rem 1.25rem; }
  .login-logo-img { width: 70px; height: 70px; }
  .login-main-title { font-size: 1.05rem; }
  .login-sub-title { font-size: .78rem; }
}

/* ═══════════════════════════════════════════════════════════════════
   POST PAGE — Phase 2
   ═══════════════════════════════════════════════════════════════════ */

/* ── Post feed layout ── */
.post-page { display:flex; flex-direction:column; height:100%; overflow:hidden; }
.post-feed-wrap {
  flex:1; overflow-y:auto; padding:1rem;
  display:flex; flex-direction:column; align-items:center; gap:1.25rem;
}

/* ── Post card ── */
.post-card {
  width:100%; max-width:520px;
  background:#fff; border-radius:14px;
  box-shadow:0 2px 12px rgba(0,0,0,.08);
  overflow:hidden;
}
.post-card-header {
  display:flex; align-items:center; gap:.65rem;
  padding:.75rem 1rem .5rem;
}
.post-card-avatar {
  width:38px; height:38px; border-radius:50%;
  background:var(--ncp-green); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:.95rem; flex-shrink:0; overflow:hidden;
}
.post-card-avatar img { width:100%; height:100%; object-fit:cover; }
.post-card-author { flex:1; min-width:0; }
.post-card-author-name  { font-weight:700; font-size:.92rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.post-card-author-desig { font-size:.75rem; color:#666; }
.post-card-time  { font-size:.72rem; color:#999; white-space:nowrap; }

/* ── Post template renderer (4:5 ratio) ── */
.post-template-wrap {
  width:100%; aspect-ratio:4/5;
  position:relative; overflow:hidden;
  background:#1a1a1a; font-size:16px; /* base for em calculations */
}
/* Full-bleed background image */
.pt-bg {
  position:absolute; inset:0; background-size:cover; background-position:center;
  background-color:#2c3e50;
}
/* Top content section: everything ABOVE the photo area */
.pt-top {
  position:absolute; top:0; left:0; right:0; bottom:40%;
  display:flex; flex-direction:column;
  padding:4% 4% 2%;
  overflow:hidden;
}
/* dark overlay inside top section */
.pt-top::before {
  content:''; position:absolute; inset:0;
  background:linear-gradient(to bottom, rgba(0,0,0,.3) 0%, rgba(0,0,0,.05) 100%);
  pointer-events:none;
}
/* Logo + org name banner — top right */
.pt-logo-banner {
  display:flex; align-items:center; gap:4px;
  background:rgba(255,255,255,.92); border-radius:5px;
  padding:4px 8px; align-self:flex-end;
  max-width:65%; position:relative; z-index:1;
}
.pt-logo-banner img { height:1.7em; width:1.7em; object-fit:contain; flex-shrink:0; }
.pt-logo-text { font-size:.6em; line-height:1.3; color:#1B7A3C; font-weight:700; }

/* Opening quote mark */
.pt-quote-open {
  font-size:3.5em; line-height:.8; color:var(--ncp-green);
  font-family:Georgia, serif; opacity:.9; pointer-events:none;
  align-self:flex-start; position:relative; z-index:1;
}
/* Main text red box */
.pt-text-box {
  background:#CC1F24; padding:4% 5%; border-radius:3px;
  text-align:center; color:#fff;
  font-family:'July', 'Hind Siliguri', sans-serif;
  font-weight:700; line-height:1.55; word-break:break-word;
  flex-shrink:1; min-height:0;
  position:relative; z-index:1;
}
/* Closing quote + char area row */
.pt-bottom-row {
  display:flex; align-items:flex-start; gap:2%;
  position:relative; z-index:1; margin-top:2%;
}
.pt-quote-close {
  font-size:3.5em; line-height:.8; color:var(--ncp-green);
  font-family:Georgia, serif; opacity:.9; flex-shrink:0;
}
.pt-char-area {
  flex:1; display:flex; flex-direction:column; gap:2px;
}
.pt-char-name {
  font-family:'July', 'Hind Siliguri', sans-serif;
  font-weight:700; color:#fff; text-shadow:0 1px 3px rgba(0,0,0,.6);
}
.pt-char-post {
  font-family:'July', 'Hind Siliguri', sans-serif;
  color:rgba(255,255,255,.85); text-shadow:0 1px 2px rgba(0,0,0,.5);
}

/* Bottom photo area */
.pt-photo-area {
  position:absolute; left:0; right:0; bottom:0;
  height:40%;
  border-top:3px solid #F8BBD0; /* pink border top */
  overflow:hidden;
}
.pt-photo-bg {
  position:absolute; inset:0;
  background-size:cover; background-position:center top;
  background-color:#555;
}
/* Shade mask: dark vignette from edges */
.pt-shade-mask {
  position:absolute; inset:0;
  background:radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,.65) 100%);
}
.pt-char-photo {
  position:absolute; inset:0;
  background-size:contain; background-repeat:no-repeat; background-position:center bottom;
}

/* ── Post card actions (nav-button style: SVG icon + small label) ── */
.post-card-actions {
  display: flex; align-items: center;
  padding: .35rem .6rem; border-top: 1px solid var(--border, #f0f0f0);
  gap: .1rem;
}
.post-action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex-direction: column; gap: .15rem;
  background: none; border: none; border-radius: 10px;
  padding: .45rem .6rem; cursor: pointer; font-family: inherit;
  color: var(--text-2, #666); transition: background .15s, color .15s;
  min-width: 44px;
}
.post-action-btn:hover { background: var(--surface, #f5f5f5); color: var(--text, #222); }
.post-action-btn.active-like    { color: #1B7A3C; }
.post-action-btn.active-dislike { color: #CC1F24; }
.post-action-btn svg { flex-shrink: 0; }
.post-action-label {
  font-size: .65rem; line-height: 1; font-weight: 500; white-space: nowrap;
}
.post-action-sep { flex: 1; }

/* ── Admin meta buttons (edit/delete) in card header ── */
.post-card-meta-actions {
  display: flex; align-items: center; gap: .15rem; margin-left: auto;
}
.post-card-meta-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 8px;
  padding: .3rem; cursor: pointer; color: var(--text-3, #aaa);
  transition: background .15s, color .15s;
}
.post-card-meta-btn:hover { background: var(--surface, #f5f5f5); color: var(--text, #333); }
.post-card-meta-danger:hover { color: #CC1F24; }

/* ── Create Post Slide Panel ── */
.create-post-panel {
  position:fixed; inset:0; background:rgba(0,0,0,.5);
  z-index:300; display:flex; align-items:flex-end; justify-content:center;
  opacity:0; pointer-events:none; transition:opacity .2s;
}
.create-post-panel.open { opacity:1; pointer-events:auto; }
.create-post-inner {
  background:#fff; border-radius:18px 18px 0 0;
  width:100%; max-width:580px; max-height:92vh;
  overflow-y:auto; padding:1.25rem 1rem 2rem;
  transform:translateY(100%); transition:transform .3s cubic-bezier(.4,0,.2,1);
}
.create-post-panel.open .create-post-inner { transform:translateY(0); }

.create-post-header {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:1rem; padding-bottom:.75rem; border-bottom:1px solid #eee;
}
.create-post-title { font-size:1.05rem; font-weight:700; color:#1B7A3C; }

/* Live preview in create form */
.create-post-preview-wrap {
  width:100%; max-width:300px; margin:0 auto 1rem;
  border-radius:10px; overflow:hidden; box-shadow:0 4px 20px rgba(0,0,0,.15);
}

/* Upload zones in create form */
.post-upload-zone {
  border:2px dashed #ccc; border-radius:10px;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:.4rem; padding:1rem; cursor:pointer; transition:border-color .15s;
  position:relative; overflow:hidden; min-height:80px;
}
.post-upload-zone:hover { border-color:#1B7A3C; }
.post-upload-zone.has-image { border-style:solid; border-color:#1B7A3C; background-size:cover; background-position:center; }
.post-upload-zone.has-image .post-upload-label { display:none; }
.post-upload-zone img { width:100%; max-height:120px; object-fit:cover; border-radius:6px; }
.post-upload-zone input[type=file] { position:absolute; inset:0; opacity:0; cursor:pointer; }
.post-upload-label { font-size:.8rem; color:#888; pointer-events:none; }
.post-upload-remove {
  position:absolute; top:4px; right:4px; background:rgba(0,0,0,.55);
  color:#fff; border:none; border-radius:50%; width:22px; height:22px;
  font-size:.7rem; cursor:pointer; display:none; align-items:center; justify-content:center;
}
.post-upload-zone.has-image .post-upload-remove { display:flex; }

/* Empty state */
.post-empty {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:.75rem; padding:3rem 1rem; color:#aaa; text-align:center;
}
.post-empty-icon { font-size:3rem; }

/* ── Speech canvas inside feed cards — fill card width ── */
.post-template-wrap .st-canvas {
  width: 100%;
}

/* ── Responsive ── */
@media (max-width:768px) {
  .post-feed-wrap { padding:.75rem .5rem; gap:1rem; }
  .pt-logo-banner { padding:4px 7px; }
  .pt-logo-banner img { height:22px; width:22px; }
  .pt-logo-text { font-size:.52rem; }
  .pt-quote-open, .pt-quote-close { font-size:2.8rem; }
  .create-post-inner { border-radius:14px 14px 0 0; }
}

/* ═══════════════════════════════════════════════════════════════════
   CUSTOM FONTS — Post template
   ═══════════════════════════════════════════════════════════════════ */
@font-face {
  font-family: 'Post';
  src: url('../fonts/Post-SemiBold.ttf') format('truetype');
  font-weight: 600; font-style: normal;
}
@font-face {
  font-family: 'Post';
  src: url('../fonts/Post-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal;
}
@font-face {
  font-family: 'Post';
  src: url('../fonts/Post-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal;
}
@font-face {
  font-family: 'Shadhinata';
  src: url('../fonts/Shadhinata-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal;
}

/* ═══════════════════════════════════════════════════════════════════
   TEMPLATE SELECTOR OVERLAY
   ═══════════════════════════════════════════════════════════════════ */
.tpl-selector-overlay {
  position: fixed; inset: 0; background: var(--surface, #f5f5f5);
  z-index: 400; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.tpl-selector-overlay.open { transform: translateX(0); }

.tpl-selector-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1rem; background: var(--ncp-green);
  color: #fff; position: sticky; top: 0; z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.tpl-selector-header-title { font-size: 1.05rem; font-weight: 700; flex: 1; }
.tpl-back-btn {
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 1.2rem; padding: .3rem .5rem; border-radius: 6px;
  transition: background .15s;
}
.tpl-back-btn:hover { background: rgba(255,255,255,.15); }

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem; padding: 1.25rem;
}
.tpl-card {
  background: #fff; border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; align-items: center;
}
.tpl-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.13); }
.tpl-card.coming-soon { opacity: .5; cursor: not-allowed; }
.tpl-card.coming-soon:hover { transform: none; box-shadow: 0 2px 10px rgba(0,0,0,.08); }

.tpl-card-thumb {
  width: 100%; aspect-ratio: 4/5; background: linear-gradient(135deg,#1B7A3C,#0d4a24);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: rgba(255,255,255,.4);
}
.tpl-card-label {
  padding: .6rem .8rem .7rem; font-size: .82rem; font-weight: 600;
  color: var(--text); text-align: center; width: 100%;
}
.tpl-card-badge {
  font-size: .65rem; color: var(--text-3); margin-top: .1rem; display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   SPEECH TEMPLATE CREATOR OVERLAY
   ═══════════════════════════════════════════════════════════════════ */
.speech-creator-overlay {
  position: fixed; inset: 0; background: var(--surface, #f0f0f0);
  z-index: 500; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.speech-creator-overlay.open { transform: translateX(0); }

.speech-creator-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; background: var(--ncp-green);
  color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.speech-creator-title { font-size: 1rem; font-weight: 700; flex: 1; }

/* Two-panel layout inside creator */
.speech-creator-body {
  flex: 1; display: flex; overflow: hidden;
}
.speech-creator-form {
  flex: 1; overflow-y: auto; padding: 1rem;
  background: var(--surface, #f5f5f5);
  max-width: 400px; flex-shrink: 0;
}
.speech-creator-preview {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: #e0e0e0; overflow: hidden;
}

/* ── Speech Template Canvas (4:5 ratio) ── */
/* All layer positions are % of canvas: width=4in, height=5in */
.st-canvas {
  width: min(300px, 80vw);   /* responsive fixed width  */
  aspect-ratio: 4 / 5;
  position: relative; overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  /* --pt is set by JS: 1pt in canvas px */
}

/* Layer base */
.st-layer { position: absolute; }

/* Layer 1 — Background (full canvas) */
.st-bg {
  inset: 0;
  background-size: cover; background-position: center;
  background-color: #fff;
}

/* Layer 2 — Content image with mask (bottom 50%) */
.st-semi-bg {
  left: 0; right: 0; bottom: 0; height: 50%;
  overflow: hidden;
}
.st-semi-bg-img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 60%);
  mask-image:         linear-gradient(to bottom, transparent 0%, black 60%);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  display: block;
}
/* When custom mask SVG is provided, JS sets mask-image inline */

/* Layer 3 — Character image PNG (same bounds as Layer 2, transparent PNG) */
.st-char-img-layer {
  left: 0; right: 0; bottom: 0; height: 50%;
  pointer-events: none;
}

/* Layer 4 — Top quote PNG */
/* top: 0.4258in/5in = 8.516%; height: 0.18in/5in = 3.6% */
.st-quote-top {
  top: 8.516%; left: 0; right: 0; height: 3.6%;
  background-size: 100% 100%; background-repeat: no-repeat;
}

/* Layer 5 — Main text area */
/* top: (0.4258+0.18+0.07)/5 = 13.516%                           */
/* bottom quote at 41.57%, min gap 0.07in = 1.4%                  */
/* → main text bottom edge at 41.57% - 1.4% = 40.17% from top   */
/* → CSS bottom = 100% - 40.17% = 59.83%                         */
.st-main-text {
  top: 13.516%; left: 0; right: 0;
  bottom: 59.83%;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-start;
  /* Horizontal padding keeps text off the edges.
     Vertical centering is handled by JS (paddingTop on .st-main-text-inner)
     so gaps above/below text are always exactly equal. */
  padding: 0 7%;
  /* font set by JS auto-size via --pt */
}
/* The actual rendered text div inside */
.st-main-text-inner {
  font-family: 'Post', sans-serif;
  font-weight: 600;
  line-height: 1.193;   /* 18.6pt / 15.6348pt ≈ 1.190 */
  text-align: center;
  color: #000;
  word-break: break-word;
  /* Default size scales with canvas --pt. JS auto-fit overrides via inline style when text overflows. */
  font-size: calc(15.6348 * var(--pt, 1.5px));
}
/* Mirror Quill output styles inside canvas */
.st-main-text-inner p  { margin: 0; padding: 0; }  /* remove browser default p margins */
.st-main-text-inner b, .st-main-text-inner strong { font-weight: 700; }
.st-main-text-inner i, .st-main-text-inner em { font-style: italic; }
.st-main-text-inner span[style] { /* honour inline styles from Quill */ }

/* Layer 6 — Bottom quote PNG */
/* positioned just above char-info: char top = 46.57%, quote height = 3.6%, margin = 1.4% */
/* bottom-quote top = 46.57% - 1.4% - 3.6% = 41.57% */
.st-quote-bottom {
  top: 41.57%; left: 0; right: 0; height: 3.6%;
  background-size: 100% 100%; background-repeat: no-repeat;
}

/* Layer 7 — Character name + designation */
/* Bottom edge anchored at 50% — the exact top of the content/char image layers.     */
/* This prevents overlap regardless of font size. The block grows upward from there. */
.st-char-info {
  bottom: 50%; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: calc(1 * var(--pt, 1.5px));
  padding: 0 4% calc(1.5 * var(--pt, 1.5px));
}
.st-char-name {
  font-family: 'Shadhinata', 'July', sans-serif;
  font-weight: 400;
  text-align: center;
  color: #118000;
  line-height: 1.2;
  /* 12pt on 4in×5in canvas */
  font-size: calc(12 * var(--pt, 1.5px));
}
.st-designation {
  font-family: 'Post', sans-serif;
  font-weight: 600;
  text-align: center;
  color: #000;
  line-height: 1.2;
  /* 5.1013pt on 4in×5in canvas */
  font-size: calc(5.1013 * var(--pt, 1.5px));
}

/* Layer 8 — Logo (flex so JS can change justify-content for alignment) */
/* height = 0.5584in / 5in = 11.168% of canvas height */
.st-logo {
  top: 0; left: 0; right: 0;
  height: 11.168%;
  display: flex; align-items: flex-start; justify-content: flex-end;
}
.st-logo img {
  height: 100%; width: auto; display: block; object-fit: contain;
}

/* ── Upload zones inside speech creator ── */
.st-upload-zone {
  border: 2px dashed var(--border, #ccc); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .4rem; padding: .9rem;
  cursor: pointer; transition: border-color .15s;
  position: relative; overflow: hidden; min-height: 72px;
  background: #fff;
}
.st-upload-zone:hover { border-color: var(--ncp-green); }
.st-upload-zone.has-image { border-style: solid; border-color: var(--ncp-green); }
.st-upload-zone.has-image .st-upload-label { display: none; }
.st-upload-zone img { width: 100%; max-height: 100px; object-fit: contain; border-radius: 6px; }
.st-upload-label { font-size: .78rem; color: #888; pointer-events: none; text-align: center; }
.st-upload-required { font-size: .68rem; color: var(--danger, #CC1F24); margin-top: .15rem; }
.st-upload-remove {
  position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55);
  color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px;
  font-size: .65rem; cursor: pointer; display: none;
  align-items: center; justify-content: center;
}
.st-upload-zone.has-image .st-upload-remove { display: flex; }

/* ── Quill editor in speech creator ── */
.st-quill-wrap .ql-container { font-family: 'Post', sans-serif; font-size: 1rem; }
.st-quill-wrap .ql-editor { min-height: 80px; font-family: 'Post', sans-serif; }

/* ── Logo alignment picker ── */
.logo-align-group {
  display: flex; gap: .5rem;
}
.logo-align-btn {
  flex: 1; padding: .4rem; border: 1.5px solid var(--border,#ccc);
  border-radius: 8px; background: none; cursor: pointer;
  font-size: .82rem; transition: all .15s; color: var(--text);
}
.logo-align-btn.active {
  border-color: var(--ncp-green); background: var(--ncp-green);
  color: #fff; font-weight: 700;
}

/* ── Mobile: stack preview above form ── */
@media (max-width: 700px) {
  .speech-creator-body { flex-direction: column; }
  .speech-creator-preview {
    flex: 0 0 auto; padding: .75rem;
    background: #ddd;
  }
  .speech-creator-form { max-width: none; }
  .st-canvas { width: min(220px, 65vw); }
  .tpl-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ── Template card "coming soon" variant ── */
.tpl-card-soon { opacity: .5; cursor: not-allowed; pointer-events: none; }
.tpl-card-thumb-soon {
  background: #e8e8e8;
}

/* ── Upload zone inner flex wrapper ── */
.st-upload-inner {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .35rem; pointer-events: none; text-align: center;
  width: 100%;
}
.st-upload-inner span { font-size: .78rem; color: #888; }
.st-upload-zone-required { border-color: #f0c0c0; }

/* ── Quill inside speech creator (not wrapped in .st-quill-wrap) ── */
#stQuillToolbar { border-radius: 8px 8px 0 0; border: 1.5px solid var(--border,#ddd); }
#stQuillEditor  {
  border: 1.5px solid var(--border,#ddd); border-top: none;
  border-radius: 0 0 8px 8px;
  font-family: 'Post', sans-serif; min-height: 90px;
  background: #fff;
}
#stQuillEditor .ql-editor { font-family: 'Post', sans-serif; }

/* Quill custom font classes (applied inside mirror div too) */
.ql-font-post-semibold { font-family: 'Post', sans-serif; font-weight: 600; }
.ql-font-post-bold     { font-family: 'Post', sans-serif; font-weight: 700; }
.ql-font-post-regular  { font-family: 'Post', sans-serif; font-weight: 400; }
.ql-font-shadhinata    { font-family: 'Shadhinata', sans-serif; }

/* Quill custom size classes */
.ql-size-10pt { font-size: calc(10 * var(--pt, 1px)); }
.ql-size-12pt { font-size: calc(12 * var(--pt, 1px)); }
.ql-size-14pt { font-size: calc(14 * var(--pt, 1px)); }
.ql-size-16pt { font-size: calc(16 * var(--pt, 1px)); }
.ql-size-18pt { font-size: calc(18 * var(--pt, 1px)); }
.ql-size-20pt { font-size: calc(20 * var(--pt, 1px)); }
.ql-size-24pt { font-size: calc(24 * var(--pt, 1px)); }

/* ── Canvas wrap: centers the canvas ── */
.st-canvas-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}

/* ── Post card caption (below template image) ── */
.post-card-caption {
  padding: .7rem 1rem .5rem;
  border-top: 1px solid #f0f0f0;
}
.post-card-caption-text {
  font-size: .9rem;
  color: var(--text-1, #222);
  line-height: 1.55;
  white-space: pre-line;
  word-break: break-word;
}
.post-card-caption-name {
  font-size: .875rem;
  font-weight: 700;
  color: #118000;
  margin-top: .45rem;
}
.post-card-caption-desig {
  font-size: .78rem;
  color: var(--text-2, #666);
  margin-top: .1rem;
}

/* ════════════════════════════════════════════════════════
   PROGRAMS PAGE
   ════════════════════════════════════════════════════════ */

/* ── Page layout ── */
.programs-page {
  padding: 1rem;
  max-width: 720px;
  margin: 0 auto;
}

/* ── Toolbar ── */
.prog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: 1.1rem;
  align-items: center;
}
.prog-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.prog-search-icon {
  position: absolute;
  left: .7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-2, #888);
  pointer-events: none;
}
.prog-search {
  width: 100%;
  padding: .5rem .75rem .5rem 2.1rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  background: var(--surface, #fff);
  color: var(--text-1, #222);
  box-sizing: border-box;
  outline: none;
  transition: border-color .15s;
}
.prog-search:focus { border-color: var(--ncp-green, #1B7A3C); }

.prog-filter-tabs {
  display: flex;
  gap: .35rem;
}
.prog-filter-btn {
  padding: .4rem .85rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 20px;
  background: transparent;
  font-family: inherit;
  font-size: .82rem;
  cursor: pointer;
  color: var(--text-2, #666);
  transition: background .15s, color .15s, border-color .15s;
}
.prog-filter-btn:hover { background: var(--surface-2, #f5f5f5); }
.prog-filter-btn.active {
  background: var(--ncp-green, #1B7A3C);
  color: #fff;
  border-color: var(--ncp-green, #1B7A3C);
}

/* ── Loading / empty ── */
.prog-loading {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 2.5rem 1rem;
  color: var(--text-2, #888);
  font-size: .95rem;
  justify-content: center;
}
.prog-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-2, #888);
  font-size: .95rem;
}

/* ── Card ── */
.prog-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: .9rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: box-shadow .15s;
}
.prog-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.09); }

/* Cover image */
.prog-card-cover {
  width: 100%;
  max-height: 220px;
  overflow: hidden;
  background: #f0f0f0;
}
.prog-card-cover img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

/* Card body */
.prog-card-body {
  padding: 1rem 1.1rem .95rem;
}
.prog-card-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .45rem;
  flex-wrap: wrap;
}
.prog-status-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 12px;
  letter-spacing: .02em;
}
.prog-status-upcoming { background: #e8f5ee; color: var(--ncp-green, #1B7A3C); }
.prog-status-ongoing  { background: #fff3e0; color: #e65100; }
.prog-status-past     { background: #f5f5f5; color: var(--text-2, #888); }

.prog-card-date {
  font-size: .78rem;
  color: var(--text-2, #888);
  margin-left: auto;
}

.prog-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-1, #1a1a1a);
  margin: 0 0 .45rem;
  line-height: 1.4;
}
.prog-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: .5rem;
}
.prog-card-loc {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .82rem;
  color: var(--text-2, #888);
}
.prog-desc-wrap {
  margin-top: .4rem;
}
.prog-card-desc {
  font-size: .88rem;
  color: var(--text-2, #555);
  line-height: 1.6;
  margin: 0;
  white-space: pre-line;
  word-break: break-word;
}
.prog-card-desc--clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prog-see-more {
  background: none;
  border: none;
  padding: .2rem 0 0;
  font-family: inherit;
  font-size: .82rem;
  color: var(--ncp-green, #1B7A3C);
  cursor: pointer;
  font-weight: 600;
}
.prog-see-more:hover { text-decoration: underline; }

/* Admin action buttons */
.prog-card-actions {
  display: flex;
  gap: .5rem;
  margin-top: .85rem;
  padding-top: .75rem;
  border-top: 1px solid #f0f0f0;
  flex-wrap: wrap;
}
.prog-action-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 7px;
  background: transparent;
  font-family: inherit;
  font-size: .82rem;
  cursor: pointer;
  color: var(--text-2, #555);
  transition: background .12s, color .12s, border-color .12s;
}
.prog-action-btn:hover { background: var(--surface-2, #f5f5f5); color: var(--text-1, #222); }
.prog-action-danger { color: var(--ncp-red, #CC1F24); border-color: #f5c2c2; }
.prog-action-danger:hover { background: #fff5f5; color: var(--ncp-red, #CC1F24); border-color: var(--ncp-red, #CC1F24); }

/* Program share row */
.prog-card-share-row {
  display: flex;
  margin-top: .6rem;
  padding-top: .6rem;
  border-top: 1px solid #f0f0f0;
}
.prog-share-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .32rem .85rem;
  border: 1px solid var(--ncp-green, #1B7A3C);
  border-radius: 20px;
  background: transparent;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ncp-green, #1B7A3C);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.prog-share-btn:hover { background: var(--ncp-green, #1B7A3C); color: #fff; }

/* Load more */
.prog-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: .75rem 0 1.5rem;
}

/* ── Cover image upload UI ── */
.prog-cover-upload {
  position: relative;
  border: 2px dashed var(--border, #ddd);
  border-radius: 10px;
  overflow: hidden;
  min-height: 90px;
}
.prog-cover-preview {
  position: relative;
  display: flex;
}
.prog-cover-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
}
.prog-cover-remove {
  position: absolute;
  top: .4rem;
  right: .4rem;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.prog-cover-remove:hover { background: rgba(0,0,0,.8); }
.prog-cover-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: 1.25rem;
  cursor: pointer;
  color: var(--text-2, #888);
  font-size: .85rem;
  transition: background .15s;
}
.prog-cover-pick:hover { background: var(--surface-2, #f9f9f9); }
.prog-cover-uploading {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1.25rem;
  justify-content: center;
  font-size: .85rem;
  color: var(--text-2, #888);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .programs-page { padding: .75rem .5rem; }
  .prog-card-cover img { height: 160px; }
  .prog-card-body { padding: .8rem .85rem .75rem; }
  .prog-card-title { font-size: 1.1rem; }
}
@media (max-width: 420px) {
  .prog-toolbar { gap: .5rem; }
  .prog-filter-btn { padding: .35rem .65rem; font-size: .78rem; }
}

/* ── Map link input ── */
.prog-map-input-wrap {
  position: relative;
}
.prog-map-input-icon {
  position: absolute;
  left: .7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-2, #888);
  pointer-events: none;
}
.prog-map-input {
  padding-left: 2.1rem !important;
}

/* ── Map link on card ── */
.prog-card-map {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .82rem;
  color: #1a73e8;
  text-decoration: none;
  padding: .15rem .4rem;
  border-radius: 4px;
  transition: background .12s;
}
.prog-card-map:hover {
  background: #e8f0fe;
  text-decoration: underline;
}

/* ── Form hints ── */
.form-hint {
  font-size: .75rem;
  color: var(--text-2, #999);
  margin-top: .3rem;
}

/* ═══════════════════════════════════════════════════════════
   CREDIT BUTTON & MODAL
   ═══════════════════════════════════════════════════════════ */

/* ── Sidebar credit button (below logout) ── */
.sidebar-credit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  width: 100%;
  margin-top: .5rem;
  padding: .38rem .6rem;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .7rem;
  color: var(--text-2, #aaa);
  opacity: .65;
  transition: opacity .15s, background .15s;
  font-family: inherit;
  text-align: center;
  letter-spacing: .01em;
}
.sidebar-credit-btn:hover {
  opacity: 1;
  background: var(--surface-2, rgba(255,255,255,.06));
}
.sidebar-credit-btn svg {
  flex-shrink: 0;
  opacity: .8;
}

/* ── More-menu credit item (mobile) ── */
.more-menu-credit {
  border-top: 1px solid var(--border, rgba(255,255,255,.08));
  margin-top: .25rem;
  padding-top: .25rem;
  color: var(--text-2, #aaa) !important;
  font-size: .82rem;
  opacity: .75;
}
.more-menu-credit:hover { opacity: 1; }

/* ── Credit modal overlay ── */
.credit-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
}
.credit-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Credit card ── */
.credit-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface, #1e1e2a);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 2.2rem 2rem 1.8rem;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  transform: translateY(18px) scale(.97);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.credit-overlay.visible .credit-card {
  transform: translateY(0) scale(1);
}

/* close button */
.credit-close {
  position: absolute;
  top: .9rem;
  right: .9rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.08);
  color: var(--text-1, #eee);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  font-size: 1rem;
  line-height: 1;
}
.credit-close:hover { background: rgba(255,255,255,.16); }

/* craft label at top */
.credit-craft-label {
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-2, #999);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}
.credit-craft-label::before,
.credit-craft-label::after {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--text-2, #999);
  opacity: .4;
}

/* developer name */
.credit-dev-name {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-1, #fff);
  letter-spacing: -.01em;
  margin-bottom: .75rem;
  line-height: 1.2;
}

/* description */
.credit-dev-desc {
  font-size: .85rem;
  color: var(--text-2, #bbb);
  line-height: 1.7;
  margin-bottom: 1.2rem;
  white-space: pre-line;
}

/* website link */
.credit-dev-url {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  color: var(--primary, #1B7A3C);
  text-decoration: none;
  border: 1px solid var(--primary, #1B7A3C);
  padding: .3rem .85rem;
  border-radius: 99px;
  transition: background .15s, color .15s;
  margin-bottom: 1.5rem;
}
.credit-dev-url:hover {
  background: var(--primary, #1B7A3C);
  color: #fff;
}

/* divider */
.credit-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,.08);
  margin: 0 0 1rem;
}

/* app footer */
.credit-app-footer {
  font-size: .72rem;
  color: var(--text-2, #888);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}
.credit-app-name {
  font-weight: 600;
  color: var(--text-1, #ccc);
}
@media (max-width: 480px) {
  .credit-card { padding: 1.8rem 1.4rem 1.4rem; }
  .credit-dev-name { font-size: 1.3rem; }
}

/* ════════════════════════════════════════════════════════════
   ▌  RESOURCES / DOWNLOADS PAGE (Phase 5)
   ════════════════════════════════════════════════════════════ */
.resources-page { padding: 0; }

.res-toolbar {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  padding: .85rem 1rem; background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #e5e7eb);
  position: sticky; top: 0; z-index: 5;
}
.res-search-wrap {
  flex: 1 1 240px; min-width: 200px; position: relative;
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg, #f5f7fa); border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 10px); padding: .5rem .85rem;
}
.res-search-icon { color: var(--text-3, #888); flex-shrink: 0; }
.res-search { flex: 1; border: none; background: none; outline: none;
  font-size: .92rem; color: var(--text, #1a1a1a); font-family: var(--font-main); }

.res-filter-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.res-filter-btn {
  background: var(--bg, #f5f7fa); color: var(--text-2, #555);
  border: 1px solid transparent; padding: .42rem .85rem; border-radius: 20px;
  font-size: .82rem; cursor: pointer; font-family: var(--font-main);
  transition: all .15s;
}
.res-filter-btn:hover  { background: var(--surface-2, #ecf3ee); }
.res-filter-btn.active {
  background: var(--ncp-green, #1B7A3C); color: #fff; border-color: var(--ncp-green, #1B7A3C);
}

.res-grid {
  display: grid; gap: 1rem; padding: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.res-loading, .res-empty {
  grid-column: 1 / -1; padding: 3rem 1rem; text-align: center;
  color: var(--text-3, #888); font-size: .9rem; display: flex;
  align-items: center; justify-content: center; gap: .65rem;
}

.res-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; overflow: hidden; transition: box-shadow .15s, transform .15s;
}
.res-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-1px); }
.res-card-inner { display: flex; flex-direction: column; height: 100%; }

.res-thumb {
  height: 130px; background: var(--bg, #f5f7fa);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.res-thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.res-thumb-fallback { background: linear-gradient(135deg, #e8f5ee, #d4ebd9); }
.res-thumb-file { flex-direction: column; gap: .35rem; color: #1B7A3C; }
.res-thumb-file svg { opacity: .75; }
.res-thumb-ext {
  background: var(--ncp-green, #1B7A3C); color: #fff;
  font-size: .68rem; font-weight: 700; letter-spacing: .5px;
  padding: .15rem .55rem; border-radius: 12px;
}

.res-body { padding: .65rem .85rem .35rem; flex: 1; min-height: 0; }
.res-meta-row { display: flex; gap: .5rem; align-items: center;
  margin-bottom: .35rem; flex-wrap: wrap; }
.res-cat-badge {
  display: inline-block; padding: .15rem .55rem; border-radius: 10px;
  font-size: .67rem; font-weight: 600; background: #e8f4fd; color: #1565c0;
}
.res-cat-logo     { background: #ffe9d6; color: #c1581f; }
.res-cat-banner   { background: #fcd9da; color: #a02a2e; }
.res-cat-document { background: #dbeafe; color: #1e40af; }
.res-cat-template { background: #ede9fe; color: #5b21b6; }
.res-cat-other    { background: #e5e7eb; color: #4b5563; }

.res-size { font-size: .72rem; color: var(--text-3, #888); margin-left: auto; }
.res-title { font-weight: 600; font-size: .93rem; color: var(--text, #1a1a1a);
  margin: .15rem 0 .25rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.res-desc { font-size: .78rem; color: var(--text-2, #555); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: .3rem;
}
.res-filename { font-size: .7rem; color: var(--text-3, #888); margin-top: .2rem;
  word-break: break-all; line-height: 1.3;
}

.res-card-actions {
  display: flex; gap: .35rem; padding: .55rem .75rem; flex-wrap: wrap;
  border-top: 1px solid var(--border, #e5e7eb);
}
.res-act-btn { padding: .35rem .65rem; font-size: .76rem;
  display: inline-flex; align-items: center; gap: .25rem;
  text-decoration: none;
}
.res-act-btn svg { flex-shrink: 0; }
.res-act-danger:hover { background: #fcd9da !important; color: #a02a2e !important; }

.res-card-foot {
  font-size: .7rem; color: var(--text-3, #888);
  padding: .35rem .85rem .55rem; border-top: 1px solid var(--border, #e5e7eb);
}

/* File upload (slide-panel) */
.res-file-upload {
  border: 2px dashed var(--border, #e5e7eb); border-radius: 12px;
  padding: 0; background: var(--bg, #f5f7fa); overflow: hidden;
}
.res-file-pick {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .35rem; padding: 1.5rem 1rem; cursor: pointer;
  color: var(--text-2, #555); transition: background .15s;
}
.res-file-pick:hover { background: var(--surface-2, #ecf3ee); }
.res-file-pick svg { color: var(--ncp-green, #1B7A3C); }
.res-file-hint { font-size: .72rem; color: var(--text-3, #888); margin-top: .25rem; }

.res-file-preview {
  display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem;
  background: var(--surface, #fff);
}
.res-file-icon { color: var(--ncp-green, #1B7A3C); flex-shrink: 0; }
.res-file-info { flex: 1; min-width: 0; }
.res-file-name { font-weight: 600; font-size: .9rem; color: var(--text, #1a1a1a);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.res-file-meta { font-size: .75rem; color: var(--text-3, #888); margin-top: .15rem; }
.res-file-remove {
  background: none; border: 1px solid var(--border, #e5e7eb); color: var(--danger, #CC1F24);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.res-file-remove:hover { background: var(--danger, #CC1F24); color: #fff; border-color: var(--danger, #CC1F24); }
.res-file-uploading { padding: 1rem; text-align: center; color: var(--text-2, #555);
  font-size: .85rem; display: flex; align-items: center; justify-content: center; gap: .5rem;
}

@media (max-width: 480px) {
  .res-grid { gap: .75rem; padding: .65rem; grid-template-columns: 1fr 1fr; }
  .res-thumb { height: 100px; }
  .res-title { font-size: .85rem; }
  .res-body { padding: .5rem .65rem .3rem; }
  .res-card-actions { padding: .4rem .55rem; }
  .res-act-btn { padding: .3rem .45rem; font-size: .68rem; }
  .res-toolbar { padding: .65rem .65rem; }
}

/* ════════════════════════════════════════════════════════════
   ▌  ACCOUNTS PAGE (Phase 6)
   ════════════════════════════════════════════════════════════ */
.accounts-page { padding: 0; }

.acc-toolbar {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  padding: .85rem 1rem; background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.acc-summary-row {
  display: grid; gap: .75rem; padding: 1rem;
  grid-template-columns: repeat(3, 1fr);
}
.acc-summary-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: 1rem 1.1rem;
  position: relative; overflow: hidden;
}
.acc-summary-card.income  { border-left: 4px solid #16a34a; }
.acc-summary-card.expense { border-left: 4px solid #dc2626; }
.acc-summary-card.balance { border-left: 4px solid #1B7A3C; }
.acc-summary-label { font-size: .8rem; color: var(--text-2, #555); margin-bottom: .3rem;
  display: flex; align-items: center; gap: .35rem; }
.acc-summary-value { font-size: 1.4rem; font-weight: 700; color: var(--text, #1a1a1a); }
.acc-summary-value.income  { color: #16a34a; }
.acc-summary-value.expense { color: #dc2626; }
.acc-summary-value.balance { color: #1B7A3C; }
.acc-summary-sub { font-size: .72rem; color: var(--text-3, #888); margin-top: .2rem; }

.acc-view-tabs { display: flex; gap: .35rem; padding: 0 1rem;
  border-bottom: 1px solid var(--border, #e5e7eb); overflow-x: auto;
}
.acc-view-btn {
  background: none; border: none; padding: .65rem 1rem;
  font-family: var(--font-main); font-size: .88rem; color: var(--text-2, #555);
  cursor: pointer; border-bottom: 3px solid transparent;
  transition: all .15s; white-space: nowrap;
}
.acc-view-btn:hover  { color: var(--text, #1a1a1a); }
.acc-view-btn.active { color: var(--ncp-green, #1B7A3C); border-bottom-color: var(--ncp-green, #1B7A3C); font-weight: 600; }

.acc-filter-row { display: flex; gap: .5rem; padding: .85rem 1rem; flex-wrap: wrap; align-items: center;
  background: var(--surface, #fff); border-bottom: 1px solid var(--border, #e5e7eb);
}
.acc-filter-row .acc-search-wrap {
  flex: 1 1 200px; display: flex; align-items: center; gap: .5rem;
  background: var(--bg, #f5f7fa); border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 10px); padding: .42rem .8rem;
}
.acc-filter-row .acc-search { flex: 1; border: none; background: none; outline: none;
  font-size: .9rem; color: var(--text, #1a1a1a); font-family: var(--font-main); }
.acc-type-tab {
  background: var(--bg, #f5f7fa); border: 1px solid transparent;
  padding: .4rem .85rem; border-radius: 20px; font-size: .82rem;
  font-family: var(--font-main); cursor: pointer; transition: all .15s;
}
.acc-type-tab.active.income  { background: #dcfce7; color: #166534; border-color: #16a34a; }
.acc-type-tab.active.expense { background: #fee2e2; color: #991b1b; border-color: #dc2626; }
.acc-type-tab.active.all     { background: var(--ncp-green, #1B7A3C); color: #fff; border-color: var(--ncp-green, #1B7A3C); }
.acc-date-range {
  display: flex; align-items: center; gap: .35rem;
  font-size: .78rem; color: var(--text-2, #555);
}
.acc-date-range input { padding: .35rem .5rem; font-size: .82rem;
  border: 1px solid var(--border, #e5e7eb); border-radius: 6px;
  font-family: var(--font-main); background: var(--surface, #fff);
}

.acc-list { padding: .5rem 1rem 1rem; }
.acc-empty { text-align: center; padding: 3rem 1rem; color: var(--text-3, #888); font-size: .9rem; }
.acc-loading { display: flex; align-items: center; justify-content: center; gap: .5rem;
  padding: 2rem; color: var(--text-3, #888); font-size: .9rem;
}

.acc-row {
  display: grid; grid-template-columns: 90px 1fr auto;
  gap: .75rem; align-items: center; padding: .7rem .85rem;
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; margin-bottom: .5rem;
}
.acc-row.income  { border-left: 3px solid #16a34a; }
.acc-row.expense { border-left: 3px solid #dc2626; }
.acc-row-date {
  font-size: .78rem; color: var(--text-2, #555); line-height: 1.3;
}
.acc-row-date strong { display: block; color: var(--text, #1a1a1a); font-size: .92rem; }
.acc-row-info { min-width: 0; }
.acc-row-desc { font-weight: 600; font-size: .92rem; color: var(--text, #1a1a1a);
  margin-bottom: .15rem; line-height: 1.35; }
.acc-row-meta { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .73rem; color: var(--text-3, #888); }
.acc-row-meta span { display: inline-flex; align-items: center; gap: .2rem; }
.acc-row-cat { background: #e5e7eb; padding: .12rem .5rem; border-radius: 10px;
  font-size: .67rem; font-weight: 600; color: #4b5563;
}
.acc-row-amount-col { text-align: right; display: flex; flex-direction: column;
  align-items: flex-end; gap: .15rem;
}
.acc-row-amount { font-weight: 700; font-size: 1.05rem; }
.acc-row-amount.income  { color: #16a34a; }
.acc-row-amount.expense { color: #dc2626; }
.acc-row-actions { display: flex; gap: .25rem; margin-top: .2rem; }
.acc-row-invoice {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .7rem; color: #1565c0; text-decoration: none;
  background: #e8f4fd; padding: .15rem .5rem; border-radius: 10px;
}
.acc-row-invoice:hover { background: #c5e0fa; }

/* Month group */
.acc-month-group { margin-bottom: 1.25rem; }
.acc-month-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .85rem; background: var(--bg, #f5f7fa);
  border-radius: 8px; margin-bottom: .5rem;
  font-weight: 700; font-size: .9rem; color: var(--ncp-green, #1B7A3C);
}
.acc-month-totals { font-size: .77rem; color: var(--text-2, #555); font-weight: 500; display: flex; gap: .85rem; flex-wrap: wrap; }
.acc-month-totals span.income  { color: #16a34a; }
.acc-month-totals span.expense { color: #dc2626; }

/* Category breakdown */
.acc-cat-grid { display: grid; gap: .75rem; padding: 1rem;
  grid-template-columns: 1fr 1fr;
}
.acc-cat-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: .85rem 1rem;
}
.acc-cat-card-title { display: flex; align-items: center; gap: .35rem; font-weight: 600;
  margin-bottom: .6rem; font-size: .92rem; }
.acc-cat-bar {
  height: 8px; background: var(--bg, #f5f7fa); border-radius: 4px;
  overflow: hidden; margin: .3rem 0;
}
.acc-cat-bar-fill { height: 100%; background: #16a34a; transition: width .3s; }
.acc-cat-bar-fill.expense { background: #dc2626; }
.acc-cat-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; padding: .25rem 0;
}
.acc-cat-row-label { color: var(--text-2, #555); }
.acc-cat-row-amount { font-weight: 600; color: var(--text, #1a1a1a); }

.acc-chart-wrap { background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: 1rem; margin: 1rem;
}
.acc-chart-wrap canvas { max-height: 280px; }
.acc-chart-title { font-weight: 600; margin-bottom: .5rem; font-size: .92rem; }

@media (max-width: 600px) {
  .acc-summary-row { grid-template-columns: 1fr; gap: .5rem; padding: .65rem; }
  .acc-summary-value { font-size: 1.2rem; }
  .acc-cat-grid { grid-template-columns: 1fr; }
  .acc-row { grid-template-columns: 70px 1fr; gap: .5rem; padding: .55rem .65rem; }
  .acc-row-amount-col { grid-column: 1 / -1; flex-direction: row; justify-content: space-between;
    border-top: 1px solid var(--border, #e5e7eb); padding-top: .3rem; align-items: center; }
  .acc-row-amount { font-size: .98rem; }
}

/* ════════════════════════════════════════════════════════════
   ▌  দপ্তর PAGE (Phase 7)
   ════════════════════════════════════════════════════════════ */
.doptor-page { padding: 0; }

.dop-tabs { display: flex; gap: .35rem; padding: 0 1rem;
  border-bottom: 1px solid var(--border, #e5e7eb); overflow-x: auto;
  background: var(--surface, #fff);
}
.dop-tab-btn {
  background: none; border: none; padding: .75rem 1rem;
  font-family: var(--font-main); font-size: .88rem; color: var(--text-2, #555);
  cursor: pointer; border-bottom: 3px solid transparent;
  transition: all .15s; white-space: nowrap;
}
.dop-tab-btn:hover  { color: var(--text, #1a1a1a); }
.dop-tab-btn.active { color: var(--ncp-green, #1B7A3C); border-bottom-color: var(--ncp-green, #1B7A3C); font-weight: 600; }
.dop-pane { display: none; padding: 1rem; }
.dop-pane.active { display: block; }

.dop-toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  margin-bottom: .85rem;
}
.dop-toolbar .search-input {
  flex: 1 1 200px; padding: .42rem .85rem; border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius, 10px); background: var(--bg, #f5f7fa);
  font-family: var(--font-main); font-size: .9rem;
}
.dop-list { display: grid; gap: .55rem; }
.dop-empty { text-align: center; padding: 2rem; color: var(--text-3, #888); font-size: .9rem; }

/* Stock card */
.dop-stock-card {
  display: grid; grid-template-columns: 60px 1fr auto; gap: .75rem;
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; padding: .7rem; align-items: center;
}
.dop-stock-thumb {
  width: 60px; height: 60px; border-radius: 8px; background: var(--bg, #f5f7fa);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  color: var(--text-3, #888); flex-shrink: 0;
}
.dop-stock-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dop-stock-info { min-width: 0; }
.dop-stock-name { font-weight: 600; font-size: .94rem; color: var(--text, #1a1a1a);
  margin-bottom: .15rem; }
.dop-stock-meta { font-size: .72rem; color: var(--text-3, #888);
  display: flex; gap: .5rem; flex-wrap: wrap;
}
.dop-stock-qty { font-weight: 700; font-size: 1.05rem; color: var(--ncp-green, #1B7A3C);
  display: flex; flex-direction: column; align-items: center;
}
.dop-stock-qty small { font-size: .7rem; color: var(--text-3, #888); font-weight: 500; margin-top: -2px; }
.dop-stock-actions { display: flex; gap: .25rem; margin-top: .35rem; }

/* Register row */
.dop-reg-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; padding: .7rem .85rem;
}
.dop-reg-card.in  { border-left: 3px solid #1565c0; }
.dop-reg-card.out { border-left: 3px solid #c97c1f; }
.dop-reg-head { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap;
  margin-bottom: .25rem;
}
.dop-reg-date { font-size: .82rem; color: var(--text-2, #555); }
.dop-reg-ref { font-weight: 600; font-size: .82rem; color: var(--ncp-green, #1B7A3C);
  background: var(--surface-2, #e8f5ee); padding: .1rem .5rem; border-radius: 8px;
}
.dop-reg-type-badge { font-size: .68rem; font-weight: 600; padding: .1rem .55rem;
  border-radius: 10px; background: #e5e7eb; color: #4b5563; }
.dop-reg-type-in  { background: #dbeafe; color: #1e40af; }
.dop-reg-type-out { background: #fef3c7; color: #92400e; }
.dop-reg-type-member { background: #dcfce7; color: #166534; }
.dop-reg-type-notice { background: #f3e8ff; color: #6b21a8; }
.dop-reg-title { font-weight: 600; font-size: .92rem; color: var(--text, #1a1a1a);
  margin: .1rem 0; line-height: 1.35; }
.dop-reg-meta { font-size: .77rem; color: var(--text-3, #888); display: flex;
  gap: .65rem; flex-wrap: wrap; margin-top: .15rem; }
.dop-reg-actions { display: flex; gap: .35rem; margin-top: .4rem; }

/* Meeting card */
.dop-meet-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; padding: .8rem .85rem;
  display: grid; grid-template-columns: 70px 1fr auto; gap: .75rem;
  align-items: center;
}
.dop-meet-date-box {
  background: var(--ncp-green, #1B7A3C); color: #fff;
  width: 70px; height: 70px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dop-meet-date-day { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.dop-meet-date-mon { font-size: .72rem; margin-top: 2px; opacity: .9; }
.dop-meet-info { min-width: 0; }
.dop-meet-title { font-weight: 600; font-size: .95rem; color: var(--text, #1a1a1a);
  margin-bottom: .2rem; line-height: 1.35; }
.dop-meet-meta { font-size: .76rem; color: var(--text-2, #555);
  display: flex; gap: .65rem; flex-wrap: wrap; }
.dop-meet-actions { display: flex; gap: .25rem; }

/* Attendance row */
.dop-att-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; padding: .65rem .85rem;
}
.dop-att-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  margin-bottom: .15rem;
}
.dop-att-name { font-weight: 600; font-size: .93rem; color: var(--text, #1a1a1a); }
.dop-att-time-in  { font-size: .72rem; color: #166534; font-weight: 600; }
.dop-att-time-out { font-size: .72rem; color: var(--text-3, #888); }
.dop-att-meta { font-size: .77rem; color: var(--text-2, #555); }
.dop-att-actions { display: flex; gap: .35rem; margin-top: .4rem; }

@media (max-width: 600px) {
  .dop-stock-card { grid-template-columns: 50px 1fr auto; padding: .55rem; }
  .dop-stock-thumb { width: 50px; height: 50px; }
  .dop-meet-card { grid-template-columns: 56px 1fr; }
  .dop-meet-date-box { width: 56px; height: 56px; }
  .dop-meet-actions { grid-column: 1 / -1; padding-top: .35rem; border-top: 1px solid var(--border, #e5e7eb); }
  .dop-tabs { padding: 0 .5rem; }
  .dop-tab-btn { padding: .55rem .65rem; font-size: .82rem; }
  .dop-pane { padding: .65rem; }
}

/* ════════════════════════════════════════════════════════════
   ▌  Username change UI (Settings → Profile)
   ════════════════════════════════════════════════════════════ */
.username-row { display: flex; align-items: center; gap: .35rem; }
.username-change-btn {
  background: none; border: 1px solid var(--border, #e5e7eb); color: var(--text-2, #555);
  padding: .25rem .6rem; font-size: .72rem; border-radius: 16px;
  cursor: pointer; font-family: var(--font-main); transition: all .15s;
}
.username-change-btn:hover { background: var(--surface-2, #e8f5ee); color: var(--ncp-green, #1B7A3C); border-color: var(--ncp-green, #1B7A3C); }
.username-row-text { flex: 1; padding: .35rem .65rem; background: var(--surface-2, #f5f7fa);
  border-radius: 6px; font-size: .9rem; color: var(--text, #1a1a1a); }

/* Username change modal helper */
.uc-modal-hint { font-size: .8rem; color: var(--text-2, #555); margin-bottom: .85rem; line-height: 1.5; }
.uc-modal-hint .warn { color: var(--danger, #CC1F24); font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   ▌  POST FEED — Performance optimizations
   ════════════════════════════════════════════════════════════ */
/* content-visibility:auto tells the browser to skip rendering
   off-screen post cards entirely — massive speed-up for long feeds */
.post-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;   /* estimated card height — prevents layout shift */
}
/* Reserve aspect-ratio for canvas so layout doesn't shift when images load */
.post-template-wrap { min-height: 1px; }
.post-template-wrap .st-canvas { background: #f5f7fa; }
/* Smoother image fade-in */
.post-card img { transition: opacity .25s; }
