/* ---------- GLOBAL ---------- */
:root {
  --bg: #f5f5f7;
  --text: #1d1d1f;
  --muted: #666;
  --card: #ffffff;
  --border: #e5e5ea;
  --primary: #007aff;
  --primary-hover: #0063ce;
  --soft: rgba(0,0,0,0.05);
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.wrapper { max-width: 1100px; margin: 56px auto; padding: 0 20px; flex: 1; }
header { text-align: center; margin-bottom: 28px; }
header h1 { font-weight: 600; letter-spacing: -0.5px; margin: 0 0 6px; }
header p { margin: 0; color: #555; }

.drop-zone {
  border: 2px dashed #ccc;
  border-radius: 14px;
  padding: 0px 20px;
  text-align: center;
  color: #666;
  cursor: pointer;
  transition: all .2s ease;
}
.drop-zone.dragging {
  background: rgba(0,122,255,0.08);
  border-color: #007aff;
  color: #007aff;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 20px var(--soft);
  padding: 18px;
  margin-bottom: 18px;
}

.label { display: block; font-size: 0.95rem; margin-bottom: 8px; color: #444; }
textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font: inherit;
  background: #fff;
  outline: none;
}
textarea:focus { border-color: #c7c7cc; box-shadow: 0 0 0 4px rgba(0,122,255,0.08); }

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

.controls { margin: 10px 0 16px; }
.status { font-size: 0.9rem; color: #444; min-height: 1lh; }

button {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f2f2f7;
  color: #111;
  cursor: pointer;
  font: inherit;
  transition: all .2s ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: 0.6; cursor: not-allowed; }
button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
button.primary:hover:not(:disabled) { background: var(--primary-hover); }

/* ---------- TABLE ---------- */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 20px var(--soft);
  padding: 12px;
}
.table-wrapper {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  overflow: auto;        /* dual-axis scroll */
  max-height: 70vh;
  padding: 10px;
}
.table-wrapper::-webkit-scrollbar { height: 10px; width: 10px; }
.table-wrapper::-webkit-scrollbar-thumb { background: #ccc; border-radius: 5px; }
.table-wrapper::-webkit-scrollbar-thumb:hover { background: #aaa; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 900px;
  font-size: 14px;
  position: relative;
}
th, td {
  border: 1px solid #e0e0e0;
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
}
th {
  background: #f9f9f9;
  position: sticky;
  top: 0;
  z-index: 3;
}
th:first-child, td:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
  text-align: left;
  font-weight: 500;
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}
tr:nth-child(even) td { background: #fafafa; }
tr:hover td { background: #f3f8ff; }

/* ---------- FOOTER ---------- */
footer {
  text-align: center;
  color: #888;
  font-size: 0.85rem;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}