/* =========================================================
   Office DMS - Complete Stylesheet with Enhanced Modal & Grid
   ========================================================= */

:root {
  --navy: #102b46;
  --blue: #1c67a3;
  --sky: #eaf4fb;
  --ink: #162534;
  --muted: #657686;
  --line: #dbe5eb;
  --green: #13785f;
  --amber: #a86100;
  --red: #bf3c3c;
  --white: #fff;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f7f9;
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* --- Login Page --- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 15% 15%, #e1f1fc, transparent 32%), linear-gradient(135deg, #f7fbfd, #e6eef2);
}

.login-card {
  width: min(940px, 100%);
  background: #fff;
  box-shadow: 0 24px 65px #1c3c5230;
  border-radius: 22px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  overflow: hidden;
}

.brand-pane {
  background: var(--navy);
  color: #fff;
  padding: 54px;
}

.brand-pane .seal {
  width: 58px;
  height: 58px;
  border: 2px solid #90c6ec;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
}

.brand-pane h1 {
  font-size: 31px;
  line-height: 1.15;
  margin: 28px 0 12px;
}

.brand-pane p {
  color: #bed4e5;
  max-width: 390px;
}

.office-list {
  margin-top: 35px;
  border-top: 1px solid #ffffff2e;
  padding-top: 18px;
}

.office-list div {
  margin: 10px 0;
}

.login-form {
  padding: 50px;
  align-self: center;
}

.login-form h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-form p {
  color: var(--muted);
  margin: 0 0 24px;
}

/* --- Form Fields & Inputs (Overlap Protection & Full Fluidity) --- */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  min-width: 0;
  width: 100%;
}

.field label {
  font-weight: 650;
  font-size: 13px;
  color: #17324d;
  line-height: 1.3;
}

.field label.small {
  font-size: 11.5px;
  color: #334e68;
}

.field input, .field select, .field textarea {
  border: 1px solid #cbd8e1;
  border-radius: 8px;
  padding: 9px 12px;
  background: #fff;
  font-size: 13px;
  color: #162534;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(28, 103, 163, 0.14);
}

/* --- Responsive Form Grids --- */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 960px) {
  .form-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .form-grid-2, .form-grid-3, .form-grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- Buttons --- */
.primary, .secondary, .danger {
  border: 0;
  border-radius: 8px;
  padding: 10px 15px;
  font-weight: 700;
  font-size: 13px;
  transition: all .15s ease;
}

.primary {
  background: var(--blue);
  color: white;
}
.primary:hover {
  background: #165385;
}

.secondary {
  background: #e9f1f6;
  color: #17476b;
}
.secondary:hover {
  background: #d8e6f0;
}

.danger {
  background: #fbe9e9;
  color: var(--red);
}
.danger:hover {
  background: #f8d3d3;
}

.full {
  width: 100%;
}

.hint {
  margin-top: 20px;
  padding: 12px;
  background: var(--sky);
  border-radius: 8px;
  color: #28536e;
  font-size: 12px;
}

/* --- App Shell & Sidebar --- */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: var(--navy);
  color: #fff;
  padding: 20px 13px;
}

.identity {
  padding: 9px 12px 22px;
  border-bottom: 1px solid #ffffff2e;
}

.identity strong {
  display: block;
  font-size: 16px;
}

.identity span {
  font-size: 12px;
  color: #a9c6d9;
}

.role-tag {
  display: inline-block;
  margin-top: 9px;
  background: #ffffff1a;
  color: #d8ecfa;
  border-radius: 99px;
  padding: 3px 8px;
  font-size: 11px;
}

.menu {
  padding-top: 18px;
}

.menu button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #c2d6e3;
  text-align: left;
  padding: 11px 12px;
  border-radius: 7px;
  margin: 2px 0;
}

.menu button:hover, .menu button.active {
  background: #ffffff18;
  color: #fff;
}

.menu .logout {
  margin-top: 24px;
  color: #b9d5e8;
}

/* --- Content & Topbar --- */
.content {
  min-width: 0;
}

.topbar {
  height: 74px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h2 {
  font-size: 19px;
  margin: 0;
}

.crumb {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}

.avatar {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: #dcecf7;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.page {
  padding: 27px 30px;
  max-width: 1400px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-head h3 {
  font-size: 23px;
  margin: 0 0 3px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.metric, .panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric {
  padding: 18px;
}

.metric label {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin: 8px 0 2px;
}

.metric span {
  font-size: 12px;
  color: var(--green);
}

.two-col {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 19px;
}

.panel h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.panel-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 15px;
}

.table-wrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 600px;
}

th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 12px 8px;
  border-bottom: 1px solid #edf2f5;
}

tr:last-child td {
  border: 0;
}

.status {
  font-size: 11px;
  font-weight: 750;
  border-radius: 99px;
  padding: 4px 8px;
  display: inline-block;
}

.approved {
  background: #e4f6ee;
  color: var(--green);
}

.pending {
  background: #fff2dd;
  color: var(--amber);
}

.blocked {
  background: #fbe9e9;
  color: var(--red);
}

/* --- Folders & Cards --- */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 15px;
}

.folder {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 17px;
  position: relative;
}

.folder-icon {
  font-size: 28px;
}

.folder h4 {
  margin: 11px 0 4px;
}

.folder p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.folder button {
  margin-top: 15px;
}

.folder-card {
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  user-select: none;
}

.folder-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 43, 70, .12);
  border-color: #74b4e3;
}

.folder-card:active {
  transform: scale(.99);
}

.toolbar {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.toolbar .search {
  flex: 1;
  min-width: 190px;
}

/* --- Modal Architecture (Proper Full-Screen Scroll & Clean Layout) --- */
.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(10, 24, 38, 0.72);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 36px;
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  backdrop-filter: blur(2px);
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: min(560px, 100%);
  padding: 26px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  position: relative;
  box-sizing: border-box;
  margin: auto 0;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.modal.modal-wide, .modal-wide {
  width: min(1120px, 96vw) !important;
  max-width: 1120px;
  padding: 28px 34px;
}

.modal h3 {
  margin: 0 0 4px;
  margin-right: 36px;
  font-size: 19px;
  color: var(--navy);
}

.modal p {
  margin: 0 0 17px;
  color: var(--muted);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all .15s ease;
  z-index: 10;
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
  transform: scale(1.05);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.modal.modal-wide .modal-actions {
  position: sticky;
  bottom: -28px;
  background: #ffffff;
  box-shadow: 0 -8px 16px rgba(0, 0, 0, 0.05);
  padding: 14px 0 6px;
  margin-top: 24px;
  border-top: 1px solid #dbe5eb;
  z-index: 9;
}

/* --- Section Legends & Detail Tables --- */
.report-section-legend {
  font-weight: 700;
  color: #0c2f50;
  margin: 22px 0 12px;
  padding: 9px 14px;
  background: #ecf3f9;
  border-left: 4px solid #1c67a3;
  border-radius: 4px;
  font-size: 13.5px;
  letter-spacing: 0.01em;
}

.sub-material-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 13px;
}

.sub-material-table th {
  background: #edf4fa;
  color: #102b46;
  font-weight: 700;
  padding: 9px 12px;
  border: 1px solid #bad4e8;
  text-align: left;
}

.sub-material-table td {
  border: 1px solid #cce0ef;
  padding: 6px 8px;
  vertical-align: middle;
}

.sub-material-table input {
  border: 1px solid #cbd8e1;
  padding: 7px 10px;
  font-size: 12.5px;
  border-radius: 6px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.sub-material-table input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(28, 103, 163, 0.15);
}

/* --- Report View Sheet (Printed & On-Screen View) --- */
.report-sheet {
  background: #fff;
  border: 1px solid #9cb5c7;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(16, 43, 70, .05);
}

.report-title-banner {
  background: #d8eaf8;
  color: #0c2b47;
  text-align: center;
  padding: 14px 10px 10px;
  border-bottom: 2px solid #a3c4dc;
}

.report-title-banner h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.report-title-banner h4 {
  margin: 5px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: #17476b;
  text-decoration: underline;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.report-table th, .report-table td {
  border: 1px solid #9cb5c7;
  padding: 7px 10px;
  vertical-align: middle;
}

.report-table th {
  background: #eef5fb;
  color: #102b46;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
}

.report-table td.center {
  text-align: center;
}

.report-table td.bold {
  font-weight: 600;
}

.report-subtable {
  width: calc(100% + 20px);
  margin: -7px -10px;
  border-collapse: collapse;
}

.report-subtable th, .report-subtable td {
  border: 1px solid #9cb5c7;
  padding: 5px 8px;
  font-size: 12px;
  text-align: center;
}

.report-subtable th {
  background: #f4f8fb;
  font-weight: 600;
}

@media print {
  body * {
    visibility: hidden;
  }
  .report-sheet, .report-sheet * {
    visibility: visible;
  }
  .report-sheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
    border: 1px solid #000;
  }
}

/* --- Role Management & Permissions Pills --- */
.perm-pill {
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
  background: #f3f4f6;
  color: #808d99;
  border-color: #d5dce2;
}

.perm-pill.on {
  background: #e6f7ef;
  color: #0e7256;
  border-color: #a8e2cb;
}

.perm-pill.on:hover {
  background: #d2f1e2;
}

.perm-pill.off:hover {
  background: #e5e9ec;
  color: #556472;
}

.perm-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: #f7fafd;
  border: 1px solid #dce8f1;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
}

.perm-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

/* --- Other UI Components --- */
.notice {
  padding: 11px 13px;
  background: #edf8f4;
  border-left: 3px solid var(--green);
  color: #175843;
  border-radius: 4px;
  margin-bottom: 17px;
}

.access-list {
  display: grid;
  gap: 9px;
}

.access-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.letter-type {
  font-weight: 650;
}

.empty {
  color: var(--muted);
  padding: 18px 0;
  text-align: center;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-ico {
  width: 31px;
  height: 31px;
  border-radius: 7px;
  background: #e7f1fa;
  color: #276293;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.file-meta {
  font-size: 12px;
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.tabrow {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tabrow button {
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tabrow button.active {
  color: var(--blue);
  border-color: var(--blue);
  font-weight: 700;
}

/* --- Global Media Queries --- */
@media (max-width: 850px) {
  .login-card {
    grid-template-columns: 1fr;
  }
  .brand-pane {
    padding: 34px;
  }
  .login-form {
    padding: 32px;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: flex;
    overflow: auto;
    align-items: center;
    padding: 10px;
  }
  .identity {
    min-width: 185px;
    border: 0;
    padding: 4px 12px;
  }
  .menu {
    padding: 0;
    display: flex;
    gap: 3px;
  }
  .menu button {
    white-space: nowrap;
  }
  .menu .logout {
    margin: 0;
  }
  .topbar, .page {
    padding-left: 18px;
    padding-right: 18px;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    height: auto;
    min-height: 68px;
  }
  .user-chip {
    display: none;
  }
  .page-head {
    display: block;
  }
  .page-head button {
    margin-top: 14px;
  }
}

/* --- Metric Card Interactive Links --- */
.metric.metric-clickable {
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
  user-select: none;
}
.metric.metric-clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(28, 103, 163, 0.12);
  border-color: #7bb5e2;
}
.metric.metric-clickable:hover strong {
  color: var(--blue);
}
.metric-num-link {
  color: var(--navy);
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}
.metric-num-link:hover {
  color: var(--blue);
  text-decoration: underline;
}
.metric span b {
  transition: transform 0.15s ease;
  display: inline-block;
}
.metric.metric-clickable:hover span b {
  transform: translateX(3px);
}

/* --- Office Management Badges --- */
.badge-division {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  display: inline-block;
}
.badge-subdiv {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  display: inline-block;
}
.badge-branch {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  display: inline-block;
}
.badge-section {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  display: inline-block;
}

/* --- Multi-Office Badges & Selection --- */
.badge-all-offices {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-primary-office {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.badge-assigned-office {
  background: #f8fafc;
  color: #334155;
  border: 1px dashed #cbd5e1;
  font-weight: 600;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.office-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 11px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.office-select-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.office-select-item.selected {
  background: #f0f9ff;
  border-color: #38bdf8;
}

/* --- Toast Notifications & Upload Feedback --- */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 440px;
  padding: 13px 20px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.18), 0 4px 6px -2px rgba(0, 0, 0, 0.08);
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.25s ease;
}
.toast-success {
  background: #065f46;
  color: #ffffff;
  border: 1px solid #059669;
}
.toast-icon {
  font-size: 18px;
  line-height: 1;
  color: #34d399;
}
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.toast.toast-fadeout {
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
}
.upload-success-banner {
  animation: bannerFadeIn 0.25s ease forwards;
}
@keyframes bannerFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast-danger, .toast-error {
  background: #991b1b;
  color: #ffffff;
  border: 1px solid #dc2626;
}
.toast-danger .toast-icon, .toast-error .toast-icon {
  color: #fca5a5;
}
.upload-error-banner {
  animation: bannerFadeIn 0.25s ease forwards;
}

/* --- Upload Button Animations, Spinner & Feedback --- */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes btnSpin {
  to {
    transform: rotate(360deg);
  }
}

.upload-btn-loading {
  background: #1c67a3 !important;
  color: #ffffff !important;
  cursor: wait !important;
  opacity: 0.92;
  position: relative;
  transition: all 0.2s ease;
}

.upload-btn-success {
  background: #059669 !important;
  border-color: #047857 !important;
  color: #ffffff !important;
  cursor: default !important;
  animation: btnSuccessPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

@keyframes btnSuccessPop {
  0% {
    transform: scale(0.95);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.input-shake {
  animation: shakeHoriz 0.4s ease-in-out !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

@keyframes shakeHoriz {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.upload-success-animated {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1.5px solid #6ee7b7;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.12);
  animation: successCardPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes successCardPop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.success-icon-circle {
  width: 44px;
  height: 44px;
  margin: 0 auto 8px;
  background: #059669;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
  animation: iconBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.35) 0.1s both;
}

@keyframes iconBounce {
  0% {
    transform: scale(0);
  }
  60% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.success-title-text {
  font-size: 16px;
  font-weight: 800;
  color: #065f46;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.success-subtitle-text {
  font-size: 13px;
  color: #047857;
  font-weight: 600;
}



/* =========================================================
   RCD ROAD DIVISION HILSA - BILL & PAYMENT WORKFLOW STYLES
   ========================================================= */

/* Top Role Switcher Bar */
.rcd-role-bar {
  background: #0d1f33;
  color: #fff;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  border-bottom: 2px solid #1c67a3;
  z-index: 100;
}
.rcd-role-bar .role-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.rcd-role-bar button {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.rcd-role-bar button:hover {
  background: #1c67a3;
  border-color: #4da3e8;
}
.rcd-role-bar button.active {
  background: #10b981;
  border-color: #34d399;
  color: #0d1f33;
  font-weight: 800;
}

/* Visual Bill Timeline */
.bill-timeline-card {
  background: #ffffff;
  border: 1px solid #dbe5eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.timeline-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin: 25px 0 10px;
  overflow-x: auto;
  padding-bottom: 10px;
}
.timeline-stepper::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  height: 4px;
  background: #e2e8f0;
  z-index: 1;
}
.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  min-width: 95px;
  text-align: center;
}
.step-bubble {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.timeline-step.completed .step-bubble {
  background: #10b981;
  border-color: #059669;
  color: #ffffff;
}
.timeline-step.current .step-bubble {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.2);
  animation: pulseBubble 2s infinite;
}
.timeline-step.rejected .step-bubble {
  background: #ef4444;
  border-color: #b91c1c;
  color: #ffffff;
}
.step-title {
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}
.step-subtitle {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
}
@keyframes pulseBubble {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Official Digital Seal / Stamp */
.rcd-digital-seal {
  display: inline-block;
  border: 2.5px dashed #059669;
  border-radius: 12px;
  padding: 12px 18px;
  background: radial-gradient(circle, #f0fdf4 0%, #ecfdf5 100%);
  color: #065f46;
  text-align: center;
  position: relative;
  box-shadow: inset 0 0 10px rgba(5, 150, 105, 0.08), 0 4px 12px rgba(5, 150, 105, 0.12);
  margin: 10px 0;
}
.rcd-digital-seal::before {
  content: 'GOVT OF BIHAR • RCD ROAD DIVISION HILSA';
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #047857;
  border-bottom: 1px dashed #34d399;
  padding-bottom: 4px;
  margin-bottom: 6px;
}
.seal-signature-name {
  font-size: 16px;
  font-weight: 800;
  color: #064e3b;
  letter-spacing: 0.02em;
}
.seal-meta {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  margin-top: 3px;
}
.seal-hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
  color: #047857;
  opacity: 0.85;
  margin-top: 4px;
  background: rgba(5, 150, 105, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* 31 Departmental Fields Project Drawer */
.project-master-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.pm-field-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
}
.pm-field-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}
.pm-field-value {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}

/* Deductions Breakdown Table */
.deductions-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
}
.deduction-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px dashed #fef3c7;
}
.deduction-row.total-row {
  border-top: 2px solid #d97706;
  border-bottom: none;
  font-weight: 800;
  font-size: 14px;
  color: #92400e;
  padding-top: 8px;
  margin-top: 6px;
}

/* Notification & History Badges */
.badge-unread {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
}
.workflow-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.tag-je { background: #e0f2fe; color: #0369a1; }
.tag-contractor { background: #fef3c7; color: #b45309; }
.tag-ae { background: #e0e7ff; color: #3730a3; }
.tag-ee { background: #fce7f3; color: #9d174d; }
.tag-ac { background: #ede9fe; color: #5b21b6; }
.tag-dao { background: #fef9c3; color: #854d0e; }
.tag-paid { background: #d1fae5; color: #065f46; }

/* Granular Power Pills */
.perm-pill {
  border: none;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.perm-pill.on {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.perm-pill.off {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* Two-Part Bill Preparation & Excel Upload Styles */
.bill-section-card {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.bill-section-card.section-agreement {
  border-color: #93c5fd;
  background: #f8fafc;
}
.bill-section-card.section-workdone {
  border-color: #86efac;
  background: #f0fdf4;
}
.locked-cell {
  background: #f1f5f9 !important;
  color: #475569 !important;
  cursor: not-allowed !important;
}

/* Form 26 Official Printable Bill Invoice */
@media print {
  body * {
    visibility: hidden !important;
  }
  #printable-bill-invoice, #printable-bill-invoice * {
    visibility: visible !important;
  }
  #printable-bill-invoice {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 10mm 15mm !important;
    background: #fff !important;
    box-shadow: none !important;
    border: none !important;
    font-size: 11px !important;
  }
  .no-print {
    display: none !important;
  }
}

