:root {
  --rt-green: #0d9488;
  --rt-green-bright: #14b8a6;
  --rt-green-deep: #0f766e;
  --rt-green-glow: rgba(20, 184, 166, 0.35);
  --rt-bg: #0a1210;
  --rt-surface: rgba(15, 30, 28, 0.72);
  --rt-border: rgba(20, 184, 166, 0.22);
  --rt-text: #ecfdf5;
  --rt-muted: #94a3a8;
  --rt-radius: 14px;
  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--rt-text);
  background: var(--rt-bg);
}

body {
  overflow-x: hidden;
}

#network-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.pnp-ghost {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pnp-ghost img {
  width: min(88vw, 640px);
  max-height: min(78vh, 640px);
  height: auto;
  object-fit: contain;
  opacity: 0.11;
  filter: grayscale(35%) brightness(1.25) contrast(0.88) blur(0.6px);
  mix-blend-mode: soft-light;
}

@media (max-width: 900px) {
  .pnp-ghost img {
    width: min(92vw, 520px);
    max-height: min(52vh, 480px);
  }
}

.page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr minmax(320px, 440px);
  align-items: stretch;
}

@media (max-width: 900px) {
  .page {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
}

.hero {
  padding: clamp(2rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
  max-width: 640px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rt-green-bright);
  font-weight: 600;
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rt-green-bright);
  box-shadow: 0 0 12px var(--rt-green-glow);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  background: linear-gradient(135deg, #ecfdf5 0%, #5eead4 45%, #0d9488 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .tagline {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--rt-muted);
  line-height: 1.55;
  max-width: 36ch;
}

.hero .hint {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--rt-muted);
  opacity: 0.85;
}

.auth-panel {
  padding: clamp(1.5rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0a1210;
  background-image: linear-gradient(
      105deg,
      rgba(8, 20, 18, 0.82) 0%,
      rgba(8, 24, 22, 0.78) 40%,
      rgba(6, 18, 16, 0.72) 100%
    ),
    url("../../images/background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-left: 1px solid var(--rt-border);
}

@media (max-width: 900px) {
  .auth-panel {
    border-left: none;
    border-top: 1px solid var(--rt-border);
    padding-bottom: 3rem;
  }
}

.auth-panel-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 380px;
}

.login-card-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.75rem;
  width: 100%;
}

.login-card-logo {
  display: block;
  height: auto;
  width: auto;
  max-height: clamp(52px, 10vw, 76px);
  max-width: min(46%, 200px);
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 2rem 1.75rem;
  border-radius: var(--rt-radius);
  background: var(--rt-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--rt-border);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(20, 184, 166, 0.06) inset;
}

.login-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.login-card .subtitle {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: var(--rt-muted);
}

.alert {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
}

.alert.ok {
  border-color: rgba(45, 212, 191, 0.35);
  background: rgba(15, 118, 110, 0.35);
  color: #ccfbf1;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--rt-muted);
  margin-bottom: 0.35rem;
}

.field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(6, 20, 18, 0.65);
  color: var(--rt-text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--rt-green-bright);
  box-shadow: 0 0 0 3px var(--rt-green-glow);
}

.btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: #042f2e;
  background: linear-gradient(135deg, #5eead4, #0d9488);
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn-primary:hover {
  box-shadow: 0 8px 24px var(--rt-green-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.footer-note {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  color: var(--rt-muted);
  text-align: center;
  opacity: 0.8;
}

.footer-note code {
  font-size: 0.7rem;
  color: var(--rt-green-bright);
  background: rgba(20, 184, 166, 0.12);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* —— Dashboard —— (isang viewport: walang browser vertical scroll; scroll sa sidebar / card) */
html:has(body.dashboard-page) {
  height: 100%;
  overflow: hidden;
}

body.dashboard-page {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@supports (height: 100dvh) {
  body.dashboard-page {
    height: 100dvh;
    max-height: 100dvh;
  }
}

.dashboard-app {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dash-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 0.65rem clamp(1rem, 3vw, 1.75rem);
  border-bottom: 1px solid var(--rt-border);
  background: rgba(8, 18, 16, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.dash-header-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  min-width: 0;
}

.dash-header-logos {
  display: flex;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.dash-header-logo {
  display: block;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.dash-header-logo--pnp {
  max-height: 48px;
  max-width: 120px;
}

.dash-header-logo--unit {
  max-height: 40px;
  max-width: 140px;
}

.dash-header-logo-rule {
  width: 1px;
  height: 32px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(20, 184, 166, 0.45),
    transparent
  );
  flex-shrink: 0;
}

.dash-header-title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.dash-header-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ecfdf5;
}

.dash-header-sub {
  font-size: 0.7rem;
  color: var(--rt-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dash-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
}

.dash-user-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(20, 184, 166, 0.25);
  background: rgba(6, 24, 22, 0.65);
}

.dash-user-pill-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rt-muted);
}

.dash-user-pill-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ccfbf1;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: #042f2e;
  border: 1px solid rgba(45, 212, 191, 0.45);
  background: linear-gradient(145deg, #5eead4, #0d9488);
  box-shadow: 0 4px 16px rgba(20, 184, 166, 0.25);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.btn-logout:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(20, 184, 166, 0.4);
  filter: brightness(1.05);
}

.btn-logout:active {
  transform: translateY(0);
}

.btn-logout-icon {
  flex-shrink: 0;
}

.dash-body {
  flex: 1;
  display: flex;
  min-height: 0;
  align-items: stretch;
}

.dash-sidebar {
  width: 240px;
  flex-shrink: 0;
  min-height: 0;
  border-right: 1px solid var(--rt-border);
  background: rgba(6, 16, 14, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem 0.65rem 1.35rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.dash-nav-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dash-nav-heading {
  margin: 0;
  padding: 0 0.35rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rt-green-bright);
}

.dash-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dash-nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--rt-text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.dash-nav-link:hover {
  background: rgba(20, 184, 166, 0.1);
  border-color: rgba(20, 184, 166, 0.18);
  color: #f0fdfa;
}

.dash-nav-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(20, 184, 166, 0.12);
  color: var(--rt-green-bright);
}

.dash-nav-icon svg {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
}

.dash-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: clamp(1rem, 2vw, 1.5rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dash-main-card {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.35rem;
  border-radius: var(--rt-radius);
  border: 1px solid var(--rt-border);
  background: var(--rt-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
}

.dash-main-card--wide > *:not(.rt-table-scroll) {
  flex-shrink: 0;
}

.dash-main-card--wide .rt-table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.dash-main-card.dash-main-card--settings {
  overflow-y: auto;
  overflow-x: hidden;
}

.dash-main-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.dash-main-lead {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--rt-muted);
}

.dash-main-lead strong {
  color: #ccfbf1;
  font-weight: 600;
}

@media (max-width: 900px) {
  .dash-body {
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  .dash-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--rt-border);
    max-height: min(38vh, 260px);
    min-height: 0;
    flex-shrink: 0;
    overflow-y: auto;
  }

  .dash-main {
    flex: 1;
    min-height: 0;
  }

  .dash-header-logo--pnp {
    max-height: 40px;
  }

  .dash-header-logo--unit {
    max-height: 34px;
  }

  .dash-header-sub {
    display: none;
  }

  .dash-user-pill {
    align-items: flex-start;
  }

  .dash-header-actions {
    width: 100%;
    justify-content: space-between;
  }
}

.dash-nav-link.is-active {
  background: rgba(20, 184, 166, 0.16);
  border-color: rgba(20, 184, 166, 0.35);
  color: #f0fdfa;
}

.dash-main-card--wide {
  max-width: none;
}

.module-head {
  margin-bottom: 1.25rem;
}

.module-head-title {
  margin-bottom: 0.35rem;
}

.module-head-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--rt-muted);
}

.rt-table-scroll {
  overflow: auto;
  margin: 0 -0.15rem;
  padding: 0.35rem;
  border-radius: 10px;
  background: rgba(4, 14, 12, 0.45);
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.rt-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  background: rgba(8, 22, 20, 0.95);
  color: var(--rt-text);
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.12) inset;
}

/* Incoming: 4000px wide table → horizontal scroll sa .rt-table-scroll; column % sa <col> */
.rt-data-table--incoming {
  table-layout: fixed;
  width: 2000px;
  min-width: 2000px;
  max-width: none;
  --rt-in-col-1: 8%;
  --rt-in-col-2: 6%;
  --rt-in-col-3: 7%;
  --rt-in-col-4: 8%;
  --rt-in-col-5: 22%;
  --rt-in-col-6: 5%;
  --rt-in-col-7: 10%;
  --rt-in-col-8: 10%;
  --rt-in-col-9: 10%;
  --rt-in-col-10: 6%;
  --rt-in-col-11: 8%;
}

.rt-data-table--incoming col:nth-child(1) {
  width: var(--rt-in-col-1);
}

.rt-data-table--incoming col:nth-child(2) {
  width: var(--rt-in-col-2);
}

.rt-data-table--incoming col:nth-child(3) {
  width: var(--rt-in-col-3);
}

.rt-data-table--incoming col:nth-child(4) {
  width: var(--rt-in-col-4);
}

.rt-data-table--incoming col:nth-child(5) {
  width: var(--rt-in-col-5);
}

.rt-data-table--incoming col:nth-child(6) {
  width: var(--rt-in-col-6);
}

.rt-data-table--incoming col:nth-child(7) {
  width: var(--rt-in-col-7);
}

.rt-data-table--incoming col:nth-child(8) {
  width: var(--rt-in-col-8);
}

.rt-data-table--incoming col:nth-child(9) {
  width: var(--rt-in-col-9);
}

.rt-data-table--incoming col:nth-child(10) {
  width: var(--rt-in-col-10);
}

.rt-data-table--incoming col:nth-child(11) {
  width: var(--rt-in-col-11);
}

.rt-data-table col.rt-col-hidden {
  visibility: collapse;
  width: 0 !important;
  min-width: 0 !important;
  border: none;
}

.rt-data-table--incoming th,
.rt-data-table--incoming td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* —— System settings (column toggles) —— */
.settings-flash {
  margin-bottom: 1rem;
}

.settings-form {
  max-width: 640px;
}

.settings-fieldset {
  margin: 0;
  padding: 0;
  border: none;
}

.settings-legend {
  padding: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rt-green-bright);
}

.settings-hint {
  margin: 0.5rem 0 1rem;
  font-size: 0.875rem;
  color: var(--rt-muted);
}

.settings-toggle-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-toggle-row {
  margin: 0;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(20, 184, 166, 0.15);
  background: rgba(6, 20, 18, 0.35);
  transition: background 0.12s, border-color 0.12s;
}

.settings-toggle:hover {
  background: rgba(20, 184, 166, 0.08);
  border-color: rgba(20, 184, 166, 0.28);
}

.settings-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.settings-toggle-ui {
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.35);
  position: relative;
  transition: background 0.18s, border-color 0.18s;
}

.settings-toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f1f5f9;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.settings-toggle-input:checked + .settings-toggle-ui {
  background: linear-gradient(135deg, #2dd4bf, #0d9488);
  border-color: rgba(45, 212, 191, 0.5);
}

.settings-toggle-input:checked + .settings-toggle-ui::after {
  transform: translateX(20px);
}

.settings-toggle-input:focus-visible + .settings-toggle-ui {
  box-shadow: 0 0 0 3px var(--rt-green-glow);
}

.settings-toggle-label {
  font-size: 0.9rem;
  color: var(--rt-text);
  font-weight: 500;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.5rem;
}

.btn-settings-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: #042f2e;
  background: linear-gradient(135deg, #5eead4, #0d9488);
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.25);
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn-settings-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(20, 184, 166, 0.35);
}

.btn-settings-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rt-green-bright);
  text-decoration: none;
}

.btn-settings-link:hover {
  text-decoration: underline;
}

.rt-data-table th,
.rt-data-table td {
  border: 1px solid rgba(20, 184, 166, 0.22);
  padding: 0.5rem 0.55rem;
  vertical-align: middle;
  text-align: center;
}

.rt-data-table thead .rt-th {
  background: linear-gradient(180deg, rgba(15, 55, 50, 0.95) 0%, rgba(10, 40, 38, 0.98) 100%);
  color: #ccfbf1;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
  line-height: 1.3;
}

.rt-data-table thead .rt-th-group {
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.35) 0%, rgba(10, 45, 42, 0.95) 100%);
  color: #f0fdfa;
}

.rt-data-table thead .rt-th-sub {
  background: rgba(6, 28, 26, 0.92);
  color: #99f6e4;
  font-size: 0.65rem;
}

.rt-data-table tbody td {
  background: rgba(6, 20, 18, 0.55);
  font-weight: 400;
  color: #e2e8f0;
  text-transform: none;
  letter-spacing: normal;
}

/* Incoming: Subject column body only — left, bold (header unchanged) */
.rt-data-table--incoming tbody tr:not(.rt-row-empty) td:nth-child(5) {
  text-align: left;
  font-weight: 700;
}

.rt-data-table tbody tr:nth-child(even) td {
  background: rgba(8, 28, 26, 0.5);
}

.rt-data-table .rt-row-empty td {
  background: rgba(4, 18, 16, 0.65);
  color: var(--rt-muted);
  font-style: italic;
  font-weight: 400;
  font-size: 0.8rem;
  padding: 0.9rem;
}

.module-head--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.25rem;
}

.rt-btn-add-document {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(45, 212, 191, 0.45);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: #042f2e;
  background: linear-gradient(135deg, #5eead4, #0d9488);
  box-shadow: 0 4px 16px rgba(20, 184, 166, 0.28);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.rt-btn-add-document:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(20, 184, 166, 0.4);
  filter: brightness(1.03);
}

.rt-btn-add-document:active {
  transform: translateY(0);
}

.rt-btn-add-document:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--rt-green-glow), 0 4px 16px rgba(20, 184, 166, 0.28);
}

.rt-btn-add-document--secondary {
  text-decoration: none;
  background: rgba(20, 184, 166, 0.12);
  color: #ccfbf1;
  border-color: rgba(20, 184, 166, 0.35);
  box-shadow: none;
}

.rt-btn-add-document--secondary:hover {
  filter: none;
  background: rgba(20, 184, 166, 0.22);
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.2);
}

.rt-gdrive-connect-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(20, 184, 166, 0.3);
  background: rgba(6, 28, 26, 0.55);
}

.rt-gdrive-connect-banner p {
  margin: 0 0 0.65rem;
  font-size: 0.875rem;
  color: var(--rt-muted);
  line-height: 1.45;
}

.rt-gdrive-connect-banner p strong {
  color: #e2e8f0;
}

.rt-gdrive-connect-banner--warn {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(55, 40, 10, 0.45);
}

.rt-gdrive-connect-banner--warn code {
  font-size: 0.8em;
  color: #fde68a;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.rt-btn-add-document-icon {
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 700;
}

.rt-attach-link {
  margin-left: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--rt-green-bright);
  text-decoration: none;
  white-space: nowrap;
}

.rt-attach-link:hover {
  text-decoration: underline;
}

body.rt-modal-open {
  overflow: hidden;
  pointer-events: none;
}

.rt-modal[hidden] {
  display: none !important;
}

.rt-modal:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
}

.rt-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 7, 0.72);
  backdrop-filter: blur(4px);
}

.rt-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: var(--rt-radius);
  border: 1px solid var(--rt-border);
  background: rgba(10, 26, 24, 0.97);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: rt-modal-in 0.22s ease-out;
}

@keyframes rt-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.rt-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--rt-border);
}

.rt-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.rt-modal-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--rt-muted);
  background: rgba(20, 184, 166, 0.08);
  transition: background 0.12s, color 0.12s;
}

.rt-modal-close:hover {
  color: #f0fdfa;
  background: rgba(20, 184, 166, 0.2);
}

.rt-modal-body {
  position: relative;
  padding: 1rem 1.15rem 1.25rem;
  overflow-y: auto;
}

.rt-modal-step--confirm {
  padding: 1.5rem 0.5rem 0.25rem;
  text-align: center;
}

.rt-modal-confirm-question {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--rt-text);
}

.rt-modal-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.rt-modal-step--saving {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1rem 1.5rem;
  min-height: 10rem;
}

.rt-modal-saving-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--rt-muted);
  animation: rt-saving-pulse 1.1s ease-in-out infinite;
}

@keyframes rt-saving-pulse {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
}

.rt-modal-saving-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 3px solid rgba(20, 184, 166, 0.2);
  border-top-color: #5eead4;
  animation: rt-spin 0.75s linear infinite;
}

@keyframes rt-spin {
  to {
    transform: rotate(360deg);
  }
}

.rt-modal-message {
  min-height: 1.25rem;
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--rt-muted);
}

.rt-modal-message--err {
  color: #fecaca;
}

.rt-modal-connect-link {
  display: inline-block;
  margin-top: 0.65rem;
  font-weight: 600;
  color: #5eead4;
  text-decoration: underline;
}

.rt-modal-connect-link:hover {
  color: #ccfbf1;
}

.rt-modal-form {
  margin: 0;
}

.rt-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

@media (max-width: 640px) {
  .rt-modal-grid {
    grid-template-columns: 1fr;
  }

  .rt-field-span2 {
    grid-column: auto;
  }
}

.rt-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rt-field-span2 {
  grid-column: 1 / -1;
}

.rt-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--rt-muted);
}

.rt-field-label abbr {
  text-decoration: none;
  color: var(--rt-green-bright);
}

.rt-field-sublabel {
  font-weight: 400;
  color: var(--rt-muted);
  font-size: 0.72rem;
}

.rt-input-readonly {
  cursor: default;
  opacity: 0.92;
  background: rgba(4, 30, 28, 0.55) !important;
  border-style: dashed !important;
}

.rt-field input[type="text"],
.rt-field input[type="date"],
.rt-field input[type="file"],
.rt-field select,
.rt-field textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(20, 184, 166, 0.25);
  background: rgba(6, 20, 18, 0.75);
  color: var(--rt-text);
  font-size: 0.9rem;
  font-family: inherit;
}

.rt-field textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.rt-field input:focus-visible,
.rt-field textarea:focus-visible,
.rt-field select:focus-visible {
  outline: none;
  border-color: var(--rt-green-bright);
  box-shadow: 0 0 0 2px var(--rt-green-glow);
}

.rt-file-drop {
  position: relative;
  display: block;
  min-height: 6.5rem;
  padding: 0;
  border-radius: 10px;
  border: 2px dashed rgba(20, 184, 166, 0.35);
  background: rgba(6, 20, 18, 0.45);
  transition: border-color 0.15s, background 0.15s;
}

.rt-file-drop--active {
  border-color: rgba(94, 234, 212, 0.75);
  background: rgba(6, 28, 26, 0.65);
}

.rt-file-drop-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.rt-file-drop-ui {
  position: relative;
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 6.5rem;
  padding: 1rem 0.75rem;
  text-align: center;
}

.rt-file-drop-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e2e8f0;
}

.rt-file-drop-name {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: #5eead4;
  word-break: break-all;
  max-width: 100%;
}

.rt-field-hint {
  font-size: 0.72rem;
  color: var(--rt-muted);
}

.rt-modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(20, 184, 166, 0.15);
}

.rt-modal-btn {
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}

.rt-modal-btn--ghost {
  color: var(--rt-muted);
  background: transparent;
  border-color: rgba(148, 163, 184, 0.25);
}

.rt-modal-btn--ghost:hover {
  color: #f0fdfa;
  border-color: rgba(20, 184, 166, 0.35);
}

.rt-modal-btn--primary {
  color: #042f2e;
  border-color: rgba(45, 212, 191, 0.45);
  background: linear-gradient(135deg, #5eead4, #0d9488);
}

.rt-modal-btn--primary:hover {
  filter: brightness(1.05);
}

.rt-modal-btn--primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  filter: none;
}
