/* Cooperative Audit Fee Workspace | Dhake & Associates | UI refresh */
:root {
  --clr-primary: #12243b;
  --clr-primary-lt: #265e88;
  --clr-primary-hover: #174b72;
  --clr-accent: #0e8b84;
  --clr-accent-lt: #a2ece4;
  --clr-bg: #f4f7fb;
  --clr-card: #fff;
  --clr-border: #d8e0e8;
  --clr-border-lt: #e8eef4;
  --clr-text: #17283d;
  --clr-text-muted: #5c6f83;
  --clr-success: #0f8068;
  --clr-highlight: #eef8fa;
  --sidebar-w: 268px;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(17, 42, 66, .06);
  --shadow-lg: 0 24px 58px rgba(17, 42, 66, .14);
}
html { font-size: 16px; scroll-padding-top: 88px; }
body { color: var(--clr-text); background: radial-gradient(circle at 90% 0%, #eaf5fa 0, transparent 42%), #f4f7fb; }
button, input, select, textarea { font-family: inherit; }
button, a, label, input[type="radio"], input[type="checkbox"] { touch-action: manipulation; }
button { transition: background-color .16s, border-color .16s, box-shadow .16s, transform .16s; }
button:disabled { opacity: .48; cursor: not-allowed; transform: none!important; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #12a6a0;
  outline-offset: 3px;
}
.sidebar {
  background: linear-gradient(160deg, #101f34 0%, #122c44 70%, #0d3444 100%);
  border-right: 1px solid rgba(255,255,255,.08);
  box-shadow: 7px 0 32px rgba(14,42,64,.06);
}
.sb-brand {
  background: none;
  gap: 13px;
  padding: 25px 18px 24px;
  min-height: 100px;
  align-items: center;
}
.brand-monogram {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  flex-shrink: 0; background: linear-gradient(140deg, #19b9ad, #207399);
  box-shadow: 0 8px 20px rgba(12,185,167,.23);
  color: white; font-weight: 850; letter-spacing: -.04em; font-size: 19px;
}
.sb-title { font-size: 1rem; letter-spacing: -.02em; }
.sb-sub { color: #abe3df; font-size: .7rem; text-transform: none; letter-spacing: .01em; line-height: 1.4; }
.sb-label { color: #98b4cb; letter-spacing: .08em; }
.quick-btn,.nav-btn {
  border-radius: 11px;
  min-height: 45px;
}
.quick-btn { background: rgba(240,250,255,.045); border-color: rgba(213,235,245,.07); }
.quick-btn:hover,.nav-btn:hover { transform: none; background: rgba(255,255,255,.12); }
.quick-btn.active,.nav-btn.active {
  background: rgba(58,179,182,.18);
  border-color: rgba(90,216,207,.48);
  box-shadow: inset 3px 0 0 #3fc9c0;
}
.qb-icon,.nb-icon { filter: saturate(.82); }
.main-panel { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  border-bottom: 1px solid rgba(193,210,224,.7);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  min-height: 76px;
  box-shadow: 0 3px 20px rgba(20,49,72,.025);
}
.topbar-office { color: #172c44; font-size: .98rem; font-weight: 760; }
.topbar-sub { color: #627b91; font-size: .76rem; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.topbar-actions button {
  border-radius: 10px;
  font-size: .77rem;
  font-weight: 650;
  padding: 10px 13px;
  min-height: 42px;
  white-space: nowrap;
}
.btn-staff { background: #fff; color: #1a496b; border: 1px solid #cbdde7; cursor: pointer; }
.btn-staff:hover { background: #eff8f9; border-color: #31a9a4; }
.btn-save { background: #0e827c; border: 1px solid #0e827c; color: #fff; cursor: pointer; }
.btn-save:hover:not(:disabled) { background: #0a6a66; }
.page-inner { max-width: 1280px; margin: auto; padding-top: 26px; }
.workspace-intro {
  background: linear-gradient(113deg, #102c47, #21587b 68%, #167b80);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 18px;
  color: #fff;
  padding: clamp(24px, 3vw, 40px);
  box-shadow: 0 18px 46px rgba(16, 45, 74, .17);
  margin-bottom: 26px;
  position: relative; overflow: hidden;
}
.workspace-intro:after {
  content: "";
  position: absolute; inset: auto -70px -115px auto; width: 320px; height: 320px;
  border: 1px solid rgba(255,255,255,.22); border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 50px rgba(255,255,255,.025),0 0 0 102px rgba(255,255,255,.02);
}
.workspace-kicker { font-weight: 750; text-transform: uppercase; letter-spacing: .12em; font-size: .69rem; color: #9de5df; }
.workspace-intro h1 { font-size: clamp(1.42rem,2.3vw,2.15rem); font-weight: 780; letter-spacing: -.032em; margin: 9px 0; line-height: 1.15; }
.workspace-intro p { color: #d6e9f3; max-width: 640px; line-height: 1.58; font-size: .88rem; }
.workspace-facts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.workspace-facts span {
  background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.18);
  border-radius: 99px; padding: 8px 13px; font-size: .75rem; font-weight: 600;
}
.card {
  border: 1px solid #e0e9f0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header { background: #fff; border-bottom: 1px solid #e9edf2; }
.card-header h3 { letter-spacing: -.013em; }
.card-num { background: #e8f7f6; color: #147e79; border-radius: 9px; font-weight: 800; }
.card-body { padding: clamp(18px, 2.6vw, 28px); }
.form-group label { color: #253d54; font-weight: 675; }
.form-group input:not([type=checkbox]):not([type=radio]),
.form-group select, .society-search-wrap input {
  min-height: 46px; border-radius: 10px; border: 1.5px solid #cfdae5;
  background: #fff; color: #15283d; font-size: .92rem; box-shadow: none;
}
.form-group input:not([type=checkbox]):not([type=radio]):hover,
.form-group select:hover, .society-search-wrap input:hover { border-color: #8baabb; }
.form-group input:not([type=checkbox]):not([type=radio]):focus,
.form-group select:focus, .society-search-wrap input:focus {
  border-color: #1a9b96; outline: 3px solid rgba(12,166,159,.13);
}
input[type=checkbox],input[type=radio] { accent-color: #0c8882; width: 18px; height: 18px; }
.form-group .helper-text { color: #60758a; }
.dropdown-list {
  max-height: 250px;
  overflow: auto;
  margin: 6px 0 0;
  border: 1px solid #d7e3eb;
  border-radius: 10px;
  background: white;
  scrollbar-width: thin;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}
.dropdown-list li { min-height: 44px; border-bottom: 1px solid #edf2f5; }
.dropdown-list li:hover { background: #f1f8fa; }
.dropdown-list li.selected { background: #e5f6f4; }
.selected-line { border-radius: 10px; }
.calculate-row { display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 10px; }
.calculate-row.hidden { display:none; }
.btn-calculate { background: linear-gradient(110deg,#156b83,#118d86); border-radius: 11px; min-height: 46px; box-shadow: 0 7px 20px rgba(17,123,143,.18); }
.btn-calculate:hover { filter: brightness(1.08); }
.btn-reset { min-height: 46px; border: 1px solid #cadbe5; border-radius: 10px; background: #fff; color: #284c62; padding: 10px 17px; cursor: pointer; font-weight: 650; }
.btn-reset:hover { background: #eaf5f6; }
.qc-hero { border-radius: 16px; box-shadow: var(--shadow); }
.qc-grid .card { border-radius: 14px; }
.location-option { min-height: 44px; border-radius: 10px; }
.result-actions button { min-height: 42px; border-radius: 9px; }
.calc-table { border-collapse: separate; border-spacing: 0; width: 100%; }
.calc-table th { background: #eef5f9; }
.final-fee-box { border-radius: 14px; }
.fee-row.grand-total { border-radius: 8px; }
.gr-schedule-table th { background: #ecf5f8; }
.gr-schedule-table td { vertical-align: middle; }
.btn-table-calc { min-height: 38px; border-radius: 8px; }
.site-footer { font-size: .78rem; color: #64778a; }
.site-footer a { color: #136f77; text-decoration: underline; }
.modal-overlay:not(.hidden) { z-index: 350; }
.staff-modal-box { max-width: 470px; width: min(95vw, 470px); border-radius: 16px; overflow: hidden; }
.staff-modal-box .modal-body { padding: 25px; }
.staff-modal-box form { display: flex; flex-direction: column; gap: 16px; }
.staff-modal-box input { width: 100%; }
.staff-modal-box .btn-calculate { width: 100%; }
#staffError { color: #b32032; font-size: .85rem; min-height: 1.3em; }
.history-intro h2 { font-size: clamp(1.3rem,2vw,1.9rem); letter-spacing: -.027em; }
.history-intro p { color: #5d7184; margin-top: 7px; }
.history-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 0; }
.history-toolbar .btn-reset { min-height: 39px; }
.history-table-wrap { overflow-x: auto; }
.history-table { width: 100%; min-width: 710px; border-collapse: collapse; font-size: .88rem; }
.history-table thead { background: #eef5f9; }
.history-table th,.history-table td { border-bottom: 1px solid #e4ecf1; text-align: left; padding: 13px 12px; }
.history-table th { color: #3d5971; font-size: .77rem; text-transform: uppercase; letter-spacing: .025em; }
.history-table tr:hover td { background: #f7fbfc; }
.history-table .row-actions { display: flex; gap: 6px; }
.history-table .row-actions button { border: 1px solid #d0e0e9; border-radius: 8px; background: white; color: #195879; cursor: pointer; padding: 7px 10px; font-weight: 650; }
.history-table .row-actions button:last-child { color: #a22e39; }
.history-empty { padding: 30px 12px; color: #667b8c; text-align: center; }
.toast {
  position: fixed; bottom: 23px; right: 22px; z-index: 600;
  max-width: min(430px,calc(100vw - 32px)); background: #162b42; color: white;
  border-radius: 11px; padding: 14px 19px; box-shadow: 0 17px 34px #0c1c2a2e;
  font-size: .85rem; line-height: 1.55;
}
.toast.hidden { display: none; }
.toast.error { background: #8f2938; }
body.modal-open { overflow: hidden; }
@media (max-width: 1200px) {
  .topbar-actions button { padding-inline: 9px; }
  .topbar-office { font-size: .87rem; }
}
@media (max-width: 992px) {
  .sidebar { box-shadow: 18px 0 42px rgba(11,29,46,.27); }
  .topbar { min-height: 67px; }
  .topbar-text { min-width: 0; }
  .topbar-sub { display: none; }
  .topbar-actions { flex-shrink: 0; }
  .topbar-actions button { font-size: .73rem; }
  .page-inner { padding-top: 18px; }
}
@media (max-width: 640px) {
  html { font-size: 15px; }
  .page-inner { padding: 16px 12px 24px; }
  .topbar { padding: 9px 10px; gap: 7px; }
  .topbar-office { display: block; font-size: .79rem; max-width: 145px; line-height: 1.2; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .topbar-print,.topbar-actions .btn-topbar-preview { display: none; }
  .topbar-actions .btn-staff,.topbar-actions .btn-save { font-size: .68rem; padding: 8px; min-height: 40px; }
  .workspace-intro { padding: 23px 19px; border-radius: 14px; margin-bottom: 18px; }
  .workspace-facts { gap: 6px; }
  .workspace-facts span { font-size: .7rem; padding: 7px 9px; }
  .card { margin-bottom: 15px; }
  .card-body { padding: 16px; }
  .result-info-grid { grid-template-columns: 1fr; }
  .calculate-row { padding-inline: 0; }
  .btn-calculate { width: 100%; }
  .btn-reset { width: 100%; }
  .result-actions { flex-wrap: wrap; }
  .result-actions button { font-size: .75rem; padding: 9px; }
  .qc-grid { display: grid; grid-template-columns: 1fr; }
  .toast { left: 16px; bottom: 16px; right: 16px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { scroll-behavior: auto!important; transition-duration: .01ms!important; animation-duration: .01ms!important; }
}
@media print {
  .toast, .staff-modal-box, .workspace-intro, #page-records { display: none !important; }
}

/* Final contrast and touch-target QA adjustments */
.card-header { color: #18344d; }
.card-header h3 { color: #18344d; font-weight: 730; }
.result-header .result-actions > button,
.result-actions > button:not(.btn-save) {
  color: #1d4e68;
  background: #edf6f8;
  border: 1px solid #bed9e1;
  font-weight: 700;
}
.result-actions > button:not(.btn-save):hover { color: #0b6f7b; background: #dff2f1; }
.result-actions > .btn-save { background: #0e827c; color: #fff; border: 1px solid #0e827c; font-weight: 700; }
.result-actions > .btn-save:hover { background: #0b6965; }
.topbar-menu { min-width: 44px; min-height: 44px; border-radius: 10px; }
@media (max-width: 640px) {
  .topbar-text { display: none; }
  .topbar-actions { margin-left: auto; }
  #btnSaveCalculation:disabled { display: none; }
  .topbar-menu { flex-shrink: 0; }
  .result-header { align-items: flex-start; }
  .result-actions { width: 100%; margin: 8px 0 0; }
  .result-actions button { flex: 1 1 auto; min-height: 44px; }
}

@media screen {
  .calc-table th, .gr-schedule-table th { color: #264961; }
}
