:root {
  --blue-dark: #284b69;
  --blue-mid: #2daae1;
  --blue-bg: #c7e9fb;
  --green: #5a8f1d;
  --panel: #eef2f7ee;
}

.crud-filter-row {
  background: white;
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #cbdced;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.crud-filter-row label {
  font-weight: 700;
  color: #1e3a5a;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.crud-filter-row select {
  padding: 8px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #334155;
  background: #f8fafc;
  min-width: 200px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.crud-filter-row select:focus {
  outline: none;
  border-color: var(--blue-mid);
}
.filter-hint {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
}

/* Vertical Abstract Button */
.abstract-flyout-btn {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: right bottom;
  background: var(--blue-dark);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  z-index: 1000;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: -2px -2px 10px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.abstract-flyout-btn:hover {
  background: var(--blue-mid);
  padding-bottom: 28px;
}
.abstract-flyout-btn i {
  transform: rotate(90deg);
}

/* Abstract Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 12px;
}
.modal-content {
  background: #fff;
  width: min(1000px, 95%);
  max-height: 90vh;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.modal-header {
  padding: 16px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.25rem; color: #1e293b; }
.close-modal {
  font-size: 1.5rem;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}
.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-tab-btn {
  padding: 8px 16px;
  border: none;
  background: none;
  color: #64748b;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s;
  flex: 0 0 auto;
  white-space: nowrap;
}
.modal-tab-btn.active {
  background: var(--blue-bg);
  color: var(--blue-dark);
  box-shadow: inset 0 -2px 0 var(--blue-dark);
}

.abstract-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  background: #f1f5f9;
  padding: 10px 15px;
  border-radius: 8px;
}
.total-row-highlight {
  background: #f8fafc !important;
  font-weight: 800;
  color: #0f172a;
  border-top: 2px solid #cbd5e1;
}

* { box-sizing: border-box; font-family: "Segoe UI", Tahoma, sans-serif; }
html, body { font-size: 16px; }
body { margin: 0; background: #f1f5f9; color: #1f2937; line-height: 1.35; }

.login-page {
  min-height: 100vh;
  background-color: #e2e8f0;
  background-image: linear-gradient(rgba(241, 245, 249, 0.12), rgba(241, 245, 249, 0.12)), var(--login-bg-image);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.overlay-box {
  width: min(1120px, 95%);
  background: #e9edf4e8;
  border-radius: 16px;
  padding: 20px 20px 14px;
}
.title-ribbon {
  margin: -30px auto 12px;
  max-width: 700px;
  text-align: center;
  background: #2ea7dd;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
}
.panel-content { display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; align-items: center; }
.left-logos { display: flex; justify-content: center; gap: 24px; }
.left-logos img { width: 112px; height: 112px; object-fit: contain; }
.login-card {
  background: #f3f5f8;
  border-radius: 8px;
  padding: 16px;
  max-width: 460px;
}
.login-card h1 { margin: 0; font-size: 2.1rem; color: #173951; }
.login-card p { margin: 4px 0 12px; font-size: 1.05rem; color: #557728; }
.login-card label { display: block; margin: 9px 0 4px; font-size: 1rem; font-weight: 600; }
.login-card select,
.login-card input {
  width: 100%;
  border: 1px solid #d2d6dc;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 0.96rem;
}
button, .btn-primary {
  border: 0;
  background: var(--green);
  color: #fff;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.login-card button { margin-top: 12px; width: 40%; min-width: 120px; display: block; margin-left: auto; margin-right: auto; }
.designed-by { margin-top: 8px; text-align: right; font-size: 0.82rem; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.designed-by img { height: 38px; width: auto; }
.flash { margin-top: 8px; padding: 8px; border-radius: 6px; }
.flash.success { background: #dcfce7; color: #166534; }
.flash.danger { background: #fee2e2; color: #991b1b; }

.app-shell { min-height: 100vh; width: 100%; background: #d3edf8; display: flex; flex-direction: column; overflow-x: hidden; }
.app-header { background: var(--blue-dark); color: #fff; padding: 8px 20px 10px; }
.header-top { opacity: 0.85; font-size: 0.8rem; margin-bottom: 6px; }
.header-main { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.brand-wrap { display: flex; gap: 10px; align-items: center; }
.logo-box { background: #e8f3ff; border-radius: 10px; padding: 6px; display: flex; gap: 8px; }
.logo-box img { width: 56px; height: 56px; object-fit: contain; }
.brand-text h2 { margin: 0; font-size: 1.1rem; border-bottom: 2px solid #43b3f3; padding-bottom: 4px; }
.brand-text p { margin: 4px 0 0; font-size: 0.86rem; }
.header-actions { display: flex; gap: 10px; }
.header-actions a {
  text-decoration: none;
  color: #fff;
  background: #78c84d;
  padding: 7px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}
.header-actions a:only-child { min-width: 110px; text-align: center; }

.dashboard-grid { flex: 1; display: grid; grid-template-columns: 220px 1fr 280px; gap: 12px; padding: 12px; }
.card, .panel, .master-card {
  background: var(--panel);
  border: 2px solid #b8e6fb;
  border-radius: 10px;
  padding: 12px;
}
.left-panel, .center-panel, .right-panel { min-width: 0; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card select, .form-grid select, .form-grid input, .form-grid textarea {
  width: 100%; padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.full { width: 100%; margin: 8px 0; }
.map-title { background: #2f37b5; color: #fff; padding: 6px 10px; border-radius: 6px 6px 0 0; display: flex; justify-content: space-between; }
#city-map { width: 100%; height: 300px; border-radius: 0 0 8px 8px; overflow: hidden; }
.live-dot { background: #dc2626; color: #fff; border-radius: 10px; font-size: 0.72rem; padding: 2px 8px; font-weight: 700; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.tab { background: #31ba67; border-radius: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab.active { background: #2637b9; }
.panel.white.large { min-height: 240px; margin: 8px 0; padding: 8px; }
.panel.chart { min-height: 190px; }
.panel.donut { min-height: 300px; }
.abstract-wrap { display: grid; gap: 6px; }
.work-title { font-size: 0.78rem; font-style: italic; color: #0f172a; }
.contract-band { display: grid; grid-template-columns: 1fr 240px; }
.contract-label {
  background: #fff200;
  color: #111827;
  border: 1px solid #111827;
  border-right: 0;
  text-align: center;
  padding: 3px 6px;
  font-weight: 700;
  font-size: 0.82rem;
}
.contract-value {
  background: #bf1010;
  color: #fff;
  border: 1px solid #111827;
  text-align: center;
  padding: 3px 6px;
  font-weight: 700;
  font-size: 0.82rem;
}
.abstract-table-wrap { overflow-x: auto; overflow-y: hidden; background: #fff; }
.abstract-table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 0.74rem; table-layout: fixed; }
.abstract-table th, .abstract-table td { border: 1px solid #1f2937; padding: 2px 4px; height: 22px; }
.abstract-table th { font-weight: 700; text-align: center; }
.abstract-table td { background: #ededed; }
.abstract-table .sl-col { text-align: center; white-space: nowrap; }
.abstract-table th:nth-child(3), .abstract-table th:nth-child(5),
.abstract-table th:nth-child(4), .abstract-table th:nth-child(6) {
  white-space: normal;
  line-height: 1.15;
  font-size: 0.7rem;
}
.abstract-table td:nth-child(3), .abstract-table td:nth-child(5) { text-align: center; white-space: nowrap; }
.abstract-table td:nth-child(4), .abstract-table td:nth-child(6) { text-align: right; white-space: nowrap; padding-right: 8px; }
.abstract-table .blue-head { background: #2f579a; color: #fff; }
.abstract-table .green-head { background: #5f8f34; color: #fff; }
.abstract-table .orange-head { background: #c85a06; color: #fff; }
.abstract-table .sub-green { background: #b7d48f; }
.abstract-table .sub-orange { background: #e9b686; }
.abstract-table tfoot td { height: 24px; }
.abstract-table .total-label {
  background: #d00000;
  color: #fff;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 800;
  padding-right: 8px;
}
.abstract-table .total-scope,
.abstract-table .total-progress { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.abstract-table .total-scope { background: #06b351; }
.abstract-table .total-progress { background: #bf9800; }
.admin-master-page { flex: 1; padding: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.master-card h3 { margin-top: 0; }
.form-grid { display: grid; gap: 8px; }
.form-grid textarea { min-height: 90px; resize: vertical; }
.admin-page-shell {
  flex: 1;
  width: 100%;
  padding: 16px;
  display: grid;
  gap: 14px;
  background: linear-gradient(180deg, #bfe7fb 0%, #d9f0fb 100%);
  overflow-x: hidden;
}
.admin-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.admin-tab {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid #ffffff59;
  border-radius: 12px;
  background: linear-gradient(180deg, #3f4ad6, #2b34ac);
  color: #fff;
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  min-height: 50px;
  height: 50px;
  line-height: 50px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  box-shadow: 0 8px 18px #1e3a8a26;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.admin-tab:hover { transform: translateY(-1px); box-shadow: 0 10px 18px #1e3a8a30; }
.admin-tab .tab-icon { margin-right: 6px; font-size: 0.95em; vertical-align: middle; }
.admin-tab.active {
  background: linear-gradient(180deg, #ffbe33, #f59e0b);
  color: #111827;
  border-color: #f6d089;
}
.tab-category { background: linear-gradient(180deg, #ffa726, #fb8c00); }
.tab-user { background: linear-gradient(180deg, #4f46e5, #3730a3); }
.tab-city { background: linear-gradient(180deg, #0ea5e9, #0369a1); }
.tab-report { background: linear-gradient(180deg, #14b8a6, #0f766e); }
.logout-tab { background: linear-gradient(180deg, #d9483b, #bb2f22); }
.tab-panel { display: none; }
.active-panel { display: grid; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.flash-wrap { margin-bottom: 0; border-radius: 12px; }
.table-wrap { overflow: auto; }
.simple-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.simple-table th, .simple-table td { border: 1px solid #d6deea; padding: 8px; text-align: left; }
.simple-table th { background: #edf4ff; color: #243b5a; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.admin-master-page > .master-card {
  background: linear-gradient(180deg, #f8fbff, #f3f9ff);
  border: 1px solid #c2d8ec;
  box-shadow: 0 8px 20px #0f172a1a;
  border-radius: 14px;
}
.compact-table th, .compact-table td { font-size: 0.78rem; padding: 6px; vertical-align: top; }
.compact-table input, .compact-table select {
  width: 100%;
  border: 1px solid #c3cfdd;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.75rem;
  background: #ffffff;
}
.actions { min-width: 130px; display: flex; gap: 6px; align-items: center; }
.mini-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.7rem;
  line-height: 1.1;
  font-weight: 700;
  border: 0;
}
.danger-btn { background: #c0392b; color: #fff; border: 0; }
.mini-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.section-head h3 { margin: 0; font-size: 1.05rem; color: #20344d; }
.section-head-actions { display: flex; gap: 6px; align-items: center; }
.lock-btn { background: #d97706; color: #fff; border: 0; }
.unlock-btn { background: #2563eb; color: #fff; border: 0; }
.hidden-section { display: none !important; }
.collapse-btn { background: #4b5563; color: #fff; border: 0; }
.form-grid label { font-weight: 600; color: #334155; }
.form-grid input, .form-grid select, .form-grid textarea {
  background: #fff;
  border: 1px solid #ccdae9;
  border-radius: 10px;
  padding: 9px 10px;
}
.admin-intro-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.admin-intro-card {
  background: linear-gradient(180deg, #ffffff, #f3f7ff);
  border: 1px solid #c8d8ea;
  border-radius: 10px;
  padding: 12px;
}
.admin-intro-card h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #1f3b58;
}
.admin-intro-card p {
  margin: 0;
  color: #475569;
  font-size: 0.8rem;
}
.accordion-block { padding: 0; overflow: hidden; border-radius: 14px; }
.accordion-head {
  width: 100%;
  background: linear-gradient(180deg, #f8fcff, #eef6ff);
  color: #20344d;
  border: 0;
  border-bottom: 1px solid #d1e1f1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 700;
}
.accordion-head.active {
  background: linear-gradient(180deg, #2f5f8f, #244c72);
  color: #fff;
}
.accordion-icon { transition: transform 0.2s ease; }
.accordion-head.active .accordion-icon { transform: rotate(180deg); }
.accordion-panel { display: none; padding: 12px; }
.accordion-panel.open { display: grid; }
.crud-group-card { padding: 12px; display: grid; gap: 12px; }
.crud-main-toggle {
  border: 1px solid #cbdced;
  background: linear-gradient(180deg, #eff6ff, #e7f1ff);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #1f3a5a;
}
.crud-main-title-wrap { display: grid; text-align: left; }
.crud-main-title { font-size: 1.08rem; font-weight: 800; }
.crud-main-subtitle { font-size: 0.8rem; color: #47617d; }
.crud-main-icon { transition: transform 0.2s ease; }
.crud-main-toggle.active .crud-main-icon { transform: rotate(180deg); }
.crud-main-wrap { display: grid; gap: 12px; }
.crud-main-wrap.hidden-section { display: none !important; }
.crud-sub-block {
  border: 1px solid #d3deec;
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px;
}
.crud-section-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.crud-toggle {
  border: 1px solid #d0deee;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f0f6ff);
  color: #1f334c;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  font-size: 0.98rem;
  font-weight: 700;
}
.crud-toggle.active {
  background: linear-gradient(180deg, #2e5a84, #274b70);
  color: #fff;
}
.crud-toggle-icon { transition: transform 0.2s ease; }
.crud-toggle.active .crud-toggle-icon { transform: rotate(180deg); }
.crud-lock-form { margin: 0; }

.app-footer {
  background: var(--blue-dark);
  color: #fff;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  font-size: 0.8rem;
}

@media (max-width: 1200px) {
  .title-ribbon { font-size: 1rem; max-width: 90%; }
  .login-card h1 { font-size: 1.75rem; }
  .login-card p { font-size: 1rem; }
  .login-card label, .login-card select, .login-card input, button { font-size: 0.95rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .admin-master-page { grid-template-columns: 1fr; padding: 0; }
  .span-2 { grid-column: auto; }
  .panel-content { grid-template-columns: 1fr; }
  .header-main { flex-direction: column; align-items: stretch; gap: 10px; }
  .header-actions { justify-content: flex-start; flex-wrap: wrap; }
  .admin-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
  .overlay-box { padding: 16px 14px 12px; border-radius: 12px; }
  .panel-content { gap: 12px; }
  .left-logos img { width: 92px; height: 92px; }
  .login-card { max-width: 100%; }
  .map-card img { height: 220px; }
  #city-map { height: 220px; }
  .panel.white.large { min-height: 170px; }
  .panel.chart { min-height: 150px; }
  .panel.donut { min-height: 180px; }
  .contract-band { grid-template-columns: 1fr 200px; }
}

@media (max-width: 768px) {
  body { overflow-x: hidden; }
  .app-shell { width: 100%; overflow-x: hidden; }
  .login-page { padding: 10px; align-items: flex-start; }
  .title-ribbon {
    margin: -22px auto 10px;
    font-size: 0.85rem;
    line-height: 1.3;
    padding: 8px 10px;
  }
  .panel-content { gap: 10px; }
  .left-logos { gap: 12px; }
  .left-logos img { width: 74px; height: 74px; }
  .login-card { padding: 12px; }
  .login-card h1 { font-size: 1.55rem; }
  .login-card p { font-size: 0.95rem; }
  .login-card button { width: 100%; }
  .designed-by { justify-content: center; text-align: center; flex-wrap: wrap; font-size: 0.74rem; }
  .designed-by img { height: 30px; }

  .app-header { padding: 8px 10px; }
  .header-main { width: 100%; }
  .brand-wrap { width: 100%; }
  .header-top { font-size: 0.72rem; }
  .brand-wrap { align-items: flex-start; }
  .logo-box img { width: 46px; height: 46px; }
  .brand-text { min-width: 0; }
  .brand-text h2 { font-size: 0.95rem; line-height: 1.25; word-break: break-word; }
  .brand-text p { font-size: 0.74rem; }
  .header-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .header-actions a { text-align: center; padding: 7px 6px; font-size: 0.8rem; }

  .dashboard-grid { padding: 8px; gap: 8px; }
  .tabs { grid-template-columns: 1fr; }
  .tab { font-size: 0.88rem; padding: 8px; }
  .map-title { font-size: 0.84rem; }
  #city-map { height: 180px; }
  .work-title { font-size: 0.74rem; }
  .contract-band { grid-template-columns: 1fr; }
  .contract-label { border-right: 1px solid #111827; border-bottom: 0; }
  .abstract-table { font-size: 0.7rem; min-width: 720px; }
  .abstract-table .total-label { font-size: 0.76rem; }
  .card h3, .master-card h3 { font-size: 1rem; }
  .admin-master-page { padding: 10px; gap: 10px; }
  .admin-page-shell { padding: 8px; }
  .admin-tabs { grid-template-columns: 1fr; gap: 8px; }
  .admin-tab {
    width: 100%;
    min-height: 46px;
    height: auto;
    line-height: 1.2;
    padding: 12px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
  }
  .admin-master-page > .master-card { width: 100%; min-width: 0; }
  .admin-intro-cards { grid-template-columns: 1fr; }
  .accordion-head { font-size: 0.88rem; padding: 10px 12px; }
  .accordion-panel { padding: 10px; }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .section-head-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .section-head-actions form {
    margin: 0;
  }
  .section-head-actions .mini-btn {
    min-width: 92px;
  }
  .crud-section-head { grid-template-columns: 1fr; }
  .crud-toggle { font-size: 0.88rem; }
  .crud-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }
  .crud-filter-row label {
    font-size: 0.9rem;
  }
  .crud-filter-row select {
    min-width: 0;
    width: 100%;
  }
  .filter-hint {
    font-size: 0.76rem;
    line-height: 1.35;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-overlay {
    align-items: flex-start;
    padding: 10px 8px;
  }
  .modal-content {
    width: 100%;
    max-height: calc(100dvh - 20px);
    border-radius: 12px;
  }
  .modal-header {
    padding: 12px 14px;
  }
  .modal-header h2 {
    font-size: 1.12rem;
    line-height: 1.3;
    margin-right: 8px;
  }
  .modal-body {
    padding: 12px;
  }
  .abstract-stats-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .abstract-stats-row > div:first-child {
    flex-wrap: wrap;
    gap: 10px;
  }
  .abstract-stats-row select {
    width: 100%;
    min-width: 0;
  }
  .modal-body .abstract-project-header {
    padding: 10px !important;
    margin-bottom: 12px !important;
  }
  .modal-body .abstract-project-header > div:first-child {
    font-size: 0.88rem !important;
    line-height: 1.35 !important;
    text-align: left !important;
  }
  .modal-body .abstract-project-header > div:nth-child(2) {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    font-size: 0.82rem !important;
  }
  .modal-body .abstract-project-header > div:nth-child(2) > div:last-child {
    text-align: left !important;
  }
  .modal-body .abstract-project-header > div:nth-child(3) {
    display: grid !important;
    gap: 8px !important;
    align-items: flex-start !important;
  }
  .modal-body .abstract-project-header > div:nth-child(3) > span:first-child {
    font-size: 0.82rem !important;
    line-height: 1.3 !important;
  }
  .modal-body .abstract-project-header > div:nth-child(3) > span:last-child {
    font-size: 1rem !important;
    word-break: break-word;
  }
  #abstract-display-table {
    min-width: 640px;
  }
  #abstract-table-foot tr:last-child > td > div {
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 10px !important;
  }
  #abstract-table-foot tr:last-child > td > div > div {
    width: 100%;
  }
  .mobile-stack thead {
    display: none;
  }
  .mobile-stack,
  .mobile-stack tbody,
  .mobile-stack tr,
  .mobile-stack td {
    display: block;
    width: 100%;
  }
  .mobile-stack tr {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    margin-bottom: 8px;
    padding: 6px;
  }
  .mobile-stack td {
    border: 0;
    border-bottom: 1px dashed #dbe3ee;
    padding: 6px 2px;
  }
  .mobile-stack td:last-child {
    border-bottom: 0;
  }
  .mobile-stack td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 4px;
  }
  .mobile-stack td input,
  .mobile-stack td select {
    width: 100%;
    min-width: 0;
  }
  .actions {
    min-width: 0;
    flex-wrap: wrap;
    gap: 8px;
  }
  .mini-btn {
    padding: 5px 7px;
    font-size: 0.7rem;
  }
  .form-grid { gap: 6px; }
  .form-grid label { font-size: 0.86rem; }
  .form-grid input, .form-grid textarea, .form-grid select { font-size: 0.9rem; }
  .form-grid select { 
      max-width: 100% !important; 
      width: 100% !important; 
      text-overflow: ellipsis; 
      overflow: hidden;
  }
  .form-row { grid-template-columns: 1fr; }

  .app-footer {
    padding: 10px;
    font-size: 0.72rem;
    line-height: 1.35;
    flex-direction: column;
    text-align: center;
  }

  .abstract-flyout-btn {
    right: 10px;
    top: auto;
    bottom: 14px;
    transform: none;
    transform-origin: center;
    border-radius: 10px;
    padding: 10px 12px;
    gap: 6px;
    z-index: 1200;
  }
  .abstract-flyout-btn i { transform: none; }
}

@media (max-width: 480px) {
  .overlay-box { width: 100%; border-radius: 10px; }
  .title-ribbon { max-width: 100%; }
  .brand-wrap { flex-direction: column; gap: 6px; }
  .logo-box { align-self: flex-start; }
  .header-actions { grid-template-columns: 1fr; }
  .header-actions a { width: 100%; }
  .panel, .card, .master-card { padding: 10px; }
  .admin-tabs { grid-template-columns: 1fr; }
  .abstract-flyout-btn { right: 8px; bottom: 12px; }
  .abstract-flyout-btn span {
    font-size: 0.92rem;
    letter-spacing: 0.4px;
  }
  .mobile-stack tr { padding: 5px; }
  .section-head h3 {
    font-size: 0.95rem;
  }
  .section-head-actions {
    gap: 5px;
  }
  .section-head-actions .mini-btn {
    min-width: 84px;
  }
  .modal-content {
    max-height: calc(100dvh - 16px);
  }
  .modal-header h2 {
    font-size: 1rem;
  }
  .modal-tab-btn {
    padding: 7px 11px;
    font-size: 0.82rem;
  }
  #abstract-display-table {
    min-width: 560px;
  }
}

/* New Form Modifications & Success Modal */
.form-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; }
.form-row input { width: 100%; }

.in-words-hint {
    font-size: 0.8rem;
    color: var(--blue-dark);
    font-style: italic;
    margin-top: -4px;
    margin-bottom: 8px;
    font-weight: 600;
}

/* Success Modal Styles */
.success-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2001;
}

.success-modal {
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.success-modal h3 { color: #1e293b; margin-bottom: 15px; font-size: 1.25rem; }
.success-modal p { color: #64748b; font-size: 0.95rem; margin-bottom: 20px; line-height: 1.5; }

.animated-tick-wrap {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.tick-circle {
    fill: none;
    stroke: #5a8f1d;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: stroke-circle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.tick-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke-check 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
    fill: none;
    stroke: #5a8f1d;
    stroke-width: 3;
}

@keyframes stroke-circle {
    100% { stroke-dashoffset: 0; }
}
@keyframes stroke-check {
    100% { stroke-dashoffset: 0; }
}

.success-modal .btn-primary { width: 100%; padding: 12px; }


.form-row textarea {
    padding: 8px 10px;
    line-height: 1.2;
    border: 1px solid #ccdae9;
    border-radius: 10px;
    resize: vertical;
}


/* Responsive Select Fix */
select {
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}
option {
    white-space: normal; /* Some browsers support this for long text wrap */
}


/* Radio Button Fix */
input[type="radio"] {
    width: 18px !important;
    height: 18px !important;
    margin: 0;
    cursor: pointer;
    accent-color: var(--blue-mid);
    padding: 0;
}


/* Hide standard flash card, use only Animated Modal */
.flash-messages {
    display: none !important;
}


/* Hide legacy flash wrap specifically */
.flash-wrap {
    display: none !important;
}


/* Logo Divider and WATCO Animation */
.logo-divider {
    width: 2px;
    height: 80px;
    background: linear-gradient(to bottom, transparent, #cbd5e1, transparent);
    margin: 0 10px;
}
.logo-watco {
    opacity: 0;
    transform: translateX(-40px);
    animation: watcoTransition 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.3s;
}
@keyframes watcoTransition {
    0% {
        opacity: 0;
        transform: translateX(-40px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

