[hidden] {
  display: none !important;
}

/* ========== Layout shell ========== */

.dashboard-root {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background-color: #f9fafb;
}

.dashboard-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-main-inner {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ========== Header ========== */

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.dashboard-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.dashboard-header-actions {
  display: flex;
  gap: 8px;
}

/* ========== States ========== */

.dashboard-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: #6b7280;
}

.dashboard-error {
  background-color: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.dashboard-empty {
  text-align: center;
  padding: 80px 0;
  color: #6b7280;
}

.dashboard-empty h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 8px 0;
}

/* ========== Simple document grid (older minimal version) ========== */

.document-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 768px) {
  .document-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

.document-card {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-card-body {
  flex: 1;
}

.document-title {
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.document-meta {
  font-size: 0.875rem;
  color: #6b7280;
}

.document-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.document-card-actions .btn {
  padding: 0.5rem 0.8rem;
  font-size: 0.875rem;
}

/* ========== Button variants (assumes base .btn in global.css) ========== */

.btn-secondary {
  background: #ffffff;
  border-color: #d1d5db;
  color: #111827;
}

.btn-secondary:hover {
  background: #f3f4f6;
  border-color: #111827;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #111827;
}

.btn-ghost:hover {
  background: #f3f4f6;
}

/* ========== Sidebar ========== */

.dashboard-sidebar {
  width: 220px;
  background-color: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: background-color 0.3s;
  border-radius: 0 25px 25px 0;
  margin-right: 10px;
}

.sidebar-item:hover {
  background-color: #f3f4f6;
}

.sidebar-item.main-tab.active {
  background-color: #fee2e2;
  color: #dc2626;
}

.sidebar-item.upload {
  color: #dc2626;
  font-weight: 600;
}

.sidebar-icon {
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-label {
  font-weight: 500;
}

.filter-section {
  padding: 8px 0;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  margin: 8px 0;
}

.filter-label {
  padding: 8px 20px;
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  transition: all 0.2s;
  margin: 0 10px;
  border-radius: 6px;
}

.filter-item:hover {
  background-color: #f3f4f6;
  color: #374151;
}

.filter-item.active {
  background-color: #fee2e2;
  color: #dc2626;
  font-weight: 500;
}

.sidebar-user-info {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  font-size: 14px;
}

.sidebar-doc-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar-stat-item {
  display: flex;
  gap: 4px;
}

.sidebar-stat-label {
  color: #6b7280;
}

.sidebar-stat-value {
  font-weight: 600;
  color: #dc2626;
}

.sidebar-purchase-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin: 8px 0;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #dc2626;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-purchase-link:hover {
  background-color: #fee2e2;
  transform: translateY(-1px);
}

.sidebar-user-email {
  color: #6b7280;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 8px;
}

/* Responsive sidebar */
@media (max-width: 768px) {
  .dashboard-root {
    flex-direction: column;
  }

  .dashboard-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 0;
    flex-direction: row;
    justify-content: space-around;
    overflow-x: auto;
  }

  .sidebar-item {
    flex-direction: column;
    padding: 8px 12px;
    margin-right: 0;
    border-radius: 8px;
    text-align: center;
  }

  .sidebar-icon {
    margin-right: 0;
    margin-bottom: 6px;
  }

  .sidebar-label {
    font-size: 12px;
  }

  .filter-section {
    display: none;
  }

  .sidebar-user-info {
    display: none;
  }

  .dashboard-main-inner {
    padding: 16px;
  }
}

/* ========== Document grid (Vue port) ========== */

.empty-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  background-color: #fff;
  border-radius: 8px;
  border: 2px dashed #e5e7eb;
}

.empty-grid-content {
  text-align: center;
  max-width: 300px;
}

.empty-grid-content h3 {
  font-size: 1.2rem;
  color: #374151;
  margin: 16px 0 8px;
}

.empty-grid-content p {
  color: #6b7280;
  margin-bottom: 24px;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.document-card {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  cursor: pointer;
}

.document-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.thumbnail-container {
  position: relative;
  width: 100%;
  height: 200px;
  background-color: #f3f4f6;
  overflow: hidden;
}

.thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: #f9fafb;
  color: #9ca3af;
  font-weight: 700;
}

.status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(31, 41, 55, 0.9);
  color: #fff;
  padding: 4px 8px;
  border-radius: 999px;
}

.doctype-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(230, 57, 70, 0.92);
  color: #fff;
  padding: 4px 8px;
  border-radius: 999px;
}

.document-info {
  padding: 16px;
}

.document-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 8px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-meta {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 12px 0;
}

.sent-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.progress-info,
.recipient-order,
.your-turn,
.link-expired {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
}

.progress-info,
.recipient-order {
  color: #6b7280;
}

.recipient-order {
  font-weight: 500;
}

.your-turn {
  color: #f59e0b;
  font-weight: 500;
}

.link-expired {
  color: #dc2626;
  font-weight: 500;
}

.document-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
  margin-top: 12px;
}

@media (max-width: 768px) {
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }
}

/* ========== Document details modal on dashboard ========== */

.document-detail-modal {
  width: min(900px, calc(100vw - 32px));
  border: none;
  border-radius: 12px;
  padding: 0;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.document-detail-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.document-detail-modal-content {
  display: flex;
  flex-direction: column;
}

.document-detail-modal-header,
.document-detail-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.document-detail-modal-footer {
  border-top: 1px solid #e5e7eb;
  border-bottom: none;
  justify-content: flex-end;
}

.document-detail-modal-body {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 24px;
  padding: 24px;
}

.document-detail-subtitle {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 14px;
}

.document-detail-preview {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.document-detail-preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.document-detail-preview-placeholder {
  color: #9ca3af;
  font-weight: 500;
  text-align: center;
  padding: 24px;
}

.document-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.detail-label {
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
}

.detail-value {
  color: #111827;
  font-size: 14px;
  word-break: break-word;
}

@media (max-width: 768px) {
  .document-detail-modal {
    width: calc(100vw - 20px);
  }

  .document-detail-modal-header,
  .document-detail-modal-footer,
  .document-detail-modal-body {
    padding: 16px;
  }

  .document-detail-modal-body {
    grid-template-columns: 1fr;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ========== Turn badges (inbox cards) ========== */

.turn-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  width: fit-content;
}

.turn-badge--yours {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.turn-badge--waiting {
  background-color: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.doc-from-line {
  font-size: 0.8125rem;
  color: #9ca3af;
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.doc-from-line .creator {
  color: #dc2626;
  font-weight: 600;
}

.signer-email {
  color: inherit;
}

.signer-email--creator {
  color: #dc2626;
  font-weight: 600;
}

/* ========== Signing action modal (your turn / pending) ========== */

.signing-action-modal {
  width: min(520px, calc(100vw - 32px));
  border: none;
  border-radius: 14px;
  padding: 0;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.signing-action-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.signing-action-modal-content {
  display: flex;
  flex-direction: column;
}

.signing-action-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.signing-action-modal-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.signing-action-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signing-action-modal-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.signing-action-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Sender message box */
.signing-action-message-box {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #dc2626;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Meta rows */
.signing-action-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.signing-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.signing-meta-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.signing-meta-label {
  color: #6b7280;
  font-weight: 600;
  font-size: 13px;
}

.signing-meta-value {
  color: #111827;
  font-size: 13px;
  text-align: right;
}

.signing-meta-yourturn {
  justify-content: flex-start;
  gap: 8px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 12px;
}

.signing-meta-waiting {
  justify-content: flex-start;
  gap: 8px;
  font-weight: 500;
  color: #6b7280;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
}

.signing-meta-expired {
  justify-content: flex-start;
  gap: 8px;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
}

/* Footer */
.signing-action-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
}

/* Close button (shared pattern) */
.modal-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

/* ========== Responsive ========== */

@media (max-width: 768px) {
  .signing-action-modal {
    width: calc(100vw - 20px);
  }

  .signing-action-modal-header,
  .signing-action-modal-body,
  .signing-action-modal-footer {
    padding: 16px;
  }
}

.status-badge--green  { background: rgba(34, 197, 94, 0.88); }
.status-badge--yellow { background: rgba(234, 179, 8, 0.92); }
.status-badge--blue   { background: rgba(59, 130, 246, 0.88); }