:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1d2733;
  --muted: #677383;
  --line: #d8dee7;
  --primary: #075985;
  --primary-strong: #06486b;
  --accent: #0f766e;
  --danger: #b42318;
  --ok: #16763f;
  --warn: #9a6700;
  --shadow: 0 8px 24px rgba(24, 39, 75, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.app-shell.pre-auth {
  grid-template-columns: 1fr;
}

.app-shell.pre-auth .sidebar,
.app-shell.pre-auth .topbar,
.app-shell.pre-auth .view,
.app-shell.pre-auth #assistedAuthorizationPanel {
  display: none;
}

.app-shell.pre-auth .main {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #10192e 0%, #050a14 65%, #000000 100%);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #17212e;
  color: #f8fafc;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-full {
  width: 100%;
  max-width: 190px;
  display: block;
}

.brand span,
.muted {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.sidebar .brand span {
  color: #aeb8c5;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-button {
  border: 1px solid transparent;
  background: transparent;
  color: #dbe3ed;
  text-align: left;
  padding: 11px 12px;
}

.nav-button.active,
.nav-button:hover {
  background: #253244;
  border-color: #34465c;
}

.nav-submenu {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-left: 12px;
  padding-left: 8px;
  border-left: 1px solid #34465c;
}

.nav-submenu.open {
  display: flex;
}

.nav-sub {
  font-size: 0.92em;
}

.folder-year,
.folder-month {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.folder-year > summary,
.folder-month > summary {
  cursor: pointer;
  padding: 10px 14px;
  background: #f8fafc;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

.folder-year > summary:hover,
.folder-month > summary:hover {
  background: #eef2f7;
}

.folder-year-body {
  padding: 8px 14px 14px;
}

.folder-month {
  margin: 8px 0 0;
}

.folder-month > summary {
  font-weight: 500;
  background: #ffffff;
}

.folder-month-body {
  padding: 4px 10px 10px;
}

.session-panel {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #34465c;
}

.session-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #aeb8c5;
  font-size: 13px;
}

.session-row strong {
  color: #ffffff;
  text-align: right;
}

.session-row strong.status-ok {
  color: #86efac;
}

.session-row strong.status-warn {
  color: #facc15;
}

.session-row strong.status-error {
  color: #fecaca;
}

.main {
  min-width: 0;
  padding: 20px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 17px;
}

.topbar p {
  color: var(--muted);
  margin-top: 4px;
}

.assisted-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  border-color: #f6d58d;
  background: #fff8e6;
}

.assisted-panel[hidden] {
  display: none;
}

.assisted-panel p {
  color: var(--muted);
  margin-top: 4px;
}

.assist-code-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.assist-code-form input {
  width: 140px;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0;
}

.view {
  display: none;
}

.role-hidden {
  display: none !important;
}

.active-view {
  display: grid;
  gap: 18px;
}

.login-band {
  display: block;
}

.login-band[hidden] {
  display: none;
}

.login-form,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 0;
}

.login-form {
  display: grid;
  gap: 14px;
  width: 380px;
  max-width: 92vw;
  margin-top: 60px;
  padding: 0 0 28px;
  background: #121212;
  border: 1px solid #3b82f6;
  border-radius: 18px;
  box-shadow: 0 0 60px rgba(59, 130, 246, 0.18), 0 30px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.login-logo {
  width: 100%;
  max-width: none;
  margin: 0;
  display: block;
  border-radius: 0;
}

.login-form label {
  margin: 0 28px;
  color: #c7ccd4;
  font-size: 15px;
}

.login-form label:first-of-type {
  margin-top: 24px;
}

.login-form input {
  background: #1b1b1b;
  border: 1px solid #333333;
  color: #f5f5f5;
  border-radius: 8px;
  font-size: 15px;
  min-height: 46px;
}

.login-form input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.password-field {
  position: relative;
}

.password-field input {
  width: 100%;
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  min-height: auto;
  padding: 6px;
  color: #9aa3ad;
  cursor: pointer;
}

.password-toggle:hover {
  color: #f5f5f5;
}

.login-form .primary-button {
  width: 160px;
  margin: 18px auto 0;
  background: linear-gradient(135deg, #60a5fa, #1d4ed8);
  color: #ffffff;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-form .primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, #7eb8fc, #2563eb);
}

.panel {
  padding: 16px;
}

.compact-panel {
  margin-top: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.status-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 12px;
  margin-bottom: 14px;
}

.status-panel small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.35;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-ready {
  border-color: #b7ebc8;
  background: #f0fff6;
}

.status-ready .status-pill {
  border-color: #86efac;
  background: #dcfce7;
  color: var(--ok);
}

.status-warning {
  border-color: #f6d58d;
  background: #fff8e6;
}

.status-warning .status-pill {
  border-color: #facc15;
  background: #fef3c7;
  color: var(--warn);
}

.status-error {
  border-color: #fecaca;
  background: #fff1f2;
}

.status-error .status-pill {
  border-color: #fca5a5;
  background: #fee2e2;
  color: var(--danger);
}

.status-dashboard {
  display: grid;
  gap: 16px;
  max-width: 760px;
}

.status-dashboard-title {
  align-items: flex-start;
  margin-bottom: 0;
}

.mobile-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mobile-status-card {
  display: grid;
  gap: 8px;
  min-height: 140px;
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 16px;
}

.mobile-status-card strong {
  font-size: 28px;
  line-height: 1.05;
}

.mobile-status-card small {
  color: var(--muted);
  line-height: 1.35;
}

.mobile-status-card.status-ready {
  border-color: #86efac;
  background: #f0fff6;
}

.mobile-status-card.status-ready strong {
  color: var(--ok);
}

.mobile-status-card.status-warning {
  border-color: #facc15;
  background: #fff8e6;
}

.mobile-status-card.status-warning strong {
  color: var(--warn);
}

.mobile-status-card.status-error {
  border-color: #fca5a5;
  background: #fff1f2;
}

.mobile-status-card.status-error strong {
  color: var(--danger);
}

.status-dashboard-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.active-batches-panel {
  max-width: 980px;
}

.backup-history-panel {
  max-width: 980px;
}

.active-batches-panel .panel-title {
  align-items: flex-start;
}

.active-batches-table {
  min-width: 720px;
}

.backup-history-table {
  min-width: 860px;
}

.backup-history-table td:nth-child(3),
.backup-history-table td:nth-child(6) {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-batches-table th,
.active-batches-table td {
  white-space: nowrap;
}

.active-batches-table td:last-child {
  display: flex;
  gap: 8px;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
  min-width: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.call-center-grid {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.form-panel,
.search-panel {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.timing-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.user-form-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.user-active-row {
  align-content: end;
  min-height: 64px;
}

.search-panel {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.policy-filter-panel {
  grid-template-columns: minmax(320px, 1fr) 150px 120px auto auto auto;
  align-items: end;
}

.policy-filter-panel .primary-button {
  min-width: 88px;
}

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #c7d0dc;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 42px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #bfdbfe;
  border-color: #2563eb;
}

.actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border: 1px solid transparent;
  min-height: 40px;
  padding: 9px 13px;
  font-weight: 700;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: #e0f2fe;
  color: #075985;
  border-color: #bae6fd;
}

.ghost-button {
  background: #ffffff;
  border-color: #c7d0dc;
  color: #273549;
}

.danger-button {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff7f7;
}

.danger-button:hover {
  background: #fee2e2;
}

.icon-button {
  width: 42px;
  padding: 0;
  background: #ffffff;
  border-color: #c7d0dc;
}

.filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.18);
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 20;
}

.filter-overlay.open {
  opacity: 1;
}

.filter-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 100vw);
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 36px rgba(15, 23, 42, 0.16);
  transform: translateX(100%);
  transition: transform 180ms ease;
  z-index: 21;
}

.filter-drawer.open {
  transform: translateX(0);
}

.filter-form {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  overflow-y: auto;
}

.filter-form .filter-actions {
  margin-top: auto;
}

.filter-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-header h2 {
  font-size: 24px;
}

.filter-back-button {
  border: 0;
  font-size: 30px;
  line-height: 1;
}

.filter-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.switch-row input {
  width: 18px;
  min-height: 18px;
}

.result-list,
.preview-grid {
  display: grid;
  gap: 10px;
}

.policy-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100vh - 24px);
  min-height: 1960px;
  overflow: hidden;
}

.policy-list-panel .panel-title {
  margin-bottom: 14px;
}

.policy-list-panel .result-list {
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.policy-list-panel .result-list::-webkit-scrollbar {
  width: 10px;
}

.policy-list-panel .result-list::-webkit-scrollbar-track {
  background: #eef2f7;
}

.policy-list-panel .result-list::-webkit-scrollbar-thumb {
  background: #aeb8c5;
  border: 2px solid #eef2f7;
}

.policy-list-panel .result-list::-webkit-scrollbar-thumb:hover {
  background: #7d8b9c;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.tab-button {
  border: 1px solid #c7d0dc;
  background: #ffffff;
  color: #273549;
  min-height: 36px;
  padding: 7px 11px;
  font-weight: 700;
  white-space: nowrap;
}

.tab-button.active-tab {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.tab-panel {
  display: none;
}

.tab-panel.active-tab-panel {
  display: grid;
  gap: 10px;
}

.result-item {
  border: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.result-title {
  font-weight: 800;
}

.local-policy-item {
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.local-policy-item:hover {
  background: #f8fbff;
  border-color: #9ecae8;
}

.local-policy-item:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.local-policy-item .result-top {
  align-items: center;
}

.local-policy-main {
  min-width: 0;
}

.local-policy-main .result-title {
  font-size: 19px;
  line-height: 1.1;
}

.local-policy-main .result-meta {
  margin-top: 3px;
  line-height: 1.15;
}

.local-policy-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.compact-button {
  min-height: 32px;
  padding: 6px 10px;
}

.result-meta,
.kv {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  color: var(--ok);
  background: #ecfdf3;
  border-color: #bbf7d0;
}

.badge.warn {
  color: var(--warn);
  background: #fffbeb;
  border-color: #fde68a;
}

.badge.error {
  color: var(--danger);
  background: #fef3f2;
  border-color: #fecaca;
}

.info-section {
  margin-bottom: 18px;
}

.info-section:last-child {
  margin-bottom: 0;
}

.info-section-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--primary);
  padding-bottom: 6px;
  border-bottom: 2px solid #e2e8f0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.info-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 12px;
  min-height: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.info-box:hover {
  border-color: #c7d2e0;
  background: #f1f5f9;
}

.info-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.info-box strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.detail-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-section {
  border: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 10px;
  background: #ffffff;
}

.detail-section h3 {
  margin: 0;
  font-size: 14px;
}

.call-card {
  align-content: start;
}

.call-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.call-summary > div {
  border: 1px solid var(--line);
  padding: 10px;
  min-height: 58px;
}

.call-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.call-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.call-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.call-contact-list {
  display: grid;
  gap: 8px;
}

.call-contact {
  display: grid;
  gap: 2px;
  border: 1px solid #c7d0dc;
  padding: 9px 10px;
  color: var(--ink);
  text-decoration: none;
  background: #f8fafc;
}

.call-contact:hover {
  border-color: #9ecae8;
  background: #f8fbff;
}

.call-contact span {
  color: var(--muted);
  font-size: 12px;
}

.call-contact-pdf {
  border-style: dashed;
  background: #fdf6e3;
}

.call-contact-pdf span {
  color: #a06a00;
  font-weight: 600;
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tab-nav .tab-sync-button {
  margin-left: auto;
}

.detail-actions:empty {
  display: none;
}

.other-policies-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 40px;
  margin-bottom: 4px;
}

.other-policies-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.policy-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.policy-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  border: 1px solid #9ecae8;
  background: #f8fbff;
  color: var(--ink);
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
}

.policy-chip:hover {
  background: #e3f1fc;
  border-color: #5aa5d6;
}

.policy-chip span {
  color: var(--muted);
  font-size: 12px;
}

.call-contact-del {
  border-style: dashed;
  background: #eef6ff;
}

.call-contact-del span {
  color: #1f5f99;
  font-weight: 600;
}

.call-contact-sipac {
  border-style: dashed;
  background: #eefbf0;
}

.call-contact-sipac span {
  color: #1a7d3a;
  font-weight: 600;
}

.sipac-gv-sync-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.call-tab-title {
  margin-bottom: 0;
}

.reception-form {
  gap: 12px;
}

.table-section {
  min-width: 0;
}

.detail-table-wrap {
  max-height: min(420px, 52vh);
  overflow: auto;
  border: 1px solid #dfe6ef;
  scrollbar-gutter: stable;
}

.detail-table {
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.detail-table th,
.detail-table td {
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}

.detail-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4fb;
  border-bottom: 2px solid #b8c6d8;
  color: #172033;
  font-weight: 800;
}

.detail-table td {
  overflow-wrap: anywhere;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #ffffff;
}

.detail-table td:nth-child(2),
.detail-table th:nth-child(2) {
  white-space: normal;
}

.coverage-table th:nth-child(1),
.coverage-table td:nth-child(1) {
  width: 6%;
}

.coverage-table th:nth-child(2),
.coverage-table td:nth-child(2) {
  width: 9%;
}

.coverage-table th:nth-child(3),
.coverage-table td:nth-child(3) {
  width: 32%;
}

.coverage-table th:nth-child(4),
.coverage-table td:nth-child(4) {
  width: 11%;
}

.coverage-table th:nth-child(5),
.coverage-table td:nth-child(5) {
  width: 10%;
}

.coverage-table th:nth-child(6),
.coverage-table td:nth-child(6) {
  width: 10%;
}

.coverage-table th:nth-child(7),
.coverage-table td:nth-child(7) {
  width: 14%;
}

.coverage-table th:nth-child(8),
.coverage-table td:nth-child(8) {
  width: 8%;
}

.coverage-table td:nth-child(3),
.coverage-table th:nth-child(3) {
  white-space: normal;
}

.coverage-table td:nth-child(4),
.coverage-table th:nth-child(4) {
  white-space: normal;
}

.coverage-table td:nth-child(7),
.coverage-table th:nth-child(7) {
  white-space: normal;
}

.coverage-table td:nth-child(8),
.coverage-table th:nth-child(8) {
  white-space: normal;
}

.service-table th:nth-child(1),
.service-table td:nth-child(1) {
  width: 13%;
}

.service-table th:nth-child(2),
.service-table td:nth-child(2) {
  width: 14%;
}

.service-table th:nth-child(3),
.service-table td:nth-child(3) {
  width: 39%;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal;
}

.service-table td:nth-child(3) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-table th:nth-child(4),
.service-table td:nth-child(4) {
  width: 20%;
}

.service-table th:nth-child(5),
.service-table td:nth-child(5) {
  width: 14%;
}

.beneficiary-table th:nth-child(1),
.beneficiary-table td:nth-child(1) {
  width: 100%;
}

.beneficiary-table td:nth-child(1),
.beneficiary-table th:nth-child(1) {
  white-space: normal;
}

.compact-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.compact-item {
  display: grid;
  gap: 2px;
  border-top: 1px solid #edf1f5;
  padding-top: 6px;
}

.compact-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.compact-item strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.compact-item span,
.muted-list {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  color: var(--muted);
  min-height: 90px;
  place-items: center;
  border: 1px dashed #c7d0dc;
  padding: 20px;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
}

.history-row td {
  vertical-align: middle;
}

.history-row {
  cursor: pointer;
}

.history-detail-summary {
  margin-bottom: 6px;
}

.history-date {
  min-width: 118px;
  color: #172033;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(420px, calc(100vw - 32px));
  background: #111827;
  color: #ffffff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav-tabs {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    flex: 1;
  }

  .session-panel {
    width: 100%;
    margin-top: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-grid,
  .content-grid,
  .call-center-grid,
  .call-summary,
  .call-sections {
    grid-template-columns: 1fr;
  }

  .timing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .policy-filter-panel {
    grid-template-columns: minmax(240px, 1fr) minmax(130px, 160px) minmax(100px, 130px) auto auto auto;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 22px;
  }

  .form-grid,
  .info-grid,
  .detail-columns,
  .search-panel,
  .mobile-status-grid {
    grid-template-columns: 1fr;
  }

  .status-dashboard-actions {
    display: grid;
  }

  .active-batches-panel .panel-title,
  .active-batches-panel .actions-row {
    display: grid;
    width: 100%;
  }

  .session-panel {
    grid-template-columns: 1fr;
  }

  .panel,
  .login-form {
    padding: 13px;
  }

  .result-top {
    flex-direction: column;
  }
}
