:root {
  --bg: #f2f6fb;
  --bg-accent: #e7eef8;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --text: #1d2a3a;
  --text-soft: #607289;
  --line: #d4dfec;
  --primary: #005a9c;
  --primary-strong: #003f71;
  --warning-bg: #fff4e5;
  --warning-border: #ffd39c;
  --warning-text: #8f5b00;
  --danger: #b42318;
  --success: #157347;
  --shadow: 0 16px 30px rgba(12, 30, 57, 0.08);
}

body[data-theme='dark'] {
  --bg: #0d1624;
  --bg-accent: #16263b;
  --surface: #17263a;
  --surface-soft: #1d3049;
  --text: #e6edf7;
  --text-soft: #aac0da;
  --line: #28415f;
  --primary: #5db3ff;
  --primary-strong: #7ac1ff;
  --warning-bg: #31260f;
  --warning-border: #6f5420;
  --warning-text: #ffd68a;
  --danger: #ff8f7e;
  --success: #5ad19e;
  --shadow: 0 18px 34px rgba(2, 7, 14, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--text-soft);
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary-strong);
  background:
    radial-gradient(circle at 0% 0%, var(--bg-accent) 0%, transparent 40%),
    radial-gradient(circle at 100% 0%, var(--bg-accent) 0%, transparent 38%),
    var(--bg);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input,
select,
button,
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
}

button {
  cursor: pointer;
  background: var(--primary);
  color: #ffffff;
  border: 0;
}

button:hover {
  background: var(--primary-strong);
}

.container {
  width: min(980px, 94vw);
  margin: 28px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.alert {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  border-radius: 10px;
  padding: 10px 12px;
}
.alert-info {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
  color: var(--text);
}
.alert-error {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  color: color-mix(in srgb, var(--danger) 85%, var(--text));
}

.toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1300;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 24px));
}

.toast-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 12px 12px;
  animation: toast-enter 220ms ease;
}

.toast-item.is-exiting {
  animation: toast-exit 220ms ease forwards;
}

.toast-success {
  border-color: color-mix(in srgb, var(--success) 45%, var(--line));
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
}

.toast-info {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.toast-error {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.toast-text {
  font-weight: 600;
}

.toast-close {
  width: auto;
  min-width: 28px;
  min-height: 28px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  border: 1px solid transparent;
  padding: 0 6px;
}

.toast-close:hover {
  background: color-mix(in srgb, var(--surface-soft) 75%, transparent);
  color: var(--text);
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-exit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field-group {
  display: grid;
  gap: 6px;
}

.password-generator-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.password-row-actions {
  display: flex;
  gap: 8px;
}

.password-generator-row .secondary-btn {
  width: auto;
  white-space: nowrap;
}

.password-toggle-btn {
  min-width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
}

.helper {
  color: var(--text-soft);
  font-size: 13px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.login-card {
  width: min(460px, 100%);
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--primary) 4%, var(--surface)) 0%, var(--surface) 55%),
    var(--surface);
  box-shadow: var(--shadow);
  padding: 26px;
  display: grid;
  gap: 18px;
  animation: login-card-enter 320ms ease-out;
}

.login-header {
  display: grid;
  gap: 8px;
}

.login-badge {
  margin: 0;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line));
  background: color-mix(in srgb, var(--primary) 12%, var(--surface-soft));
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login-title {
  margin: 0;
  font-size: 36px;
  line-height: 1;
  color: var(--primary-strong);
}

.login-subtitle {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form input {
  min-height: 44px;
}

.login-form .password-generator-row {
  grid-template-columns: 1fr auto;
}

.login-form .password-toggle-btn {
  min-height: 44px;
}

.login-submit-btn {
  min-height: 44px;
}

.login-footer {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.login-helper {
  margin: 0;
}

.login-credit {
  margin: 0;
  font-size: 13px;
  color: var(--text-soft);
}

.login-credit a {
  font-weight: 700;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-credit a:hover {
  color: var(--primary-strong);
}

@keyframes login-card-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden-assignment-input {
  display: none;
}

.assignment-summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assignment-summary-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}

.assignment-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.assignment-summary-header h3 {
  margin: 0;
  font-size: 14px;
}

.assignment-link-btn {
  width: auto;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.assignment-link-btn:hover {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface-soft));
  color: var(--primary-strong);
}

.assignment-link-btn:focus-visible {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface-soft));
  color: var(--primary-strong);
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  outline-offset: 1px;
}

.assignment-summary-value {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.assignment-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.assignment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.assignment-empty {
  color: var(--text-soft);
  font-size: 13px;
}

.assignment-modal-card {
  width: min(760px, calc(100vw - 40px));
  max-height: min(82vh, 760px);
  overflow: hidden;
  display: grid;
  gap: 10px;
}

.assignment-modal-card .modal-header {
  margin-bottom: 0;
}

.assignment-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-soft);
}

.assignment-list-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  background: var(--surface);
}

.assignment-list-item:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

.assignment-list-item input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  padding: 0;
}

.assignment-list-item-content {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.assignment-list-item-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.assignment-list-item-meta {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.3;
}

.assignment-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.assignment-list-info {
  color: var(--text-soft);
  font-size: 13px;
}

.assignment-pagination-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.assignment-pagination-actions .secondary-btn {
  width: auto;
  min-height: 34px;
  padding: 6px 12px;
}

.assignment-pagination-actions .secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.assignment-modal-card .actions {
  justify-content: flex-end;
}

.assignment-modal-card .actions .secondary-btn,
.assignment-modal-card .actions .btn-modern {
  width: auto;
  min-height: 40px;
  padding: 8px 14px;
}

.assignment-empty-list {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  padding: 6px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.brand-subtitle {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 28px;
}

.sidebar-nav a {
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
}

.sidebar-nav a:hover {
  background: var(--bg-accent);
}

.sidebar-nav a.active {
  background: var(--primary);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
}

.sidebar-footer form {
  margin: 0;
}

.sidebar-logout-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.sidebar-logout-btn:hover {
  background: var(--bg-accent);
}

.app-main {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
  padding: 20px 26px;
}

.app-header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.page-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  position: relative;
  width: 92px;
  min-width: 92px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 4px;
  overflow: hidden;
}

.theme-track-icons {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  color: var(--text-soft);
  font-size: 13px;
  pointer-events: none;
}

.theme-toggle-thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  box-shadow: 0 8px 16px rgba(0, 90, 156, 0.28);
  transition: transform 0.24s ease;
}

.theme-toggle[data-theme='dark'] .theme-toggle-thumb {
  transform: translateX(54px);
}

.theme-toggle.switching .theme-toggle-thumb {
  transition: transform 0.24s ease, box-shadow 0.24s ease;
  box-shadow: 0 0 0 7px rgba(0, 90, 156, 0.14);
}

.icon-btn {
  width: auto;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
}

.notify-btn {
  position: relative;
  min-width: 42px;
  min-height: 38px;
}

.notify-btn.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 16%, var(--surface-soft));
}

.notify-btn i {
  font-size: 15px;
}

.notify-wrap {
  position: relative;
}

.notify-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(380px, 88vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 20;
  transform-origin: top right;
}

.notify-dropdown.open {
  display: block;
  animation: notify-pop 0.18s ease;
}

@keyframes notify-pop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notify-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notify-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.notify-pill {
  border-radius: 999px;
  font-size: 12px;
  padding: 3px 8px;
  color: #fff;
  background: var(--primary);
}
.notify-clear-btn {
  width: auto;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.notify-clear-btn:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-soft));
}

.notify-list {
  max-height: 380px;
  overflow: auto;
}

.notify-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.notify-item:hover {
  background: var(--surface-soft);
}

.notify-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 17%, var(--surface-soft));
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.notify-item small {
  display: block;
  color: var(--text-soft);
  margin-top: 2px;
}

.notify-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  gap: 6px;
  font-size: 14px;
  text-align: center;
}

.notify-empty i {
  font-size: 20px;
}

.notify-badge {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
  padding: 0 5px;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  width: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 6px 10px 6px 6px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.avatar-image {
  object-fit: cover;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
}

.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: 112%;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
  z-index: 15;
}

.user-menu-dropdown.open {
  display: block;
}

.user-menu-dropdown a,
.user-menu-dropdown .menu-exit {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  color: var(--text);
  border-radius: 8px;
  background: transparent;
  border: 0;
}

.user-menu-dropdown a:hover,
.user-menu-dropdown .menu-exit:hover {
  background: var(--surface-soft);
}

.user-menu-dropdown form {
  margin: 0;
}

.page-content {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.page-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-soft);
}

.page-breadcrumb a {
  color: var(--primary);
  font-weight: 600;
}

.breadcrumb-separator {
  opacity: 0.6;
}

.split {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.4fr 1fr;
}

.dashboard-greeting {
  margin-bottom: 12px;
  display: grid;
  gap: 4px;
}

.dashboard-greeting-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.dashboard-greeting-subtitle {
  margin: 0;
}

.dashboard-status-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  margin: 12px 0;
}

.dashboard-status-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.dashboard-status-card span {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
}

.dashboard-status-card strong {
  font-size: 24px;
  line-height: 1;
}

.dashboard-status-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.dashboard-status-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.dashboard-status-card.uploaded {
  border-color: color-mix(in srgb, #1d4ed8 35%, var(--line));
}

.dashboard-status-card.processed {
  border-color: color-mix(in srgb, #0d9488 35%, var(--line));
}

.dashboard-status-card.approved {
  border-color: color-mix(in srgb, #15803d 35%, var(--line));
}

.dashboard-status-card.sent {
  border-color: color-mix(in srgb, #7c3aed 35%, var(--line));
}

.dashboard-status-card.failed {
  border-color: color-mix(in srgb, #b42318 35%, var(--line));
}

.dashboard-chart-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  min-height: 360px;
  padding: 10px;
}

.dashboard-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.dashboard-chart-range {
  display: inline-grid;
  grid-template-columns: auto minmax(120px, 1fr) auto minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
}

.dashboard-chart-range label {
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
}

.dashboard-chart-range input {
  min-height: 36px;
  padding: 6px 8px;
}

.dashboard-chart-range-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-chart-range-actions .secondary-btn {
  width: auto;
  min-height: 36px;
  padding: 6px 10px;
}

.dashboard-chart-feedback {
  margin: 0 0 8px;
  min-height: 18px;
}

.dashboard-chart-feedback[data-tone='warning'] {
  color: color-mix(in srgb, var(--danger) 80%, var(--text));
}

.dashboard-chart-feedback[data-tone='success'] {
  color: color-mix(in srgb, var(--success) 80%, var(--text));
}

.dashboard-chart-selection {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.dashboard-chart-canvas {
  width: 100%;
  height: 340px;
}

.dashboard-empty-state {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 320px;
}

.dashboard-approval-alert {
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--line));
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.dashboard-approval-alert:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--primary) 55%, var(--line));
}

.dashboard-approval-alert-badge {
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  padding: 0 8px;
}

.dashboard-approval-alert-text {
  display: grid;
  gap: 2px;
}

.dashboard-approval-alert-text strong {
  font-size: 14px;
  line-height: 1.25;
}

.dashboard-approval-alert-text small {
  color: var(--text-soft);
  font-size: 12px;
}

.dashboard-approval-alert i {
  color: var(--primary-strong);
  font-size: 17px;
}

.card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 16px;
}

.card-title {
  margin-bottom: 8px;
  font-size: 16px;
}

.report-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.reports-filters-panel {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.reports-filters-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(280px, 2fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr) auto;
  align-items: end;
}

.reports-filter-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.reports-filter-field label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.reports-filter-field input {
  min-height: 40px;
  padding: 8px 10px;
}

.reports-filters-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-self: end;
}

.reports-filter-apply-btn,
.reports-filter-clear-btn {
  width: auto;
  min-height: 40px;
  padding: 0 14px;
  white-space: nowrap;
}

.reports-filters-actions .btn-modern,
.reports-filters-actions .secondary-btn {
  width: auto;
}

.dispatch-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.dispatch-cta .helper {
  margin: 2px 0 0;
}

.report-filter a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
}

.report-filter a.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.analysis-request-cell {
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
}

.report-files-stack {
  display: grid;
  gap: 8px;
}

.file-version-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

.file-version-original {
  background: var(--surface-soft);
  color: var(--text);
}

.file-version-processed {
  background: color-mix(in srgb, var(--success) 15%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--success) 35%, var(--line));
  color: color-mix(in srgb, var(--success) 75%, var(--text));
}

.file-version-pending {
  background: color-mix(in srgb, var(--warning-bg) 65%, var(--surface-soft));
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.reports-actions-col {
  width: 72px;
  text-align: center;
}

.reports-actions-cell {
  width: 72px;
  text-align: center;
}

.row-actions-wrap {
  position: relative;
  display: inline-flex;
  justify-content: center;
}

.table-kebab-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-kebab-btn i {
  font-size: 18px;
}

.table-kebab-btn.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--surface-soft));
}

.row-actions-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(330px, 86vw);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  background: var(--surface);
  padding: 8px;
  z-index: 40;
  display: none;
}

.row-actions-menu.open {
  display: grid;
  gap: 6px;
  animation: notify-pop 0.16s ease;
}

.row-menu-item,
.row-menu-submit {
  display: inline-flex;
  align-items: center;
  width: 100%;
  border-radius: 9px;
  padding: 9px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 14px;
}

.row-menu-item i,
.row-menu-submit i {
  width: 16px;
  margin-right: 8px;
  color: var(--text-soft);
  flex-shrink: 0;
}

.row-menu-item:hover,
.row-menu-submit:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.row-menu-item-approve {
  color: color-mix(in srgb, var(--success) 86%, var(--text));
}

.row-menu-item-approve i {
  color: color-mix(in srgb, var(--success) 80%, var(--text));
}

.row-menu-item-retry {
  color: color-mix(in srgb, var(--warning-text) 88%, var(--text));
}

.row-menu-item-retry i {
  color: color-mix(in srgb, var(--warning-text) 82%, var(--text));
}

.row-menu-item-process,
.row-menu-item-dispatch {
  color: color-mix(in srgb, var(--primary-strong) 86%, var(--text));
}

.row-menu-item-process i,
.row-menu-item-dispatch i {
  color: color-mix(in srgb, var(--primary) 80%, var(--text));
}

.row-menu-item-info {
  color: color-mix(in srgb, var(--primary-strong) 76%, var(--text));
}

.row-menu-item-info i {
  color: color-mix(in srgb, var(--primary) 68%, var(--text));
}

.row-menu-item-muted {
  color: var(--text-soft);
  cursor: default;
}

.row-menu-item-muted i {
  color: var(--text-soft);
}

.row-menu-item-muted:hover {
  background: transparent;
  border-color: transparent;
}

.row-menu-form {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 8px;
  display: grid;
  gap: 8px;
}

.row-menu-form-compact {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.row-menu-form label {
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
}

.row-menu-form input,
.row-menu-form select {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.row-menu-submit {
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.row-menu-submit:hover {
  filter: brightness(1.05);
  border-color: transparent;
}

th {
  background: var(--surface-soft);
}

.status-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.channel-pill i {
  font-size: 11px;
}

.status-pill.uploaded {
  color: var(--primary);
}

.status-pill.processed {
  color: var(--success);
}

.status-pill.approved,
.status-pill.sent {
  color: var(--success);
}

.status-pill.failed {
  color: var(--danger);
}
.status-reason {
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
  max-width: 320px;
  word-break: break-word;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions form,
.actions a {
  margin: 0;
}

.actions a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 9px 12px;
}

.actions-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
}
.table-action-link {
  width: auto;
  align-items: center;
}
.table-approve-form {
  margin: 0;
}
.table-approve-btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
  font-weight: 600;
}

.table-action-btn {
  min-width: 168px;
  justify-content: center;
}
.client-row-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.client-workspace-tabs {
  margin-bottom: 10px;
}
.movements-content {
  max-width: 380px;
  white-space: pre-wrap;
  word-break: break-word;
}

.client-groups-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.8fr);
  gap: 12px;
}

.client-group-create-card {
  height: fit-content;
}

.client-groups-list {
  display: grid;
  gap: 12px;
}

.client-group-card {
  display: grid;
  gap: 10px;
}

.client-group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.client-group-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.client-group-toggle-btn {
  width: auto;
  min-height: 38px;
  padding: 7px 12px;
}

.client-group-delete-btn {
  width: auto;
}

.client-group-details {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.client-group-details[hidden] {
  display: none !important;
}

.client-group-member-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 140px minmax(240px, 1fr) minmax(160px, 0.8fr) auto;
  align-items: start;
}

.client-group-member-form .field-group {
  align-self: start;
}

.client-group-member-form .field-group input,
.client-group-member-form .field-group select,
.client-group-member-form .field-group textarea {
  min-height: 52px;
}

.client-group-member-action button {
  width: auto;
  min-height: 52px;
}

.client-group-member-action {
  align-self: start;
  padding-top: 34px;
}

.client-member-recipient-help {
  min-height: 18px;
  line-height: 1.2;
}

.client-group-search-row {
  display: grid;
}

.client-group-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.client-group-row-actions form {
  margin: 0;
}

.client-group-row-actions .secondary-btn {
  width: auto;
}

.client-group-edit-modal-card {
  width: min(620px, 96vw);
}

.client-group-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.client-group-modal-actions .secondary-btn,
.client-group-modal-actions .btn-modern {
  width: auto;
}

.client-group-members-table {
  margin-top: 0;
}

.client-group-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.client-group-pagination-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.client-group-pagination-actions .secondary-btn {
  width: auto;
  min-height: 34px;
  padding: 6px 12px;
}

.client-group-pagination-actions .secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.client-insights-placeholder {
  margin-top: 4px;
}

.client-insights-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.client-insights-grid > div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface);
  display: grid;
  gap: 4px;
}

.client-insights-grid strong {
  font-size: 19px;
}

.table-action-process {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
}

.table-action-process:hover {
  filter: brightness(1.05);
}

.table-action-retry {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: #fff;
}

.table-action-retry:hover {
  filter: brightness(1.05);
}

.table-action-approve {
  background: linear-gradient(135deg, #0f9d58 0%, #0a7a44 100%);
  color: #fff;
}

.table-action-approve:hover {
  filter: brightness(1.05);
}

.table-action-dispatch {
  background: linear-gradient(135deg, #0f766e 0%, #155e75 100%);
  color: #fff;
}

.table-action-dispatch:hover {
  filter: brightness(1.05);
}

.button-link {
  border: 0;
  width: auto;
}

.actions-link:hover {
  background: var(--primary-strong);
}

.actions-link.table-action-process:hover {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  filter: brightness(1.05);
}

.actions-link.table-action-retry:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  filter: brightness(1.05);
}

.actions-link.table-action-dispatch:hover {
  background: linear-gradient(135deg, #0f766e 0%, #155e75 100%);
  filter: brightness(1.05);
}

.report-sent-summary {
  display: grid;
  gap: 8px;
}

.report-sent-action-btn {
  width: auto;
  min-width: 210px;
  min-height: 38px;
  padding: 7px 12px;
  justify-content: flex-start;
  border-radius: 999px;
  font-weight: 700;
}

.report-dispatch-modal-card {
  width: min(620px, 96vw);
}

.report-dispatch-modal-list {
  display: grid;
  gap: 8px;
  max-height: 45vh;
  overflow: auto;
}

.report-dispatch-modal-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-dispatch-modal-item code {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.table-pagination {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.table-pagination-summary {
  color: var(--text-soft);
  font-size: 13px;
}

.table-pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.table-pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.table-pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.table-pagination-btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.table-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
}

.table-avatar-fallback {
  display: inline-grid;
  place-items: center;
  font-size: 11px;
}

.users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.table-action-btn {
  width: auto;
  padding: 8px 11px;
}

.secondary-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.secondary-btn:hover {
  background: var(--surface-soft);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 36, 0.48);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 14px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: min(620px, 96vw);
  max-height: 90vh;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.preview-modal-card {
  width: min(1180px, 96vw);
  max-height: 92vh;
}

.processing-overlay {
  z-index: 120;
  background: rgba(6, 14, 26, 0.62);
  backdrop-filter: blur(3px);
}

.processing-overlay .processing-card {
  width: min(460px, calc(100vw - 28px));
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 12px;
}

.processing-overlay[data-provider='anthropic'] .processing-card {
  --ai-accent: #c2410c;
  --ai-accent-soft: #ffedd5;
  --ai-surface: #fff7ed;
  --ai-user-surface: #f4f4f5;
}

.processing-overlay[data-provider='deepseek'] .processing-card {
  --ai-accent: #0369a1;
  --ai-accent-soft: #cffafe;
  --ai-surface: #ecfeff;
  --ai-user-surface: #eff6ff;
}

.processing-overlay[data-provider='openai'] .processing-card {
  --ai-accent: #0f766e;
  --ai-accent-soft: #d1fae5;
  --ai-surface: #ecfdf5;
  --ai-user-surface: #f3f4f6;
}

.processing-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ai-accent) 72%, var(--text));
}

.processing-provider-label {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  color: color-mix(in srgb, var(--ai-accent) 76%, var(--text));
}

.processing-copy {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
}

.processing-visual {
  display: none;
}

.processing-overlay[data-provider='anthropic'] .processing-visual-anthropic,
.processing-overlay[data-provider='deepseek'] .processing-visual-deepseek,
.processing-overlay[data-provider='openai'] .processing-visual-openai {
  display: block;
}

.processing-chat-box {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--ai-accent) 28%, var(--line));
  border-radius: 14px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--ai-accent-soft) 72%, #fff) 0%, var(--surface) 100%);
  padding: 12px;
  display: grid;
  gap: 8px;
  overflow: hidden;
}

.processing-line {
  width: fit-content;
  max-width: min(86%, 320px);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.3;
}

.processing-line.ai {
  justify-self: start;
  background: var(--ai-surface);
  color: color-mix(in srgb, var(--ai-accent) 72%, var(--text));
  border: 1px solid color-mix(in srgb, var(--ai-accent) 20%, var(--line));
}

.processing-line.user {
  justify-self: end;
  background: var(--ai-user-surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.processing-line.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
}

.processing-line.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ai-accent) 70%, #fff);
  animation: processing-dot-bounce 0.9s ease-in-out infinite;
}

.processing-line.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.processing-line.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes processing-dot-bounce {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.processing-line.deepseek-wave {
  min-height: 34px;
  width: min(72%, 260px);
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--ai-accent) 16%, transparent) 0%,
      color-mix(in srgb, var(--ai-accent) 44%, transparent) 50%,
      color-mix(in srgb, var(--ai-accent) 16%, transparent) 100%
    );
  border: 1px solid color-mix(in srgb, var(--ai-accent) 26%, var(--line));
  animation: deepseek-wave-pulse 1.6s ease-in-out infinite;
}

@keyframes deepseek-wave-pulse {
  0%,
  100% {
    transform: scaleX(0.95);
    opacity: 0.65;
  }
  50% {
    transform: scaleX(1);
    opacity: 1;
  }
}

.deepseek-scan-line {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--ai-accent) 58%, #fff) 50%,
    transparent 100%
  );
  animation: deepseek-scan 2.1s linear infinite;
}

@keyframes deepseek-scan {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(72px);
    opacity: 0;
  }
}

.openai-orbit {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--ai-accent) 36%, transparent);
}

.openai-orbit::before,
.openai-orbit::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--ai-accent) 74%, transparent);
  animation: openai-spin 1.3s linear infinite;
}

.openai-orbit::after {
  inset: 9px;
  animation-duration: 1.9s;
  animation-direction: reverse;
}

@keyframes openai-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.processing-helper {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
}

.report-viewer-frame-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #0f1726;
  height: 72vh;
}

.report-viewer-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #0f1726;
}

.preview-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.preview-toolbar-left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-toolbar-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-toolbar-right a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--surface-soft);
  color: var(--text);
}

.preview-tab {
  width: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--surface-soft);
  color: var(--text);
}

.preview-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.preview-table-wrapper {
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 64vh;
  overflow: auto;
  background: var(--surface);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
}

.preview-table th,
.preview-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  font-size: 13px;
}

.preview-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-soft);
  z-index: 2;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
}

.modal-close-btn {
  width: auto;
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 22px;
  line-height: 1;
  padding: 2px 10px;
}

.modal-close-btn:hover {
  background: var(--surface-soft);
}

.profile-avatar {
  width: 74px;
  height: 74px;
  border-radius: 12px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: var(--surface-soft);
}

.account-avatar-section {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.account-avatar-preview-wrap {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.account-avatar-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 26px;
}

.account-avatar-actions {
  flex: 1;
  min-width: 0;
}

.actions button {
  width: auto;
  padding: 9px 12px;
}

.inline-form {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.inline-form input {
  flex: 1;
}

.btn-modern {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  border: 0;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 90, 156, 0.24);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.btn-modern:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 90, 156, 0.28);
}
.btn-danger {
  width: 100%;
  background: linear-gradient(135deg, #b42318 0%, #8f1a13 100%);
  color: #fff;
  border: 0;
  font-weight: 600;
  min-height: 44px;
}
.btn-danger:hover {
  filter: brightness(1.06);
}
.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.process-chat-shell {
  display: grid;
  gap: 14px;
}
.process-chat-header {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.process-chat-header p {
  margin: 0;
  color: var(--text-soft);
}
.process-chat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
.process-chat-grid .field-group:last-child {
  grid-column: 1 / -1;
}
.process-chat-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.process-chat-actions .btn-modern,
.process-chat-actions .secondary-btn {
  width: auto;
}
.mass-dispatch-shell {
  display: grid;
  gap: 14px;
}
.mass-dispatch-header p {
  margin: 0;
}
.mass-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mass-tab-btn {
  width: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 600;
}
.mass-tab-btn:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-soft));
}
.mass-tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.mass-tab-panel {
  display: none;
}
.mass-tab-panel.active {
  display: block;
}
.mass-dispatch-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1.2fr 1fr;
}
.mass-dispatch-card h3 {
  margin-bottom: 10px;
}
.mass-dispatch-list {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.mass-group-picker {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.mass-group-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.mass-group-row:last-child {
  border-bottom: 0;
}
.mass-group-row input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin-top: 4px;
}
.mass-group-picker-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--text-soft);
  background: var(--surface-soft);
}
.mass-report-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.mass-report-row:last-child {
  border-bottom: 0;
}
.mass-report-row input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin-top: 4px;
}
.mass-dispatch-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.mass-dispatch-actions .btn-modern,
.mass-dispatch-actions .secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  width: auto;
  text-decoration: none;
}
.mass-dispatch-preview {
  display: grid;
  gap: 12px;
}
.mass-dispatch-preview-empty {
  display: grid;
  gap: 10px;
}
.mass-dispatch-preview-empty .secondary-btn {
  width: auto;
}
.mass-preview-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.5fr 1fr;
}
.mass-preview-main {
  display: grid;
  gap: 12px;
}
.mass-preview-side {
  min-width: 0;
}
.mass-preview-kpis {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}
.mass-preview-kpis > div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-soft);
}
.mass-preview-kpis strong {
  display: block;
  margin-top: 4px;
}
.mass-preview-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-soft);
}
.mass-preview-block p {
  margin: 6px 0 0;
}
.mass-preview-report-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
  max-height: 220px;
  overflow: auto;
}
.mass-preview-report-title {
  margin: 0 0 8px;
  font-size: 15px;
}
.mass-preview-report-item {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.mass-preview-report-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.mass-preview-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.mass-preview-modal-actions form {
  display: inline-flex;
}
.mass-preview-modal-actions .secondary-btn {
  width: auto;
  min-height: 42px;
  padding: 0 14px;
}
.mass-preview-modal-actions .btn-modern {
  width: auto;
  min-height: 42px;
  padding: 0 14px;
}

.input-file-modern {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}

.input-file-modern::file-selector-button {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  margin-right: 10px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
}

.table-action-stack {
  display: grid;
  gap: 8px;
}

.timeline-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.timeline-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-assignees-block {
  margin-top: 10px;
  margin-bottom: 14px;
  display: grid;
  gap: 6px;
}

.timeline-assignee-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
}

.timeline-item-dot {
  width: 12px;
  height: 12px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.timeline-item-dot.is-error {
  background: #c81e1e;
  box-shadow: 0 0 0 3px color-mix(in srgb, #c81e1e 20%, transparent);
}

.timeline-item-content {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.timeline-item-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-item-text {
  margin: 6px 0 0;
  line-height: 1.45;
  font-size: 14px;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-main {
    margin-left: 0;
    padding: 14px;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .dashboard-status-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-chart-wrap {
    min-height: 320px;
  }

  .dashboard-chart-range {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .dashboard-chart-range label {
    display: none;
  }

  .dashboard-chart-range-actions {
    width: 100%;
  }

  .dashboard-chart-range-actions .secondary-btn {
    flex: 1;
    min-width: 120px;
  }

  .dashboard-chart-canvas {
    height: 280px;
  }

  .dashboard-empty-state {
    min-height: 260px;
  }

  .dashboard-greeting-title {
    font-size: 20px;
  }

  .dashboard-approval-alert {
    grid-template-columns: auto 1fr;
  }

  .dashboard-approval-alert i {
    display: none;
  }

  .assignment-summary-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 18px;
  }

  .user-name {
    display: none;
  }

  .inline-form {
    flex-direction: column;
  }

  .password-generator-row {
    grid-template-columns: 1fr;
  }

  .account-avatar-section {
    flex-direction: column;
    align-items: flex-start;
  }

  .theme-toggle {
    width: 84px;
    min-width: 84px;
  }

  .theme-toggle[data-theme='dark'] .theme-toggle-thumb {
    transform: translateX(46px);
  }

  .notify-dropdown {
    right: -8px;
    width: min(340px, 92vw);
  }

  .process-chat-grid {
    grid-template-columns: 1fr;
  }

  .dispatch-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .reports-filters-row {
    grid-template-columns: 1fr 1fr;
  }

  .reports-filters-actions {
    grid-column: 1 / -1;
    justify-self: start;
    flex-direction: row;
    align-items: center;
  }

  .reports-filter-apply-btn,
  .reports-filter-clear-btn {
    width: auto;
  }

  .mass-dispatch-grid {
    grid-template-columns: 1fr;
  }

  .mass-preview-layout {
    grid-template-columns: 1fr;
  }

  .client-groups-layout {
    grid-template-columns: 1fr;
  }

  .client-group-member-form {
    grid-template-columns: 1fr;
  }

  .client-group-member-action {
    padding-top: 0;
  }

  .client-insights-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mass-preview-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .timeline-header-actions {
    width: 100%;
  }

  .login-card {
    padding: 22px 18px;
    border-radius: 14px;
  }

  .login-title {
    font-size: 30px;
  }

  .login-form .password-generator-row {
    grid-template-columns: 1fr auto;
  }

  .login-form .password-row-actions {
    justify-content: flex-end;
  }

  .processing-overlay .processing-card {
    width: min(94vw, 420px);
    padding: 16px;
  }

  .processing-provider-label {
    font-size: 21px;
  }

  .processing-chat-box {
    padding: 10px;
  }

  .processing-line {
    font-size: 12px;
  }
}
