:root {
  --cork: #8B6343;
  --cork-light: #C9A96E;
  --cork-bg: #F5EFE0;
  --card-bg: #FFFDF7;
  --text: #2C2C2C;
  --text-muted: #777;
  --border: #D9C9A8;
  --success: #4CAF50;
  --error: #E53935;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--cork-bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--cork); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Header ─────────────────────────────── */
header {
  background: var(--cork);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
header h1 { font-size: 1.2rem; font-weight: 700; }
header .logo { font-size: 1.6rem; }
header .spacer { flex: 1; }
header nav a { color: rgba(255,255,255,0.85); font-size: 0.9rem; margin-left: 16px; }

/* ─── Container ──────────────────────────── */
.container { max-width: 680px; margin: 0 auto; padding: 24px 16px; }

/* ─── Cards ──────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; margin-bottom: 16px; color: var(--cork); }

/* ─── Buttons ────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  min-height: 48px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--cork); color: #fff; }
.btn-primary:hover { background: #6e4d2f; }
.btn-secondary { background: var(--cork-light); color: var(--text); }
.btn-danger { background: var(--error); color: #fff; }
.btn-small { padding: 6px 14px; font-size: 0.82rem; min-height: 34px; }
.btn-full { width: 100%; }

/* ─── Forms ──────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}
input[type="text"],
input[type="password"],
input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.15s;
}
input:focus { outline: none; border-color: var(--cork); }

/* ─── Photo grid ─────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.photo-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #eee;
  aspect-ratio: 1;
  cursor: grab;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.photo-item.dragging { opacity: 0.4; border-color: var(--cork); }
.photo-item.drag-over { border-color: var(--cork-light); }
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-item .delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(229, 57, 53, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.photo-item .order-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 4px;
}

/* ─── Upload area ────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.upload-area:hover, .upload-area.drag-active {
  border-color: var(--cork);
  background: rgba(139,99,67,0.05);
}
.upload-area input[type="file"] {
  display: none;
}
.upload-area .icon { font-size: 2rem; margin-bottom: 8px; }

/* ─── Toast ──────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 0.9rem;
  z-index: 9999;
  transition: transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--error); }
#toast.success { background: var(--success); }

/* ─── Alert / Info ───────────────────────── */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.alert-info { background: #e3f2fd; border-left: 4px solid #1976d2; }
.alert-warn { background: #fff8e1; border-left: 4px solid #f9a825; }
.alert-error { background: #ffebee; border-left: 4px solid var(--error); }

/* ─── Table ──────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
th { background: var(--cork-bg); font-weight: 600; color: var(--cork); }
tr:hover td { background: rgba(0,0,0,0.02); }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}
.tag-active { background: #e8f5e9; color: #2e7d32; }
.tag-disabled { background: #ffebee; color: var(--error); }

/* ─── Spinner ────────────────────────────── */
.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Hero (top page) ────────────────────── */
.hero {
  text-align: center;
  padding: 48px 20px 32px;
}
.hero .icon { font-size: 4rem; margin-bottom: 16px; }
.hero h1 { font-size: 1.8rem; font-weight: 800; color: var(--cork); margin-bottom: 12px; }
.hero p { color: var(--text-muted); font-size: 1rem; max-width: 480px; margin: 0 auto 24px; }

/* ─── Misc ───────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 0.88rem; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ─── Responsive ─────────────────────────── */
@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .card { padding: 18px; }
}
