/* Utility Tools module styles */
.tools-shell {
  background: linear-gradient(150deg, #fffaf0 0%, #f0f9ff 45%, #ecfdf5 100%);
  min-height: calc(100vh - 120px);
  padding: 2rem 0 4rem;
}

.tools-header {
  margin-bottom: 1.25rem;
}

.tools-header h1 {
  font-family: 'Sora', sans-serif;
  letter-spacing: -0.02em;
}

.tools-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1rem;
}

.tool-menu {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--neutral-200);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 0.75rem;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.tool-menu button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.75rem;
  border-radius: 10px;
  color: var(--neutral-700);
  font-weight: 600;
  cursor: pointer;
}

.tool-menu button:hover,
.tool-menu button.active {
  background: #dbeafe;
  color: #1d4ed8;
}

.tool-panels {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tool-panel {
  display: none;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--neutral-200);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 1rem;
}

.tool-panel.active {
  display: block;
}

.tool-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field label {
  font-size: 0.85rem;
  color: var(--neutral-600);
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--neutral-300);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: white;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.tool-meta {
  background: #f8fafc;
  border: 1px dashed #bfdbfe;
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 0.92rem;
}

.preview-box {
  min-height: 220px;
  border: 1px dashed var(--neutral-300);
  border-radius: 10px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.preview-box img,
.preview-box canvas {
  max-width: 100%;
}

.signature-pad {
  width: 100%;
  height: 190px;
  border: 1px solid var(--neutral-300);
  border-radius: 10px;
  background: #ffffff;
}

.sign-tabs {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.sign-tabs button {
  border: 1px solid var(--neutral-300);
  background: #ffffff;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--neutral-600);
  cursor: pointer;
}

.sign-tabs button.active {
  color: #1d4ed8;
  border-color: #93c5fd;
  background: #dbeafe;
}

.sign-tab-panels {
  margin-top: 0.65rem;
}

.sign-tab-panel {
  display: none;
}

.sign-tab-panel.active {
  display: block;
}

.pdf-stage-wrap {
  margin-top: 0.75rem;
  border: 1px solid var(--neutral-300);
  border-radius: 10px;
  padding: 0.5rem;
  background: #f8fafc;
}

.pdf-stage {
  position: relative;
  width: 100%;
  max-width: 540px;
  min-height: 360px;
  margin: 0 auto;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  overflow: auto;
}

.pdf-stage-page {
  position: relative;
  width: 100%;
  max-width: 500px;
  min-height: 340px;
  margin: 0 auto;
  border: 1px solid #e2e8f0;
  background: repeating-linear-gradient(
    -45deg,
    #ffffff,
    #ffffff 12px,
    #f8fafc 12px,
    #f8fafc 24px
  );
  transform-origin: top center;
}

.signature-box {
  position: absolute;
  left: 32px;
  top: 32px;
  width: 200px;
  min-height: 70px;
  border: 2px dashed #2563eb;
  border-radius: 8px;
  background: rgba(219, 234, 254, 0.7);
  cursor: move;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.signature-box img {
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: contain;
  pointer-events: none;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.kpi {
  background: #f8fafc;
  border: 1px solid var(--neutral-200);
  border-radius: 10px;
  padding: 0.5rem;
}

.kpi .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.kpi .label {
  font-size: 0.75rem;
  color: #475569;
}

.list-box {
  border: 1px solid var(--neutral-200);
  border-radius: 10px;
  padding: 0.5rem;
  max-height: 230px;
  overflow-y: auto;
  background: #fff;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  padding: 0.45rem 0;
  font-size: 0.85rem;
}

.list-item:last-child {
  border-bottom: none;
}

.inline-controls {
  display: flex;
  gap: 0.4rem;
}

.game-prompt {
  font-size: 1.1rem;
  line-height: 1.6;
  padding: 0.75rem;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.game-prompt .ok {
  color: #15803d;
}

.game-prompt .bad {
  color: #b91c1c;
  text-decoration: underline;
}

.hide {
  display: none !important;
}

@media (max-width: 1024px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }

  .tool-menu {
    position: static;
    max-height: none;
  }

  .tool-layout,
  .form-row {
    grid-template-columns: 1fr;
  }

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