* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #0e1116 0%, #121824 100%);
  color: #f5f7fb;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.sidebar {
  padding: 24px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 11, 18, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  font-size: 24px;
  font-weight: 800;
  color: #ff6b2d;
  margin-bottom: 12px;
}

.sidebar-copy,
.upload-copy,
.status-message {
  color: #a9b6ca;
  line-height: 1.5;
}

.upload-card,
.session-card {
  display: block;
  margin-top: 20px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.upload-card input {
  margin-top: 12px;
  width: 100%;
}

.upload-title,
.meta-value {
  display: block;
  font-weight: 700;
}

.meta-label {
  margin-top: 10px;
  color: #7b8ba4;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.primary-button,
.secondary-button {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  margin-top: 20px;
  background: linear-gradient(135deg, #008cff 0%, #00a8ff 100%);
  color: white;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  color: #f5f7fb;
}

.main-panel {
  padding: 24px;
}

.empty-state {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
  text-align: center;
}

.empty-state h1 {
  margin-bottom: 10px;
  font-size: 40px;
}

.empty-state p {
  max-width: 460px;
  color: #9eabc0;
}

.status-card {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.status-badge.pending {
  background: rgba(255, 180, 0, 0.12);
  color: #ffcb66;
}

.status-badge.signed {
  background: rgba(0, 200, 100, 0.12);
  color: #58d69a;
}

.status-badge.expired {
  background: rgba(255, 92, 92, 0.12);
  color: #ff9b9b;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.status-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(7, 11, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.status-label {
  color: #7b8ba4;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.status-value {
  color: #f5f7fb;
  font-weight: 700;
  word-break: break-word;
}

.download-link {
  display: inline-flex;
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #008cff 0%, #00a8ff 100%);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
}

.document-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.page-card {
  position: relative;
  width: min(100%, 860px);
}

.page-card img {
  width: 100%;
  display: block;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.field-layer {
  position: absolute;
  inset: 0;
}

.field-box {
  position: absolute;
  border-radius: 10px;
  overflow: visible;
}

.field-box.static {
  pointer-events: none;
}

.field-box.client {
  cursor: pointer;
  border: 2px dashed rgba(0, 140, 255, 0.95);
  background: rgba(0, 140, 255, 0.12);
}

.field-box.signature-ready {
  background: rgba(0, 140, 255, 0.08);
}

.field-label {
  position: absolute;
  top: -24px;
  left: 0;
  padding: 4px 8px;
  border-radius: 8px 8px 0 0;
  background: #0a7de2;
  color: white;
  font-size: 11px;
  font-weight: 700;
}

.field-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  color: #123154;
  text-align: center;
  font-weight: 600;
}

.field-content.signature-content {
  padding: 0;
}

.field-content img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  box-shadow: none;
}

.field-content img.signature-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.field-date-input {
  width: calc(100% - 16px);
  margin: 8px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  color: #133150;
}

.field-text-input {
  width: calc(100% - 16px);
  margin: 8px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  color: #133150;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 15, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(760px, 100%);
  background: #101722;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 14px;
}

.signature-canvas-wrap {
  position: relative;
  height: 260px;
  background: #ffffff;
  border: 2px dashed #0a7de2;
  border-radius: 16px;
  overflow: hidden;
}

#signature-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.signature-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7a8796;
  pointer-events: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .main-panel {
    padding: 16px;
  }

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