/* Sidebar - enterprise */
.sidebar {
  width: 280px;
  min-height: 100vh;
  height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  background: linear-gradient(180deg, #0a0e27 0%, #0f172a 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
  border-right: 1px solid rgba(66, 153, 225, 0.2);
  padding: 20px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  transition: width 0.25s ease, padding 0.25s ease;
}

.sidebar.collapsed {
  width: 88px;
  padding-left: 10px;
  padding-right: 10px;
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 14px;
  transition: all 0.2s ease;
}

.sidebar-toggle:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #ffffff;
  border-color: rgba(59, 130, 246, 0.3);
}

.logo-wrap {
  margin-bottom: 24px;
  padding: 8px 0 14px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  position: relative;
}

.logo-wrap::after {
  display: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-decoration: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.logo i {
  font-size: 28px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex-shrink: 0;
}

.logo:hover {
  opacity: 0.9;
  transform: translateX(2px);
}

.nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  padding: 12px 14px 8px;
  margin-top: 8px;
  white-space: nowrap;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  margin-bottom: 2px;
  white-space: nowrap;
}

.nav-link i {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 16px;
  transition: transform 0.2s ease;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-radius: 0 3px 3px 0;
  transition: height 0.2s ease;
}

.nav-link:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #ffffff;
  transform: translateX(4px);
}

.nav-link:hover i {
  transform: scale(1.05);
  color: #3b82f6;
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.02));
  color: #ffffff;
  border-right: 1px solid rgba(59, 130, 246, 0.3);
}

.nav-link.active::before {
  height: 60%;
}

.nav-link.active i {
  color: #3b82f6;
}

.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
}

.user-info {
  margin-top: auto;
  padding-top: 8px;
  border-top: none;
  background: none;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.05);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.user-profile:hover {
  background: rgba(59, 130, 246, 0.1);
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email i {
  font-size: 10px;
  opacity: 0.7;
  flex-shrink: 0;
}

.user-email span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  transform: translateY(-1px);
  border-color: rgba(239, 68, 68, 0.4);
}

.logout-btn i {
  font-size: 12px;
}

.sidebar.collapsed .logo span,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn span,
.sidebar.collapsed .nav-badge {
  display: none;
}

.sidebar.collapsed .logo {
  justify-content: center;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding-left: 12px;
  padding-right: 12px;
}

.sidebar.collapsed .user-profile {
  justify-content: center;
  padding: 8px;
}

.sidebar.collapsed .logout-btn {
  justify-content: center;
  padding-left: 10px;
  padding-right: 10px;
}

@media (max-width: 768px) {
  .sidebar {
    width: 88px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .sidebar .logo span,
  .sidebar .nav-link span,
  .sidebar .nav-section-title,
  .sidebar .user-details,
  .sidebar .logout-btn span,
  .sidebar .nav-badge {
    display: none;
  }

  .sidebar .logo {
    justify-content: center;
  }

  .sidebar .nav-link {
    justify-content: center;
    padding-left: 12px;
    padding-right: 12px;
  }

  .sidebar .user-profile {
    justify-content: center;
    padding: 8px;
  }

  .sidebar .logout-btn {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Navigation */
.nav {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.nav-section {
  padding-bottom: 8px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  padding: 12px 14px 8px;
  margin-top: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  margin-bottom: 2px;
}

.nav-link i {
  width: 20px;
  text-align: center;
  font-size: 16px;
  transition: transform 0.2s ease;
}

.nav-link span {
  position: relative;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-radius: 0 3px 3px 0;
  transition: height 0.2s ease;
}

.nav-link:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #ffffff;
  transform: translateX(4px);
}

.nav-link:hover i {
  transform: scale(1.05);
  color: #3b82f6;
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.02));
  color: #ffffff;
  border-right: 1px solid rgba(59, 130, 246, 0.3);
}

.nav-link.active::before {
  height: 60%;
}

.nav-link.active i {
  color: #3b82f6;
}

/* Badge */
.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  letter-spacing: 0;
}

/* User Info Section */

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.05);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.user-profile:hover {
  background: rgba(59, 130, 246, 0.1);
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email i {
  font-size: 10px;
  opacity: 0.7;
  flex-shrink: 0;
}

.user-email span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  transform: translateY(-1px);
  border-color: rgba(239, 68, 68, 0.4);
}

.logout-btn i {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.logout-btn:hover i {
  transform: translateX(2px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    width: 80px;
    padding: 20px 8px;
  }
  
  .logo span,
  .nav-link span,
  .user-name,
  .user-email span,
  .logout-btn span,
  .nav-section-title {
    display: none;
  }
  
  .logo i {
    font-size: 24px;
    margin: 0 auto;
  }
  
  .logo {
    justify-content: center;
  }
  
  .nav-link {
    justify-content: center;
    padding: 12px;
  }
  
  .nav-link i {
    margin: 0;
    font-size: 20px;
    width: auto;
  }
  
  .user-profile {
    justify-content: center;
    padding: 8px;
  }
  
  .user-avatar {
    margin: 0;
  }
  
  .logout-btn {
    justify-content: center;
    padding: 10px;
  }
  
  .nav-badge {
    display: none;
  }
}

/* Scrollbar Styling for sidebar if needed */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.5);
  border-radius: 4px;
}


/* ===== Contracts Pages ===== */

.status-processing {
  background: #FFF4D6;
  color: #A16207;
}

.status-processed {
  background: #DCFCE7;
  color: #166534;
}

.status-failed {
  background: #FEE2E2;
  color: #991B1B;
}

.status-uploaded {
  background: #DBEAFE;
  color: #1D4ED8;
}

.status-neutral {
  background: #E5E7EB;
  color: #4B5563;
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 56px;
  line-height: 1;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 15px;
  line-height: 1.6;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.16);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
}

.content-card {
  background: #ffffff;
  border: 1px solid #eef2f7;
  border-radius: 28px;
  padding: 28px 30px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.app-table thead th {
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  padding: 0 0 16px;
  border-bottom: 1px solid #e2e8f0;
}

.app-table tbody td {
  padding: 18px 0;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
  font-size: 15px;
  vertical-align: middle;
}

.app-table tbody tr:last-child td {
  border-bottom: none;
}

.contract-name {
  font-weight: 700;
  color: #0f172a;
}

.contract-meta {
  color: #64748b;
  font-size: 13px;
  margin-top: 4px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.status-active {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.status-draft {
  background: rgba(148, 163, 184, 0.16);
  color: #475569;
}

.status-expired {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.status-terminated {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: #64748b;
}

.empty-state h3 {
  margin: 0 0 10px;
  font-size: 22px;
  color: #0f172a;
}

.empty-state p {
  margin: 0 0 20px;
  font-size: 15px;
}

@media (max-width: 768px) {
  .page-title {
    font-size: 40px;
  }

  .content-card {
    padding: 20px;
    border-radius: 22px;
  }

  .page-header-row {
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}

/* ===== New Contract ===== */

.btn-secondary {
  color: #0f172a;
  background: #e2e8f0;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.flash-message {
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
}

.flash-error {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.flash-success {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 24px;
  background: #f8fafc;
  padding: 40px 24px;
  text-align: center;
  transition: all 0.2s ease;
}

.upload-dropzone:hover {
  border-color: #3b82f6;
  background: #f8fbff;
}

.upload-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.16);
}

.upload-dropzone h3 {
  margin: 0 0 8px;
  font-size: 24px;
  color: #0f172a;
}

.upload-dropzone p {
  margin: 0 0 20px;
  color: #64748b;
  font-size: 15px;
}

.upload-dropzone input[type="file"] {
  display: none;
}

.upload-select-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 14px;
  background: #0f172a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-select-btn:hover {
  transform: translateY(-1px);
  background: #1e293b;
}

.upload-note {
  margin-top: 14px;
  color: #94a3b8;
  font-size: 13px;
}

.selected-file-list {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
}

.selected-file-item {
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .actions-row {
    flex-direction: column;
  }

  .actions-row .btn {
    width: 100%;
  }
}

.contract-link {
  color: #0f172a;
  text-decoration: none;
  font-weight: 700;
}

.contract-link:hover {
  color: #2563eb;
}

.table-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 700;
}

.table-link:hover {
  text-decoration: underline;
}

/* ===== Clickable table rows ===== */

.app-table tbody tr.clickable-row {
  cursor: pointer;
  transition: background 0.18s ease;
}

.app-table tbody tr.clickable-row:hover {
  background: #f8fbff;
}

.app-table tbody tr.clickable-row:focus-within {
  background: #f8fbff;
}

.app-table tbody tr.clickable-row td {
  transition: background 0.18s ease;
}

.app-table tbody tr.clickable-row td:first-child {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

.app-table tbody tr.clickable-row td:last-child {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}

.app-table tbody tr.clickable-row:hover .contract-name,
.app-table tbody tr.clickable-row:hover .contract-link {
  color: #2563eb;
}

.app-table tbody tr.clickable-row .table-link {
  position: relative;
  z-index: 2;
}

/* ===== Contract Detail ===== */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: #2563eb;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.back-link:hover {
  text-decoration: underline;
}

.contract-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.overview-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 18px 20px;
}

.overview-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 10px;
}

.overview-value {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-header h3 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
}

.section-meta {
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.document-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.document-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.document-meta {
  flex-shrink: 0;
}

.status-processing {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

@media (max-width: 768px) {
  .contract-overview-grid {
    grid-template-columns: 1fr;
  }

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

  .document-main {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Contract Review ===== */

.review-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  background: #ffffff;
  padding: 13px 14px;
  font-size: 14px;
  color: #0f172a;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  box-sizing: border-box;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
}

.form-field textarea {
  resize: vertical;
  min-height: 110px;
}

.task-review-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.task-review-card {
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  background: #f8fafc;
  padding: 20px;
}

.task-review-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.task-review-title-wrap {
  flex: 1;
  min-width: 0;
}

.task-review-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.task-review-source {
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
}

.review-add-task {
  margin-top: 20px;
}

.btn-danger-soft {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.16);
}

.btn-danger-soft:hover {
  background: rgba(239, 68, 68, 0.16);
}

@media (max-width: 768px) {
  .review-form-grid {
    grid-template-columns: 1fr;
  }

  .task-review-top {
    flex-direction: column;
    align-items: stretch;
  }
}

.status-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.review-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  background: #ffffff;
  padding: 13px 14px;
  font-size: 14px;
  color: #0f172a;
  box-sizing: border-box;
}

.form-field textarea {
  resize: vertical;
  min-height: 110px;
}

.task-table-container {
  overflow-x: auto;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

.task-table th,
.task-table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.task-table th {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  background: #f8fafc;
}

.task-title-cell {
  font-weight: 700;
  color: #0f172a;
}

.task-subtext {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.task-source-details {
  margin-top: 8px;
}

.task-source-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #2563eb;
}

.task-source-text {
  margin-top: 6px;
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}

.table-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #f1f5f9;
  color: #334155;
}

.status-task-pending {
  background: rgba(148, 163, 184, 0.16);
  color: #475569;
}

.status-task-in_progress {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.status-task-done {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.status-task-cancelled {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.status-doc-uploaded {
  background: rgba(148, 163, 184, 0.16);
  color: #475569;
}

.status-doc-processing {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.status-doc-processed {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.status-doc-failed {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.document-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.document-error {
  margin-top: 8px;
  font-size: 13px;
  color: #b91c1c;
}

.empty-state-small {
  padding: 28px 8px;
}

.review-add-task {
  margin-top: 18px;
}

@media (max-width: 768px) {
  .review-form-grid {
    grid-template-columns: 1fr;
  }
}

.task-edit-row td {
  background: #f8fafc;
  padding: 18px 16px;
}

.task-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.task-confirm-inline {
  display: flex;
  align-items: end;
}

.task-edit-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.edit-task-btn:hover {
  color: #2563eb;
}

@media (max-width: 768px) {
  .task-edit-grid {
    grid-template-columns: 1fr;
  }
}

.task-row .cell-edit {
  display: none;
}

.task-row.is-editing .cell-display {
  display: none;
}

.task-row.is-editing .cell-edit {
  display: block;
}

.task-row .row-actions-edit {
  display: none;
}

.task-row.is-editing .row-actions-default {
  display: none;
}

.task-row.is-editing .row-actions-edit {
  display: flex;
  gap: 6px;
  align-items: center;
}

.task-row .row-actions-default {
  display: flex;
  gap: 6px;
  align-items: center;
}

.inline-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.task-row .table-input,
.task-row .table-textarea,
.task-row .table-select {
  width: 100%;
}

.task-row .table-textarea {
  margin-top: 8px;
}

.task-row .cell-edit .table-input-secondary {
  margin-top: 8px;
}

.task-row.is-editing td {
  background: #f8fbff;
}

.due-edit-cell {
  min-width: 180px;
}

.due-recurring-fields,
.due-conditional-fields {
  display: none;
}

.due-recurring-fields {
  display: grid;
  gap: 8px;
}

.recurrence-preview {
  font-size: 13px;
  color: #64748b;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.task-toolbar {
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
}



.type-display-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-weight: 600;
}

.type-icon {
  width: 20px;
  min-width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.type-display-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.type-icon {
  width: 20px;
  min-width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.task-title-cell {
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin-bottom: 6px;
}

.task-main-cell .task-subtext {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  max-height: 2.8em;
}

.scheduling-cell .cell-display > div:first-child {
  font-weight: 600;
  line-height: 1.3;
}

.scheduling-cell .task-subtext {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
}

.owner-cell .cell-display {
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.task-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.type-display-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 600;
}

.type-icon {
  flex-shrink: 0;
}

.task-table th:nth-child(6),
.task-table td:nth-child(6) {
  width: 140px;
}

.status-badge {
  font-size: 11px;
  padding: 6px 12px;
}

/* Contract_details.html */

/* ===== Contract Detail 10/10 Redesign ===== */

.escalation-timing-section.is-hidden {
  display: none;
}

.task-source-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.clause-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.clause-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.clause-modal-dialog {
  position: relative;
  width: min(900px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.clause-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.clause-modal-title {
  margin: 0;
}

.clause-modal-meta {
  padding: 10px 20px 0;
  font-size: 13px;
  color: #64748b;
}

.clause-modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.clause-modal-content {
  white-space: pre-wrap;
  line-height: 1.7;
  color: #0f172a;
  font-size: 14px;
}

.clause-snippet {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
}

.clause-highlight {
  background: #fde68a;
  color: #111827;
  padding: 2px 4px;
  border-radius: 4px;
}

.clause-fallback-note {
  font-size: 13px;
  color: #92400e;
  margin-bottom: 10px;
}

.clause-fallback {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 16px;
  white-space: pre-wrap;
}

.clause-label {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}

.task-source-readonly {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
  white-space: pre-wrap;
}

.task-source-expand {
  margin-top: 16px;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background: #f8fafc;
  overflow: hidden;
}

.task-source-expand-summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  color: #475569;
}

.task-source-expand-summary::-webkit-details-marker {
  display: none;
}

.task-source-expand-summary::after {
  content: "▾";
  font-size: 14px;
  color: #64748b;
  transition: transform 0.2s ease;
}

.task-source-expand[open] .task-source-expand-summary::after {
  transform: rotate(180deg);
}

.task-source-expand-title {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-source-expand-meta {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}

.task-source-expand-body {
  padding: 0 18px 18px;
}

.task-source-readonly {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #3b82f6;
  border-radius: 14px;
  padding: 16px 18px;

  font-size: 15px;
  line-height: 1.8;
  color: #334155;

  white-space: pre-line;
  text-align: left;
  box-sizing: border-box;
}

.task-card-actions {
  display: flex;
  justify-content: flex-end;
}

.task-advanced-details {
  margin-top: 14px;
}

.task-advanced-summary {
  cursor: pointer;
  font-weight: 600;
  color: #5f6b85;
  margin-bottom: 10px;
}

.task-advanced-body {
  padding-top: 12px;
}

.task-edit-layout-simple {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

@media (max-width: 980px) {
  .task-edit-layout-simple {
    grid-template-columns: 1fr;
  }
}

.contract-detail-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.contract-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 32px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.14), transparent 28%),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #e8eef8;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.contract-hero-left {
  min-width: 0;
  flex: 1;
}

.contract-hero-headline {
  margin-top: 2px;
}

.contract-hero-title {
  margin: 0;
  font-size: 38px;
  line-height: 1.05;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.contract-hero-subtitle {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 15px;
  line-height: 1.6;
}

.contract-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.contract-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.contract-overview-grid-hero {
  margin-bottom: 0;
}

.overview-card-strong {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border: none;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.overview-card-strong .overview-label,
.overview-card-strong .overview-value,
.overview-card-strong .overview-foot {
  color: #ffffff;
}

.overview-foot {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.meta-card {
  padding: 0;
  overflow: hidden;
}

.meta-collapse {
  width: 100%;
}

.meta-collapse[open] .meta-collapse-summary {
  border-bottom: 1px solid #eef2f7;
}

.meta-collapse-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px;
  cursor: pointer;
  user-select: none;
}

.meta-collapse-summary::-webkit-details-marker {
  display: none;
}

.meta-collapse-summary h3 {
  margin: 4px 0 0;
  font-size: 20px;
  color: #0f172a;
}

.meta-collapse-hint {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.meta-collapse-body {
  padding: 0 28px 28px;
}

.section-kicker {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3b82f6;
}

.review-form-grid-clean {
  gap: 20px;
}

.task-board-card {
  padding: 28px;
}

.section-header-large {
  margin-bottom: 22px;
}

.section-header-large h3 {
  font-size: 24px;
  margin: 4px 0 0;
}

.task-board-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.task-board-progress {
  min-width: 240px;
}

.task-board-progress-label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
  text-align: right;
}

.task-board-progress-bar {
  width: 240px;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.task-board-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.25s ease;
}

.task-card-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.task-card {
  border: 1px solid #e6edf6;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.task-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  border-color: #d8e3f3;
}

.task-card.is-editing {
  border-color: #bfdbfe;
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.10);
}

.task-card-display,
.task-card-edit {
  padding: 22px 24px;
}

.task-row .cell-edit {
  display: none;
}

.task-row.is-editing .cell-display {
  display: none;
}

.task-row.is-editing .cell-edit {
  display: block;
}

.task-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.task-card-main {
  flex: 1;
  min-width: 0;
}

.task-card-right {
  flex-shrink: 0;
}

.task-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.task-title-cell {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
  color: #0f172a;
}

.task-description-preview {
  margin-top: 10px;
  max-width: 100%;
  color: #526274;
  font-size: 14px;
}

.task-status-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.task-card-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr 1fr;
  gap: 14px;
}

.task-info-box {
  background: #f8fafc;
  border: 1px solid #e8eef5;
  border-radius: 18px;
  padding: 16px;
}

.task-info-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 10px;
}

.task-info-value {
  font-size: 15px;
  line-height: 1.45;
  font-weight: 700;
  color: #0f172a;
}

.task-due-main {
  font-weight: 700;
}

.task-due-next {
  margin-top: 8px;
  font-size: 13px;
  color: #475569;
  font-weight: 700;
}

.task-card-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.row-actions-default,
.row-actions-edit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-row .row-actions-edit {
  display: none;
}

.task-row.is-editing .row-actions-default {
  display: none;
}

.task-row.is-editing .row-actions-edit {
  display: flex;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #dbe4ee;
  background: #ffffff;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-icon:hover {
  border-color: #c5d4e7;
  background: #f8fbff;
  color: #2563eb;
}

.task-edit-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}

.task-edit-main,
.task-edit-scheduling {
  min-width: 0;
}

.task-edit-section {
  background: #f8fafc;
  border: 1px solid #e7edf5;
  border-radius: 18px;
  padding: 16px;
}

.task-edit-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.task-edit-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 12px;
}

.task-edit-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.due-edit-cell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.due-one-time-fields,
.due-recurring-fields,
.due-conditional-fields {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px;
}

.due-one-time-fields,
.due-recurring-fields,
.due-conditional-fields {
  display: none;
}

.preview-chip {
  margin-top: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  line-height: 1.4;
}

.inline-checkbox-card {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.task-card-actions-edit {
  margin-top: 18px;
  justify-content: flex-end;
}

.documents-card {
  padding: 28px;
}

.document-card-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.document-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 18px;
  border: 1px solid #e8eef5;
  border-radius: 18px;
  background: #f8fafc;
}

.document-card-main {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}

.document-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.document-card-content {
  min-width: 0;
}

.mini-badge-blue {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.mini-badge-purple {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

.mini-badge-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.mini-badge-neutral {
  background: #eef2f7;
  color: #475569;
}

.status-active {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.status-warning {
  background: rgba(249, 115, 22, 0.14);
  color: #c2410c;
}

.status-processing {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.task-source-details summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
  color: #2563eb;
}

.task-source-details summary::-webkit-details-marker {
  display: none;
}

.task-source-text {
  margin-top: 8px;
  font-size: 13px;
  color: #475569;
  line-height: 1.55;
}

.table-input,
.table-textarea,
.table-select {
  width: 100%;
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  background: #ffffff;
  padding: 13px 14px;
  font-size: 14px;
  color: #0f172a;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  box-sizing: border-box;
}

.table-input:focus,
.table-textarea:focus,
.table-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
}

.table-textarea {
  resize: vertical;
  min-height: 110px;
  margin-top: 10px;
}

@media (max-width: 1200px) {
  .task-card-grid {
    grid-template-columns: 1fr;
  }

  .task-edit-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .contract-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .contract-hero-actions {
    justify-content: flex-start;
  }

  .contract-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-status-stack {
    align-items: flex-start;
  }

  .task-edit-two-col {
    grid-template-columns: 1fr;
  }

  .task-board-meta {
    width: 100%;
    justify-content: space-between;
  }

  .task-board-progress-label {
    text-align: left;
  }
}

@media (max-width: 768px) {
  .contract-hero {
    padding: 22px;
    border-radius: 24px;
  }

  .contract-hero-title {
    font-size: 30px;
  }

  .contract-overview-grid {
    grid-template-columns: 1fr;
  }

  .task-card-display,
  .task-card-edit,
  .task-board-card,
  .documents-card,
  .meta-collapse-summary,
  .meta-collapse-body {
    padding-left: 18px;
    padding-right: 18px;
  }

  .task-board-progress,
  .task-board-progress-bar {
    width: 100%;
    min-width: 0;
  }

  .document-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .document-actions {
    width: 100%;
  }
}

/* ===== Simplified Contract Metadata ===== */

.meta-card-simple {
  padding: 24px 28px;
}

.meta-summary-header {
  margin-bottom: 18px;
}

.contract-meta-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.meta-summary-item {
  background: #f8fafc;
  border: 1px solid #e8eef5;
  border-radius: 18px;
  padding: 16px 18px;
}

.meta-summary-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 10px;
}

.meta-summary-value {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.45;
  word-break: break-word;
}

.meta-collapse-advanced {
  margin-top: 18px;
  border-top: 1px solid #eef2f7;
  padding-top: 18px;
}

.meta-collapse-advanced-summary {
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 700;
  color: #2563eb;
  user-select: none;
}

.meta-collapse-advanced-summary::-webkit-details-marker {
  display: none;
}

.meta-collapse-advanced-body {
  margin-top: 18px;
}

@media (max-width: 1100px) {
  .contract-meta-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .meta-card-simple {
    padding: 20px;
  }

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

.task-card {
  border-left: 4px solid transparent;
}

/* Needs review */
.task-card.needs-review {
  border-left: 4px solid #f59e0b;
}

/* Confirmed */
.task-card.confirmed {
  border-left: 4px solid #22c55e;
}

/* Recurring override (jači signal) */
.task-card.recurring {
  border-left: 4px solid #3b82f6;
}

.task-card.recurring.confirmed {
  border-left: 4px solid #22c55e;
}

.task-card.needs-review {
  background: rgba(245, 158, 11, 0.04);
}

.task-card.confirmed {
  background: rgba(34, 197, 94, 0.04);
}

/* OVERDUE */
.task-card.overdue {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

/* DUE SOON */
.task-card.due-soon {
  border-left: 4px solid #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.task-card.overdue.recurring,
.task-card.overdue.confirmed {
  border-left: 4px solid #ef4444;
}

.mini-badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.mini-badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.task-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/*Dashboard*/
/* ===== Dashboard ===== */

.workload-row-rich {
  align-items: center;
  gap: 18px;
}

.workload-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.workload-score {
  min-width: 120px;
  width: 120px;
}

.workload-score-label {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  text-align: right;
}

.workload-score-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.workload-score-bar span {
  display: block;
  height: 100%;
  width: calc(var(--width) * 1%);
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 32px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.14), transparent 28%),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #e8eef8;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.page-kicker {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3b82f6;
}

.dashboard-title {
  margin: 8px 0 0;
  font-size: 40px;
  line-height: 1.05;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.dashboard-subtitle {
  margin: 12px 0 0;
  color: #64748b;
  font-size: 15px;
  line-height: 1.6;
  max-width: 760px;
}

.dashboard-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-kpi {
  background: #ffffff;
  border: 1px solid #e8eef5;
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.dashboard-kpi-strong {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border: none;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.18);
}

.dashboard-kpi-strong .dashboard-kpi-label,
.dashboard-kpi-strong .dashboard-kpi-value,
.dashboard-kpi-strong .dashboard-kpi-foot,
.dashboard-kpi-strong .dashboard-kpi-icon {
  color: #ffffff;
}

.dashboard-kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dashboard-kpi-label {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.dashboard-kpi-icon {
  font-size: 16px;
  color: #94a3b8;
}

.dashboard-kpi-value {
  margin-top: 14px;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  color: #0f172a;
}

.dashboard-kpi-foot {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

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

.dashboard-grid-main {
  grid-template-columns: 1.4fr 0.8fr;
}

.dashboard-panel {
  min-width: 0;
}

.dashboard-panel-wide {
  min-width: 0;
}

.priority-list,
.mini-table,
.activity-feed,
.workload-list,
.health-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.priority-item,
.mini-table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  background: #f8fafc;
  border: 1px solid #e8eef5;
  border-radius: 16px;
  padding: 14px 16px;
  transition: all 0.18s ease;
}

.priority-item:hover,
.mini-table-row:hover {
  background: #f8fbff;
  border-color: #d7e5f5;
  transform: translateY(-1px);
}

.priority-item-left,
.mini-table-main {
  min-width: 0;
  flex: 1;
}

.priority-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.priority-item-title,
.mini-table-title,
.activity-title,
.workload-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.priority-item-meta,
.mini-table-meta,
.activity-meta,
.workload-meta {
  margin-top: 4px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}

.priority-item-right,
.mini-table-side,
.workload-count {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.priority-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.priority-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.priority-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.priority-neutral {
  background: rgba(148, 163, 184, 0.14);
  color: #475569;
}

.health-row,
.workload-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #eef2f7;
}

.health-row:last-child,
.workload-row:last-child {
  border-bottom: none;
}

.health-row span {
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.health-row strong {
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.activity-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  flex-shrink: 0;
}

@media (max-width: 1200px) {
  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 768px) {
  .dashboard-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 22px;
    border-radius: 24px;
  }

  .dashboard-title {
    font-size: 32px;
  }

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

  .dashboard-hero-actions .btn {
    width: 100%;
  }

  .priority-item,
  .mini-table-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/*Menu*/

.sidebar-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sidebar-top-logout {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  text-decoration: none;
  transition: 0.2s ease;
}

.sidebar-top-logout:hover {
  color: #ff8b8b;
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
}

.nav-badge-danger {
  background: #ef4444;
  color: white;
}

.nav-badge-warning {
  background: #f59e0b;
  color: white;
}

.nav-badge-neutral {
  background: #64748b;
  color: white;
}

.health-bar span {
  width: calc(var(--width) * 1%);
}

.sidebar-health {
  margin: 10px 0 18px;
}

.health-label {
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.health-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.health-bar span {
  display: block;
  height: 100%;
  width: calc(var(--width) * 1%);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.bar-danger {
  background: #ef4444;
}

.bar-warning {
  background: #f59e0b;
}

.bar-good {
  background: #22c55e;
}

.health-subtext {
  margin-top: 8px;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

.logo-subtitle {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

/*user_form*/

.users-table {
  min-width: 980px;
}

.users-table th,
.users-table td {
  padding-left: 14px;
  padding-right: 14px;
}

.users-table th:first-child,
.users-table td:first-child {
  width: 32%;
}

.users-table .table-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.btn-sm {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
}

/* ===== Users Form ===== */

.user-page-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.user-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 32px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.14), transparent 28%),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #e8eef8;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.user-hero-left {
  flex: 1;
  min-width: 0;
}

.user-hero-title {
  margin: 8px 0 0;
  font-size: 46px;
  line-height: 1.02;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.user-hero-subtitle {
  margin: 12px 0 0;
  max-width: 720px;
  color: #64748b;
  font-size: 15px;
  line-height: 1.6;
}

.user-form-shell {
  padding: 30px;
}

.user-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 340px;
  gap: 22px;
}

.user-form-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.user-form-card {
  border: 1px solid #e8eef5;
  background: #f8fafc;
  border-radius: 24px;
  padding: 22px;
}

.user-form-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.user-form-card-header h3 {
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.2;
  color: #0f172a;
}

.user-form-card-header p {
  margin: 0;
  max-width: 260px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 600;
  text-align: right;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-field-full {
  grid-column: 1 / -1;
}

.field-hint {
  margin-top: 8px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}

.user-form-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.user-side-card {
  border: 1px solid #e8eef5;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.user-side-card h3 {
  margin: 4px 0 0;
  font-size: 20px;
  color: #0f172a;
}

.user-side-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.user-side-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e8eef5;
}

.user-side-item strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
}

.user-side-item span,
.user-side-text {
  color: #64748b;
  font-size: 14px;
  line-height: 1.55;
}

.user-side-text {
  margin: 16px 0 0;
}

.user-role-helper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.role-chip-owner {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.role-chip-admin {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

.role-chip-member {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

.user-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 4px;
  padding-top: 8px;
}

@media (max-width: 1100px) {
  .user-form-layout {
    grid-template-columns: 1fr;
  }

  .user-form-side {
    order: 2;
  }
}

@media (max-width: 768px) {
  .user-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 22px;
    border-radius: 24px;
  }

  .user-hero-title {
    font-size: 34px;
  }

  .user-form-shell {
    padding: 20px;
  }

  .user-form-card {
    padding: 18px;
    border-radius: 20px;
  }

  .user-form-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-form-card-header p {
    max-width: none;
    text-align: left;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .user-form-actions {
    flex-direction: column;
  }

  .user-form-actions .btn {
    width: 100%;
  }
}

/* contract_detail.html — task title / ID / badges / status / AI confidence */

.task-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  row-gap: 10px;
}

.task-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.task-title-cell {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
  color: #0f172a;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-id-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.task-badges-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.task-badges-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.task-badges-row .mini-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  line-height: 1;
  opacity: 0.95;
}

.task-title-row > .mini-badge {
  margin: 0;
}

.task-ai-confidence {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.4;
}

.task-description-preview {
  margin-top: 8px;
}

.task-status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 120px;
}

.task-status-stack .status-badge {
  min-width: 118px;
  justify-content: center;
  text-align: center;
}

.task-edit-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.task-id-ref-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f5f7fb;
  border: 1px solid #dbe2ea;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .task-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-badges-wrapper {
    justify-content: flex-start;
  }

  .task-status-stack {
    align-items: flex-start;
    min-width: 0;
  }

  .task-status-stack .status-badge {
    min-width: 0;
  }
}

/*contract_details*/

.notice-lock-hint {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 8px;
}

/*Dwopdown name*/
select.recurrence-reference option[disabled] {
  color: #999;
}

.field-mini-label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a859f;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field-mini-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b778c;
  margin: 0;
}

/*my_tasks.html*/

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 18px;
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.tab-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.tab-btn.active {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
}

.tab-btn.tab-alert {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.tab-btn.tab-alert:hover {
  background: #fecaca;
  color: #991b1b;
}

.tab-btn.tab-alert.active {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.thread-panel {
  position: fixed;
  top: 0;
  right: -430px;
  width: 430px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #e8edf5;
  box-shadow: -10px 0 30px rgba(16, 24, 40, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  transition: right 0.28s ease;
}

.thread-panel.open {
  right: 0;
}

.thread-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid #eef2f7;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.thread-header h3 {
  margin: 0;
  font-size: 20px;
}

.thread-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: #667085;
}

.thread-close-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: #667085;
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #fbfcfe;
}

.thread-empty-state {
  color: #667085;
  font-size: 14px;
  padding: 8px 4px;
}

.thread-message {
  margin-bottom: 14px;
}

.thread-meta {
  font-size: 12px;
  color: #667085;
  margin-bottom: 6px;
}

.thread-type-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.thread-type-badge.comment {
  background: #eef2f7;
  color: #344054;
}

.thread-type-badge.issue {
  background: #fff3cd;
  color: #8a5a00;
}

.thread-type-badge.resolution {
  background: #d9f2e3;
  color: #0f6b3c;
}

.thread-text {
  background: #f2f4f7;
  border-radius: 12px;
  padding: 10px 12px;
  color: #101828;
  white-space: pre-wrap;
  word-break: break-word;
}

.thread-message.issue .thread-text {
  background: #fff7e6;
  border: 1px solid #ffe2a8;
}

.thread-message.resolution .thread-text {
  background: #e8f7ee;
  border: 1px solid #bce3ca;
}

.thread-attachment-pill {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #315efb;
  font-size: 12px;
  font-weight: 600;
}

.thread-input {
  border-top: 1px solid #eef2f7;
  padding: 14px;
  background: #ffffff;
}

.thread-input textarea {
  width: 100%;
  resize: vertical;
  min-height: 80px;
}

.thread-attachment-row {
  margin-top: 10px;
}

.thread-attachment-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475467;
  margin-bottom: 6px;
}

.thread-attachment-input {
  display: block;
  width: 100%;
}

.thread-attachment-name {
  margin-top: 6px;
  font-size: 12px;
  color: #667085;
}

.thread-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.thread-attachment-actions a {
  font-size: 12px;
  color: #315efb;
  text-decoration: none;
}

.thread-attachment-actions a:hover {
  text-decoration: underline;
}

#resolve-issue:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.task-inline-actions button {
  padding: 6px 10px;
  font-size: 13px;
}

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


/* =========================
   AI CHAT
   ========================= */
/* =========================
   AI CHAT
   ========================= */

.doc-chat-card {
  margin-top: 24px;
}

.doc-chat-shell {
  display: grid;
  gap: 16px;
}

.doc-chat-toolbar {
  display: grid;
  gap: 12px;
}

.doc-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-chat-chip {
  border: 1px solid #d9deea;
  background: #f7f9fc;
  color: #274690;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.doc-chat-chip:hover {
  background: #eef3ff;
  border-color: #c8d7f0;
}

.doc-chat-messages {
  background: #f7f9fc;
  border: 1px solid #e3e8f3;
  border-radius: 20px;
  padding: 18px;
  min-height: 320px;
  max-height: 560px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-chat-empty {
  color: #6d7890;
  font-size: 14px;
}

.doc-chat-bubble {
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.5;
  word-break: break-word;
}

.doc-chat-bubble.user {
  align-self: flex-end;
  max-width: 78%;
  background: linear-gradient(135deg, #2f6df6, #4f46e5);
  color: #ffffff;
  border-bottom-right-radius: 6px;
}

.doc-chat-bubble.assistant {
  align-self: flex-start;
  width: min(100%, 1100px);
  max-width: 100%;
  background: #ffffff;
  border: 1px solid #dde4f2;
  color: #16213e;
  border-bottom-left-radius: 6px;
}

.doc-chat-bubble.system {
  align-self: center;
  max-width: 78%;
  background: #fff4e8;
  border: 1px solid #ffd8a8;
  color: #8a4b08;
  font-size: 13px;
}

.doc-chat-input-row {
  display: grid;
  gap: 10px;
}

.doc-chat-actions {
  display: flex;
  justify-content: flex-end;
}

/* =========================
   OBLIGATIONS LIST
   ========================= */

.doc-chat-obligations-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.obligation-item {
  padding: 8px 0 10px;
  border-bottom: 1px solid #e9edf4;
}

.obligation-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.obligation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.obligation-text {
  min-width: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #1e293b;
}

.btn-prepare-task {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: #2f6df6;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 36px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.18s ease;
}

.btn-prepare-task:hover {
  background: #1a4fcf;
}

.chat-task-preview {
  margin-top: 10px;
}

/* =========================
   PREPARED TASK PREVIEW
   ========================= */

.prepared-task-card {
  border: 1px solid #d9deea;
  border-radius: 14px;
  background: #f8fbff;
  padding: 14px 16px;
}

.prepared-task-title {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.prepared-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.prepared-task-body {
  display: grid;
  gap: 6px;
}

.prepared-task-desc {
  font-size: 14px;
  line-height: 1.5;
  color: #334155;
}

.prepared-task-rule {
  font-size: 13px;
  color: #475569;
}

.prepared-task-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.doc-chat-inline-note {
  font-size: 13px;
  color: #64748b;
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 640px) {
  .obligation-row {
    grid-template-columns: 1fr;
  }

  .btn-prepare-task {
    justify-self: start;
  }

  .doc-chat-bubble.user,
  .doc-chat-bubble.system {
    max-width: 100%;
  }
}

.obligation-item {
  padding: 8px 0 8px;
  border-bottom: 1px solid #e9edf4;
}

.obligation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.obligation-text {
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #1e293b;
}

.btn-prepare-task {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: #2f6df6;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.18s ease;
}

.btn-prepare-task:hover {
  background: #1a4fcf;
}

.chat-task-preview {
  margin-top: 8px;
}

.prepared-task-card {
  border: 1px solid #d9deea;
  border-radius: 12px;
  background: #f8fbff;
  padding: 12px 14px;
}

.prepared-task-title {
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.prepared-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.prepared-task-body {
  display: grid;
  gap: 4px;
}

.prepared-task-desc {
  font-size: 14px;
  line-height: 1.45;
  color: #334155;
}

.prepared-task-rule {
  font-size: 13px;
  color: #475569;
}

.prepared-task-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.prepared-task-actions .btn,
.prepared-task-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
  box-shadow: none;
}

.prepared-task-actions .btn.btn-primary,
.prepared-task-actions .btn-add-prepared-task {
  background: #2f6df6;
  color: #ffffff;
}

.prepared-task-actions .btn.btn-primary:hover,
.prepared-task-actions .btn-add-prepared-task:hover {
  background: #1a4fcf;
  transform: none;
  box-shadow: none;
}

.prepared-task-actions .btn.btn-secondary,
.prepared-task-actions .btn-cancel-prepared-task {
  background: #eef2f7;
  color: #0f172a;
}

.prepared-task-actions .btn.btn-secondary:hover,
.prepared-task-actions .btn-cancel-prepared-task:hover {
  background: #e2e8f0;
  transform: none;
  box-shadow: none;
}

.doc-chat-answer-text {
  white-space: pre-wrap;
  line-height: 1.6;
}

.task-candidate-notices {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.task-candidate-notice {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fafafa;
}

.task-candidate-notice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.task-candidate-notice-body {
  font-size: 14px;
  color: #555;
}

/*BANNER FOR ALERT*/
.contract-warning-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0 22px;
  padding: 14px 16px;
  border: 1px solid #f3d38a;
  background: #fff8e6;
  border-radius: 14px;
}

.contract-warning-content {
  font-size: 14px;
  line-height: 1.5;
  color: #6b4e16;
}

.contract-warning-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.contract-warning-close {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #8a6a22;
  padding: 4px 6px;
  border-radius: 8px;
}

.contract-warning-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ===== Task candidates in document chat ===== */

.chat-candidate-group {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.chat-candidate-group-title {
  font-size: 13px;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chat-candidate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid #e5ebf5;
  border-radius: 16px;
  background: #f8fbff;
}

.chat-candidate-row.is-tracked {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.chat-candidate-main {
  min-width: 0;
}

.chat-candidate-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.chat-candidate-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #526274;
  font-weight: 400;
}

.chat-candidate-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #526274;
}

.chat-candidate-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.btn-create-candidate-task {
  min-width: 108px;
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

.btn-create-candidate-task:hover {
  transform: none;
}

.chat-candidate-row .status-badge {
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .chat-candidate-row {
    grid-template-columns: 1fr;
  }

  .chat-candidate-actions {
    justify-content: flex-start;
  }

  .btn-create-candidate-task {
    width: 100%;
  }
}

/* =========================
   REPORTS PAGE
   ========================= */

.reports-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.reports-filters-card {
  padding: 24px 28px;
}

.reports-filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.reports-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

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

.reports-grid-single {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.reports-panel {
  min-width: 0;
}

.reports-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.reports-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.reports-table thead th {
  text-align: left;
  padding: 0 0 14px;
  border-bottom: 1px solid #e5edf6;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
  white-space: nowrap;
}

.reports-table tbody td {
  padding: 14px 0;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  font-size: 14px;
  color: #0f172a;
}

.reports-table tbody tr:last-child td {
  border-bottom: none;
}

.reports-table a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 700;
}

.reports-table a:hover {
  text-decoration: underline;
}

.report-cell-muted {
  color: #64748b;
  font-size: 13px;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.risk-high {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
}

.risk-medium {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.risk-low {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  background: #f1f5f9;
  color: #334155;
}

.metric-pill-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.metric-pill-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.metric-pill-success {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.metric-pill-neutral {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

.reports-empty {
  padding: 36px 10px;
  text-align: center;
  color: #64748b;
}

.reports-empty h3 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 22px;
}

.reports-empty p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.owner-hotspot-row td {
  background: rgba(239, 68, 68, 0.03);
}

.owner-medium-row td {
  background: rgba(245, 158, 11, 0.04);
}

.reports-table tbody tr:hover td {
  background: #f8fbff;
}

.reports-inline-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.reports-inline-status .status-badge {
  margin-left: 0;
}

.reports-note {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

@media (max-width: 1200px) {
  .reports-filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reports-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 768px) {
  .reports-filters-card {
    padding: 20px;
  }

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

  .reports-table {
    min-width: 640px;
  }
}